Merge branch 'master' of github.com:thelia/thelia

This commit is contained in:
Etienne Roudeix
2013-09-17 20:33:08 +02:00
9 changed files with 15 additions and 14 deletions

View File

@@ -133,7 +133,7 @@ class CategoryController extends AbstractCrudController
'description' => $object->getDescription(), 'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(), 'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(), 'visible' => $object->getVisible(),
'url' => $object->getRewritenUrl($this->getCurrentEditionLocale()), 'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'parent' => $object->getParent() 'parent' => $object->getParent()
); );

View File

@@ -141,7 +141,7 @@ class ProductController extends AbstractCrudController
'description' => $object->getDescription(), 'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(), 'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(), 'visible' => $object->getVisible(),
'url' => $object->getRewritenUrl($this->getCurrentEditionLocale()), 'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'parent' => $object->getParent() 'parent' => $object->getParent()
); );

View File

@@ -79,7 +79,6 @@ class Category extends BaseCategory
*/ */
public function postInsert(ConnectionInterface $con = null) public function postInsert(ConnectionInterface $con = null)
{ {
//$this->generateRewrittenUrl($this->getLocale());
$this->dispatchEvent(TheliaEvents::AFTER_CREATECATEGORY, new CategoryEvent($this)); $this->dispatchEvent(TheliaEvents::AFTER_CREATECATEGORY, new CategoryEvent($this));
} }

View File

@@ -39,9 +39,4 @@ class Content extends BaseContent
return true; return true;
} }
public function postInsert(ConnectionInterface $con = null)
{
//$this->generateRewrittenUrl($this->getLocale());
}
} }

View File

@@ -70,9 +70,4 @@ class Folder extends BaseFolder
return true; return true;
} }
public function postInsert(ConnectionInterface $con = null)
{
//$this->generateRewrittenUrl($this->getLocale());
}
} }

View File

@@ -2,8 +2,14 @@
namespace Thelia\Model; namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Base\FolderI18n as BaseFolderI18n; use Thelia\Model\Base\FolderI18n as BaseFolderI18n;
class FolderI18n extends BaseFolderI18n { class FolderI18n extends BaseFolderI18n {
public function postInsert(ConnectionInterface $con = null)
{
$folder = $this->getFolder();
$folder->generateRewrittenUrl($this->getLocale());
}
} }

View File

@@ -119,7 +119,6 @@ class Product extends BaseProduct
*/ */
public function postInsert(ConnectionInterface $con = null) public function postInsert(ConnectionInterface $con = null)
{ {
//$this->generateRewrittenUrl($this->getLocale());
$this->dispatchEvent(TheliaEvents::AFTER_CREATEPRODUCT, new ProductEvent($this)); $this->dispatchEvent(TheliaEvents::AFTER_CREATEPRODUCT, new ProductEvent($this));
} }

View File

@@ -2,8 +2,14 @@
namespace Thelia\Model; namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Base\ProductI18n as BaseProductI18n; use Thelia\Model\Base\ProductI18n as BaseProductI18n;
class ProductI18n extends BaseProductI18n { class ProductI18n extends BaseProductI18n {
public function postInsert(ConnectionInterface $con = null)
{
$product = $this->getProduct();
$product->generateRewrittenUrl($this->getLocale());
}
} }

View File

@@ -76,6 +76,7 @@ class ProductRewriteTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @covers Thelia\Model\Tools\UrlRewritingTrait::generateRewrittenUrl
* @expectedException \RuntimeException * @expectedException \RuntimeException
* @expectedExceptionMessage Object product must be saved before generating url * @expectedExceptionMessage Object product must be saved before generating url
*/ */