Merge branch 'master' of https://github.com/thelia/thelia into coupon

* 'master' of https://github.com/thelia/thelia: (121 commits)
  set cartItem in cart add and update events
  need to unescape breadcrumb strings after been in array
  update readme file
  update insert.sql with new release version
  change changelog file format
  Prevent product and content création at catalog root
  dynamic delivery modules on delivery front template
  complete changelog
  Finished merging modules with master
  Revert "Merge branch 'cleanmaster' into modules"
  use TaxEngine::getDeliveryCountry in delivery loop
  refacto getTaxCountry which is actually getDeliveryCountry
  make it magic last stand
  change loop in shipping zone template using module insteadof delivery
  Fixed template loop
  Refactored templates processing
  complete readme file
  change email address of core contributors
  fix getPosition folder test
  add coupon tests
  ...

Conflicts:
	core/lib/Thelia/Controller/Admin/ProductController.php
This commit is contained in:
gmorel
2013-12-25 14:14:20 +01:00
199 changed files with 7036 additions and 2625 deletions

29
CHANGELOG.md Normal file
View File

@@ -0,0 +1,29 @@
#2.0.0-beta2
- http://doc.thelia.net is available in beta.
- Increase performance in prod mode.
- Front part (routes and controller) are now a dedicated module.
- allow to create a customer in admin panel
- translation is implemented :
- I18n directory in template or module.
- multiple extensions are available. We choose to use php but you can use other.
- You can translate your template or module from the admin.
- Admin hooks exist. With this hooks, a module can insert code in admin pages
- Admin hooks can be display using SHOW_INCLUDE=1 in your query string and in dev mode (http://doc.thelia.net/en/documentation/modules/hook.html)
- change memory_limit parameter in installation process. 128M is now needed
- assets can be used from template directory and from module
- Product, Category, Folder and Content have a dedicated SEO panel
- Allow to configure store information like email, address, phone number, etc.
- email management : http://doc.thelia.net/en/documentation/templates/emails.html
- "How to contribute ?" see http://doc.thelia.net/en/documentation/contribute.html
-Cache http (use it carefully, default template is not compatible with this cache) :
- if you don't know http specification, learn it first http://www.w3.org/Protocols/rfc2616/rfc2616.html
- esi tag integrated, use {render_esi path="http://your-taget.tld/resource"}
- if no reverse proxy detected, html is render instead of esi tag
- if you can't install a reverse proxy like varnish, use the HttpCache (just uncomment line 14 in web/index.php file)
- resources :
- http://www.mnot.net/cache_docs/ (fr)
- http://tomayko.com/writings/things-caches-do (en)
- http://symfony.com/doc/current/book/http_cache.html#http-cache-introduction (en and fr)

View File

@@ -1,11 +0,0 @@
2.0.0-beta2
http://doc.thelia.net is available in beta.
Increase performance in prod mode.
Front part (routes and controller) are now a dedicated module.
allow to create a customer in admin panel
translation is implemented :
- I18n directory in template or module.
- multiple extensions are available. We choose to use php but you can use other.
- You can translate your template or module from the admin.
Admin hooks exist. With this hooks, a module can insert code in admin pages

View File

@@ -1,8 +1,8 @@
If you contributes or contributed to this project and do not appear in this list below, If you contributes or contributed to this project and do not appear in this list below,
please email us (info@thelia.net) or fork this file on Github and send a pull-request. please email us (info@thelia.net) or fork this file on Github and send a pull-request.
Manuel Raynaud - mraynaud@openstudio.fr Manuel Raynaud - manu@thelia.net
Etienne Roudeix - eroudeix@openstudio.fr Etienne Roudeix - etienne@thelia.net
Franck Allimant - franck@allimant.org Franck Allimant - franck@allimant.org
Guillaume Morel - gmorel@openstudio.fr Guillaume Morel - gmorel@openstudio.fr
Michael Espeche - mespeche@openstudio.fr Michael Espeche - mespeche@openstudio.fr

View File

@@ -22,7 +22,7 @@ Requirements
* gd * gd
* curl * curl
* safe_mode off * safe_mode off
* memory_limit at least 150M, preferably 256. * memory_limit at least 128M, preferably 256.
* post_max_size 20M * post_max_size 20M
* upload_max_filesize 2M * upload_max_filesize 2M
* apache 2 * apache 2
@@ -30,8 +30,8 @@ Requirements
If you use Mac OSX, it still doesn't use php 5.4 as default php version... There are many solutions for you : If you use Mac OSX, it still doesn't use php 5.4 as default php version... There are many solutions for you :
* use linux (the best one) * use [phpbrew](https://github.com/c9s/phpbrew)
* use last MAMP version and put the php bin directory in your path : * use last MAMP version and put the php bin directory in your path:
```bash ```bash
export PATH=/Applications/MAMP/bin/php/php5.4.x/bin/:$PATH export PATH=/Applications/MAMP/bin/php/php5.4.x/bin/:$PATH
@@ -44,10 +44,8 @@ Installation
------------ ------------
``` bash ``` bash
$ git clone https://github.com/thelia/thelia.git
$ cd thelia
$ curl -sS https://getcomposer.org/installer | php $ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install --prefer-dist --optimize-autoloader $ php composer.phar create-project thelia/thelia path/ dev-master
``` ```
Finish the installation using cli tools : Finish the installation using cli tools :
@@ -58,6 +56,13 @@ $ php Thelia thelia:install
You just have to follow all instructions. You just have to follow all instructions.
Documentation
-------------
Thelia documentation is available at http://doc.thelia.net
The documentation is also in beta version and some part can be obsolete cause to some refactor.
Contribute Contribute
---------- ----------

View File

@@ -23,9 +23,14 @@
namespace Thelia\Action; namespace Thelia\Action;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Thelia\Model\AdminLog;
use Propel\Runtime\ActiveQuery\ModelCriteria; use Propel\Runtime\ActiveQuery\ModelCriteria;
use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Exception\UrlRewritingException;
use Thelia\Form\Exception\FormValidationException;
use \Thelia\Model\Tools\UrlRewritingTrait;
class BaseAction class BaseAction
{ {
@@ -73,4 +78,41 @@ class BaseAction
return $object->movePositionDown(); return $object->movePositionDown();
} }
} }
/**
* Changes SEO Fields for an object.
*
* @param ModelCriteria $query
* @param UpdateSeoEvent $event
*
* @return mixed
*/
protected function genericUpdateSeo(ModelCriteria $query, UpdateSeoEvent $event)
{
if (null !== $object = $query->findPk($event->getObjectId())) {
$object
->setDispatcher($this->getDispatcher())
->setLocale($event->getLocale())
->setMetaTitle($event->getMetaTitle())
->setMetaDescription($event->getMetaDescription())
->setMetaKeywords($event->getMetaKeywords())
->save()
;
// Update the rewritten URL, if required
try {
$object->setRewrittenUrl($event->getLocale(), $event->getUrl());
} catch(UrlRewritingException $e) {
throw new FormValidationException($e->getMessage(), $e->getCode());
}
$event->setObject($object);
return $object;
}
}
} }

View File

@@ -66,12 +66,18 @@ class Cart extends BaseAction implements EventSubscriberInterface
->filterByProductSaleElementsId($productSaleElementsId) ->filterByProductSaleElementsId($productSaleElementsId)
->findOne(); ->findOne();
$this->doAddItem($cart, $productId, $productPrice->getProductSaleElements(), $quantity, $productPrice); $event->setCartItem(
$this->doAddItem($cart, $productId, $productPrice->getProductSaleElements(), $quantity, $productPrice)
);
} }
if ($append && $cartItem !== null) { if ($append && $cartItem !== null) {
$cartItem->addQuantity($quantity) $cartItem->addQuantity($quantity)
->save(); ->save();
$event->setCartItem(
$cartItem
);
} }
} }
@@ -123,7 +129,9 @@ class Cart extends BaseAction implements EventSubscriberInterface
->findOne(); ->findOne();
if ($cartItem) { if ($cartItem) {
$this->updateQuantity($cartItem, $quantity); $event->setCartItem(
$this->updateQuantity($cartItem, $quantity)
);
} }
} }
} }
@@ -163,12 +171,16 @@ class Cart extends BaseAction implements EventSubscriberInterface
* *
* @param CartItem $cartItem * @param CartItem $cartItem
* @param float $quantity * @param float $quantity
*
* @return CartItem
*/ */
protected function updateQuantity(CartItem $cartItem, $quantity) protected function updateQuantity(CartItem $cartItem, $quantity)
{ {
$cartItem->setDisptacher($this->getDispatcher()); $cartItem->setDisptacher($this->getDispatcher());
$cartItem->updateQuantity($quantity) $cartItem->updateQuantity($quantity)
->save(); ->save();
return $cartItem;
} }
/** /**
@@ -176,9 +188,11 @@ class Cart extends BaseAction implements EventSubscriberInterface
* *
* @param \Thelia\Model\Cart $cart * @param \Thelia\Model\Cart $cart
* @param int $productId * @param int $productId
* @param int $productSaleElementsId * @param \Thelia\Model\ProductSaleElements $productSaleElements
* @param float $quantity * @param float $quantity
* @param ProductPrice $productPrice * @param ProductPrice $productPrice
*
* @return CartItem
*/ */
protected function doAddItem(\Thelia\Model\Cart $cart, $productId, \Thelia\Model\ProductSaleElements $productSaleElements, $quantity, ProductPrice $productPrice) protected function doAddItem(\Thelia\Model\Cart $cart, $productId, \Thelia\Model\ProductSaleElements $productSaleElements, $quantity, ProductPrice $productPrice)
{ {
@@ -194,6 +208,8 @@ class Cart extends BaseAction implements EventSubscriberInterface
->setPromo($productSaleElements->getPromo()) ->setPromo($productSaleElements->getPromo())
->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30)) ->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30))
->save(); ->save();
return $cartItem;
} }
/** /**

View File

@@ -25,8 +25,7 @@ namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Exception\UrlRewritingException; use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\CategoryQuery; use Thelia\Model\CategoryQuery;
use Thelia\Model\Category as CategoryModel; use Thelia\Model\Category as CategoryModel;
@@ -74,8 +73,6 @@ class Category extends BaseAction implements EventSubscriberInterface
*/ */
public function update(CategoryUpdateEvent $event) public function update(CategoryUpdateEvent $event)
{ {
$search = CategoryQuery::create();
if (null !== $category = CategoryQuery::create()->findPk($event->getCategoryId())) { if (null !== $category = CategoryQuery::create()->findPk($event->getCategoryId())) {
$category $category
@@ -92,17 +89,22 @@ class Category extends BaseAction implements EventSubscriberInterface
->save(); ->save();
// Update the rewritten URL, if required
try {
$category->setRewrittenUrl($event->getLocale(), $event->getUrl());
} catch(UrlRewritingException $e) {
throw new FormValidationException($e->getMessage(), $e->getCode());
}
$event->setCategory($category); $event->setCategory($category);
} }
} }
/**
* Change a Category SEO
*
* @param \Thelia\Core\Event\UpdateSeoEvent $event
*
* @return mixed
*/
public function updateSeo(UpdateSeoEvent $event)
{
return $this->genericUpdateSeo(CategoryQuery::create(), $event);
}
/** /**
* Delete a category entry * Delete a category entry
* *
@@ -190,6 +192,7 @@ class Category extends BaseAction implements EventSubscriberInterface
TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128), TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
TheliaEvents::CATEGORY_UPDATE_POSITION => array("updatePosition", 128), TheliaEvents::CATEGORY_UPDATE_POSITION => array("updatePosition", 128),
TheliaEvents::CATEGORY_UPDATE_SEO => array("updateSeo", 128),
TheliaEvents::CATEGORY_ADD_CONTENT => array("addContent", 128), TheliaEvents::CATEGORY_ADD_CONTENT => array("addContent", 128),
TheliaEvents::CATEGORY_REMOVE_CONTENT => array("removeContent", 128), TheliaEvents::CATEGORY_REMOVE_CONTENT => array("removeContent", 128),

View File

@@ -32,8 +32,7 @@ use Thelia\Core\Event\Content\ContentToggleVisibilityEvent;
use Thelia\Core\Event\Content\ContentUpdateEvent; use Thelia\Core\Event\Content\ContentUpdateEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Exception\UrlRewritingException; use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\ContentFolder; use Thelia\Model\ContentFolder;
use Thelia\Model\ContentFolderQuery; use Thelia\Model\ContentFolderQuery;
use Thelia\Model\ContentQuery; use Thelia\Model\ContentQuery;
@@ -81,19 +80,24 @@ class Content extends BaseAction implements EventSubscriberInterface
->save() ->save()
; ;
// Update the rewritten URL, if required
try {
$content->setRewrittenUrl($event->getLocale(), $event->getUrl());
} catch(UrlRewritingException $e) {
throw new FormValidationException($e->getMessage(), $e->getCode());
}
$content->updateDefaultFolder($event->getDefaultFolder()); $content->updateDefaultFolder($event->getDefaultFolder());
$event->setContent($content); $event->setContent($content);
} }
} }
/**
* Change Content SEO
*
* @param \Thelia\Core\Event\UpdateSeoEvent $event
*
* @return mixed
*/
public function updateSeo(UpdateSeoEvent $event)
{
return $this->genericUpdateSeo(ContentQuery::create(), $event);
}
public function updatePosition(UpdatePositionEvent $event) public function updatePosition(UpdatePositionEvent $event)
{ {
if (null !== $content = ContentQuery::create()->findPk($event->getObjectId())) { if (null !== $content = ContentQuery::create()->findPk($event->getObjectId())) {
@@ -203,6 +207,7 @@ class Content extends BaseAction implements EventSubscriberInterface
TheliaEvents::CONTENT_TOGGLE_VISIBILITY => array('toggleVisibility', 128), TheliaEvents::CONTENT_TOGGLE_VISIBILITY => array('toggleVisibility', 128),
TheliaEvents::CONTENT_UPDATE_POSITION => array('updatePosition', 128), TheliaEvents::CONTENT_UPDATE_POSITION => array('updatePosition', 128),
TheliaEvents::CONTENT_UPDATE_SEO => array('updateSeo', 128),
TheliaEvents::CONTENT_ADD_FOLDER => array('addFolder', 128), TheliaEvents::CONTENT_ADD_FOLDER => array('addFolder', 128),
TheliaEvents::CONTENT_REMOVE_FOLDER => array('removeFolder', 128), TheliaEvents::CONTENT_REMOVE_FOLDER => array('removeFolder', 128),

View File

@@ -28,6 +28,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent; use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent;
use Thelia\Core\Event\Document\DocumentDeleteEvent; use Thelia\Core\Event\Document\DocumentDeleteEvent;
use Thelia\Core\Event\Document\DocumentEvent; use Thelia\Core\Event\Document\DocumentEvent;
use Thelia\Core\Event\UpdateFilePositionEvent;
use Thelia\Exception\ImageException; use Thelia\Exception\ImageException;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Tools\FileManager; use Thelia\Tools\FileManager;
@@ -195,6 +196,11 @@ class Document extends BaseCachedFile implements EventSubscriberInterface
$event->setModelDocument($event->getModelDocument()); $event->setModelDocument($event->getModelDocument());
} }
public function updatePosition(UpdateFilePositionEvent $event)
{
return $this->genericUpdatePosition($event->getQuery(), $event);
}
/** /**
* Take care of deleting document in the database and file storage * Take care of deleting document in the database and file storage
* *
@@ -218,6 +224,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface
TheliaEvents::DOCUMENT_DELETE => array("deleteDocument", 128), TheliaEvents::DOCUMENT_DELETE => array("deleteDocument", 128),
TheliaEvents::DOCUMENT_SAVE => array("saveDocument", 128), TheliaEvents::DOCUMENT_SAVE => array("saveDocument", 128),
TheliaEvents::DOCUMENT_UPDATE => array("updateDocument", 128), TheliaEvents::DOCUMENT_UPDATE => array("updateDocument", 128),
TheliaEvents::DOCUMENT_UPDATE_POSITION => array("updatePosition", 128),
); );
} }
} }

View File

@@ -29,8 +29,7 @@ use Thelia\Core\Event\Folder\FolderToggleVisibilityEvent;
use Thelia\Core\Event\Folder\FolderUpdateEvent; use Thelia\Core\Event\Folder\FolderUpdateEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Exception\UrlRewritingException; use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\FolderQuery; use Thelia\Model\FolderQuery;
use Thelia\Model\Folder as FolderModel; use Thelia\Model\Folder as FolderModel;
@@ -58,17 +57,22 @@ class Folder extends BaseAction implements EventSubscriberInterface
->save(); ->save();
; ;
// Update the rewritten URL, if required
try {
$folder->setRewrittenUrl($event->getLocale(), $event->getUrl());
} catch(UrlRewritingException $e) {
throw new FormValidationException($e->getMessage(), $e->getCode());
}
$event->setFolder($folder); $event->setFolder($folder);
} }
} }
/**
* Change Folder SEO
*
* @param \Thelia\Core\Event\UpdateSeoEvent $event
*
* @return mixed
*/
public function updateSeo(UpdateSeoEvent $event)
{
return $this->genericUpdateSeo(FolderQuery::create(), $event);
}
public function delete(FolderDeleteEvent $event) public function delete(FolderDeleteEvent $event)
{ {
if (null !== $folder = FolderQuery::create()->findPk($event->getFolderId())) { if (null !== $folder = FolderQuery::create()->findPk($event->getFolderId())) {
@@ -158,6 +162,7 @@ class Folder extends BaseAction implements EventSubscriberInterface
TheliaEvents::FOLDER_TOGGLE_VISIBILITY => array("toggleVisibility", 128), TheliaEvents::FOLDER_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
TheliaEvents::FOLDER_UPDATE_POSITION => array("updatePosition", 128), TheliaEvents::FOLDER_UPDATE_POSITION => array("updatePosition", 128),
TheliaEvents::FOLDER_UPDATE_SEO => array('updateSeo', 128)
); );
} }
} }

View File

@@ -56,7 +56,7 @@ class HttpException extends BaseAction implements EventSubscriberInterface
$parser = $this->container->get("thelia.parser"); $parser = $this->container->get("thelia.parser");
// Define the template thant shoud be used // Define the template thant shoud be used
$parser->setTemplate(TemplateHelper::getInstance()->getActiveFrontTemplate()); $parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveFrontTemplate());
//$event->getRequest()->attributes->set('_view', ConfigQuery::getPageNotFoundView()); //$event->getRequest()->attributes->set('_view', ConfigQuery::getPageNotFoundView());

View File

@@ -28,6 +28,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent; use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent;
use Thelia\Core\Event\Image\ImageDeleteEvent; use Thelia\Core\Event\Image\ImageDeleteEvent;
use Thelia\Core\Event\Image\ImageEvent; use Thelia\Core\Event\Image\ImageEvent;
use Thelia\Core\Event\UpdateFilePositionEvent;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Tools\FileManager; use Thelia\Tools\FileManager;
use Thelia\Tools\URL; use Thelia\Tools\URL;
@@ -301,6 +302,11 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
$event->setModelImage($event->getModelImage()); $event->setModelImage($event->getModelImage());
} }
public function updatePosition(UpdateFilePositionEvent $event)
{
return $this->genericUpdatePosition($event->getQuery(), $event);
}
/** /**
* Take care of deleting image in the database and file storage * Take care of deleting image in the database and file storage
* *
@@ -441,6 +447,7 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
TheliaEvents::IMAGE_DELETE => array("deleteImage", 128), TheliaEvents::IMAGE_DELETE => array("deleteImage", 128),
TheliaEvents::IMAGE_SAVE => array("saveImage", 128), TheliaEvents::IMAGE_SAVE => array("saveImage", 128),
TheliaEvents::IMAGE_UPDATE => array("updateImage", 128), TheliaEvents::IMAGE_UPDATE => array("updateImage", 128),
TheliaEvents::IMAGE_UPDATE_POSITION => array("updatePosition", 128),
); );
} }
} }

View File

@@ -33,6 +33,7 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Map\ModuleTableMap; use Thelia\Model\Map\ModuleTableMap;
use Thelia\Model\ModuleQuery; use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule; use Thelia\Module\BaseModule;
use Thelia\Core\Event\UpdatePositionEvent;
/** /**
* Class Module * Class Module
@@ -122,6 +123,16 @@ class Module extends BaseAction implements EventSubscriberInterface
} }
} }
/**
* Changes position, selecting absolute ou relative change.
*
* @param CategoryChangePositionEvent $event
*/
public function updatePosition(UpdatePositionEvent $event)
{
return $this->genericUpdatePosition(ModuleQuery::create(), $event);
}
protected function cacheClear() protected function cacheClear()
{ {
$cacheEvent = new CacheEvent($this->container->getParameter('kernel.cache_dir')); $cacheEvent = new CacheEvent($this->container->getParameter('kernel.cache_dir'));
@@ -153,6 +164,7 @@ class Module extends BaseAction implements EventSubscriberInterface
{ {
return array( return array(
TheliaEvents::MODULE_TOGGLE_ACTIVATION => array('toggleActivation', 128), TheliaEvents::MODULE_TOGGLE_ACTIVATION => array('toggleActivation', 128),
TheliaEvents::MODULE_UPDATE_POSITION => array('updatePosition', 128),
TheliaEvents::MODULE_DELETE => array('delete', 128), TheliaEvents::MODULE_DELETE => array('delete', 128),
TheliaEvents::MODULE_UPDATE => array('update', 128), TheliaEvents::MODULE_UPDATE => array('update', 128),
); );

View File

@@ -25,38 +25,37 @@ namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Exception\UrlRewritingException; use Thelia\Model\Map\ProductTableMap;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\ProductQuery; use Thelia\Model\ProductQuery;
use Thelia\Model\Product as ProductModel; use Thelia\Model\Product as ProductModel;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\Product\ProductUpdateEvent;
use Thelia\Core\Event\Product\ProductCreateEvent;
use Thelia\Core\Event\Product\ProductDeleteEvent;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\Product\ProductToggleVisibilityEvent;
use Thelia\Core\Event\Product\ProductAddContentEvent;
use Thelia\Core\Event\Product\ProductDeleteContentEvent;
use Thelia\Model\ProductAssociatedContent; use Thelia\Model\ProductAssociatedContent;
use Thelia\Model\ProductAssociatedContentQuery; use Thelia\Model\ProductAssociatedContentQuery;
use Thelia\Model\ProductCategory; use Thelia\Model\ProductCategory;
use Thelia\Model\TaxRuleQuery; use Thelia\Model\TaxRuleQuery;
use Thelia\Model\AccessoryQuery; use Thelia\Model\AccessoryQuery;
use Thelia\Model\Accessory; use Thelia\Model\Accessory;
use Thelia\Core\Event\FeatureProduct\FeatureProductUpdateEvent;
use Thelia\Model\FeatureProduct; use Thelia\Model\FeatureProduct;
use Thelia\Core\Event\FeatureProduct\FeatureProductDeleteEvent;
use Thelia\Model\FeatureProductQuery; use Thelia\Model\FeatureProductQuery;
use Thelia\Model\ProductCategoryQuery; use Thelia\Model\ProductCategoryQuery;
use Thelia\Core\Event\Product\ProductSetTemplateEvent;
use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\ProductSaleElementsQuery;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\Product\ProductUpdateEvent;
use Thelia\Core\Event\Product\ProductCreateEvent;
use Thelia\Core\Event\Product\ProductDeleteEvent;
use Thelia\Core\Event\Product\ProductToggleVisibilityEvent;
use Thelia\Core\Event\Product\ProductAddContentEvent;
use Thelia\Core\Event\Product\ProductDeleteContentEvent;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Core\Event\FeatureProduct\FeatureProductUpdateEvent;
use Thelia\Core\Event\FeatureProduct\FeatureProductDeleteEvent;
use Thelia\Core\Event\Product\ProductSetTemplateEvent;
use Thelia\Core\Event\Product\ProductDeleteCategoryEvent; use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
use Thelia\Core\Event\Product\ProductAddCategoryEvent; use Thelia\Core\Event\Product\ProductAddCategoryEvent;
use Thelia\Core\Event\Product\ProductAddAccessoryEvent; use Thelia\Core\Event\Product\ProductAddAccessoryEvent;
use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent; use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent;
use Thelia\Model\Map\ProductTableMap;
use Propel\Runtime\Propel; use Propel\Runtime\Propel;
class Product extends BaseAction implements EventSubscriberInterface class Product extends BaseAction implements EventSubscriberInterface
@@ -115,13 +114,6 @@ class Product extends BaseAction implements EventSubscriberInterface
->save() ->save()
; ;
// Update the rewritten URL, if required
try {
$product->setRewrittenUrl($event->getLocale(), $event->getUrl());
} catch(UrlRewritingException $e) {
throw new FormValidationException($e->getMessage(), $e->getCode());
}
// Update default category (ifd required) // Update default category (ifd required)
$product->updateDefaultCategory($event->getDefaultCategory()); $product->updateDefaultCategory($event->getDefaultCategory());
@@ -129,6 +121,17 @@ class Product extends BaseAction implements EventSubscriberInterface
} }
} }
/**
* Change a product SEO
*
* @param \Thelia\Core\Event\UpdateSeoEvent $event
*/
public function updateSeo(UpdateSeoEvent $event)
{
return $this->genericUpdateSeo(ProductQuery::create(), $event);
}
/** /**
* Delete a product entry * Delete a product entry
* *
@@ -389,12 +392,13 @@ class Product extends BaseAction implements EventSubscriberInterface
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array( return array(
TheliaEvents::PRODUCT_CREATE => array("create", 128), TheliaEvents::PRODUCT_CREATE => array("create", 128),
TheliaEvents::PRODUCT_UPDATE => array("update", 128), TheliaEvents::PRODUCT_UPDATE => array("update", 128),
TheliaEvents::PRODUCT_DELETE => array("delete", 128), TheliaEvents::PRODUCT_DELETE => array("delete", 128),
TheliaEvents::PRODUCT_TOGGLE_VISIBILITY => array("toggleVisibility", 128), TheliaEvents::PRODUCT_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
TheliaEvents::PRODUCT_UPDATE_POSITION => array("updatePosition", 128), TheliaEvents::PRODUCT_UPDATE_POSITION => array("updatePosition", 128),
TheliaEvents::PRODUCT_UPDATE_SEO => array("updateSeo", 128),
TheliaEvents::PRODUCT_ADD_CONTENT => array("addContent", 128), TheliaEvents::PRODUCT_ADD_CONTENT => array("addContent", 128),
TheliaEvents::PRODUCT_REMOVE_CONTENT => array("removeContent", 128), TheliaEvents::PRODUCT_REMOVE_CONTENT => array("removeContent", 128),
@@ -404,13 +408,13 @@ class Product extends BaseAction implements EventSubscriberInterface
TheliaEvents::PRODUCT_REMOVE_ACCESSORY => array("removeAccessory", 128), TheliaEvents::PRODUCT_REMOVE_ACCESSORY => array("removeAccessory", 128),
TheliaEvents::PRODUCT_UPDATE_ACCESSORY_POSITION => array("updateAccessoryPosition", 128), TheliaEvents::PRODUCT_UPDATE_ACCESSORY_POSITION => array("updateAccessoryPosition", 128),
TheliaEvents::PRODUCT_ADD_CATEGORY => array("addCategory", 128), TheliaEvents::PRODUCT_ADD_CATEGORY => array("addCategory", 128),
TheliaEvents::PRODUCT_REMOVE_CATEGORY => array("removeCategory", 128), TheliaEvents::PRODUCT_REMOVE_CATEGORY => array("removeCategory", 128),
TheliaEvents::PRODUCT_SET_TEMPLATE => array("setProductTemplate", 128), TheliaEvents::PRODUCT_SET_TEMPLATE => array("setProductTemplate", 128),
TheliaEvents::PRODUCT_FEATURE_UPDATE_VALUE => array("updateFeatureProductValue", 128), TheliaEvents::PRODUCT_FEATURE_UPDATE_VALUE => array("updateFeatureProductValue", 128),
TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE => array("deleteFeatureProductValue", 128), TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE => array("deleteFeatureProductValue", 128),
); );
} }
} }

View File

@@ -17,6 +17,7 @@
<form name="thelia.front.newsletter" class="Thelia\Form\NewsletterForm"/> <form name="thelia.front.newsletter" class="Thelia\Form\NewsletterForm"/>
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/> <form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>
<form name="thelia.admin.seo" class="Thelia\Form\SeoForm"/>
<form name="thelia.admin.customer.create" class="Thelia\Form\CustomerCreateForm"/> <form name="thelia.admin.customer.create" class="Thelia\Form\CustomerCreateForm"/>
<form name="thelia.admin.customer.update" class="Thelia\Form\CustomerUpdateForm"/> <form name="thelia.admin.customer.update" class="Thelia\Form\CustomerUpdateForm"/>
@@ -39,7 +40,6 @@
<form name="thelia.admin.product_default_sale_element.update" class="Thelia\Form\ProductDefaultSaleElementUpdateForm"/> <form name="thelia.admin.product_default_sale_element.update" class="Thelia\Form\ProductDefaultSaleElementUpdateForm"/>
<form name="thelia.admin.product_combination.build" class="Thelia\Form\ProductCombinationGenerationForm"/> <form name="thelia.admin.product_combination.build" class="Thelia\Form\ProductCombinationGenerationForm"/>
<form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/> <form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/>
<form name="thelia.admin.folder.creation" class="Thelia\Form\FolderCreationForm"/> <form name="thelia.admin.folder.creation" class="Thelia\Form\FolderCreationForm"/>

View File

@@ -59,6 +59,11 @@
<requirement key="parentType">.*</requirement> <requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement> <requirement key="parentId">\d+</requirement>
</route> </route>
<route id="admin.image.update-position" path="/admin/image/type/{parentType}/{parentId}/update-position">
<default key="_controller">Thelia\Controller\Admin\FileController::updateImagePositionAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="admin.image.update.view" path="/admin/image/type/{parentType}/{imageId}/update" methods="get"> <route id="admin.image.update.view" path="/admin/image/type/{parentType}/{imageId}/update" methods="get">
<default key="_controller">Thelia\Controller\Admin\FileController::viewImageAction</default> <default key="_controller">Thelia\Controller\Admin\FileController::viewImageAction</default>
<requirement key="parentType">.*</requirement> <requirement key="parentType">.*</requirement>
@@ -90,6 +95,11 @@
<requirement key="parentType">.*</requirement> <requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement> <requirement key="parentId">\d+</requirement>
</route> </route>
<route id="admin.document.update-position" path="/admin/document/type/{parentType}/{parentId}/update-position">
<default key="_controller">Thelia\Controller\Admin\FileController::updateDocumentPositionAction</default>
<requirement key="parentType">.*</requirement>
<requirement key="parentId">\d+</requirement>
</route>
<route id="admin.document.update.view" path="/admin/document/type/{parentType}/{documentId}/update" methods="get"> <route id="admin.document.update.view" path="/admin/document/type/{parentType}/{documentId}/update" methods="get">
<default key="_controller">Thelia\Controller\Admin\FileController::viewDocumentAction</default> <default key="_controller">Thelia\Controller\Admin\FileController::viewDocumentAction</default>
<requirement key="parentType">.*</requirement> <requirement key="parentType">.*</requirement>
@@ -211,6 +221,10 @@
<default key="_controller">Thelia\Controller\Admin\CategoryController::processUpdateAction</default> <default key="_controller">Thelia\Controller\Admin\CategoryController::processUpdateAction</default>
</route> </route>
<route id="admin.categories.seo.save" path="/admin/categories/seo/save">
<default key="_controller">Thelia\Controller\Admin\CategoryController::processUpdateSeoAction</default>
</route>
<route id="admin.categories.set-default" path="/admin/categories/toggle-online"> <route id="admin.categories.set-default" path="/admin/categories/toggle-online">
<default key="_controller">Thelia\Controller\Admin\CategoryController::setToggleVisibilityAction</default> <default key="_controller">Thelia\Controller\Admin\CategoryController::setToggleVisibilityAction</default>
</route> </route>
@@ -227,7 +241,7 @@
<default key="_controller">Thelia\Controller\Admin\CategoryController::addRelatedContentAction</default> <default key="_controller">Thelia\Controller\Admin\CategoryController::addRelatedContentAction</default>
</route> </route>
<route id="admin.categories.related-content.add" path="/admin/categories/related-picture/add"> <route id="admin.categories.related-picture.add" path="/admin/categories/related-picture/add">
<default key="_controller">Thelia\Controller\Admin\CategoryController::addRelatedPictureAction</default> <default key="_controller">Thelia\Controller\Admin\CategoryController::addRelatedPictureAction</default>
</route> </route>
@@ -263,6 +277,10 @@
<default key="_controller">Thelia\Controller\Admin\ProductController::processUpdateAction</default> <default key="_controller">Thelia\Controller\Admin\ProductController::processUpdateAction</default>
</route> </route>
<route id="admin.products.seo.save" path="/admin/products/seo/save">
<default key="_controller">Thelia\Controller\Admin\ProductController::processUpdateSeoAction</default>
</route>
<route id="admin.products.set-default" path="/admin/products/toggle-online"> <route id="admin.products.set-default" path="/admin/products/toggle-online">
<default key="_controller">Thelia\Controller\Admin\ProductController::setToggleVisibilityAction</default> <default key="_controller">Thelia\Controller\Admin\ProductController::setToggleVisibilityAction</default>
</route> </route>
@@ -414,6 +432,10 @@
<default key="_controller">Thelia\Controller\Admin\FolderController::processUpdateAction</default> <default key="_controller">Thelia\Controller\Admin\FolderController::processUpdateAction</default>
</route> </route>
<route id="admin.folders.seo.save" path="/admin/folders/seo/save">
<default key="_controller">Thelia\Controller\Admin\FolderController::processUpdateSeoAction</default>
</route>
<route id="admin.folders.delete" path="/admin/folders/delete"> <route id="admin.folders.delete" path="/admin/folders/delete">
<default key="_controller">Thelia\Controller\Admin\FolderController::deleteAction</default> <default key="_controller">Thelia\Controller\Admin\FolderController::deleteAction</default>
</route> </route>
@@ -436,6 +458,10 @@
<default key="_controller">Thelia\Controller\Admin\ContentController::processUpdateAction</default> <default key="_controller">Thelia\Controller\Admin\ContentController::processUpdateAction</default>
</route> </route>
<route id="admin.content.seo.save" path="/admin/content/seo/save">
<default key="_controller">Thelia\Controller\Admin\ContentController::processUpdateSeoAction</default>
</route>
<route id="admin.content.update-position" path="/admin/content/update-position"> <route id="admin.content.update-position" path="/admin/content/update-position">
<default key="_controller">Thelia\Controller\Admin\ContentController::updatePositionAction</default> <default key="_controller">Thelia\Controller\Admin\ContentController::updatePositionAction</default>
</route> </route>
@@ -954,6 +980,10 @@
<default key="_controller">Thelia\Controller\Admin\ModuleController::deleteAction</default> <default key="_controller">Thelia\Controller\Admin\ModuleController::deleteAction</default>
</route> </route>
<route id="admin.module.delete" path="/admin/module/update-position">
<default key="_controller">Thelia\Controller\Admin\ModuleController::updatePositionAction</default>
</route>
<!-- <!--
Generic module route. Generic module route.
Will be use if module route is not define in module own config file. Will be use if module route is not define in module own config file.

View File

@@ -34,7 +34,7 @@ use Thelia\Core\Event\UpdatePositionEvent;
*/ */
abstract class AbstractCrudController extends BaseAdminController abstract class AbstractCrudController extends BaseAdminController
{ {
protected $objectName; protected $objectName;
// List ordering // List ordering
protected $defaultListOrder; protected $defaultListOrder;
@@ -139,7 +139,7 @@ abstract class AbstractCrudController extends BaseAdminController
/** /**
* Get the created object from an event. * Get the created object from an event.
* *
* @param unknown $createEvent * @param unknown $event
*/ */
abstract protected function getObjectFromEvent($event); abstract protected function getObjectFromEvent($event);
@@ -230,7 +230,7 @@ abstract class AbstractCrudController extends BaseAdminController
/** /**
* Put in this method post object position change processing if required. * Put in this method post object position change processing if required.
* *
* @param unknown $deleteEvent the delete event * @param unknown $positionChangeEvent the delete event
* @return Response a response, or null to continue normal processing * @return Response a response, or null to continue normal processing
*/ */
protected function performAdditionalUpdatePositionAction($positionChangeEvent) protected function performAdditionalUpdatePositionAction($positionChangeEvent)
@@ -267,7 +267,10 @@ abstract class AbstractCrudController extends BaseAdminController
*/ */
public function defaultAction() public function defaultAction()
{ {
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::VIEW)) return $response; // Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::VIEW))
return $response;
return $this->renderList(); return $this->renderList();
} }
@@ -279,8 +282,10 @@ abstract class AbstractCrudController extends BaseAdminController
public function createAction() public function createAction()
{ {
// Check current user authorization // Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::CREATE)) return $response; if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::CREATE))
return $response;
// Error (Default: false)
$error_msg = false; $error_msg = false;
// Create the Creation Form // Create the Creation Form
@@ -288,24 +293,29 @@ abstract class AbstractCrudController extends BaseAdminController
try { try {
// Validate the form, create the event and dispatch it. // Check the form against constraints violations
$form = $this->validateForm($creationForm, "POST"); $form = $this->validateForm($creationForm, "POST");
// Get the form field values
$data = $form->getData(); $data = $form->getData();
// Create a new event object with the modified fields
$createEvent = $this->getCreationEvent($data); $createEvent = $this->getCreationEvent($data);
// Dispatch Create Event
$this->dispatch($this->createEventIdentifier, $createEvent); $this->dispatch($this->createEventIdentifier, $createEvent);
// Check if object exist
if (! $this->eventContainsObject($createEvent)) if (! $this->eventContainsObject($createEvent))
throw new \LogicException( throw new \LogicException(
$this->getTranslator()->trans("No %obj was created.", array('%obj', $this->objectName))); $this->getTranslator()->trans("No %obj was created.", array('%obj', $this->objectName)));
// Log object creation
if (null !== $createdObject = $this->getObjectFromEvent($createEvent)) { if (null !== $createdObject = $this->getObjectFromEvent($createEvent)) {
// Log object creation
$this->adminLogAppend($this->resourceCode, AccessManager::CREATE, sprintf("%s %s (ID %s) created", ucfirst($this->objectName), $this->getObjectLabel($createdObject), $this->getObjectId($createdObject))); $this->adminLogAppend($this->resourceCode, AccessManager::CREATE, sprintf("%s %s (ID %s) created", ucfirst($this->objectName), $this->getObjectLabel($createdObject), $this->getObjectId($createdObject)));
} }
// Execute additional Action
$response = $this->performAdditionalCreateAction($createEvent); $response = $this->performAdditionalCreateAction($createEvent);
if ($response == null) { if ($response == null) {
@@ -326,7 +336,11 @@ abstract class AbstractCrudController extends BaseAdminController
} }
$this->setupFormErrorContext( $this->setupFormErrorContext(
$this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)), $error_msg, $creationForm, $ex); $this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)),
$error_msg,
$creationForm,
$ex
);
// At this point, the form has error, and should be redisplayed. // At this point, the form has error, and should be redisplayed.
return $this->renderList(); return $this->renderList();
@@ -340,12 +354,11 @@ abstract class AbstractCrudController extends BaseAdminController
public function updateAction() public function updateAction()
{ {
// Check current user authorization // Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response; if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE))
return $response;
// Load the object // Load object if exist
$object = $this->getExistingObject(); if (null !== $object = $this->getExistingObject()) {
if ($object != null) {
// Hydrate the form abd pass it to the parser // Hydrate the form abd pass it to the parser
$changeForm = $this->hydrateObjectForm($object); $changeForm = $this->hydrateObjectForm($object);
@@ -366,11 +379,13 @@ abstract class AbstractCrudController extends BaseAdminController
public function processUpdateAction() public function processUpdateAction()
{ {
// Check current user authorization // Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response; if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE))
return $response;
// Error (Default: false)
$error_msg = false; $error_msg = false;
// Create the form from the request // Create the Form from the request
$changeForm = $this->getUpdateForm($this->getRequest()); $changeForm = $this->getUpdateForm($this->getRequest());
try { try {
@@ -381,23 +396,27 @@ abstract class AbstractCrudController extends BaseAdminController
// Get the form field values // Get the form field values
$data = $form->getData(); $data = $form->getData();
// Create a new event object with the modified fields
$changeEvent = $this->getUpdateEvent($data); $changeEvent = $this->getUpdateEvent($data);
// Dispatch Update Event
$this->dispatch($this->updateEventIdentifier, $changeEvent); $this->dispatch($this->updateEventIdentifier, $changeEvent);
// Check if object exist
if (! $this->eventContainsObject($changeEvent)) if (! $this->eventContainsObject($changeEvent))
throw new \LogicException( throw new \LogicException(
$this->getTranslator()->trans("No %obj was updated.", array('%obj', $this->objectName))); $this->getTranslator()->trans("No %obj was updated.", array('%obj', $this->objectName)));
// Log object modification // Log object modification
if (null !== $changedObject = $this->getObjectFromEvent($changeEvent)) { if (null !== $changedObject = $this->getObjectFromEvent($changeEvent)) {
$this->adminLogAppend($this->resourceCode, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject))); $this->adminLogAppend($this->resourceCode, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
} }
// Execute additional Action
$response = $this->performAdditionalUpdateAction($changeEvent); $response = $this->performAdditionalUpdateAction($changeEvent);
if ($response == null) { if ($response == null) {
// If we have to stay on the same page, do not redirect to the succesUrl, // If we have to stay on the same page, do not redirect to the successUrl,
// just redirect to the edit page again. // just redirect to the edit page again.
if ($this->getRequest()->get('save_mode') == 'stay') { if ($this->getRequest()->get('save_mode') == 'stay') {
$this->redirectToEditionTemplate($this->getRequest()); $this->redirectToEditionTemplate($this->getRequest());
@@ -416,11 +435,16 @@ abstract class AbstractCrudController extends BaseAdminController
$error_msg = $ex->getMessage();*/ $error_msg = $ex->getMessage();*/
} }
$this->setupFormErrorContext(
$this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)), $error_msg, $changeForm, $ex);
// At this point, the form has errors, and should be redisplayed. // At this point, the form has errors, and should be redisplayed.
return $this->renderEditionTemplate(); $this->setupFormErrorContext(
$this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)),
$error_msg,
$changeForm,
$ex
);
//return $this->renderEditionTemplate();
} }
/** /**
@@ -431,7 +455,8 @@ abstract class AbstractCrudController extends BaseAdminController
public function updatePositionAction() public function updatePositionAction()
{ {
// Check current user authorization // Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response; if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE))
return $response;
try { try {
$mode = $this->getRequest()->get('mode', null); $mode = $this->getRequest()->get('mode', null);
@@ -448,6 +473,7 @@ abstract class AbstractCrudController extends BaseAdminController
$event = $this->createUpdatePositionEvent($mode, $position); $event = $this->createUpdatePositionEvent($mode, $position);
$this->dispatch($this->changePositionEventIdentifier, $event); $this->dispatch($this->changePositionEventIdentifier, $event);
} catch (\Exception $ex) { } catch (\Exception $ex) {
// Any error // Any error
return $this->errorPage($ex); return $this->errorPage($ex);
@@ -465,7 +491,8 @@ abstract class AbstractCrudController extends BaseAdminController
protected function genericUpdatePositionAction($object, $eventName, $doFinalRedirect = true) protected function genericUpdatePositionAction($object, $eventName, $doFinalRedirect = true)
{ {
// Check current user authorization // Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response; if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE))
return $response;
if ($object != null) { if ($object != null) {
@@ -499,7 +526,8 @@ abstract class AbstractCrudController extends BaseAdminController
public function setToggleVisibilityAction() public function setToggleVisibilityAction()
{ {
// Check current user authorization // Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) return $response; if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE))
return $response;
$changeEvent = $this->createToggleVisibilityEvent($this->getRequest()); $changeEvent = $this->createToggleVisibilityEvent($this->getRequest());
@@ -521,7 +549,8 @@ abstract class AbstractCrudController extends BaseAdminController
public function deleteAction() public function deleteAction()
{ {
// Check current user authorization // Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::DELETE)) return $response; if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::DELETE))
return $response;
// Get the currency id, and dispatch the delet request // Get the currency id, and dispatch the delet request
$deleteEvent = $this->getDeleteEvent(); $deleteEvent = $this->getDeleteEvent();

View File

@@ -0,0 +1,235 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
use Thelia\Core\Event\UpdateSeoEvent;
use Thelia\Core\Security\AccessManager;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Form\SeoForm;
/**
* Extend abstract CRUD controller to manage basic CRUD + SEO operations on a given object.
*
* @author Christophe Laffont <claffont@openstudio.fr>
*/
abstract class AbstractSeoCrudController extends AbstractCrudController
{
// Events
protected $updateSeoEventIdentifier;
/**
* @param string $objectName the lower case object name. Example. "message"
*
* @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual
* @param string $orderRequestParameterName Name of the request parameter that set the list order (null if list is not sortable)
*
* @param string $resourceCode the 'resource' code. Example: "admin.configuration.message"
*
* @param string $createEventIdentifier the dispatched create TheliaEvent identifier. Example: TheliaEvents::MESSAGE_CREATE
* @param string $updateEventIdentifier the dispatched update TheliaEvent identifier. Example: TheliaEvents::MESSAGE_UPDATE
* @param string $deleteEventIdentifier the dispatched delete TheliaEvent identifier. Example: TheliaEvents::MESSAGE_DELETE
*
* @param string $visibilityToggleEventIdentifier the dispatched visibility toggle TheliaEvent identifier, or null if the object has no visible options. Example: TheliaEvents::MESSAGE_TOGGLE_VISIBILITY
* @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION
* @param string $updateSeoEventIdentifier the dispatched update SEO change TheliaEvent identifier, or null if the object has no SEO. Example: TheliaEvents::MESSAGE_UPDATE_SEO
*/
public function __construct(
$objectName,
$defaultListOrder = null,
$orderRequestParameterName = null,
$resourceCode,
$createEventIdentifier,
$updateEventIdentifier,
$deleteEventIdentifier,
$visibilityToggleEventIdentifier = null,
$changePositionEventIdentifier = null,
$updateSeoEventIdentifier = null
)
{
parent::__construct(
$objectName,
$defaultListOrder,
$orderRequestParameterName,
$resourceCode,
$createEventIdentifier,
$updateEventIdentifier,
$deleteEventIdentifier,
$visibilityToggleEventIdentifier,
$changePositionEventIdentifier
);
$this->updateSeoEventIdentifier = $updateSeoEventIdentifier;
}
/**
* Put in this method post object update SEO processing if required.
*
* @param unknown $updateSeoEvent the update event
* @return Response a response, or null to continue normal processing
*/
protected function performAdditionalUpdateSeoAction($updateSeoEvent)
{
return null;
}
/**
* Return the update SEO form for this object
*/
protected function getUpdateSeoForm()
{
return new SeoForm($this->getRequest());
}
/**
* Creates the update SEO event with the provided form data
*
* @param $formData
* @return UpdateSeoEvent
*/
protected function getUpdateSeoEvent($formData)
{
$updateSeoEvent = new UpdateSeoEvent($formData['id']);
$updateSeoEvent
->setLocale($formData['locale'])
->setMetaTitle($formData['meta_title'])
->setMetaDescription($formData['meta_description'])
->setMetaKeywords($formData['meta_keywords'])
->setUrl($formData['url'])
;
// Create and dispatch the change event
return $updateSeoEvent;
}
/**
* Hydrate the SEO form for this object, before passing it to the update template
*
* @param unknown $object
*/
protected function hydrateSeoForm($object){
// The "SEO" tab form
$locale = $object->getLocale();
$data = array(
'id' => $object->getId(),
'locale' => $locale,
'url' => $object->getRewrittenUrl($locale),
'meta_title' => $object->getMetaTitle(),
'meta_description' => $object->getMetaDescription(),
'meta_keywords' => $object->getMetaKeywords()
);
$seoForm = new SeoForm($this->getRequest(), "form", $data);
$this->getParserContext()->addForm($seoForm);
// URL based on the language
$this->getParserContext()->set('url_language', $this->getUrlLanguage($locale));
}
/**
* Update SEO modification, and either go back to the object list, or stay on the edition page.
*
* @return Thelia\Core\HttpFoundation\Response the response
*/
public function processUpdateSeoAction()
{
// Check current user authorization
if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE))
return $response;
// Error (Default: false)
$error_msg = false;
// Create the Form from the request
$updateSeoForm = $this->getUpdateSeoForm($this->getRequest());
// Pass the object id to the request
$this->getRequest()->attributes->set($this->objectName . '_id', $this->getRequest()->get('current_id'));
try {
// Check the form against constraints violations
$form = $this->validateForm($updateSeoForm, "POST");
// Get the form field values
$data = $form->getData();
// Create a new event object with the modified fields
$updateSeoEvent = $this->getUpdateSeoEvent($data);
// Dispatch Update SEO Event
$this->dispatch($this->updateSeoEventIdentifier, $updateSeoEvent);
// Execute additional Action
$response = $this->performAdditionalUpdateSeoAction($updateSeoEvent);
if ($response == null) {
// If we have to stay on the same page, do not redirect to the successUrl,
// just redirect to the edit page again.
if ($this->getRequest()->get('save_mode') == 'stay') {
$this->redirectToEditionTemplate($this->getRequest());
}
// Redirect to the success URL
$this->redirect($updateSeoForm->getSuccessUrl());
} else {
return $response;
}
} catch (FormValidationException $ex) {
// Form cannot be validated
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
/*} catch (\Exception $ex) {
// Any other error
$error_msg = $ex->getMessage();*/
}
// Load object if exist
if (null !== $object = $this->getExistingObject()) {
// Hydrate the form abd pass it to the parser
$changeForm = $this->hydrateObjectForm($object);
// Pass it to the parser
$this->getParserContext()->addForm($changeForm);
}
$this->setupFormErrorContext(
$this->getTranslator()->trans("%obj SEO modification", array('%obj' => $this->objectName)),
$error_msg,
$updateSeoForm,
$ex
);
// At this point, the form has errors, and should be redisplayed.
return $this->renderEditionTemplate();
}
}

View File

@@ -201,7 +201,7 @@ class BaseAdminController extends BaseController
$parser = $this->container->get("thelia.parser"); $parser = $this->container->get("thelia.parser");
// Define the template that should be used // Define the template that should be used
$parser->setTemplate($template ?: TemplateHelper::getInstance()->getActiveAdminTemplate()); $parser->setTemplateDefinition($template ?: TemplateHelper::getInstance()->getActiveAdminTemplate());
return $parser; return $parser;
} }
@@ -302,6 +302,23 @@ class BaseAdminController extends BaseController
return $this->getCurrentEditionLang()->getLocale(); return $this->getCurrentEditionLang()->getLocale();
} }
/**
* A simple helper to get the URL based on the language.
*/
protected function getUrlLanguage($locale = null)
{
// Check if the functionality is activated
if(!ConfigQuery::read("one_domain_foreach_lang", false))
return;
// If we don't have a locale value, use the locale value in the session
if(!$locale)
$locale = $this->getCurrentEditionLocale();
return LangQuery::create()->findOneByLocale($locale)->getUrl();
}
/** /**
* Return the current list order identifier for a given object name, * Return the current list order identifier for a given object name,
* updating in using the current request. * updating in using the current request.

View File

@@ -47,7 +47,7 @@ use Thelia\Model\CategoryAssociatedContentQuery;
* *
* @author Franck Allimant <franck@cqfdev.fr> * @author Franck Allimant <franck@cqfdev.fr>
*/ */
class CategoryController extends AbstractCrudController class CategoryController extends AbstractSeoCrudController
{ {
public function __construct() public function __construct()
{ {
@@ -62,7 +62,8 @@ class CategoryController extends AbstractCrudController
TheliaEvents::CATEGORY_UPDATE, TheliaEvents::CATEGORY_UPDATE,
TheliaEvents::CATEGORY_DELETE, TheliaEvents::CATEGORY_DELETE,
TheliaEvents::CATEGORY_TOGGLE_VISIBILITY, TheliaEvents::CATEGORY_TOGGLE_VISIBILITY,
TheliaEvents::CATEGORY_UPDATE_POSITION TheliaEvents::CATEGORY_UPDATE_POSITION,
TheliaEvents::CATEGORY_UPDATE_SEO
); );
} }
@@ -102,7 +103,6 @@ class CategoryController extends AbstractCrudController
->setDescription($formData['description']) ->setDescription($formData['description'])
->setPostscriptum($formData['postscriptum']) ->setPostscriptum($formData['postscriptum'])
->setVisible($formData['visible']) ->setVisible($formData['visible'])
->setUrl($formData['url'])
->setParent($formData['parent']) ->setParent($formData['parent'])
; ;
@@ -130,7 +130,10 @@ class CategoryController extends AbstractCrudController
protected function hydrateObjectForm($object) protected function hydrateObjectForm($object)
{ {
// Prepare the data that will hydrate the form // Hydrate the "SEO" tab form
$this->hydrateSeoForm($object);
// The "General" tab form
$data = array( $data = array(
'id' => $object->getId(), 'id' => $object->getId(),
'locale' => $object->getLocale(), 'locale' => $object->getLocale(),
@@ -139,7 +142,6 @@ class CategoryController extends AbstractCrudController
'description' => $object->getDescription(), 'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(), 'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(), 'visible' => $object->getVisible(),
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'parent' => $object->getParent() 'parent' => $object->getParent()
); );
@@ -193,10 +195,25 @@ class CategoryController extends AbstractCrudController
protected function redirectToListTemplate() protected function redirectToListTemplate()
{ {
$this->redirectToRoute( $category_id = $this->getRequest()->get('category_id', 0);
$this->redirectToListTemplateWithId($category_id);
}
protected function redirectToListTemplateWithId($category_id)
{
if($category_id > 0)
{
$this->redirectToRoute(
'admin.categories.default', 'admin.categories.default',
array('category_id' => $this->getRequest()->get('category_id', 0)) array('category_id' => $category_id)
); );
}
else
{
$this->redirectToRoute(
'admin.catalog'
);
}
} }
protected function renderEditionTemplate() protected function renderEditionTemplate()
@@ -233,21 +250,16 @@ class CategoryController extends AbstractCrudController
protected function performAdditionalDeleteAction($deleteEvent) protected function performAdditionalDeleteAction($deleteEvent)
{ {
// Redirect to parent category list // Redirect to parent category list
$this->redirectToRoute( $category_id = $deleteEvent->getCategory()->getParent();
'admin.categories.default', $this->redirectToListTemplateWithId($category_id);
array('category_id' => $deleteEvent->getCategory()->getParent())
);
} }
protected function performAdditionalUpdateAction($updateEvent) protected function performAdditionalUpdateAction($updateEvent)
{ {
if ($this->getRequest()->get('save_mode') != 'stay') { if ($this->getRequest()->get('save_mode') != 'stay') {
// Redirect to parent category list // Redirect to parent category list
$this->redirectToRoute( $category_id = $updateEvent->getCategory()->getParent();
'admin.categories.default', $this->redirectToListTemplateWithId($category_id);
array('category_id' => $updateEvent->getCategory()->getParent())
);
} }
} }
@@ -258,10 +270,8 @@ class CategoryController extends AbstractCrudController
if ($category != null) { if ($category != null) {
// Redirect to parent category list // Redirect to parent category list
$this->redirectToRoute( $category_id = $category->getParent();
'admin.categories.default', $this->redirectToListTemplateWithId($category_id);
array('category_id' => $category->getParent())
);
} }
return null; return null;

View File

@@ -41,7 +41,7 @@ use Thelia\Model\ContentQuery;
* @package Thelia\Controller\Admin * @package Thelia\Controller\Admin
* @author manuel raynaud <mraynaud@openstudio.fr> * @author manuel raynaud <mraynaud@openstudio.fr>
*/ */
class ContentController extends AbstractCrudController class ContentController extends AbstractSeoCrudController
{ {
public function __construct() public function __construct()
@@ -57,7 +57,8 @@ class ContentController extends AbstractCrudController
TheliaEvents::CONTENT_UPDATE, TheliaEvents::CONTENT_UPDATE,
TheliaEvents::CONTENT_DELETE, TheliaEvents::CONTENT_DELETE,
TheliaEvents::CONTENT_TOGGLE_VISIBILITY, TheliaEvents::CONTENT_TOGGLE_VISIBILITY,
TheliaEvents::CONTENT_UPDATE_POSITION TheliaEvents::CONTENT_UPDATE_POSITION,
TheliaEvents::CONTENT_UPDATE_SEO
); );
} }
@@ -140,6 +141,9 @@ class ContentController extends AbstractCrudController
*/ */
protected function hydrateObjectForm($object) protected function hydrateObjectForm($object)
{ {
// Hydrate the "SEO" tab form
$this->hydrateSeoForm($object);
// Prepare the data that will hydrate the form // Prepare the data that will hydrate the form
$data = array( $data = array(
'id' => $object->getId(), 'id' => $object->getId(),
@@ -148,8 +152,7 @@ class ContentController extends AbstractCrudController
'chapo' => $object->getChapo(), 'chapo' => $object->getChapo(),
'description' => $object->getDescription(), 'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(), 'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(), 'visible' => $object->getVisible()
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
); );
// Setup the object form // Setup the object form
@@ -191,7 +194,6 @@ class ContentController extends AbstractCrudController
->setDescription($formData['description']) ->setDescription($formData['description'])
->setPostscriptum($formData['postscriptum']) ->setPostscriptum($formData['postscriptum'])
->setVisible($formData['visible']) ->setVisible($formData['visible'])
->setUrl($formData['url'])
->setDefaultFolder($formData['default_folder']); ->setDefaultFolder($formData['default_folder']);
return $contentUpdateEvent; return $contentUpdateEvent;

View File

@@ -25,6 +25,7 @@ namespace Thelia\Controller\Admin;
use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Exception\PropelException;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Thelia\Core\Event\UpdateFilePositionEvent;
use Thelia\Core\HttpFoundation\Response; use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent; use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent;
@@ -519,6 +520,8 @@ class FileController extends BaseAdminController
*/ */
public function deleteImageAction($imageId, $parentType) public function deleteImageAction($imageId, $parentType)
{ {
$message = null;
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE); $this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
$this->checkXmlHttpRequest(); $this->checkXmlHttpRequest();
@@ -569,14 +572,134 @@ class FileController extends BaseAdminController
'image' 'image'
) )
); );
$message = $this->getTranslator()
->trans(
'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)',
array(
'%id%' => $imageDeleteEvent->getImageToDelete()->getId(),
'%parentId%' => $imageDeleteEvent->getImageToDelete()->getParentId(),
'%e%' => $e->getMessage()
),
'image'
);
} }
$message = $this->getTranslator() if(null === $message) {
->trans( $message = $this->getTranslator()
'Images deleted successfully', ->trans(
array(), 'Images deleted successfully',
'image' array(),
'image'
);
}
return new Response($message);
}
public function updateImagePositionAction($parentType, $parentId)
{
$message = null;
$imageId = $this->getRequest()->request->get('image_id');
$position = $this->getRequest()->request->get('position');
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
$this->checkXmlHttpRequest();
$fileManager = new FileManager($this->container);
$imageModelQuery = $fileManager->getImageModelQuery($parentType);
$model = $imageModelQuery->findPk($imageId);
if ($model === null || $position === null) {
return $this->pageNotFound();
}
// Feed event
$imageUpdateImagePositionEvent = new UpdateFilePositionEvent(
$fileManager->getImageModelQuery($parentType),
$imageId,
UpdateFilePositionEvent::POSITION_ABSOLUTE,
$position
);
// Dispatch Event to the Action
try {
$this->dispatch(
TheliaEvents::IMAGE_UPDATE_POSITION,
$imageUpdateImagePositionEvent
); );
} catch (\Exception $e) {
$message = $this->getTranslator()
->trans(
'Fail to update image position',
array(),
'image'
) . $e->getMessage();
}
if(null === $message) {
$message = $this->getTranslator()
->trans(
'Image position updated',
array(),
'image'
);
}
return new Response($message);
}
public function updateDocumentPositionAction($parentType, $parentId)
{
$message = null;
$documentId = $this->getRequest()->request->get('document_id');
$position = $this->getRequest()->request->get('position');
$this->checkAuth(AdminResources::retrieve($parentType), array(), AccessManager::UPDATE);
$this->checkXmlHttpRequest();
$fileManager = new FileManager($this->container);
$documentModelQuery = $fileManager->getDocumentModelQuery($parentType);
$model = $documentModelQuery->findPk($documentId);
if ($model === null || $position === null) {
return $this->pageNotFound();
}
// Feed event
$documentUpdateDocumentPositionEvent = new UpdateFilePositionEvent(
$fileManager->getDocumentModelQuery($parentType),
$documentId,
UpdateFilePositionEvent::POSITION_ABSOLUTE,
$position
);
// Dispatch Event to the Action
try {
$this->dispatch(
TheliaEvents::DOCUMENT_UPDATE_POSITION,
$documentUpdateDocumentPositionEvent
);
} catch (\Exception $e) {
$message = $this->getTranslator()
->trans(
'Fail to update document position',
array(),
'document'
) . $e->getMessage();
}
if(null === $message) {
$message = $this->getTranslator()
->trans(
'Document position updated',
array(),
'document'
);
}
return new Response($message); return new Response($message);
} }

View File

@@ -22,6 +22,7 @@
/*************************************************************************************/ /*************************************************************************************/
namespace Thelia\Controller\Admin; namespace Thelia\Controller\Admin;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Event\Folder\FolderCreateEvent; use Thelia\Core\Event\Folder\FolderCreateEvent;
use Thelia\Core\Event\Folder\FolderDeleteEvent; use Thelia\Core\Event\Folder\FolderDeleteEvent;
@@ -38,7 +39,7 @@ use Thelia\Model\FolderQuery;
* @package Thelia\Controller\Admin * @package Thelia\Controller\Admin
* @author Manuel Raynaud <mraynaud@openstudio.fr> * @author Manuel Raynaud <mraynaud@openstudio.fr>
*/ */
class FolderController extends AbstractCrudController class FolderController extends AbstractSeoCrudController
{ {
public function __construct() public function __construct()
@@ -54,7 +55,8 @@ class FolderController extends AbstractCrudController
TheliaEvents::FOLDER_UPDATE, TheliaEvents::FOLDER_UPDATE,
TheliaEvents::FOLDER_DELETE, TheliaEvents::FOLDER_DELETE,
TheliaEvents::FOLDER_TOGGLE_VISIBILITY, TheliaEvents::FOLDER_TOGGLE_VISIBILITY,
TheliaEvents::FOLDER_UPDATE_POSITION TheliaEvents::FOLDER_UPDATE_POSITION,
TheliaEvents::FOLDER_UPDATE_SEO
); );
} }
@@ -81,6 +83,9 @@ class FolderController extends AbstractCrudController
*/ */
protected function hydrateObjectForm($object) protected function hydrateObjectForm($object)
{ {
// Hydrate the "SEO" tab form
$this->hydrateSeoForm($object);
// Prepare the data that will hydrate the form // Prepare the data that will hydrate the form
$data = array( $data = array(
'id' => $object->getId(), 'id' => $object->getId(),
@@ -90,7 +95,6 @@ class FolderController extends AbstractCrudController
'description' => $object->getDescription(), 'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(), 'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(), 'visible' => $object->getVisible(),
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'parent' => $object->getParent() 'parent' => $object->getParent()
); );
@@ -132,7 +136,6 @@ class FolderController extends AbstractCrudController
->setDescription($formData['description']) ->setDescription($formData['description'])
->setPostscriptum($formData['postscriptum']) ->setPostscriptum($formData['postscriptum'])
->setVisible($formData['visible']) ->setVisible($formData['visible'])
->setUrl($formData['url'])
->setParent($formData['parent']) ->setParent($formData['parent'])
; ;
@@ -247,11 +250,15 @@ class FolderController extends AbstractCrudController
return $this->render('folder-edit', $this->getEditionArguments()); return $this->render('folder-edit', $this->getEditionArguments());
} }
protected function getEditionArguments() protected function getEditionArguments(Request $request = null)
{ {
if (null === $request) {
$request = $this->getRequest();
}
return array( return array(
'folder_id' => $this->getRequest()->get('folder_id', 0), 'folder_id' => $request->get('folder_id', 0),
'current_tab' => $this->getRequest()->get('current_tab', 'general') 'current_tab' => $request->get('current_tab', 'general')
); );
} }
@@ -309,9 +316,9 @@ class FolderController extends AbstractCrudController
/** /**
* Redirect to the edition template * Redirect to the edition template
*/ */
protected function redirectToEditionTemplate() protected function redirectToEditionTemplate(Request $request = null)
{ {
$this->redirect($this->getRoute('admin.folders.update', $this->getEditionArguments())); $this->redirect($this->getRoute('admin.folders.update', $this->getEditionArguments($request)));
} }
/** /**

View File

@@ -33,6 +33,7 @@ use Thelia\Core\Security\AccessManager;
use Thelia\Form\ModuleModificationForm; use Thelia\Form\ModuleModificationForm;
use Thelia\Model\ModuleQuery; use Thelia\Model\ModuleQuery;
use Thelia\Module\ModuleManagement; use Thelia\Module\ModuleManagement;
use Thelia\Core\Event\UpdatePositionEvent;
/** /**
* Class ModuleController * Class ModuleController
@@ -45,14 +46,30 @@ class ModuleController extends AbstractCrudController
{ {
parent::__construct( parent::__construct(
'module', 'module',
null, 'manual',
null, 'module_order',
AdminResources::MODULE, AdminResources::MODULE,
null, null,
TheliaEvents::MODULE_UPDATE, TheliaEvents::MODULE_UPDATE,
null null,
null,
TheliaEvents::MODULE_UPDATE_POSITION
/*
$objectName,
$defaultListOrder = null,
$orderRequestParameterName = null,
$resourceCode,
$createEventIdentifier,
$updateEventIdentifier,
$deleteEventIdentifier,
$visibilityToggleEventIdentifier = null,
$changePositionEventIdentifier = null
*/
); );
} }
@@ -90,6 +107,15 @@ class ModuleController extends AbstractCrudController
return null; return null;
} }
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
{
return new UpdatePositionEvent(
$this->getRequest()->get('module_id', null),
$positionChangeMode,
$positionValue
);
}
protected function eventContainsObject($event) protected function eventContainsObject($event)
{ {
return $event->hasModule(); return $event->hasModule();
@@ -151,7 +177,7 @@ class ModuleController extends AbstractCrudController
// We always return to the feature edition form // We always return to the feature edition form
return $this->render( return $this->render(
'modules', 'modules',
array() array('module_order' => $currentOrder)
); );
} }
@@ -185,7 +211,7 @@ class ModuleController extends AbstractCrudController
$moduleManagement = new ModuleManagement(); $moduleManagement = new ModuleManagement();
$moduleManagement->updateModules(); $moduleManagement->updateModules();
return $this->render("modules"); return $this->renderList();
} }
public function configureAction($module_code) public function configureAction($module_code)

View File

@@ -23,57 +23,62 @@
namespace Thelia\Controller\Admin; namespace Thelia\Controller\Admin;
use Thelia\Core\Security\Resource\AdminResources; use Symfony\Component\HttpFoundation\JsonResponse;
use Thelia\Core\Event\Product\ProductAddCategoryEvent; use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
use Thelia\Core\Event\Product\ProductDeleteEvent;
use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\Product\ProductUpdateEvent; use Thelia\Core\Event\Product\ProductUpdateEvent;
use Thelia\Core\Event\Product\ProductCreateEvent; use Thelia\Core\Event\Product\ProductCreateEvent;
use Thelia\Core\Security\AccessManager; use Thelia\Core\Event\Product\ProductAddCategoryEvent;
use Thelia\Model\ProductQuery; use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
use Thelia\Form\ProductModificationForm; use Thelia\Core\Event\Product\ProductDeleteEvent;
use Thelia\Form\ProductCreationForm;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\Product\ProductToggleVisibilityEvent; use Thelia\Core\Event\Product\ProductToggleVisibilityEvent;
use Thelia\Core\Event\Product\ProductDeleteContentEvent; use Thelia\Core\Event\Product\ProductDeleteContentEvent;
use Thelia\Core\Event\Product\ProductAddContentEvent; use Thelia\Core\Event\Product\ProductAddContentEvent;
use Thelia\Model\FolderQuery;
use Thelia\Model\ContentQuery;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Model\ProductAssociatedContentQuery;
use Thelia\Model\AccessoryQuery;
use Thelia\Model\CategoryQuery;
use Thelia\Core\Event\Product\ProductAddAccessoryEvent; use Thelia\Core\Event\Product\ProductAddAccessoryEvent;
use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent; use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent;
use Thelia\Model\ProductSaleElementsQuery; use Thelia\Core\Event\Product\ProductCombinationGenerationEvent;
use Thelia\Core\Event\Product\ProductSetTemplateEvent;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementDeleteEvent; use Thelia\Core\Event\ProductSaleElement\ProductSaleElementDeleteEvent;
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementUpdateEvent; use Thelia\Core\Event\ProductSaleElement\ProductSaleElementUpdateEvent;
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent; use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Security\AccessManager;
use Thelia\Model\AccessoryQuery;
use Thelia\Model\CategoryQuery;
use Thelia\Model\FolderQuery;
use Thelia\Model\ContentQuery;
use Thelia\Model\AttributeQuery; use Thelia\Model\AttributeQuery;
use Thelia\Model\AttributeAvQuery; use Thelia\Model\AttributeAvQuery;
use Thelia\Form\ProductSaleElementUpdateForm; use Thelia\Model\ProductQuery;
use Thelia\Model\ProductAssociatedContentQuery;
use Thelia\Model\ProductSaleElementsQuery;
use Thelia\Model\ProductPriceQuery; use Thelia\Model\ProductPriceQuery;
use Thelia\Form\ProductDefaultSaleElementUpdateForm;
use Thelia\Model\ProductPrice; use Thelia\Model\ProductPrice;
use Thelia\Model\Currency; use Thelia\Model\Currency;
use Symfony\Component\HttpFoundation\JsonResponse;
use Thelia\TaxEngine\Calculator;
use Thelia\Model\Country;
use Thelia\Tools\NumberFormat;
use Thelia\Model\Product;
use Thelia\Model\CurrencyQuery; use Thelia\Model\CurrencyQuery;
use Thelia\Model\Country;
use Thelia\Model\Product;
use Thelia\Form\ProductCreationForm;
use Thelia\Form\ProductModificationForm;
use Thelia\Form\ProductSaleElementUpdateForm;
use Thelia\Form\ProductDefaultSaleElementUpdateForm;
use Thelia\Form\ProductCombinationGenerationForm; use Thelia\Form\ProductCombinationGenerationForm;
use Thelia\Core\Event\Product\ProductCombinationGenerationEvent;
use Thelia\Core\Event\Product\ProductSetTemplateEvent; use Thelia\TaxEngine\Calculator;
use Thelia\Tools\NumberFormat;
/** /**
* Manages products * Manages products
* *
* @author Franck Allimant <franck@cqfdev.fr> * @author Franck Allimant <franck@cqfdev.fr>
*/ */
class ProductController extends AbstractCrudController class ProductController extends AbstractSeoCrudController
{ {
public function __construct() public function __construct()
{ {
@@ -89,7 +94,8 @@ class ProductController extends AbstractCrudController
TheliaEvents::PRODUCT_DELETE, TheliaEvents::PRODUCT_DELETE,
TheliaEvents::PRODUCT_TOGGLE_VISIBILITY, TheliaEvents::PRODUCT_TOGGLE_VISIBILITY,
TheliaEvents::PRODUCT_UPDATE_POSITION TheliaEvents::PRODUCT_UPDATE_POSITION,
TheliaEvents::PRODUCT_UPDATE_SEO
); );
} }
@@ -153,9 +159,9 @@ class ProductController extends AbstractCrudController
protected function getUpdateEvent($formData) protected function getUpdateEvent($formData)
{ {
$changeEvent = new ProductUpdateEvent($formData['id']); $changeEvent = new ProductUpdateEvent($formData['id']);
// Create and dispatch the change event
$changeEvent $changeEvent
->setLocale($formData['locale']) ->setLocale($formData['locale'])
->setTitle($formData['title']) ->setTitle($formData['title'])
@@ -163,10 +169,10 @@ class ProductController extends AbstractCrudController
->setDescription($formData['description']) ->setDescription($formData['description'])
->setPostscriptum($formData['postscriptum']) ->setPostscriptum($formData['postscriptum'])
->setVisible($formData['visible']) ->setVisible($formData['visible'])
->setUrl($formData['url'])
->setDefaultCategory($formData['default_category']) ->setDefaultCategory($formData['default_category'])
; ;
// Create and dispatch the change event
return $changeEvent; return $changeEvent;
} }
@@ -307,6 +313,9 @@ class ProductController extends AbstractCrudController
$this->getParserContext()->addForm($combinationPseForm); $this->getParserContext()->addForm($combinationPseForm);
} }
// Hydrate the "SEO" tab form
$this->hydrateSeoForm($object);
// The "General" tab form // The "General" tab form
$data = array( $data = array(
'id' => $object->getId(), 'id' => $object->getId(),
@@ -317,7 +326,6 @@ class ProductController extends AbstractCrudController
'description' => $object->getDescription(), 'description' => $object->getDescription(),
'postscriptum' => $object->getPostscriptum(), 'postscriptum' => $object->getPostscriptum(),
'visible' => $object->getVisible(), 'visible' => $object->getVisible(),
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'default_category' => $object->getDefaultCategoryId() 'default_category' => $object->getDefaultCategoryId()
); );
@@ -1110,7 +1118,7 @@ class ProductController extends AbstractCrudController
$this->dispatch(TheliaEvents::PRODUCT_COMBINATION_GENERATION, $event); $this->dispatch(TheliaEvents::PRODUCT_COMBINATION_GENERATION, $event);
// Log object modification // Log object modification
$this->adminLogAppend(sprintf("Combination generation for product reference %s", $event->getProduct()->getRef()), 'ac', 'mes'); $this->adminLogAppend($this->resourceCode, AccessManager::CREATE, sprintf("Combination generation for product reference %s", $event->getProduct()->getRef()));
// Redirect to the success URL // Redirect to the success URL
$this->redirect($changeForm->getSuccessUrl()); $this->redirect($changeForm->getSuccessUrl());

View File

@@ -99,7 +99,7 @@ class SessionController extends BaseAdminController
$this->getSecurityContext()->setAdminUser($user); $this->getSecurityContext()->setAdminUser($user);
// Log authentication success // Log authentication success
AdminLog::append("admin", "LOGIN", "Authentication successful", $request, $user); AdminLog::append("admin", "LOGIN", "Authentication successful", $request, $user, false);
/** /**
* FIXME: we have tou find a way to send cookie * FIXME: we have tou find a way to send cookie

View File

@@ -147,7 +147,7 @@ abstract class BaseController extends ContainerAware
} }
/** /**
* @return \Symfony\Component\HttpFoundation\Request * @return \Thelia\Core\HttpFoundation\Request
*/ */
protected function getRequest() protected function getRequest()
{ {

View File

@@ -97,7 +97,7 @@ class BaseFrontController extends BaseController
$parser = $this->container->get("thelia.parser"); $parser = $this->container->get("thelia.parser");
// Define the template that should be used // Define the template that should be used
$parser->setTemplate($template ?: TemplateHelper::getInstance()->getActiveFrontTemplate()); $parser->setTemplateDefinition($template ?: TemplateHelper::getInstance()->getActiveFrontTemplate());
return $parser; return $parser;
} }

View File

@@ -33,7 +33,6 @@ class CategoryUpdateEvent extends CategoryCreateEvent
protected $description; protected $description;
protected $postscriptum; protected $postscriptum;
protected $url;
protected $parent; protected $parent;
public function __construct($category_id) public function __construct($category_id)
@@ -89,18 +88,6 @@ class CategoryUpdateEvent extends CategoryCreateEvent
return $this; return $this;
} }
public function getUrl()
{
return $this->url;
}
public function setUrl($url)
{
$this->url = $url;
return $this;
}
public function getParent() public function getParent()
{ {
return $this->parent; return $this->parent;

View File

@@ -36,8 +36,6 @@ class ContentUpdateEvent extends ContentCreateEvent
protected $description; protected $description;
protected $postscriptum; protected $postscriptum;
protected $url;
public function __construct($content_id) public function __construct($content_id)
{ {
$this->content_id = $content_id; $this->content_id = $content_id;
@@ -123,24 +121,4 @@ class ContentUpdateEvent extends ContentCreateEvent
return $this->postscriptum; return $this->postscriptum;
} }
/**
* @param mixed $url
*
* @return $this
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* @return mixed
*/
public function getUrl()
{
return $this->url;
}
} }

View File

@@ -37,8 +37,6 @@ class FolderUpdateEvent extends FolderCreateEvent
protected $description; protected $description;
protected $postscriptum; protected $postscriptum;
protected $url;
public function __construct($folder_id) public function __construct($folder_id)
{ {
$this->folder_id = $folder_id; $this->folder_id = $folder_id;
@@ -116,22 +114,4 @@ class FolderUpdateEvent extends FolderCreateEvent
return $this->postscriptum; return $this->postscriptum;
} }
/**
* @param mixed $url
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* @return mixed
*/
public function getUrl()
{
return $this->url;
}
} }

View File

@@ -33,7 +33,6 @@ class ProductUpdateEvent extends ProductCreateEvent
protected $description; protected $description;
protected $postscriptum; protected $postscriptum;
protected $url;
protected $parent; protected $parent;
public function __construct($product_id) public function __construct($product_id)
@@ -89,18 +88,6 @@ class ProductUpdateEvent extends ProductCreateEvent
return $this; return $this;
} }
public function getUrl()
{
return $this->url;
}
public function setUrl($url)
{
$this->url = $url;
return $this;
}
public function getParent() public function getParent()
{ {
return $this->parent; return $this->parent;

View File

@@ -160,6 +160,7 @@ final class TheliaEvents
const CATEGORY_DELETE = "action.deleteCategory"; const CATEGORY_DELETE = "action.deleteCategory";
const CATEGORY_TOGGLE_VISIBILITY = "action.toggleCategoryVisibility"; const CATEGORY_TOGGLE_VISIBILITY = "action.toggleCategoryVisibility";
const CATEGORY_UPDATE_POSITION = "action.updateCategoryPosition"; const CATEGORY_UPDATE_POSITION = "action.updateCategoryPosition";
const CATEGORY_UPDATE_SEO = "action.updateCategorySeo";
const CATEGORY_ADD_CONTENT = "action.categoryAddContent"; const CATEGORY_ADD_CONTENT = "action.categoryAddContent";
const CATEGORY_REMOVE_CONTENT = "action.categoryRemoveContent"; const CATEGORY_REMOVE_CONTENT = "action.categoryRemoveContent";
@@ -180,6 +181,7 @@ final class TheliaEvents
const FOLDER_DELETE = "action.deleteFolder"; const FOLDER_DELETE = "action.deleteFolder";
const FOLDER_TOGGLE_VISIBILITY = "action.toggleFolderVisibility"; const FOLDER_TOGGLE_VISIBILITY = "action.toggleFolderVisibility";
const FOLDER_UPDATE_POSITION = "action.updateFolderPosition"; const FOLDER_UPDATE_POSITION = "action.updateFolderPosition";
const FOLDER_UPDATE_SEO = "action.updateFolderSeo";
const BEFORE_CREATEFOLDER = "action.before_createFolder"; const BEFORE_CREATEFOLDER = "action.before_createFolder";
const AFTER_CREATEFOLDER = "action.after_createFolder"; const AFTER_CREATEFOLDER = "action.after_createFolder";
@@ -197,6 +199,7 @@ final class TheliaEvents
const CONTENT_DELETE = "action.deleteContent"; const CONTENT_DELETE = "action.deleteContent";
const CONTENT_TOGGLE_VISIBILITY = "action.toggleContentVisibility"; const CONTENT_TOGGLE_VISIBILITY = "action.toggleContentVisibility";
const CONTENT_UPDATE_POSITION = "action.updateContentPosition"; const CONTENT_UPDATE_POSITION = "action.updateContentPosition";
const CONTENT_UPDATE_SEO = "action.updateContentSeo";
const CONTENT_ADD_FOLDER = "action.contentAddFolder"; const CONTENT_ADD_FOLDER = "action.contentAddFolder";
const CONTENT_REMOVE_FOLDER = "action.contentRemoveFolder"; const CONTENT_REMOVE_FOLDER = "action.contentRemoveFolder";
@@ -269,6 +272,7 @@ final class TheliaEvents
const PRODUCT_DELETE = "action.deleteProduct"; const PRODUCT_DELETE = "action.deleteProduct";
const PRODUCT_TOGGLE_VISIBILITY = "action.toggleProductVisibility"; const PRODUCT_TOGGLE_VISIBILITY = "action.toggleProductVisibility";
const PRODUCT_UPDATE_POSITION = "action.updateProductPosition"; const PRODUCT_UPDATE_POSITION = "action.updateProductPosition";
const PRODUCT_UPDATE_SEO = "action.updateProductSeo";
const PRODUCT_ADD_CONTENT = "action.productAddContent"; const PRODUCT_ADD_CONTENT = "action.productAddContent";
const PRODUCT_REMOVE_CONTENT = "action.productRemoveContent"; const PRODUCT_REMOVE_CONTENT = "action.productRemoveContent";
@@ -404,6 +408,7 @@ final class TheliaEvents
* Save given documents * Save given documents
*/ */
const DOCUMENT_UPDATE = "action.updateDocument"; const DOCUMENT_UPDATE = "action.updateDocument";
const DOCUMENT_UPDATE_POSITION = "action.updateDocumentPosition";
/** /**
* Delete given document * Delete given document
@@ -424,6 +429,7 @@ final class TheliaEvents
* Save given images * Save given images
*/ */
const IMAGE_UPDATE = "action.updateImages"; const IMAGE_UPDATE = "action.updateImages";
const IMAGE_UPDATE_POSITION = "action.updateImagePosition";
/** /**
* Delete given image * Delete given image
@@ -685,9 +691,15 @@ final class TheliaEvents
*/ */
const MODULE_TOGGLE_ACTIVATION = 'thelia.module.toggleActivation'; const MODULE_TOGGLE_ACTIVATION = 'thelia.module.toggleActivation';
/**
* sent when module position is changed
*/
const MODULE_UPDATE_POSITION = 'thelia.module.action.updatePosition';
/** /**
* module * module
*/ */
const MODULE_CREATE = 'thelia.module.create';
const MODULE_UPDATE = 'thelia.module.update'; const MODULE_UPDATE = 'thelia.module.update';
const MODULE_DELETE = 'thelia.module.delete'; const MODULE_DELETE = 'thelia.module.delete';

View File

@@ -0,0 +1,60 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
use Propel\Runtime\ActiveQuery\ModelCriteria;
class UpdateFilePositionEvent extends UpdatePositionEvent
{
protected $query;
/**
* @param ModelCriteria $query
* @param $object_id
* @param null $mode
* @param null $position
*/
public function __construct(ModelCriteria $query, $object_id, $mode, $position = null)
{
parent::__construct($object_id, $mode, $position);
$this->setQuery($query);
}
/**
* @param ModelCriteria $query
*/
public function setQuery(ModelCriteria $query)
{
$this->query = $query;
}
/**
* @return ModelCriteria|null
*/
public function getQuery()
{
return $this->query;
}
}

View File

@@ -0,0 +1,188 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
class UpdateSeoEvent extends ActionEvent
{
protected $object_id;
protected $locale;
protected $url;
protected $meta_title;
protected $meta_description;
protected $meta_keywords;
protected $object;
/**
* @param $object_id
* @param null $locale
* @param null $url
* @param null $meta_title
* @param null $meta_description
* @param null $meta_keywords
*/
public function __construct($object_id, $locale = null, $url = null, $meta_title = null, $meta_description = null, $meta_keywords = null)
{
$this->object_id = $object_id;
$this->locale = $locale;
$this->url = $url;
$this->meta_title = $meta_title;
$this->meta_description = $meta_description;
$this->meta_keywords = $meta_keywords;
}
/**
* @return mixed
*/
public function getObjectId()
{
return $this->object_id;
}
/**
* @param $object_id
* @return $this
*/
public function setObjectId($object_id)
{
$this->object_id = $object_id;
return $this;
}
/**
* @return null
*/
public function getLocale()
{
return $this->locale;
}
/**
* @param $locale
* @return $this
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* @return null
*/
public function getUrl()
{
return $this->url;
}
/**
* @param $url
* @return $this
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* @return null
*/
public function getMetaTitle()
{
return $this->meta_title;
}
/**
* @param $meta_title
* @return $this
*/
public function setMetaTitle($meta_title)
{
$this->meta_title = $meta_title;
return $this;
}
/**
* @return null
*/
public function getMetaDescription()
{
return $this->meta_description;
}
/**
* @param $meta_description
* @return $this
*/
public function setMetaDescription($meta_description)
{
$this->meta_description = $meta_description;
return $this;
}
/**
* @return null
*/
public function getMetaKeywords()
{
return $this->meta_keywords;
}
/**
* @param $meta_keywords
* @return $this
*/
public function setMetaKeywords($meta_keywords)
{
$this->meta_keywords = $meta_keywords;
return $this;
}
/**
* @param mixed $object
*/
public function setObject($object)
{
$this->object = $object;
return $this;
}
/**
* @return mixed
*/
public function getObject()
{
return $this->object;
}
}

View File

@@ -78,7 +78,7 @@ class ViewListener implements EventSubscriberInterface
{ {
$parser = $this->container->get('thelia.parser'); $parser = $this->container->get('thelia.parser');
$parser->setTemplate(TemplateHelper::getInstance()->getActiveFrontTemplate()); $parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveFrontTemplate());
$request = $this->container->get('request'); $request = $this->container->get('request');
try { try {

View File

@@ -34,6 +34,11 @@ use Symfony\Component\HttpFoundation\Request as BaseRequest;
class Request extends BaseRequest class Request extends BaseRequest
{ {
private $excludeContent = array(
'username',
'password'
);
public function getProductId() public function getProductId()
{ {
return $this->get("product_id"); return $this->get("product_id");
@@ -66,4 +71,17 @@ class Request extends BaseRequest
{ {
return parent::getSession(); return parent::getSession();
} }
public function toString($withContent = true)
{
$string =
sprintf('%s %s %s', $this->getMethod(), $this->getRequestUri(), $this->server->get('SERVER_PROTOCOL'))."\r\n".
$this->headers."\r\n";
if (true === $withContent) {
$string .= $this->getContent();
}
return $string;
}
} }

View File

@@ -23,7 +23,7 @@
namespace Thelia\Core\Security\Exception; namespace Thelia\Core\Security\Exception;
class RessourceException extends \RuntimeException class ResourceException extends \RuntimeException
{ {
const UNKNOWN_EXCEPTION = 0; const UNKNOWN_EXCEPTION = 0;

View File

@@ -25,29 +25,43 @@ namespace Thelia\Core\Template\Assets;
interface AssetManagerInterface { interface AssetManagerInterface {
/** /**
* Prepare an asset directory. * Prepare an asset directory by checking that no changes occured in
* the source directory. If any change is detected, the whole asset directory
* is copied in the web space.
*
* @param string $sourceAssetsDirectory the full path to the source asstes directory
* @param string $webAssetsDirectoryBase the base directory of the web based asset directory
* @param $webAssetsTemplate
* @param string $webAssetsKey the assets key : module name or 0 for base template
* *
* @param string $source_assets_directory the full path to the source asstes directory
* @param string $web_assets_directory_base the base directory of the web based asset directory
* @throws \RuntimeException if something goes wrong. * @throws \RuntimeException if something goes wrong.
*
* @internal param string $source_assets_directory the full path to the source asstes directory
* @internal param string $web_assets_directory_base the base directory of the web based asset directory
* @internal param string $key the assets key : module name or 0 for base template
*/ */
public function prepareAssets($source_assets_directory, $web_assets_directory_base); public function prepareAssets($sourceAssetsDirectory, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey);
/** /**
* Generates assets from $asset_path in $output_path, using $filters. * Generates assets from $asset_path in $output_path, using $filters.
* *
* @param string $asset_path the full path to the asset file (or file collection, e.g. *.less) * @param $assetSource
* @param $assetDirectoryBase
* @param string $webAssetsDirectoryBase the full path to the asset file (or file collection, e.g. *.less)
* *
* @param string $web_assets_directory_base the full disk path to the base assets output directory in the web space * @param string $webAssetsTemplate the full disk path to the base assets output directory in the web space
* @param string $output_url the URL to the base assets output directory in the web space * @param $webAssetsKey
* @param string $outputUrl the URL to the base assets output directory in the web space
* *
* @param string $asset_type the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension. * @param string $assetType the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension.
* @param array $filters a list of filters, as defined below (see switch($filter_name) ...) * @param array $filters a list of filters, as defined below (see switch($filter_name) ...)
* *
* @param boolean $debug the debug mode, true or false * @param boolean $debug true / false
* *
* @throws \InvalidArgumentException if an invalid filter name is found * @internal param string $web_assets_directory_base the full disk path to the base assets output directory in the web space
* @return string The URL to the generated asset file. * @internal param string $output_url the URL to the base assets output directory in the web space
*
* @return string The URL to the generated asset file.
*/ */
public function processAsset($asset_path, $web_assets_directory_base, $output_url, $asset_type, $filters, $debug); public function processAsset($assetSource, $assetDirectoryBase, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey, $outputUrl, $assetType, $filters, $debug);
} }

View File

@@ -31,7 +31,6 @@ use Assetic\AssetWriter;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Log\Tlog; use Thelia\Log\Tlog;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOException;
/** /**
* This class is a simple helper for generating assets using Assetic. * This class is a simple helper for generating assets using Assetic.
@@ -73,7 +72,9 @@ class AsseticAssetManager implements AssetManagerInterface
/** /**
* Check if a file is a source asset file * Check if a file is a source asset file
* *
* @param \DirectoryIterator $fileInfo * @param \SplFileInfo $fileInfo
*
* @return bool
*/ */
protected function isSourceFile(\SplFileInfo $fileInfo) { protected function isSourceFile(\SplFileInfo $fileInfo) {
return in_array($fileInfo->getExtension(), $this->source_file_extensions); return in_array($fileInfo->getExtension(), $this->source_file_extensions);
@@ -81,8 +82,9 @@ class AsseticAssetManager implements AssetManagerInterface
/** /**
* Recursively copy assets from the source directory to the destination * Recursively copy assets from the source directory to the destination
* directory in the web space, ommiting source files. * directory in the web space, omitting source files.
* *
* @param Filesystem $fs
* @param string $from_directory the source * @param string $from_directory the source
* @param string $to_directory the destination * @param string $to_directory the destination
* @throws \RuntimeException if a problem occurs. * @throws \RuntimeException if a problem occurs.
@@ -121,38 +123,21 @@ class AsseticAssetManager implements AssetManagerInterface
} }
} }
/**
* Compite the assets path relative to the base template directory
*
* @param string $source_assets_directory the source directory
* @param string $web_assets_directory_base base directory of the web assets
* @return the full path of the destination directory
*/
protected function getRelativeDirectoryPath($source_assets_directory, $web_assets_directory_base)
{
$source_assets_directory = realpath($source_assets_directory);
// Remove base path from asset source path to get a path relative to the template base
// and use it to create the destination path.
return str_replace(
realpath(THELIA_ROOT),
'',
$source_assets_directory
);
}
/** /**
* Compute the destination directory path, from the source directory and the * Compute the destination directory path, from the source directory and the
* base directory of the web assets * base directory of the web assets
* *
* @param string $source_assets_directory the source directory * @param string $webAssetsDirectoryBase base directory of the web assets
* @param string $web_assets_directory_base base directory of the web assets * @param $webAssetsTemplate
* @param string $webAssetsKey the assests key : module name or 0 for base template
*
* @internal param string $source_assets_directory the source directory
* @return the full path of the destination directory * @return the full path of the destination directory
*/ */
protected function getDestinationDirectory($source_assets_directory, $web_assets_directory_base) protected function getDestinationDirectory($webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey)
{ {
// Compute the absolute path of the output directory // Compute the absolute path of the output directory
return $web_assets_directory_base . $this->getRelativeDirectoryPath($source_assets_directory, $web_assets_directory_base); return $webAssetsDirectoryBase . DS . $webAssetsTemplate . DS . $webAssetsKey;
} }
/** /**
@@ -160,14 +145,17 @@ class AsseticAssetManager implements AssetManagerInterface
* the source directory. If any change is detected, the whole asset directory * the source directory. If any change is detected, the whole asset directory
* is copied in the web space. * is copied in the web space.
* *
* @param string $source_assets_directory the full path to the source asstes directory * @param string $sourceAssetsDirectory the full path to the source asstes directory
* @param string $web_assets_directory_base the base directory of the web based asset directory * @param string $webAssetsDirectoryBase the base directory of the web based asset directory
* @param $webAssetsTemplate
* @param string $webAssetsKey the assets key : module name or 0 for base template
*
* @throws \RuntimeException if something goes wrong. * @throws \RuntimeException if something goes wrong.
*/ */
public function prepareAssets($source_assets_directory, $web_assets_directory_base) { public function prepareAssets($sourceAssetsDirectory, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey)
{
// Compute the absolute path of the output directory // Compute the absolute path of the output directory
$to_directory = $this->getDestinationDirectory($source_assets_directory, $web_assets_directory_base); $to_directory = $this->getDestinationDirectory($webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey);
// Get a path to the stamp file // Get a path to the stamp file
$stamp_file_path = $to_directory . DS . '.source-stamp'; $stamp_file_path = $to_directory . DS . '.source-stamp';
@@ -176,7 +164,7 @@ class AsseticAssetManager implements AssetManagerInterface
$prev_stamp = @file_get_contents($stamp_file_path); $prev_stamp = @file_get_contents($stamp_file_path);
// Get the current stamp of the source directory // Get the current stamp of the source directory
$curr_stamp = $this->getStamp($source_assets_directory); $curr_stamp = $this->getStamp($sourceAssetsDirectory);
if ($prev_stamp !== $curr_stamp) { if ($prev_stamp !== $curr_stamp) {
@@ -197,7 +185,7 @@ class AsseticAssetManager implements AssetManagerInterface
$fs->remove($tmp_dir); $fs->remove($tmp_dir);
// Copy the whole source dir in a temp directory // Copy the whole source dir in a temp directory
$this->copyAssets($fs, $source_assets_directory, $tmp_dir); $this->copyAssets($fs, $sourceAssetsDirectory, $tmp_dir);
// Remove existing directory // Remove existing directory
if ($fs->exists($to_directory)) $fs->remove($to_directory); if ($fs->exists($to_directory)) $fs->remove($to_directory);
@@ -284,67 +272,73 @@ class AsseticAssetManager implements AssetManagerInterface
/** /**
* Generates assets from $asset_path in $output_path, using $filters. * Generates assets from $asset_path in $output_path, using $filters.
* *
* @param string $asset_path the full path to the asset file (or file collection, e.g. *.less) * @param $assetSource
* @param $assetDirectoryBase
* @param string $webAssetsDirectoryBase the full path to the asset file (or file collection, e.g. *.less)
* *
* @param string $web_assets_directory_base the full disk path to the base assets output directory in the web space * @param string $webAssetsTemplate the full disk path to the base assets output directory in the web space
* @param string $output_url the URL to the base assets output directory in the web space * @param $webAssetsKey
* @param string $outputUrl the URL to the base assets output directory in the web space
* *
* @param string $asset_type the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension. * @param string $assetType the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension.
* @param array $filters a list of filters, as defined below (see switch($filter_name) ...) * @param array $filters a list of filters, as defined below (see switch($filter_name) ...)
* *
* @param boolean $debug true / false * @param boolean $debug true / false
* @throws \InvalidArgumentException if an invalid filter name is found *
* @return string The URL to the generated asset file. * @return string The URL to the generated asset file.
*/ */
public function processAsset($asset_path, $web_assets_directory_base, $output_url, $asset_type, $filters, $debug) public function processAsset($assetSource, $assetDirectoryBase, $webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey, $outputUrl, $assetType, $filters, $debug)
{ {
$asset_name = basename($asset_path); $assetName = basename($assetSource);
$input_directory = realpath(dirname($asset_path)); $inputDirectory = realpath(dirname($assetSource));
$assetFileDirectoryInAssetDirectory = trim(str_replace(array($assetDirectoryBase, $assetName), '', $assetSource), DS);
$am = new AssetManager(); $am = new AssetManager();
$fm = new FilterManager(); $fm = new FilterManager();
// Get the filter list // Get the filter list
$filter_list = $this->decodeAsseticFilters($fm, $filters); $filterList = $this->decodeAsseticFilters($fm, $filters);
// Factory setup // Factory setup
$factory = new AssetFactory($input_directory); $factory = new AssetFactory($inputDirectory);
$factory->setAssetManager($am); $factory->setAssetManager($am);
$factory->setFilterManager($fm); $factory->setFilterManager($fm);
$factory->setDefaultOutput('*' . (!empty($asset_type) ? '.' : '') . $asset_type); $factory->setDefaultOutput('*' . (!empty($assetType) ? '.' : '') . $assetType);
$factory->setDebug($debug); $factory->setDebug($debug);
$asset = $factory->createAsset($asset_name, $filter_list); $asset = $factory->createAsset($assetName, $filterList);
$input_directory = realpath(dirname($asset_path)); $outputDirectory = $this->getDestinationDirectory($webAssetsDirectoryBase, $webAssetsTemplate, $webAssetsKey);
$output_directory = $this->getDestinationDirectory($input_directory, $web_assets_directory_base);
// Get the URL part from the relative path // Get the URL part from the relative path
$output_relative_path = $this->getRelativeDirectoryPath($input_directory, $web_assets_directory_base); $outputRelativePath = $webAssetsTemplate . DS . $webAssetsKey;
$output_relative_web_path = rtrim(str_replace('\\', '/', $output_relative_path), '/') . '/'; $outputRelativeWebPath = rtrim(str_replace('\\', '/', $outputRelativePath), '/') . '/';
$asset_target_filename = $asset->getTargetPath(); $assetTargetFilename = $asset->getTargetPath();
// This is the final name of the generated asset /*
$asset_destination_path = $output_directory . DS . $asset_target_filename; * This is the final name of the generated asset
* We preserve file structure intending to keep - for example - relative css links working
*/
$assetDestinationPath = $outputDirectory . DS . $assetFileDirectoryInAssetDirectory . DS . $assetTargetFilename;
Tlog::getInstance()->addDebug("Asset destination full path: $asset_destination_path"); Tlog::getInstance()->addDebug("Asset destination full path: $assetDestinationPath");
// We generate an asset only if it does not exists, or if the asset processing is forced in development mode // We generate an asset only if it does not exists, or if the asset processing is forced in development mode
if (! file_exists($asset_destination_path) || ($this->debugMode && ConfigQuery::read('process_assets', true)) ) { if (! file_exists($assetDestinationPath) || ($this->debugMode && ConfigQuery::read('process_assets', true)) ) {
$writer = new AssetWriter($output_directory); $writer = new AssetWriter($outputDirectory . DS . $assetFileDirectoryInAssetDirectory);
Tlog::getInstance()->addDebug("Writing asset to $output_directory"); Tlog::getInstance()->addDebug("Writing asset to $outputDirectory . DS . $assetFileDirectoryInAssetDirectory");
$writer->writeAsset($asset); $writer->writeAsset($asset);
} }
return rtrim($output_url, '/') . '/' . ltrim($output_relative_web_path, '/') . $asset_target_filename; return rtrim($outputUrl, '/') . '/' . trim($outputRelativeWebPath, '/') . '/' . trim($assetFileDirectoryInAssetDirectory, '/') . '/' . ltrim($assetTargetFilename, '/');
} }
} }

View File

@@ -16,6 +16,7 @@ use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\CountryQuery; use Thelia\Model\CountryQuery;
use Thelia\TaxEngine\TaxEngine;
use Thelia\Type; use Thelia\Type;
class Cart extends BaseLoop implements ArraySearchLoopInterface class Cart extends BaseLoop implements ArraySearchLoopInterface
@@ -78,7 +79,7 @@ class Cart extends BaseLoop implements ArraySearchLoopInterface
public function parseResults(LoopResult $loopResult) public function parseResults(LoopResult $loopResult)
{ {
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic; $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
foreach($loopResult->getResultDataCollection() as $cartItem) { foreach($loopResult->getResultDataCollection() as $cartItem) {
$product = $cartItem->getProduct(); $product = $cartItem->getProduct();

View File

@@ -96,7 +96,7 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface
$search = CategoryQuery::create(); $search = CategoryQuery::create();
/* manage translations */ /* manage translations */
$this->configureI18nProcessing($search); $this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
$id = $this->getId(); $id = $this->getId();
@@ -213,25 +213,28 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface
$loopResultRow = new LoopResultRow($category); $loopResultRow = new LoopResultRow($category);
$loopResultRow $loopResultRow
->set("ID", $category->getId()) ->set("ID" , $category->getId())
->set("IS_TRANSLATED",$category->getVirtualColumn('IS_TRANSLATED')) ->set("IS_TRANSLATED" ,$category->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE",$this->locale) ->set("LOCALE" ,$this->locale)
->set("TITLE", $category->getVirtualColumn('i18n_TITLE')) ->set("TITLE" , $category->getVirtualColumn('i18n_TITLE'))
->set("CHAPO", $category->getVirtualColumn('i18n_CHAPO')) ->set("CHAPO" , $category->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $category->getVirtualColumn('i18n_DESCRIPTION')) ->set("DESCRIPTION" , $category->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $category->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSTSCRIPTUM" , $category->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("PARENT", $category->getParent()) ->set("PARENT" , $category->getParent())
->set("URL", $category->getUrl($this->locale)) ->set("URL" , $category->getUrl($this->locale))
->set("PRODUCT_COUNT", $category->countAllProducts()) ->set("META_TITLE" , $category->getVirtualColumn('i18n_META_TITLE'))
->set("CHILD_COUNT", $category->countChild()) ->set("META_DESCRIPTION" , $category->getVirtualColumn('i18n_META_DESCRIPTION'))
->set("VISIBLE", $category->getVisible() ? "1" : "0") ->set("META_KEYWORDS" , $category->getVirtualColumn('i18n_META_KEYWORDS'))
->set("POSITION", $category->getPosition()) ->set("PRODUCT_COUNT" , $category->countAllProducts())
->set("CHILD_COUNT" , $category->countChild())
->set("VISIBLE" , $category->getVisible() ? "1" : "0")
->set("POSITION" , $category->getPosition())
->set("HAS_PREVIOUS", $previous != null ? 1 : 0) ->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
->set("HAS_NEXT" , $next != null ? 1 : 0) ->set("HAS_NEXT" , $next != null ? 1 : 0)
->set("PREVIOUS", $previous != null ? $previous->getId() : -1) ->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
->set("NEXT" , $next != null ? $next->getId() : -1) ->set("NEXT" , $next != null ? $next->getId() : -1)
; ;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);

View File

@@ -85,7 +85,7 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
$search = ContentQuery::create(); $search = ContentQuery::create();
/* manage translations */ /* manage translations */
$this->configureI18nProcessing($search); $this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
$id = $this->getId(); $id = $this->getId();
@@ -215,17 +215,21 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
foreach ($loopResult->getResultDataCollection() as $content) { foreach ($loopResult->getResultDataCollection() as $content) {
$loopResultRow = new LoopResultRow($content); $loopResultRow = new LoopResultRow($content);
$loopResultRow->set("ID", $content->getId()) $loopResultRow->set("ID" , $content->getId())
->set("IS_TRANSLATED",$content->getVirtualColumn('IS_TRANSLATED')) ->set("IS_TRANSLATED" , $content->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE",$this->locale) ->set("LOCALE" , $this->locale)
->set("TITLE",$content->getVirtualColumn('i18n_TITLE')) ->set("TITLE" , $content->getVirtualColumn('i18n_TITLE'))
->set("CHAPO", $content->getVirtualColumn('i18n_CHAPO')) ->set("CHAPO" , $content->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $content->getVirtualColumn('i18n_DESCRIPTION')) ->set("DESCRIPTION" , $content->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $content->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSTSCRIPTUM" , $content->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("POSITION", $content->getPosition()) ->set("URL" , $content->getUrl($this->locale))
->set("DEFAULT_FOLDER", $content->getDefaultFolderId()) ->set("META_TITLE" , $content->getVirtualColumn('i18n_META_TITLE'))
->set("URL", $content->getUrl($this->locale)) ->set("META_DESCRIPTION" , $content->getVirtualColumn('i18n_META_DESCRIPTION'))
->set("VISIBLE", $content->getVisible()) ->set("META_KEYWORDS" , $content->getVirtualColumn('i18n_META_KEYWORDS'))
->set("POSITION" , $content->getPosition())
->set("DEFAULT_FOLDER" , $content->getDefaultFolderId())
->set("VISIBLE" , $content->getVisible())
; ;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);

View File

@@ -29,6 +29,7 @@ use Thelia\Exception\OrderException;
use Thelia\Model\CountryQuery; use Thelia\Model\CountryQuery;
use Thelia\Module\BaseModule; use Thelia\Module\BaseModule;
use Thelia\Module\DeliveryModuleInterface; use Thelia\Module\DeliveryModuleInterface;
use Thelia\TaxEngine\TaxEngine;
/** /**
* Class Delivery * Class Delivery
@@ -59,7 +60,7 @@ class Delivery extends BaseSpecificModule
throw new \InvalidArgumentException('Cannot found country id: `' . $countryId . '` in delivery loop'); throw new \InvalidArgumentException('Cannot found country id: `' . $countryId . '` in delivery loop');
} }
} else { } else {
$country = CountryQuery::create()->findOneByByDefault(1); $country = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
} }
foreach ($loopResult->getResultDataCollection() as $deliveryModule) { foreach ($loopResult->getResultDataCollection() as $deliveryModule) {

View File

@@ -78,7 +78,7 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface
$search = FolderQuery::create(); $search = FolderQuery::create();
/* manage translations */ /* manage translations */
$this->configureI18nProcessing($search); $this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
$id = $this->getId(); $id = $this->getId();
@@ -164,19 +164,22 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface
$loopResultRow = new LoopResultRow($folder); $loopResultRow = new LoopResultRow($folder);
$loopResultRow $loopResultRow
->set("ID", $folder->getId()) ->set("ID" , $folder->getId())
->set("IS_TRANSLATED",$folder->getVirtualColumn('IS_TRANSLATED')) ->set("IS_TRANSLATED" , $folder->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE",$this->locale) ->set("LOCALE" , $this->locale)
->set("TITLE",$folder->getVirtualColumn('i18n_TITLE')) ->set("TITLE" , $folder->getVirtualColumn('i18n_TITLE'))
->set("CHAPO", $folder->getVirtualColumn('i18n_CHAPO')) ->set("CHAPO" , $folder->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $folder->getVirtualColumn('i18n_DESCRIPTION')) ->set("DESCRIPTION" , $folder->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSTSCRIPTUM" , $folder->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("PARENT", $folder->getParent()) ->set("PARENT" , $folder->getParent())
->set("URL", $folder->getUrl($this->locale)) ->set("URL" , $folder->getUrl($this->locale))
->set("CHILD_COUNT", $folder->countChild()) ->set("META_TITLE" , $folder->getVirtualColumn('i18n_META_TITLE'))
->set("CONTENT_COUNT", $folder->countAllContents()) ->set("META_DESCRIPTION" , $folder->getVirtualColumn('i18n_META_DESCRIPTION'))
->set("VISIBLE", $folder->getVisible() ? "1" : "0") ->set("META_KEYWORDS" , $folder->getVirtualColumn('i18n_META_KEYWORDS'))
->set("POSITION", $folder->getPosition()) ->set("CHILD_COUNT" , $folder->countChild())
->set("CONTENT_COUNT" , $folder->countAllContents())
->set("VISIBLE" , $folder->getVisible() ? "1" : "0")
->set("POSITION" , $folder->getPosition())
; ;
$loopResult->addRow($loopResultRow); $loopResult->addRow($loopResultRow);

View File

@@ -38,6 +38,7 @@ use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule; use Thelia\Module\BaseModule;
use Thelia\Type; use Thelia\Type;
use Thelia\Type\TypeCollection;
/** /**
* *
@@ -76,6 +77,13 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
)) ))
) )
), ),
new Argument(
'order',
new TypeCollection(
new Type\EnumListType(array('id', 'id_reverse', 'code', 'code_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'enabled', 'enabled_reverse'))
),
'manual'
),
Argument::createIntListTypeArgument('exclude'), Argument::createIntListTypeArgument('exclude'),
Argument::createBooleanOrBothTypeArgument('active', Type\BooleanOrBothType::ANY) Argument::createBooleanOrBothTypeArgument('active', Type\BooleanOrBothType::ANY)
); );
@@ -126,7 +134,42 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
$search->filterByActivate($active ? 1 : 0, Criteria::EQUAL); $search->filterByActivate($active ? 1 : 0, Criteria::EQUAL);
} }
$search->orderByPosition(); $orders = $this->getOrder();
foreach ($orders as $order) {
switch ($order) {
case "id":
$search->orderById(Criteria::ASC);
break;
case "id_reverse":
$search->orderById(Criteria::DESC);
break;
case "alpha":
$search->addAscendingOrderByColumn('i18n_TITLE');
break;
case "alpha_reverse":
$search->addDescendingOrderByColumn('i18n_TITLE');
break;
case "code":
$search->orderByCode(Criteria::ASC);
break;
case "code_reverse":
$search->orderByCode(Criteria::DESC);
break;
case "manual":
$search->orderByPosition(Criteria::ASC);
break;
case "manual_reverse":
$search->orderByPosition(Criteria::DESC);
break;
case "enabled":
$search->orderByActivate(Criteria::ASC);
break;
case "enabled_reverse":
$search->orderByActivate(Criteria::DESC);
break;
}
}
return $search; return $search;

View File

@@ -42,6 +42,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
use Thelia\Model\Map\ProductSaleElementsTableMap; use Thelia\Model\Map\ProductSaleElementsTableMap;
use Thelia\Model\Map\ProductTableMap; use Thelia\Model\Map\ProductTableMap;
use Thelia\Model\ProductQuery; use Thelia\Model\ProductQuery;
use Thelia\TaxEngine\TaxEngine;
use Thelia\Type\TypeCollection; use Thelia\Type\TypeCollection;
use Thelia\Type; use Thelia\Type;
@@ -222,7 +223,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
} }
/* manage translations */ /* manage translations */
$this->configureI18nProcessing($search); $this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
$id = $this->getId(); $id = $this->getId();
@@ -464,7 +465,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
return $this->parseComplex($loopResult); return $this->parseComplex($loopResult);
} }
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
foreach ($loopResult->getResultDataCollection() as $product) { foreach ($loopResult->getResultDataCollection() as $product) {
@@ -518,6 +519,9 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION')) ->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("URL" , $product->getUrl($this->locale)) ->set("URL" , $product->getUrl($this->locale))
->set("META_TITLE" , $product->getVirtualColumn('i18n_META_TITLE'))
->set("META_DESCRIPTION" , $product->getVirtualColumn('i18n_META_DESCRIPTION'))
->set("META_KEYWORDS" , $product->getVirtualColumn('i18n_META_KEYWORDS'))
->set("BEST_PRICE" , $product->getVirtualColumn('is_promo') ? $promoPrice : $price) ->set("BEST_PRICE" , $product->getVirtualColumn('is_promo') ? $promoPrice : $price)
->set("BEST_PRICE_TAX" , $taxedPrice - $product->getVirtualColumn('is_promo') ? $taxedPromoPrice - $promoPrice : $taxedPrice - $price) ->set("BEST_PRICE_TAX" , $taxedPrice - $product->getVirtualColumn('is_promo') ? $taxedPromoPrice - $promoPrice : $taxedPrice - $price)
->set("BEST_TAXED_PRICE" , $product->getVirtualColumn('is_promo') ? $taxedPromoPrice : $taxedPrice) ->set("BEST_TAXED_PRICE" , $product->getVirtualColumn('is_promo') ? $taxedPromoPrice : $taxedPrice)
@@ -569,7 +573,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
$search = ProductQuery::create(); $search = ProductQuery::create();
/* manage translations */ /* manage translations */
$this->configureI18nProcessing($search); $this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
$attributeNonStrictMatch = $this->getAttribute_non_strict_match(); $attributeNonStrictMatch = $this->getAttribute_non_strict_match();
$isPSELeftJoinList = array(); $isPSELeftJoinList = array();
@@ -979,7 +983,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
{ {
$loopResult = new LoopResult($results); $loopResult = new LoopResult($results);
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
foreach ($loopResult->getResultDataCollection() as $product) { foreach ($loopResult->getResultDataCollection() as $product) {
@@ -1025,6 +1029,9 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION')) ->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("URL" , $product->getUrl($this->locale)) ->set("URL" , $product->getUrl($this->locale))
->set("META_TITLE" , $product->getVirtualColumn('i18n_META_TITLE'))
->set("META_DESCRIPTION" , $product->getVirtualColumn('i18n_META_DESCRIPTION'))
->set("META_KEYWORDS" , $product->getVirtualColumn('i18n_META_KEYWORDS'))
->set("BEST_PRICE" , $price) ->set("BEST_PRICE" , $price)
->set("BEST_PRICE_TAX" , $taxedPrice - $price) ->set("BEST_PRICE_TAX" , $taxedPrice - $price)
->set("BEST_TAXED_PRICE" , $taxedPrice) ->set("BEST_TAXED_PRICE" , $taxedPrice)

View File

@@ -37,6 +37,7 @@ use Thelia\Model\Base\ProductSaleElementsQuery;
use Thelia\Model\CountryQuery; use Thelia\Model\CountryQuery;
use Thelia\Model\CurrencyQuery; use Thelia\Model\CurrencyQuery;
use Thelia\Model\Map\ProductSaleElementsTableMap; use Thelia\Model\Map\ProductSaleElementsTableMap;
use Thelia\TaxEngine\TaxEngine;
use Thelia\Type\TypeCollection; use Thelia\Type\TypeCollection;
use Thelia\Type; use Thelia\Type;
@@ -145,7 +146,7 @@ class ProductSaleElements extends BaseLoop implements PropelSearchLoopInterface
public function parseResults(LoopResult $loopResult) public function parseResults(LoopResult $loopResult)
{ {
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
foreach ($loopResult->getResultDataCollection() as $PSEValue) { foreach ($loopResult->getResultDataCollection() as $PSEValue) {
$loopResultRow = new LoopResultRow($PSEValue); $loopResultRow = new LoopResultRow($PSEValue);

View File

@@ -59,9 +59,9 @@ class Template extends BaseLoop implements ArraySearchLoopInterface
{ {
return new ArgumentCollection( return new ArgumentCollection(
new Argument( new Argument(
'template_type', 'template-type',
new Type\TypeCollection( new Type\TypeCollection(
new Type\EnumListType(array( new Type\EnumType(array(
'front-office', 'front-office',
'back-office', 'back-office',
'pdf', 'pdf',
@@ -73,7 +73,7 @@ class Template extends BaseLoop implements ArraySearchLoopInterface
} }
public function buildArray() { public function buildArray() {
$type = $this->getArg(template_type); $type = $this->getArg('template-type')->getValue();
if ($type == 'front-office') if ($type == 'front-office')
$templateType = TemplateDefinition::FRONT_OFFICE; $templateType = TemplateDefinition::FRONT_OFFICE;
@@ -104,4 +104,4 @@ class Template extends BaseLoop implements ArraySearchLoopInterface
return $loopResult; return $loopResult;
} }
} }

View File

@@ -30,9 +30,6 @@ namespace Thelia\Core\Template;
interface ParserInterface interface ParserInterface
{ {
/**
*
*/
public function render($realTemplateName, array $parameters = array()); public function render($realTemplateName, array $parameters = array());
public function setContent($content); public function setContent($content);
@@ -40,4 +37,26 @@ interface ParserInterface
public function getStatus(); public function getStatus();
public function setStatus($status); public function setStatus($status);
}
/**
* Add a template directory to the current template list
*
* @param unknown $templateType the template type (
*
* @param string $templateName the template name
* @param string $templateDirectory path to the template dirtectory
* @param unknown $key ???
* @param string $unshift ??? Etienne ?
*/
public function addTemplateDirectory($templateType, $templateName, $templateDirectory, $key, $unshift = false);
/**
* Return the registeted template directories for a givent template type
*
* @param unknown $templateType
* @throws InvalidArgumentException if the tempmateType is not defined
* @return array: an array of defined templates directories for the given template type
*/
public function getTemplateDirectories($templateType);
}

View File

@@ -24,6 +24,7 @@
namespace Thelia\Core\Template\Smarty\Assets; namespace Thelia\Core\Template\Smarty\Assets;
use Thelia\Core\Template\Assets\AsseticHelper; use Thelia\Core\Template\Assets\AsseticHelper;
use Thelia\Core\Template\TemplateDefinition;
use Thelia\Tools\URL; use Thelia\Tools\URL;
use Thelia\Core\Template\Assets\AssetManagerInterface; use Thelia\Core\Template\Assets\AssetManagerInterface;
@@ -36,6 +37,8 @@ class SmartyAssetsManager
private $web_root; private $web_root;
private $path_relative_to_web_root; private $path_relative_to_web_root;
static private $assetsDirectory = null;
/** /**
* Creates a new SmartyAssetsManager instance * Creates a new SmartyAssetsManager instance
* *
@@ -51,48 +54,75 @@ class SmartyAssetsManager
$this->assetsManager = $assetsManager; $this->assetsManager = $assetsManager;
} }
public function prepareAssets($assets_directory, \Smarty_Internal_Template $template) { public function prepareAssets($assets_directory, \Smarty_Internal_Template $template)
{
self::$assetsDirectory = $assets_directory;
$tpl_dir = dirname($template->source->filepath); $smartyParser = $template->smarty;
$templateDefinition = $smartyParser->getTemplateDefinition();
$asset_dir_absolute_path = realpath($tpl_dir . DS . $assets_directory); // Get the registered template directories for the current template path
$templateDirectories = $smartyParser->getTemplateDirectories($templateDefinition->getType());
if ($asset_dir_absolute_path === false) throw new \Exception("Failed to get real path of '".$tpl_dir . DS . $assets_directory."'"); if (isset($templateDirectories[$templateDefinition->getName()])) {
$this->assetsManager->prepareAssets( /* create assets foreach registered directory : main @ modules */
$asset_dir_absolute_path, foreach($templateDirectories[$templateDefinition->getName()] as $key => $directory) {
$this->web_root . $this->path_relative_to_web_root
); $tpl_path = $directory . DS . self::$assetsDirectory;
$asset_dir_absolute_path = realpath($tpl_path);
if (false !== $asset_dir_absolute_path) {
$this->assetsManager->prepareAssets(
$asset_dir_absolute_path,
$this->web_root . $this->path_relative_to_web_root,
$templateDefinition->getPath(),
$key
);
}
}
}
} }
public function computeAssetUrl($assetType, $params, \Smarty_Internal_Template $template) public function computeAssetUrl($assetType, $params, \Smarty_Internal_Template $template)
{ {
$file = $params['file']; $file = $params['file'];
$filters = isset($params['filters']) ? $params['filters'] : ''; $assetOrigin = isset($params['source']) ? $params['source'] : "0";
$debug = isset($params['debug']) ? trim(strtolower($params['debug'])) == 'true' : false; $filters = isset($params['filters']) ? $params['filters'] : '';
$debug = isset($params['debug']) ? trim(strtolower($params['debug'])) == 'true' : false;
// Get template base path /* we trick here relative thinking for file attribute */
$tpl_path = $template->source->filepath; $file = ltrim($file, '/');
while(substr($file, 0, 3) == '../') {
$file = substr($file, 3);
}
// Get basedir $smartyParser = $template->smarty;
$tpl_dir = dirname($tpl_path); $templateDefinition = $smartyParser->getTemplateDefinition();
// Create absolute dir path $templateDirectories = $smartyParser->getTemplateDirectories($templateDefinition->getType());
$asset_dir = realpath($tpl_dir) . DS . dirname($file);
$asset_file = basename($file);
if ($asset_dir === false) throw new \Exception("Failed to get real path of '".$tpl_dir.'/'.dirname($file)."'"); if (! isset($templateDirectories[$templateDefinition->getName()][$assetOrigin])) {
throw new \Exception("Failed to get real path of '/".dirname($file)."'");
}
$url = $this->assetsManager->processAsset( $assetSource = $templateDirectories[$templateDefinition->getName()][$assetOrigin];
$asset_dir . DS . $asset_file,
$this->web_root . $this->path_relative_to_web_root,
URL::getInstance()->absoluteUrl($this->path_relative_to_web_root, null, URL::PATH_TO_FILE /* path only */),
$assetType,
$filters,
$debug
);
return $url; $url = $this->assetsManager->processAsset(
$assetSource . DS . $file,
$assetSource . DS . self::$assetsDirectory,
$this->web_root . $this->path_relative_to_web_root,
$templateDefinition->getPath(),
$assetOrigin,
URL::getInstance()->absoluteUrl($this->path_relative_to_web_root, null, URL::PATH_TO_FILE /* path only */),
$assetType,
$filters,
$debug
);
return $url;
} }
public function processSmartyPluginCall($assetType, $params, $content, \Smarty_Internal_Template $template, &$repeat) public function processSmartyPluginCall($assetType, $params, $content, \Smarty_Internal_Template $template, &$repeat)

View File

@@ -40,6 +40,7 @@ use Thelia\Model\OrderQuery;
use Thelia\Model\Product; use Thelia\Model\Product;
use Thelia\Model\ProductQuery; use Thelia\Model\ProductQuery;
use Thelia\Model\Tools\ModelCriteriaTools; use Thelia\Model\Tools\ModelCriteriaTools;
use Thelia\TaxEngine\TaxEngine;
use Thelia\Tools\DateTimeFormat; use Thelia\Tools\DateTimeFormat;
use Thelia\Cart\CartTrait; use Thelia\Cart\CartTrait;
@@ -181,10 +182,10 @@ class DataAccessFunctions extends AbstractSmartyPlugin
public function cartDataAccess($params, $smarty) public function cartDataAccess($params, $smarty)
{ {
if (array_key_exists('currentCountry', self::$dataAccessCache)) { if (array_key_exists('currentCountry', self::$dataAccessCache)) {
$currentCountry = self::$dataAccessCache['currentCountry']; $taxCountry = self::$dataAccessCache['currentCountry'];
} else { } else {
$currentCountry = CountryQuery::create()->findOneById(64); // @TODO : make it magic $taxCountry = TaxEngine::getInstance($this->request->getSession())->getDeliveryCountry();
self::$dataAccessCache['currentCountry'] = $currentCountry; self::$dataAccessCache['currentCountry'] = $taxCountry;
} }
$cart = $this->getCart($this->request); $cart = $this->getCart($this->request);
@@ -197,7 +198,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
$result = $cart->getTotalAmount(); $result = $cart->getTotalAmount();
break; break;
case "total_taxed_price": case "total_taxed_price":
$result = $cart->getTaxedAmount($currentCountry); $result = $cart->getTaxedAmount($taxCountry);
break; break;
} }

View File

@@ -16,6 +16,7 @@ use Thelia\Core\Template\ParserContext;
use Thelia\Core\Template\TemplateDefinition; use Thelia\Core\Template\TemplateDefinition;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateHelper;
use Imagine\Exception\InvalidArgumentException;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
/** /**
@@ -34,7 +35,12 @@ class SmartyParser extends Smarty implements ParserInterface
protected $backOfficeTemplateDirectories = array(); protected $backOfficeTemplateDirectories = array();
protected $frontOfficeTemplateDirectories = array(); protected $frontOfficeTemplateDirectories = array();
protected $template = ""; protected $templateDirectories = array();
/**
* @var TemplateDefinition
*/
protected $templateDefinition = "";
protected $status = 200; protected $status = 200;
@@ -91,6 +97,46 @@ class SmartyParser extends Smarty implements ParserInterface
$this->registerFilter('variable', array(__CLASS__, "theliaEscape")); $this->registerFilter('variable', array(__CLASS__, "theliaEscape"));
} }
/**
* Add a template directory to the current template list
*
* @param unknown $templateType the template type (a TemplateDefinition type constant)
* @param string $templateName the template name
* @param string $templateDirectory path to the template dirtectory
* @param unknown $key ???
* @param string $unshift ??? Etienne ?
*/
public function addTemplateDirectory($templateType, $templateName, $templateDirectory, $key, $unshift = false) {
if(true === $unshift && isset($this->templateDirectories[$templateType][$templateName])) {
$this->templateDirectories[$templateType][$templateName] = array_merge(
array(
$key => $templateDirectory,
),
$this->templateDirectories[$templateType][$templateName]
);
} else {
$this->templateDirectories[$templateType][$templateName][$key] = $templateDirectory;
}
}
/**
* Return the registeted template directories for a givent template type
*
* @param unknown $templateType
* @throws InvalidArgumentException
* @return multitype:
*/
public function getTemplateDirectories($templateType)
{
if (! isset($this->templateDirectories[$templateType])) {
throw new InvalidArgumentException("Failed to get template type %", $templateType);
}
return $this->templateDirectories[$templateType];
}
public function removeBlankLines($tpl_source, \Smarty_Internal_Template $template) public function removeBlankLines($tpl_source, \Smarty_Internal_Template $template)
{ {
return preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $tpl_source); return preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $tpl_source);
@@ -105,72 +151,52 @@ class SmartyParser extends Smarty implements ParserInterface
} }
} }
public function addBackOfficeTemplateDirectory($templateName, $templateDirectory, $key)
{
$this->backOfficeTemplateDirectories[$templateName][$key] = $templateDirectory;
}
public function addFrontOfficeTemplateDirectory($templateName, $templateDirectory, $key)
{
$this->frontOfficeTemplateDirectories[$templateName][$key] = $templateDirectory;
}
/** /**
* @param TemplateDefinition $templateDefinition * @param TemplateDefinition $templateDefinition
*/ */
public function setTemplate(TemplateDefinition $templateDefinition) public function setTemplateDefinition(TemplateDefinition $templateDefinition)
{ {
$this->template = $templateDefinition->getPath(); $this->templateDefinition = $templateDefinition;
/* init template directories */ /* init template directories */
$this->setTemplateDir(array()); $this->setTemplateDir(array());
/* add main template directory */
$this->addTemplateDir($templateDefinition->getAbsolutePath(), 0);
/* define config directory */ /* define config directory */
$configDirectory = $templateDefinition->getAbsoluteConfigPath(); $configDirectory = THELIA_TEMPLATE_DIR . $this->getTemplate() . '/configs';
$this->setConfigDir($configDirectory); $this->setConfigDir($configDirectory);
/* add modules template directories */ /* add modules template directories */
switch($templateDefinition->getType()) { $this->addTemplateDirectory(
case TemplateDefinition::FRONT_OFFICE: $templateDefinition->getType(),
/* do not pass array directly to addTemplateDir since we cant control on keys */ $templateDefinition->getName(),
if(isset($this->frontOfficeTemplateDirectories[$templateDefinition->getName()])) { THELIA_TEMPLATE_DIR . $this->getTemplate(),
foreach($this->frontOfficeTemplateDirectories[$templateDefinition->getName()] as $key => $directory) { '0',
$this->addTemplateDir($directory, $key); true
} );
}
break;
case TemplateDefinition::BACK_OFFICE: /* do not pass array directly to addTemplateDir since we cant control on keys */
/* do not pass array directly to addTemplateDir since we cant control on keys */ if (isset($this->templateDirectories[$templateDefinition->getType()][$templateDefinition->getName()])) {
if(isset($this->backOfficeTemplateDirectories[$templateDefinition->getName()])) { foreach($this->templateDirectories[$templateDefinition->getType()][$templateDefinition->getName()] as $key => $directory) {
foreach($this->backOfficeTemplateDirectories[$templateDefinition->getName()] as $key => $directory) { $this->addTemplateDir($directory, $key);
$this->addTemplateDir($directory, $key); }
}
}
break;
case TemplateDefinition::PDF:
break;
default:
break;
} }
} }
public function getTemplateDefinition()
{
return $this->templateDefinition;
}
public function getTemplate() public function getTemplate()
{ {
return $this->template; return $this->templateDefinition->getPath();
} }
/** /**
* Return a rendered template, either from file or ftom a string * Return a rendered template, either from file or ftom a string
* *
* @param string $resourceType either 'string' (rendering from a string) or 'file' (rendering a file) * @param string $resourceType either 'string' (rendering from a string) or 'file' (rendering a file)
* @param string $resourceContent the resource content (a text, or a template file name) * @param string $resourceContent the resource content (a text, or a template file name)
* @param array $parameters an associative array of names / value pairs * @param array $parameters an associative array of names / value pairs
* *
* @return string the rendered template text * @return string the rendered template text
*/ */
@@ -186,17 +212,16 @@ class SmartyParser extends Smarty implements ParserInterface
return $this->fetch(sprintf("%s:%s", $resourceType, $resourceContent)); return $this->fetch(sprintf("%s:%s", $resourceType, $resourceContent));
} }
/** /**
* Return a rendered template file * Return a rendered template file
* *
* @param string $realTemplateName the template name (from the template directory) * @param string $realTemplateName the template name (from the template directory)
* @param array $parameters an associative array of names / value pairs * @param array $parameters an associative array of names / value pairs
* @return string the rendered template text * @return string the rendered template text
*/ */
public function render($realTemplateName, array $parameters = array()) { public function render($realTemplateName, array $parameters = array())
{
if(false === $this->templateExists($realTemplateName)) { if (false === $this->templateExists($realTemplateName)) {
throw new ResourceNotFoundException(Translator::getInstance()->trans("Template file %file cannot be found.", array('%file', $realTemplateName))); throw new ResourceNotFoundException(Translator::getInstance()->trans("Template file %file cannot be found.", array('%file', $realTemplateName)));
} }
@@ -206,11 +231,12 @@ class SmartyParser extends Smarty implements ParserInterface
/** /**
* Return a rendered template text * Return a rendered template text
* *
* @param string $templateText the template text * @param string $templateText the template text
* @param array $parameters an associative array of names / value pairs * @param array $parameters an associative array of names / value pairs
* @return string the rendered template text * @return string the rendered template text
*/ */
public function renderString($templateText, array $parameters = array()) { public function renderString($templateText, array $parameters = array())
{
return $this->internalRenderer('string', $templateText, $parameters); return $this->internalRenderer('string', $templateText, $parameters);
} }

View File

@@ -35,6 +35,13 @@ class TemplateDefinition
const PDF_SUBDIR = 'pdf/'; const PDF_SUBDIR = 'pdf/';
const EMAIL_SUBDIR = 'email/'; const EMAIL_SUBDIR = 'email/';
protected static $standardTemplatesSubdirs = array(
self::FRONT_OFFICE => self::FRONT_OFFICE_SUBDIR,
self::BACK_OFFICE => self::BACK_OFFICE_SUBDIR,
self::PDF => self::PDF_SUBDIR,
self::EMAIL => self::EMAIL_SUBDIR,
);
/** /**
* @var the template directory name (e.g. 'default') * @var the template directory name (e.g. 'default')
*/ */
@@ -128,4 +135,11 @@ class TemplateDefinition
$this->type = $type; $this->type = $type;
return $this; return $this;
} }
}
/**
* Returns an iterator on the standard templates subdir names
*/
public static function getStandardTemplatesSubdirsIterator() {
return new \ArrayIterator(self::$standardTemplatesSubdirs);
}
}

View File

@@ -86,36 +86,52 @@ class TemplateHelper
); );
} }
/**
* Returns an array which contains all standard template definitions
*/
public function getStandardTemplateDefinitions() {
return array(
$this->getActiveFrontTemplate(),
$this->getActiveAdminTemplate(),
$this->getActivePdfTemplate(),
$this->getActiveMailTemplate(),
);
}
/**
* Return a list of existing templates for a given template type
*
* @param int $templateType the template type
* @return An array of \Thelia\Core\Template\TemplateDefinition
*/
public function getList($templateType) { public function getList($templateType) {
$list = $exclude = array(); $list = $exclude = array();
if ($templateType == TemplateDefinition::BACK_OFFICE) { $tplIterator = TemplateDefinition::getStandardTemplatesSubdirsIterator();
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::BACK_OFFICE_SUBDIR;
foreach($tplIterator as $type => $subdir) {
if ($templateType == $type) {
$baseDir = THELIA_TEMPLATE_DIR.$subdir;
// Every subdir of the basedir is supposed to be a template.
$di = new \DirectoryIterator($baseDir);
foreach ($di as $file) {
// Ignore 'dot' elements
if ($file->isDot() || ! $file->isDir()) continue;
// Ignore reserved directory names
if (in_array($file->getFilename()."/", $exclude)) continue;
$list[] = new TemplateDefinition($file->getFilename(), $templateType);
}
return $list;
}
} }
else if ($templateType == TemplateDefinition::PDF) {
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::PDF_SUBDIR;
}
else {
$baseDir = THELIA_TEMPLATE_DIR.TemplateDefinition::FRONT_OFFICE_SUBDIR;
$exclude = array(TemplateDefinition::BACK_OFFICE_SUBDIR, TemplateDefinition::PDF_SUBDIR);
}
// Every subdir of the basedir is supposed to be a template.
$di = new \DirectoryIterator($baseDir);
foreach ($di as $file) {
// Ignore 'dot' elements
if ($file->isDot() || ! $file->isDir()) continue;
// Ignore reserved directory names
if (in_array($file->getFilename()."/", $exclude)) continue;
$list[] = new TemplateDefinition($file->getFilename(), $templateType);
}
return $list;
} }

View File

@@ -55,11 +55,12 @@ use Symfony\Component\Config\FileLocator;
use Propel\Runtime\Propel; use Propel\Runtime\Propel;
use Propel\Runtime\Connection\ConnectionManagerSingle; use Propel\Runtime\Connection\ConnectionManagerSingle;
use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Template\TemplateHelper;
use Thelia\Log\Tlog;
class Thelia extends Kernel class Thelia extends Kernel
{ {
const THELIA_VERSION = '2.0.0-beta1'; const THELIA_VERSION = '2.0.0-beta2';
public function init() public function init()
{ {
@@ -105,6 +106,61 @@ class Thelia extends Kernel
} }
/**
* Add all module's standard templates to the parser environment
*
* @param TheliaParser $parser the parser
* @param Module $module the Module.
*/
protected function addStandardModuleTemplatesToParserEnvironment($parser, $module) {
$stdTpls = TemplateDefinition::getStandardTemplatesSubdirsIterator();
foreach($stdTpls as $templateType => $templateSubdirName) {
$this->addModuleTemplateToParserEnvironment($parser, $module, $templateType, $templateSubdirName);
}
}
/**
* Add a module template directory to the parser environment
*
* @param TheliaParser $parser the parser
* @param Module $module the Module.
* @param string $templateType the template type (one of the TemplateDefinition type constants)
* @param string $templateSubdirName the template subdirectory name (one of the TemplateDefinition::XXX_SUBDIR constants)
*/
protected function addModuleTemplateToParserEnvironment($parser, $module, $templateType, $templateSubdirName) {
// Get template path
$templateDirectory = $module->getAbsoluteTemplateDirectoryPath($templateSubdirName);
try {
$templateDirBrowser = new \DirectoryIterator($templateDirectory);
$code = ucfirst($module->getCode());
/* browse the directory */
foreach ($templateDirBrowser as $templateDirContent) {
/* is it a directory which is not . or .. ? */
if ($templateDirContent->isDir() && ! $templateDirContent->isDot()) {
$parser->addMethodCall(
'addTemplateDirectory',
array(
$templateType,
$templateDirContent->getFilename(),
$templateDirContent->getPathName(),
$code
)
);
}
}
}
catch (\UnexpectedValueException $ex) {
// The directory does not exists, ignore it.
}
}
/** /**
* *
* Load some configuration * Load some configuration
@@ -129,22 +185,19 @@ class Thelia extends Kernel
$translationDirs = array(); $translationDirs = array();
$parser = $container->getDefinition('thelia.parser'); $parser = $container->getDefinition('thelia.parser');
foreach ($modules as $module) { foreach ($modules as $module) {
try { try {
$definition = new Definition();
$defintion = new Definition(); $definition->setClass($module->getFullNamespace());
$defintion->setClass($module->getFullNamespace()); $definition->addMethodCall("setContainer", array(new Reference('service_container')));
$defintion->addMethodCall("setContainer", array(new Reference('service_container')));
$container->setDefinition( $container->setDefinition(
"module.".$module->getCode(), "module.".$module->getCode(),
$defintion $definition
); );
$code = ucfirst($module->getCode());
$loader = new XmlFileLoader($container, new FileLocator($module->getAbsoluteConfigPath())); $loader = new XmlFileLoader($container, new FileLocator($module->getAbsoluteConfigPath()));
$loader->load("config.xml"); $loader->load("config.xml");
@@ -152,79 +205,24 @@ class Thelia extends Kernel
$translationDirs[] = $dir; $translationDirs[] = $dir;
} }
/* is there a front-office template directory ? */ $this->addStandardModuleTemplatesToParserEnvironment($parser, $module);
$frontOfficeModuleTemplateDirectory = sprintf("%s%stemplates%s%s", $module->getAbsoluteBaseDir(), DS, DS, TemplateDefinition::FRONT_OFFICE_SUBDIR);
if (is_dir($frontOfficeModuleTemplateDirectory)) {
try {
$moduleFrontOfficeTemplateBrowser = new \DirectoryIterator($frontOfficeModuleTemplateDirectory);
} catch (\UnexpectedValueException $e) {
throw $e;
}
/* browse the directory */
foreach ($moduleFrontOfficeTemplateBrowser as $moduleFrontOfficeTemplateContent) {
/* is it a directory which is not . or .. ? */
if ($moduleFrontOfficeTemplateContent->isDir() && !$moduleFrontOfficeTemplateContent->isDot()) {
$parser->addMethodCall(
'addFrontOfficeTemplateDirectory',
array(
$moduleFrontOfficeTemplateContent->getFilename(),
$moduleFrontOfficeTemplateContent->getPathName(),
$code,
)
);
}
}
}
/* is there a back-office template directory ? */
$backOfficeModuleTemplateDirectory = sprintf("%s%stemplates%s%s", $module->getAbsoluteBaseDir(), DS, DS, TemplateDefinition::BACK_OFFICE_SUBDIR);
if (is_dir($backOfficeModuleTemplateDirectory)) {
try {
$moduleBackOfficeTemplateBrowser = new \DirectoryIterator($backOfficeModuleTemplateDirectory);
} catch (\UnexpectedValueException $e) {
throw $e;
}
/* browse the directory */
foreach ($moduleBackOfficeTemplateBrowser as $moduleBackOfficeTemplateContent) {
/* is it a directory which is not . or .. ? */
if ($moduleBackOfficeTemplateContent->isDir() && !$moduleBackOfficeTemplateContent->isDot()) {
$parser->addMethodCall(
'addBackOfficeTemplateDirectory',
array(
$moduleBackOfficeTemplateContent->getFilename(),
$moduleBackOfficeTemplateContent->getPathName(),
$code,
)
);
}
}
}
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
// TODO: process module configuration exception Tlog::getInstance()->addError(sprintf("Failed to load module %s: %s", $module->getCode(), $e->getMessage()), $e);
} }
} }
// Load translation from templates // Load translation from templates
//core translation // core translation
$translationDirs[] = THELIA_ROOT . "core/lib/Thelia/Config/I18n"; $translationDirs[] = THELIA_ROOT . "core/lib/Thelia/Config/I18n";
// Standard templates (front, back, pdf, mail)
$th = TemplateHelper::getInstance(); $th = TemplateHelper::getInstance();
// admin template foreach($th->getStandardTemplateDefinitions() as $templateDefinition) {
if (is_dir($dir = $th->getActiveAdminTemplate()->getAbsoluteI18nPath())) { if (is_dir($dir = $templateDefinition->getAbsoluteI18nPath())) {
$translationDirs[] = $dir; $translationDirs[] = $dir;
} }
// front template
if (is_dir($dir = $th->getActiveFrontTemplate()->getAbsoluteI18nPath())) {
$translationDirs[] = $dir;
}
// PDF template
if (is_dir($dir = $th->getActivePdfTemplate()->getAbsoluteI18nPath())) {
$translationDirs[] = $dir;
} }
if ($translationDirs) { if ($translationDirs) {
@@ -372,5 +370,4 @@ class Thelia extends Kernel
//Nothing is load here but it's possible to load container configuration here. //Nothing is load here but it's possible to load container configuration here.
//exemple in sf2 : $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); //exemple in sf2 : $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
} }
} }

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form; namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\NotBlank;
class CategoryModificationForm extends CategoryCreationForm class CategoryModificationForm extends CategoryCreationForm
{ {
@@ -35,17 +33,15 @@ class CategoryModificationForm extends CategoryCreationForm
parent::buildForm(true); parent::buildForm(true);
$this->formBuilder $this->formBuilder
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) ->add("id", "hidden", array(
"constraints" => array(
->add("url", "text", array( new GreaterThan(array('value' => 0))
"label" => Translator::getInstance()->trans("Rewritten URL *"), )
"constraints" => array(new NotBlank()), ))
"label_attr" => array("for" => "rewriten_url")
))
; ;
// Add standard description fields, excluding title and locale, which a re defined in parent class // Add standard description fields, excluding title which is defined in parent class
$this->addStandardDescFields(array('title', 'locale')); $this->addStandardDescFields(array('title'));
} }
public function getName() public function getName()

View File

@@ -24,8 +24,6 @@
namespace Thelia\Form; namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
use Thelia\Form\StandardDescriptionFieldsTrait; use Thelia\Form\StandardDescriptionFieldsTrait;
/** /**
@@ -43,12 +41,6 @@ class ContentModificationForm extends ContentCreationForm
$this->formBuilder $this->formBuilder
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) ->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
->add("url", "text", array(
"label" => Translator::getInstance()->trans("Rewritten URL *"),
"constraints" => array(new NotBlank()),
"label_attr" => array("for" => "rewritten_url")
))
; ;
// Add standard description fields, excluding title and locale, which a re defined in parent class // Add standard description fields, excluding title and locale, which a re defined in parent class

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form; namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\NotBlank;
class FolderModificationForm extends FolderCreationForm class FolderModificationForm extends FolderCreationForm
{ {
@@ -36,12 +34,6 @@ class FolderModificationForm extends FolderCreationForm
$this->formBuilder $this->formBuilder
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) ->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
->add("url", "text", array(
"label" => Translator::getInstance()->trans("Rewritten URL *"),
"constraints" => array(new NotBlank()),
"label_attr" => array("for" => "rewriten_url")
))
; ;
// Add standard description fields, excluding title and locale, which a re defined in parent class // Add standard description fields, excluding title and locale, which a re defined in parent class

View File

@@ -24,7 +24,7 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\NotBlank;
class ProductModificationForm extends ProductCreationForm class ProductModificationForm extends ProductCreationForm
{ {
@@ -39,17 +39,10 @@ class ProductModificationForm extends ProductCreationForm
"label" => Translator::getInstance()->trans("Prodcut ID *"), "label" => Translator::getInstance()->trans("Prodcut ID *"),
"label_attr" => array("for" => "product_id_field"), "label_attr" => array("for" => "product_id_field"),
"constraints" => array(new GreaterThan(array('value' => 0))) "constraints" => array(new GreaterThan(array('value' => 0)))
)) ))
->add("template_id", "integer", array( ->add("template_id", "integer", array(
"label" => Translator::getInstance()->trans("Product template"), "label" => Translator::getInstance()->trans("Product template"),
"label_attr" => array("for" => "product_template_field") "label_attr" => array("for" => "product_template_field")
))
->add("url", "text", array(
"label" => Translator::getInstance()->trans("Rewritten URL *"),
"constraints" => array(new NotBlank()),
"label_attr" => array("for" => "rewriten_url_field")
)) ))
; ;

View File

@@ -0,0 +1,89 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
/**
* A trait to add standard localized description fields to a form.
*
* @author Christophe Laffont <claffont@openstudio.fr>
*/
trait SeoFieldsTrait
{
/**
* Add seo meta title, meta description and meta keywords fields
*
* @param array $exclude name of the fields that should not be added to the form
*/
protected function addSeoFields($exclude = array())
{
if (! in_array('url', $exclude))
$this->formBuilder
->add('url', 'text', array(
'label' => Translator::getInstance()->trans('Rewriten URL'),
'label_attr' => array(
'for' => 'rewriten_url_field'
),
'required' => false
)
);
if (! in_array('meta_title', $exclude))
$this->formBuilder
->add('meta_title', 'text', array(
'constraints' => array(
new NotBlank()
),
'label' => Translator::getInstance()->trans('Page Title'),
'label_attr' => array(
'for' => 'meta_title'
)
)
);
if (! in_array('meta_description', $exclude))
$this->formBuilder
->add('meta_description', 'text', array(
'label' => Translator::getInstance()->trans('Meta Description'),
'label_attr' => array(
'for' => 'meta_description'
),
'required' => false
)
);
if (! in_array('meta_keywords', $exclude))
$this->formBuilder
->add('meta_keywords', 'text', array(
'label' => Translator::getInstance()->trans('Meta Keywords'),
'label_attr' => array(
'for' => 'meta_keywords'
),
'required' => false
)
);
}
}

View File

@@ -0,0 +1,81 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* Class SeoForm
* @package Thelia\Form
* @author Christophe Laffont <claffont@openstudio.fr>
*/
class SeoForm extends BaseForm
{
use SeoFieldsTrait;
/**
*
* in this function you add all the fields you need for your Form.
* Form this you have to call add method on $this->formBuilder attribute :
*
* $this->formBuilder->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
* ),
* "label" => "email",
* "constraints" => array(
* new \Symfony\Component\Validator\Constraints\NotBlank()
* )
* )
* )
* ->add('age', 'integer');
*
* @return null
*/
protected function buildForm()
{
$this->formBuilder
->add("id", "hidden", array(
"constraints" => array(
new GreaterThan(array('value' => 0))
)
))
->add("locale", "hidden", array(
"constraints" => array(
new NotBlank()
)
))
;
// Add SEO Fields
$this->addSeoFields();
}
public function getName()
{
return "thelia_seo";
}
}

View File

@@ -18,7 +18,7 @@ class AdminLog extends BaseAdminLog
* @param Request $request * @param Request $request
* @param Base\Admin $adminUser * @param Base\Admin $adminUser
*/ */
public static function append($resource, $action, $message, Request $request, BaseAdminUser $adminUser = null) { public static function append($resource, $action, $message, Request $request, BaseAdminUser $adminUser = null, $withRequestContent = true) {
$log = new AdminLog(); $log = new AdminLog();
@@ -29,7 +29,7 @@ class AdminLog extends BaseAdminLog
->setResource($resource) ->setResource($resource)
->setAction($action) ->setAction($action)
->setMessage($message) ->setMessage($message)
->setRequest($request->__toString()) ->setRequest($request->toString($withRequestContent))
; ;
try { try {

View File

@@ -3651,6 +3651,78 @@ abstract class Category implements ActiveRecordInterface
return $this; return $this;
} }
/**
* Get the [meta_title] column value.
*
* @return string
*/
public function getMetaTitle()
{
return $this->getCurrentTranslation()->getMetaTitle();
}
/**
* Set the value of [meta_title] column.
*
* @param string $v new value
* @return \Thelia\Model\CategoryI18n The current object (for fluent API support)
*/
public function setMetaTitle($v)
{ $this->getCurrentTranslation()->setMetaTitle($v);
return $this;
}
/**
* Get the [meta_description] column value.
*
* @return string
*/
public function getMetaDescription()
{
return $this->getCurrentTranslation()->getMetaDescription();
}
/**
* Set the value of [meta_description] column.
*
* @param string $v new value
* @return \Thelia\Model\CategoryI18n The current object (for fluent API support)
*/
public function setMetaDescription($v)
{ $this->getCurrentTranslation()->setMetaDescription($v);
return $this;
}
/**
* Get the [meta_keywords] column value.
*
* @return string
*/
public function getMetaKeywords()
{
return $this->getCurrentTranslation()->getMetaKeywords();
}
/**
* Set the value of [meta_keywords] column.
*
* @param string $v new value
* @return \Thelia\Model\CategoryI18n The current object (for fluent API support)
*/
public function setMetaKeywords($v)
{ $this->getCurrentTranslation()->setMetaKeywords($v);
return $this;
}
// versionable behavior // versionable behavior
/** /**

View File

@@ -90,6 +90,24 @@ abstract class CategoryI18n implements ActiveRecordInterface
*/ */
protected $postscriptum; protected $postscriptum;
/**
* The value for the meta_title field.
* @var string
*/
protected $meta_title;
/**
* The value for the meta_description field.
* @var string
*/
protected $meta_description;
/**
* The value for the meta_keywords field.
* @var string
*/
protected $meta_keywords;
/** /**
* @var Category * @var Category
*/ */
@@ -440,6 +458,39 @@ abstract class CategoryI18n implements ActiveRecordInterface
return $this->postscriptum; return $this->postscriptum;
} }
/**
* Get the [meta_title] column value.
*
* @return string
*/
public function getMetaTitle()
{
return $this->meta_title;
}
/**
* Get the [meta_description] column value.
*
* @return string
*/
public function getMetaDescription()
{
return $this->meta_description;
}
/**
* Get the [meta_keywords] column value.
*
* @return string
*/
public function getMetaKeywords()
{
return $this->meta_keywords;
}
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
@@ -570,6 +621,69 @@ abstract class CategoryI18n implements ActiveRecordInterface
return $this; return $this;
} // setPostscriptum() } // setPostscriptum()
/**
* Set the value of [meta_title] column.
*
* @param string $v new value
* @return \Thelia\Model\CategoryI18n The current object (for fluent API support)
*/
public function setMetaTitle($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_title !== $v) {
$this->meta_title = $v;
$this->modifiedColumns[] = CategoryI18nTableMap::META_TITLE;
}
return $this;
} // setMetaTitle()
/**
* Set the value of [meta_description] column.
*
* @param string $v new value
* @return \Thelia\Model\CategoryI18n The current object (for fluent API support)
*/
public function setMetaDescription($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_description !== $v) {
$this->meta_description = $v;
$this->modifiedColumns[] = CategoryI18nTableMap::META_DESCRIPTION;
}
return $this;
} // setMetaDescription()
/**
* Set the value of [meta_keywords] column.
*
* @param string $v new value
* @return \Thelia\Model\CategoryI18n The current object (for fluent API support)
*/
public function setMetaKeywords($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_keywords !== $v) {
$this->meta_keywords = $v;
$this->modifiedColumns[] = CategoryI18nTableMap::META_KEYWORDS;
}
return $this;
} // setMetaKeywords()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
* *
@@ -628,6 +742,15 @@ abstract class CategoryI18n implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CategoryI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CategoryI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)];
$this->postscriptum = (null !== $col) ? (string) $col : null; $this->postscriptum = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CategoryI18nTableMap::translateFieldName('MetaTitle', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_title = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CategoryI18nTableMap::translateFieldName('MetaDescription', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_description = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CategoryI18nTableMap::translateFieldName('MetaKeywords', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_keywords = (null !== $col) ? (string) $col : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@@ -636,7 +759,7 @@ abstract class CategoryI18n implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 6; // 6 = CategoryI18nTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 9; // 9 = CategoryI18nTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\CategoryI18n object", 0, $e); throw new PropelException("Error populating \Thelia\Model\CategoryI18n object", 0, $e);
@@ -875,6 +998,15 @@ abstract class CategoryI18n implements ActiveRecordInterface
if ($this->isColumnModified(CategoryI18nTableMap::POSTSCRIPTUM)) { if ($this->isColumnModified(CategoryI18nTableMap::POSTSCRIPTUM)) {
$modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM';
} }
if ($this->isColumnModified(CategoryI18nTableMap::META_TITLE)) {
$modifiedColumns[':p' . $index++] = 'META_TITLE';
}
if ($this->isColumnModified(CategoryI18nTableMap::META_DESCRIPTION)) {
$modifiedColumns[':p' . $index++] = 'META_DESCRIPTION';
}
if ($this->isColumnModified(CategoryI18nTableMap::META_KEYWORDS)) {
$modifiedColumns[':p' . $index++] = 'META_KEYWORDS';
}
$sql = sprintf( $sql = sprintf(
'INSERT INTO category_i18n (%s) VALUES (%s)', 'INSERT INTO category_i18n (%s) VALUES (%s)',
@@ -904,6 +1036,15 @@ abstract class CategoryI18n implements ActiveRecordInterface
case 'POSTSCRIPTUM': case 'POSTSCRIPTUM':
$stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
break; break;
case 'META_TITLE':
$stmt->bindValue($identifier, $this->meta_title, PDO::PARAM_STR);
break;
case 'META_DESCRIPTION':
$stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR);
break;
case 'META_KEYWORDS':
$stmt->bindValue($identifier, $this->meta_keywords, PDO::PARAM_STR);
break;
} }
} }
$stmt->execute(); $stmt->execute();
@@ -977,6 +1118,15 @@ abstract class CategoryI18n implements ActiveRecordInterface
case 5: case 5:
return $this->getPostscriptum(); return $this->getPostscriptum();
break; break;
case 6:
return $this->getMetaTitle();
break;
case 7:
return $this->getMetaDescription();
break;
case 8:
return $this->getMetaKeywords();
break;
default: default:
return null; return null;
break; break;
@@ -1012,6 +1162,9 @@ abstract class CategoryI18n implements ActiveRecordInterface
$keys[3] => $this->getDescription(), $keys[3] => $this->getDescription(),
$keys[4] => $this->getChapo(), $keys[4] => $this->getChapo(),
$keys[5] => $this->getPostscriptum(), $keys[5] => $this->getPostscriptum(),
$keys[6] => $this->getMetaTitle(),
$keys[7] => $this->getMetaDescription(),
$keys[8] => $this->getMetaKeywords(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1074,6 +1227,15 @@ abstract class CategoryI18n implements ActiveRecordInterface
case 5: case 5:
$this->setPostscriptum($value); $this->setPostscriptum($value);
break; break;
case 6:
$this->setMetaTitle($value);
break;
case 7:
$this->setMetaDescription($value);
break;
case 8:
$this->setMetaKeywords($value);
break;
} // switch() } // switch()
} }
@@ -1104,6 +1266,9 @@ abstract class CategoryI18n implements ActiveRecordInterface
if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]); if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setMetaTitle($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setMetaDescription($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setMetaKeywords($arr[$keys[8]]);
} }
/** /**
@@ -1121,6 +1286,9 @@ abstract class CategoryI18n implements ActiveRecordInterface
if ($this->isColumnModified(CategoryI18nTableMap::DESCRIPTION)) $criteria->add(CategoryI18nTableMap::DESCRIPTION, $this->description); if ($this->isColumnModified(CategoryI18nTableMap::DESCRIPTION)) $criteria->add(CategoryI18nTableMap::DESCRIPTION, $this->description);
if ($this->isColumnModified(CategoryI18nTableMap::CHAPO)) $criteria->add(CategoryI18nTableMap::CHAPO, $this->chapo); if ($this->isColumnModified(CategoryI18nTableMap::CHAPO)) $criteria->add(CategoryI18nTableMap::CHAPO, $this->chapo);
if ($this->isColumnModified(CategoryI18nTableMap::POSTSCRIPTUM)) $criteria->add(CategoryI18nTableMap::POSTSCRIPTUM, $this->postscriptum); if ($this->isColumnModified(CategoryI18nTableMap::POSTSCRIPTUM)) $criteria->add(CategoryI18nTableMap::POSTSCRIPTUM, $this->postscriptum);
if ($this->isColumnModified(CategoryI18nTableMap::META_TITLE)) $criteria->add(CategoryI18nTableMap::META_TITLE, $this->meta_title);
if ($this->isColumnModified(CategoryI18nTableMap::META_DESCRIPTION)) $criteria->add(CategoryI18nTableMap::META_DESCRIPTION, $this->meta_description);
if ($this->isColumnModified(CategoryI18nTableMap::META_KEYWORDS)) $criteria->add(CategoryI18nTableMap::META_KEYWORDS, $this->meta_keywords);
return $criteria; return $criteria;
} }
@@ -1197,6 +1365,9 @@ abstract class CategoryI18n implements ActiveRecordInterface
$copyObj->setDescription($this->getDescription()); $copyObj->setDescription($this->getDescription());
$copyObj->setChapo($this->getChapo()); $copyObj->setChapo($this->getChapo());
$copyObj->setPostscriptum($this->getPostscriptum()); $copyObj->setPostscriptum($this->getPostscriptum());
$copyObj->setMetaTitle($this->getMetaTitle());
$copyObj->setMetaDescription($this->getMetaDescription());
$copyObj->setMetaKeywords($this->getMetaKeywords());
if ($makeNew) { if ($makeNew) {
$copyObj->setNew(true); $copyObj->setNew(true);
} }
@@ -1286,6 +1457,9 @@ abstract class CategoryI18n implements ActiveRecordInterface
$this->description = null; $this->description = null;
$this->chapo = null; $this->chapo = null;
$this->postscriptum = null; $this->postscriptum = null;
$this->meta_title = null;
$this->meta_description = null;
$this->meta_keywords = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->clearAllReferences(); $this->clearAllReferences();
$this->applyDefaultValues(); $this->applyDefaultValues();

View File

@@ -27,6 +27,9 @@ use Thelia\Model\Map\CategoryI18nTableMap;
* @method ChildCategoryI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column * @method ChildCategoryI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildCategoryI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column * @method ChildCategoryI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildCategoryI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column * @method ChildCategoryI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ChildCategoryI18nQuery orderByMetaTitle($order = Criteria::ASC) Order by the meta_title column
* @method ChildCategoryI18nQuery orderByMetaDescription($order = Criteria::ASC) Order by the meta_description column
* @method ChildCategoryI18nQuery orderByMetaKeywords($order = Criteria::ASC) Order by the meta_keywords column
* *
* @method ChildCategoryI18nQuery groupById() Group by the id column * @method ChildCategoryI18nQuery groupById() Group by the id column
* @method ChildCategoryI18nQuery groupByLocale() Group by the locale column * @method ChildCategoryI18nQuery groupByLocale() Group by the locale column
@@ -34,6 +37,9 @@ use Thelia\Model\Map\CategoryI18nTableMap;
* @method ChildCategoryI18nQuery groupByDescription() Group by the description column * @method ChildCategoryI18nQuery groupByDescription() Group by the description column
* @method ChildCategoryI18nQuery groupByChapo() Group by the chapo column * @method ChildCategoryI18nQuery groupByChapo() Group by the chapo column
* @method ChildCategoryI18nQuery groupByPostscriptum() Group by the postscriptum column * @method ChildCategoryI18nQuery groupByPostscriptum() Group by the postscriptum column
* @method ChildCategoryI18nQuery groupByMetaTitle() Group by the meta_title column
* @method ChildCategoryI18nQuery groupByMetaDescription() Group by the meta_description column
* @method ChildCategoryI18nQuery groupByMetaKeywords() Group by the meta_keywords column
* *
* @method ChildCategoryI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildCategoryI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCategoryI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildCategoryI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -52,6 +58,9 @@ use Thelia\Model\Map\CategoryI18nTableMap;
* @method ChildCategoryI18n findOneByDescription(string $description) Return the first ChildCategoryI18n filtered by the description column * @method ChildCategoryI18n findOneByDescription(string $description) Return the first ChildCategoryI18n filtered by the description column
* @method ChildCategoryI18n findOneByChapo(string $chapo) Return the first ChildCategoryI18n filtered by the chapo column * @method ChildCategoryI18n findOneByChapo(string $chapo) Return the first ChildCategoryI18n filtered by the chapo column
* @method ChildCategoryI18n findOneByPostscriptum(string $postscriptum) Return the first ChildCategoryI18n filtered by the postscriptum column * @method ChildCategoryI18n findOneByPostscriptum(string $postscriptum) Return the first ChildCategoryI18n filtered by the postscriptum column
* @method ChildCategoryI18n findOneByMetaTitle(string $meta_title) Return the first ChildCategoryI18n filtered by the meta_title column
* @method ChildCategoryI18n findOneByMetaDescription(string $meta_description) Return the first ChildCategoryI18n filtered by the meta_description column
* @method ChildCategoryI18n findOneByMetaKeywords(string $meta_keywords) Return the first ChildCategoryI18n filtered by the meta_keywords column
* *
* @method array findById(int $id) Return ChildCategoryI18n objects filtered by the id column * @method array findById(int $id) Return ChildCategoryI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildCategoryI18n objects filtered by the locale column * @method array findByLocale(string $locale) Return ChildCategoryI18n objects filtered by the locale column
@@ -59,6 +68,9 @@ use Thelia\Model\Map\CategoryI18nTableMap;
* @method array findByDescription(string $description) Return ChildCategoryI18n objects filtered by the description column * @method array findByDescription(string $description) Return ChildCategoryI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildCategoryI18n objects filtered by the chapo column * @method array findByChapo(string $chapo) Return ChildCategoryI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildCategoryI18n objects filtered by the postscriptum column * @method array findByPostscriptum(string $postscriptum) Return ChildCategoryI18n objects filtered by the postscriptum column
* @method array findByMetaTitle(string $meta_title) Return ChildCategoryI18n objects filtered by the meta_title column
* @method array findByMetaDescription(string $meta_description) Return ChildCategoryI18n objects filtered by the meta_description column
* @method array findByMetaKeywords(string $meta_keywords) Return ChildCategoryI18n objects filtered by the meta_keywords column
* *
*/ */
abstract class CategoryI18nQuery extends ModelCriteria abstract class CategoryI18nQuery extends ModelCriteria
@@ -147,7 +159,7 @@ abstract class CategoryI18nQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM category_i18n WHERE ID = :p0 AND LOCALE = :p1'; $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORDS FROM category_i18n WHERE ID = :p0 AND LOCALE = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -436,6 +448,93 @@ abstract class CategoryI18nQuery extends ModelCriteria
return $this->addUsingAlias(CategoryI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison); return $this->addUsingAlias(CategoryI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
} }
/**
* Filter the query on the meta_title column
*
* Example usage:
* <code>
* $query->filterByMetaTitle('fooValue'); // WHERE meta_title = 'fooValue'
* $query->filterByMetaTitle('%fooValue%'); // WHERE meta_title LIKE '%fooValue%'
* </code>
*
* @param string $metaTitle The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryI18nQuery The current query, for fluid interface
*/
public function filterByMetaTitle($metaTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaTitle)) {
$metaTitle = str_replace('*', '%', $metaTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CategoryI18nTableMap::META_TITLE, $metaTitle, $comparison);
}
/**
* Filter the query on the meta_description column
*
* Example usage:
* <code>
* $query->filterByMetaDescription('fooValue'); // WHERE meta_description = 'fooValue'
* $query->filterByMetaDescription('%fooValue%'); // WHERE meta_description LIKE '%fooValue%'
* </code>
*
* @param string $metaDescription The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryI18nQuery The current query, for fluid interface
*/
public function filterByMetaDescription($metaDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaDescription)) {
$metaDescription = str_replace('*', '%', $metaDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CategoryI18nTableMap::META_DESCRIPTION, $metaDescription, $comparison);
}
/**
* Filter the query on the meta_keywords column
*
* Example usage:
* <code>
* $query->filterByMetaKeywords('fooValue'); // WHERE meta_keywords = 'fooValue'
* $query->filterByMetaKeywords('%fooValue%'); // WHERE meta_keywords LIKE '%fooValue%'
* </code>
*
* @param string $metaKeywords The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildCategoryI18nQuery The current query, for fluid interface
*/
public function filterByMetaKeywords($metaKeywords = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaKeywords)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaKeywords)) {
$metaKeywords = str_replace('*', '%', $metaKeywords);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CategoryI18nTableMap::META_KEYWORDS, $metaKeywords, $comparison);
}
/** /**
* Filter the query by a related \Thelia\Model\Category object * Filter the query by a related \Thelia\Model\Category object
* *

View File

@@ -3904,6 +3904,78 @@ abstract class Content implements ActiveRecordInterface
return $this; return $this;
} }
/**
* Get the [meta_title] column value.
*
* @return string
*/
public function getMetaTitle()
{
return $this->getCurrentTranslation()->getMetaTitle();
}
/**
* Set the value of [meta_title] column.
*
* @param string $v new value
* @return \Thelia\Model\ContentI18n The current object (for fluent API support)
*/
public function setMetaTitle($v)
{ $this->getCurrentTranslation()->setMetaTitle($v);
return $this;
}
/**
* Get the [meta_description] column value.
*
* @return string
*/
public function getMetaDescription()
{
return $this->getCurrentTranslation()->getMetaDescription();
}
/**
* Set the value of [meta_description] column.
*
* @param string $v new value
* @return \Thelia\Model\ContentI18n The current object (for fluent API support)
*/
public function setMetaDescription($v)
{ $this->getCurrentTranslation()->setMetaDescription($v);
return $this;
}
/**
* Get the [meta_keywords] column value.
*
* @return string
*/
public function getMetaKeywords()
{
return $this->getCurrentTranslation()->getMetaKeywords();
}
/**
* Set the value of [meta_keywords] column.
*
* @param string $v new value
* @return \Thelia\Model\ContentI18n The current object (for fluent API support)
*/
public function setMetaKeywords($v)
{ $this->getCurrentTranslation()->setMetaKeywords($v);
return $this;
}
// versionable behavior // versionable behavior
/** /**

View File

@@ -90,6 +90,24 @@ abstract class ContentI18n implements ActiveRecordInterface
*/ */
protected $postscriptum; protected $postscriptum;
/**
* The value for the meta_title field.
* @var string
*/
protected $meta_title;
/**
* The value for the meta_description field.
* @var string
*/
protected $meta_description;
/**
* The value for the meta_keywords field.
* @var string
*/
protected $meta_keywords;
/** /**
* @var Content * @var Content
*/ */
@@ -440,6 +458,39 @@ abstract class ContentI18n implements ActiveRecordInterface
return $this->postscriptum; return $this->postscriptum;
} }
/**
* Get the [meta_title] column value.
*
* @return string
*/
public function getMetaTitle()
{
return $this->meta_title;
}
/**
* Get the [meta_description] column value.
*
* @return string
*/
public function getMetaDescription()
{
return $this->meta_description;
}
/**
* Get the [meta_keywords] column value.
*
* @return string
*/
public function getMetaKeywords()
{
return $this->meta_keywords;
}
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
@@ -570,6 +621,69 @@ abstract class ContentI18n implements ActiveRecordInterface
return $this; return $this;
} // setPostscriptum() } // setPostscriptum()
/**
* Set the value of [meta_title] column.
*
* @param string $v new value
* @return \Thelia\Model\ContentI18n The current object (for fluent API support)
*/
public function setMetaTitle($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_title !== $v) {
$this->meta_title = $v;
$this->modifiedColumns[] = ContentI18nTableMap::META_TITLE;
}
return $this;
} // setMetaTitle()
/**
* Set the value of [meta_description] column.
*
* @param string $v new value
* @return \Thelia\Model\ContentI18n The current object (for fluent API support)
*/
public function setMetaDescription($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_description !== $v) {
$this->meta_description = $v;
$this->modifiedColumns[] = ContentI18nTableMap::META_DESCRIPTION;
}
return $this;
} // setMetaDescription()
/**
* Set the value of [meta_keywords] column.
*
* @param string $v new value
* @return \Thelia\Model\ContentI18n The current object (for fluent API support)
*/
public function setMetaKeywords($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_keywords !== $v) {
$this->meta_keywords = $v;
$this->modifiedColumns[] = ContentI18nTableMap::META_KEYWORDS;
}
return $this;
} // setMetaKeywords()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
* *
@@ -628,6 +742,15 @@ abstract class ContentI18n implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ContentI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ContentI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)];
$this->postscriptum = (null !== $col) ? (string) $col : null; $this->postscriptum = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ContentI18nTableMap::translateFieldName('MetaTitle', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_title = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ContentI18nTableMap::translateFieldName('MetaDescription', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_description = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ContentI18nTableMap::translateFieldName('MetaKeywords', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_keywords = (null !== $col) ? (string) $col : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@@ -636,7 +759,7 @@ abstract class ContentI18n implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 6; // 6 = ContentI18nTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 9; // 9 = ContentI18nTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ContentI18n object", 0, $e); throw new PropelException("Error populating \Thelia\Model\ContentI18n object", 0, $e);
@@ -875,6 +998,15 @@ abstract class ContentI18n implements ActiveRecordInterface
if ($this->isColumnModified(ContentI18nTableMap::POSTSCRIPTUM)) { if ($this->isColumnModified(ContentI18nTableMap::POSTSCRIPTUM)) {
$modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM';
} }
if ($this->isColumnModified(ContentI18nTableMap::META_TITLE)) {
$modifiedColumns[':p' . $index++] = 'META_TITLE';
}
if ($this->isColumnModified(ContentI18nTableMap::META_DESCRIPTION)) {
$modifiedColumns[':p' . $index++] = 'META_DESCRIPTION';
}
if ($this->isColumnModified(ContentI18nTableMap::META_KEYWORDS)) {
$modifiedColumns[':p' . $index++] = 'META_KEYWORDS';
}
$sql = sprintf( $sql = sprintf(
'INSERT INTO content_i18n (%s) VALUES (%s)', 'INSERT INTO content_i18n (%s) VALUES (%s)',
@@ -904,6 +1036,15 @@ abstract class ContentI18n implements ActiveRecordInterface
case 'POSTSCRIPTUM': case 'POSTSCRIPTUM':
$stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
break; break;
case 'META_TITLE':
$stmt->bindValue($identifier, $this->meta_title, PDO::PARAM_STR);
break;
case 'META_DESCRIPTION':
$stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR);
break;
case 'META_KEYWORDS':
$stmt->bindValue($identifier, $this->meta_keywords, PDO::PARAM_STR);
break;
} }
} }
$stmt->execute(); $stmt->execute();
@@ -977,6 +1118,15 @@ abstract class ContentI18n implements ActiveRecordInterface
case 5: case 5:
return $this->getPostscriptum(); return $this->getPostscriptum();
break; break;
case 6:
return $this->getMetaTitle();
break;
case 7:
return $this->getMetaDescription();
break;
case 8:
return $this->getMetaKeywords();
break;
default: default:
return null; return null;
break; break;
@@ -1012,6 +1162,9 @@ abstract class ContentI18n implements ActiveRecordInterface
$keys[3] => $this->getDescription(), $keys[3] => $this->getDescription(),
$keys[4] => $this->getChapo(), $keys[4] => $this->getChapo(),
$keys[5] => $this->getPostscriptum(), $keys[5] => $this->getPostscriptum(),
$keys[6] => $this->getMetaTitle(),
$keys[7] => $this->getMetaDescription(),
$keys[8] => $this->getMetaKeywords(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1074,6 +1227,15 @@ abstract class ContentI18n implements ActiveRecordInterface
case 5: case 5:
$this->setPostscriptum($value); $this->setPostscriptum($value);
break; break;
case 6:
$this->setMetaTitle($value);
break;
case 7:
$this->setMetaDescription($value);
break;
case 8:
$this->setMetaKeywords($value);
break;
} // switch() } // switch()
} }
@@ -1104,6 +1266,9 @@ abstract class ContentI18n implements ActiveRecordInterface
if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]); if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setMetaTitle($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setMetaDescription($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setMetaKeywords($arr[$keys[8]]);
} }
/** /**
@@ -1121,6 +1286,9 @@ abstract class ContentI18n implements ActiveRecordInterface
if ($this->isColumnModified(ContentI18nTableMap::DESCRIPTION)) $criteria->add(ContentI18nTableMap::DESCRIPTION, $this->description); if ($this->isColumnModified(ContentI18nTableMap::DESCRIPTION)) $criteria->add(ContentI18nTableMap::DESCRIPTION, $this->description);
if ($this->isColumnModified(ContentI18nTableMap::CHAPO)) $criteria->add(ContentI18nTableMap::CHAPO, $this->chapo); if ($this->isColumnModified(ContentI18nTableMap::CHAPO)) $criteria->add(ContentI18nTableMap::CHAPO, $this->chapo);
if ($this->isColumnModified(ContentI18nTableMap::POSTSCRIPTUM)) $criteria->add(ContentI18nTableMap::POSTSCRIPTUM, $this->postscriptum); if ($this->isColumnModified(ContentI18nTableMap::POSTSCRIPTUM)) $criteria->add(ContentI18nTableMap::POSTSCRIPTUM, $this->postscriptum);
if ($this->isColumnModified(ContentI18nTableMap::META_TITLE)) $criteria->add(ContentI18nTableMap::META_TITLE, $this->meta_title);
if ($this->isColumnModified(ContentI18nTableMap::META_DESCRIPTION)) $criteria->add(ContentI18nTableMap::META_DESCRIPTION, $this->meta_description);
if ($this->isColumnModified(ContentI18nTableMap::META_KEYWORDS)) $criteria->add(ContentI18nTableMap::META_KEYWORDS, $this->meta_keywords);
return $criteria; return $criteria;
} }
@@ -1197,6 +1365,9 @@ abstract class ContentI18n implements ActiveRecordInterface
$copyObj->setDescription($this->getDescription()); $copyObj->setDescription($this->getDescription());
$copyObj->setChapo($this->getChapo()); $copyObj->setChapo($this->getChapo());
$copyObj->setPostscriptum($this->getPostscriptum()); $copyObj->setPostscriptum($this->getPostscriptum());
$copyObj->setMetaTitle($this->getMetaTitle());
$copyObj->setMetaDescription($this->getMetaDescription());
$copyObj->setMetaKeywords($this->getMetaKeywords());
if ($makeNew) { if ($makeNew) {
$copyObj->setNew(true); $copyObj->setNew(true);
} }
@@ -1286,6 +1457,9 @@ abstract class ContentI18n implements ActiveRecordInterface
$this->description = null; $this->description = null;
$this->chapo = null; $this->chapo = null;
$this->postscriptum = null; $this->postscriptum = null;
$this->meta_title = null;
$this->meta_description = null;
$this->meta_keywords = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->clearAllReferences(); $this->clearAllReferences();
$this->applyDefaultValues(); $this->applyDefaultValues();

View File

@@ -27,6 +27,9 @@ use Thelia\Model\Map\ContentI18nTableMap;
* @method ChildContentI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column * @method ChildContentI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildContentI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column * @method ChildContentI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildContentI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column * @method ChildContentI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ChildContentI18nQuery orderByMetaTitle($order = Criteria::ASC) Order by the meta_title column
* @method ChildContentI18nQuery orderByMetaDescription($order = Criteria::ASC) Order by the meta_description column
* @method ChildContentI18nQuery orderByMetaKeywords($order = Criteria::ASC) Order by the meta_keywords column
* *
* @method ChildContentI18nQuery groupById() Group by the id column * @method ChildContentI18nQuery groupById() Group by the id column
* @method ChildContentI18nQuery groupByLocale() Group by the locale column * @method ChildContentI18nQuery groupByLocale() Group by the locale column
@@ -34,6 +37,9 @@ use Thelia\Model\Map\ContentI18nTableMap;
* @method ChildContentI18nQuery groupByDescription() Group by the description column * @method ChildContentI18nQuery groupByDescription() Group by the description column
* @method ChildContentI18nQuery groupByChapo() Group by the chapo column * @method ChildContentI18nQuery groupByChapo() Group by the chapo column
* @method ChildContentI18nQuery groupByPostscriptum() Group by the postscriptum column * @method ChildContentI18nQuery groupByPostscriptum() Group by the postscriptum column
* @method ChildContentI18nQuery groupByMetaTitle() Group by the meta_title column
* @method ChildContentI18nQuery groupByMetaDescription() Group by the meta_description column
* @method ChildContentI18nQuery groupByMetaKeywords() Group by the meta_keywords column
* *
* @method ChildContentI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildContentI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildContentI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildContentI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -52,6 +58,9 @@ use Thelia\Model\Map\ContentI18nTableMap;
* @method ChildContentI18n findOneByDescription(string $description) Return the first ChildContentI18n filtered by the description column * @method ChildContentI18n findOneByDescription(string $description) Return the first ChildContentI18n filtered by the description column
* @method ChildContentI18n findOneByChapo(string $chapo) Return the first ChildContentI18n filtered by the chapo column * @method ChildContentI18n findOneByChapo(string $chapo) Return the first ChildContentI18n filtered by the chapo column
* @method ChildContentI18n findOneByPostscriptum(string $postscriptum) Return the first ChildContentI18n filtered by the postscriptum column * @method ChildContentI18n findOneByPostscriptum(string $postscriptum) Return the first ChildContentI18n filtered by the postscriptum column
* @method ChildContentI18n findOneByMetaTitle(string $meta_title) Return the first ChildContentI18n filtered by the meta_title column
* @method ChildContentI18n findOneByMetaDescription(string $meta_description) Return the first ChildContentI18n filtered by the meta_description column
* @method ChildContentI18n findOneByMetaKeywords(string $meta_keywords) Return the first ChildContentI18n filtered by the meta_keywords column
* *
* @method array findById(int $id) Return ChildContentI18n objects filtered by the id column * @method array findById(int $id) Return ChildContentI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildContentI18n objects filtered by the locale column * @method array findByLocale(string $locale) Return ChildContentI18n objects filtered by the locale column
@@ -59,6 +68,9 @@ use Thelia\Model\Map\ContentI18nTableMap;
* @method array findByDescription(string $description) Return ChildContentI18n objects filtered by the description column * @method array findByDescription(string $description) Return ChildContentI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildContentI18n objects filtered by the chapo column * @method array findByChapo(string $chapo) Return ChildContentI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildContentI18n objects filtered by the postscriptum column * @method array findByPostscriptum(string $postscriptum) Return ChildContentI18n objects filtered by the postscriptum column
* @method array findByMetaTitle(string $meta_title) Return ChildContentI18n objects filtered by the meta_title column
* @method array findByMetaDescription(string $meta_description) Return ChildContentI18n objects filtered by the meta_description column
* @method array findByMetaKeywords(string $meta_keywords) Return ChildContentI18n objects filtered by the meta_keywords column
* *
*/ */
abstract class ContentI18nQuery extends ModelCriteria abstract class ContentI18nQuery extends ModelCriteria
@@ -147,7 +159,7 @@ abstract class ContentI18nQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM content_i18n WHERE ID = :p0 AND LOCALE = :p1'; $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORDS FROM content_i18n WHERE ID = :p0 AND LOCALE = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -436,6 +448,93 @@ abstract class ContentI18nQuery extends ModelCriteria
return $this->addUsingAlias(ContentI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison); return $this->addUsingAlias(ContentI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
} }
/**
* Filter the query on the meta_title column
*
* Example usage:
* <code>
* $query->filterByMetaTitle('fooValue'); // WHERE meta_title = 'fooValue'
* $query->filterByMetaTitle('%fooValue%'); // WHERE meta_title LIKE '%fooValue%'
* </code>
*
* @param string $metaTitle The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentI18nQuery The current query, for fluid interface
*/
public function filterByMetaTitle($metaTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaTitle)) {
$metaTitle = str_replace('*', '%', $metaTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ContentI18nTableMap::META_TITLE, $metaTitle, $comparison);
}
/**
* Filter the query on the meta_description column
*
* Example usage:
* <code>
* $query->filterByMetaDescription('fooValue'); // WHERE meta_description = 'fooValue'
* $query->filterByMetaDescription('%fooValue%'); // WHERE meta_description LIKE '%fooValue%'
* </code>
*
* @param string $metaDescription The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentI18nQuery The current query, for fluid interface
*/
public function filterByMetaDescription($metaDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaDescription)) {
$metaDescription = str_replace('*', '%', $metaDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ContentI18nTableMap::META_DESCRIPTION, $metaDescription, $comparison);
}
/**
* Filter the query on the meta_keywords column
*
* Example usage:
* <code>
* $query->filterByMetaKeywords('fooValue'); // WHERE meta_keywords = 'fooValue'
* $query->filterByMetaKeywords('%fooValue%'); // WHERE meta_keywords LIKE '%fooValue%'
* </code>
*
* @param string $metaKeywords The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentI18nQuery The current query, for fluid interface
*/
public function filterByMetaKeywords($metaKeywords = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaKeywords)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaKeywords)) {
$metaKeywords = str_replace('*', '%', $metaKeywords);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ContentI18nTableMap::META_KEYWORDS, $metaKeywords, $comparison);
}
/** /**
* Filter the query by a related \Thelia\Model\Content object * Filter the query by a related \Thelia\Model\Content object
* *

View File

@@ -3368,6 +3368,78 @@ abstract class Folder implements ActiveRecordInterface
return $this; return $this;
} }
/**
* Get the [meta_title] column value.
*
* @return string
*/
public function getMetaTitle()
{
return $this->getCurrentTranslation()->getMetaTitle();
}
/**
* Set the value of [meta_title] column.
*
* @param string $v new value
* @return \Thelia\Model\FolderI18n The current object (for fluent API support)
*/
public function setMetaTitle($v)
{ $this->getCurrentTranslation()->setMetaTitle($v);
return $this;
}
/**
* Get the [meta_description] column value.
*
* @return string
*/
public function getMetaDescription()
{
return $this->getCurrentTranslation()->getMetaDescription();
}
/**
* Set the value of [meta_description] column.
*
* @param string $v new value
* @return \Thelia\Model\FolderI18n The current object (for fluent API support)
*/
public function setMetaDescription($v)
{ $this->getCurrentTranslation()->setMetaDescription($v);
return $this;
}
/**
* Get the [meta_keywords] column value.
*
* @return string
*/
public function getMetaKeywords()
{
return $this->getCurrentTranslation()->getMetaKeywords();
}
/**
* Set the value of [meta_keywords] column.
*
* @param string $v new value
* @return \Thelia\Model\FolderI18n The current object (for fluent API support)
*/
public function setMetaKeywords($v)
{ $this->getCurrentTranslation()->setMetaKeywords($v);
return $this;
}
// versionable behavior // versionable behavior
/** /**

View File

@@ -90,6 +90,24 @@ abstract class FolderI18n implements ActiveRecordInterface
*/ */
protected $postscriptum; protected $postscriptum;
/**
* The value for the meta_title field.
* @var string
*/
protected $meta_title;
/**
* The value for the meta_description field.
* @var string
*/
protected $meta_description;
/**
* The value for the meta_keywords field.
* @var string
*/
protected $meta_keywords;
/** /**
* @var Folder * @var Folder
*/ */
@@ -440,6 +458,39 @@ abstract class FolderI18n implements ActiveRecordInterface
return $this->postscriptum; return $this->postscriptum;
} }
/**
* Get the [meta_title] column value.
*
* @return string
*/
public function getMetaTitle()
{
return $this->meta_title;
}
/**
* Get the [meta_description] column value.
*
* @return string
*/
public function getMetaDescription()
{
return $this->meta_description;
}
/**
* Get the [meta_keywords] column value.
*
* @return string
*/
public function getMetaKeywords()
{
return $this->meta_keywords;
}
/** /**
* Set the value of [id] column. * Set the value of [id] column.
* *
@@ -570,6 +621,69 @@ abstract class FolderI18n implements ActiveRecordInterface
return $this; return $this;
} // setPostscriptum() } // setPostscriptum()
/**
* Set the value of [meta_title] column.
*
* @param string $v new value
* @return \Thelia\Model\FolderI18n The current object (for fluent API support)
*/
public function setMetaTitle($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_title !== $v) {
$this->meta_title = $v;
$this->modifiedColumns[] = FolderI18nTableMap::META_TITLE;
}
return $this;
} // setMetaTitle()
/**
* Set the value of [meta_description] column.
*
* @param string $v new value
* @return \Thelia\Model\FolderI18n The current object (for fluent API support)
*/
public function setMetaDescription($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_description !== $v) {
$this->meta_description = $v;
$this->modifiedColumns[] = FolderI18nTableMap::META_DESCRIPTION;
}
return $this;
} // setMetaDescription()
/**
* Set the value of [meta_keywords] column.
*
* @param string $v new value
* @return \Thelia\Model\FolderI18n The current object (for fluent API support)
*/
public function setMetaKeywords($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_keywords !== $v) {
$this->meta_keywords = $v;
$this->modifiedColumns[] = FolderI18nTableMap::META_KEYWORDS;
}
return $this;
} // setMetaKeywords()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
* *
@@ -628,6 +742,15 @@ abstract class FolderI18n implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : FolderI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : FolderI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)];
$this->postscriptum = (null !== $col) ? (string) $col : null; $this->postscriptum = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : FolderI18nTableMap::translateFieldName('MetaTitle', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_title = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : FolderI18nTableMap::translateFieldName('MetaDescription', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_description = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : FolderI18nTableMap::translateFieldName('MetaKeywords', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_keywords = (null !== $col) ? (string) $col : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@@ -636,7 +759,7 @@ abstract class FolderI18n implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 6; // 6 = FolderI18nTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 9; // 9 = FolderI18nTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\FolderI18n object", 0, $e); throw new PropelException("Error populating \Thelia\Model\FolderI18n object", 0, $e);
@@ -875,6 +998,15 @@ abstract class FolderI18n implements ActiveRecordInterface
if ($this->isColumnModified(FolderI18nTableMap::POSTSCRIPTUM)) { if ($this->isColumnModified(FolderI18nTableMap::POSTSCRIPTUM)) {
$modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM';
} }
if ($this->isColumnModified(FolderI18nTableMap::META_TITLE)) {
$modifiedColumns[':p' . $index++] = 'META_TITLE';
}
if ($this->isColumnModified(FolderI18nTableMap::META_DESCRIPTION)) {
$modifiedColumns[':p' . $index++] = 'META_DESCRIPTION';
}
if ($this->isColumnModified(FolderI18nTableMap::META_KEYWORDS)) {
$modifiedColumns[':p' . $index++] = 'META_KEYWORDS';
}
$sql = sprintf( $sql = sprintf(
'INSERT INTO folder_i18n (%s) VALUES (%s)', 'INSERT INTO folder_i18n (%s) VALUES (%s)',
@@ -904,6 +1036,15 @@ abstract class FolderI18n implements ActiveRecordInterface
case 'POSTSCRIPTUM': case 'POSTSCRIPTUM':
$stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
break; break;
case 'META_TITLE':
$stmt->bindValue($identifier, $this->meta_title, PDO::PARAM_STR);
break;
case 'META_DESCRIPTION':
$stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR);
break;
case 'META_KEYWORDS':
$stmt->bindValue($identifier, $this->meta_keywords, PDO::PARAM_STR);
break;
} }
} }
$stmt->execute(); $stmt->execute();
@@ -977,6 +1118,15 @@ abstract class FolderI18n implements ActiveRecordInterface
case 5: case 5:
return $this->getPostscriptum(); return $this->getPostscriptum();
break; break;
case 6:
return $this->getMetaTitle();
break;
case 7:
return $this->getMetaDescription();
break;
case 8:
return $this->getMetaKeywords();
break;
default: default:
return null; return null;
break; break;
@@ -1012,6 +1162,9 @@ abstract class FolderI18n implements ActiveRecordInterface
$keys[3] => $this->getDescription(), $keys[3] => $this->getDescription(),
$keys[4] => $this->getChapo(), $keys[4] => $this->getChapo(),
$keys[5] => $this->getPostscriptum(), $keys[5] => $this->getPostscriptum(),
$keys[6] => $this->getMetaTitle(),
$keys[7] => $this->getMetaDescription(),
$keys[8] => $this->getMetaKeywords(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1074,6 +1227,15 @@ abstract class FolderI18n implements ActiveRecordInterface
case 5: case 5:
$this->setPostscriptum($value); $this->setPostscriptum($value);
break; break;
case 6:
$this->setMetaTitle($value);
break;
case 7:
$this->setMetaDescription($value);
break;
case 8:
$this->setMetaKeywords($value);
break;
} // switch() } // switch()
} }
@@ -1104,6 +1266,9 @@ abstract class FolderI18n implements ActiveRecordInterface
if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]); if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setMetaTitle($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setMetaDescription($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setMetaKeywords($arr[$keys[8]]);
} }
/** /**
@@ -1121,6 +1286,9 @@ abstract class FolderI18n implements ActiveRecordInterface
if ($this->isColumnModified(FolderI18nTableMap::DESCRIPTION)) $criteria->add(FolderI18nTableMap::DESCRIPTION, $this->description); if ($this->isColumnModified(FolderI18nTableMap::DESCRIPTION)) $criteria->add(FolderI18nTableMap::DESCRIPTION, $this->description);
if ($this->isColumnModified(FolderI18nTableMap::CHAPO)) $criteria->add(FolderI18nTableMap::CHAPO, $this->chapo); if ($this->isColumnModified(FolderI18nTableMap::CHAPO)) $criteria->add(FolderI18nTableMap::CHAPO, $this->chapo);
if ($this->isColumnModified(FolderI18nTableMap::POSTSCRIPTUM)) $criteria->add(FolderI18nTableMap::POSTSCRIPTUM, $this->postscriptum); if ($this->isColumnModified(FolderI18nTableMap::POSTSCRIPTUM)) $criteria->add(FolderI18nTableMap::POSTSCRIPTUM, $this->postscriptum);
if ($this->isColumnModified(FolderI18nTableMap::META_TITLE)) $criteria->add(FolderI18nTableMap::META_TITLE, $this->meta_title);
if ($this->isColumnModified(FolderI18nTableMap::META_DESCRIPTION)) $criteria->add(FolderI18nTableMap::META_DESCRIPTION, $this->meta_description);
if ($this->isColumnModified(FolderI18nTableMap::META_KEYWORDS)) $criteria->add(FolderI18nTableMap::META_KEYWORDS, $this->meta_keywords);
return $criteria; return $criteria;
} }
@@ -1197,6 +1365,9 @@ abstract class FolderI18n implements ActiveRecordInterface
$copyObj->setDescription($this->getDescription()); $copyObj->setDescription($this->getDescription());
$copyObj->setChapo($this->getChapo()); $copyObj->setChapo($this->getChapo());
$copyObj->setPostscriptum($this->getPostscriptum()); $copyObj->setPostscriptum($this->getPostscriptum());
$copyObj->setMetaTitle($this->getMetaTitle());
$copyObj->setMetaDescription($this->getMetaDescription());
$copyObj->setMetaKeywords($this->getMetaKeywords());
if ($makeNew) { if ($makeNew) {
$copyObj->setNew(true); $copyObj->setNew(true);
} }
@@ -1286,6 +1457,9 @@ abstract class FolderI18n implements ActiveRecordInterface
$this->description = null; $this->description = null;
$this->chapo = null; $this->chapo = null;
$this->postscriptum = null; $this->postscriptum = null;
$this->meta_title = null;
$this->meta_description = null;
$this->meta_keywords = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->clearAllReferences(); $this->clearAllReferences();
$this->applyDefaultValues(); $this->applyDefaultValues();

View File

@@ -27,6 +27,9 @@ use Thelia\Model\Map\FolderI18nTableMap;
* @method ChildFolderI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column * @method ChildFolderI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildFolderI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column * @method ChildFolderI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildFolderI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column * @method ChildFolderI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ChildFolderI18nQuery orderByMetaTitle($order = Criteria::ASC) Order by the meta_title column
* @method ChildFolderI18nQuery orderByMetaDescription($order = Criteria::ASC) Order by the meta_description column
* @method ChildFolderI18nQuery orderByMetaKeywords($order = Criteria::ASC) Order by the meta_keywords column
* *
* @method ChildFolderI18nQuery groupById() Group by the id column * @method ChildFolderI18nQuery groupById() Group by the id column
* @method ChildFolderI18nQuery groupByLocale() Group by the locale column * @method ChildFolderI18nQuery groupByLocale() Group by the locale column
@@ -34,6 +37,9 @@ use Thelia\Model\Map\FolderI18nTableMap;
* @method ChildFolderI18nQuery groupByDescription() Group by the description column * @method ChildFolderI18nQuery groupByDescription() Group by the description column
* @method ChildFolderI18nQuery groupByChapo() Group by the chapo column * @method ChildFolderI18nQuery groupByChapo() Group by the chapo column
* @method ChildFolderI18nQuery groupByPostscriptum() Group by the postscriptum column * @method ChildFolderI18nQuery groupByPostscriptum() Group by the postscriptum column
* @method ChildFolderI18nQuery groupByMetaTitle() Group by the meta_title column
* @method ChildFolderI18nQuery groupByMetaDescription() Group by the meta_description column
* @method ChildFolderI18nQuery groupByMetaKeywords() Group by the meta_keywords column
* *
* @method ChildFolderI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildFolderI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildFolderI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildFolderI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -52,6 +58,9 @@ use Thelia\Model\Map\FolderI18nTableMap;
* @method ChildFolderI18n findOneByDescription(string $description) Return the first ChildFolderI18n filtered by the description column * @method ChildFolderI18n findOneByDescription(string $description) Return the first ChildFolderI18n filtered by the description column
* @method ChildFolderI18n findOneByChapo(string $chapo) Return the first ChildFolderI18n filtered by the chapo column * @method ChildFolderI18n findOneByChapo(string $chapo) Return the first ChildFolderI18n filtered by the chapo column
* @method ChildFolderI18n findOneByPostscriptum(string $postscriptum) Return the first ChildFolderI18n filtered by the postscriptum column * @method ChildFolderI18n findOneByPostscriptum(string $postscriptum) Return the first ChildFolderI18n filtered by the postscriptum column
* @method ChildFolderI18n findOneByMetaTitle(string $meta_title) Return the first ChildFolderI18n filtered by the meta_title column
* @method ChildFolderI18n findOneByMetaDescription(string $meta_description) Return the first ChildFolderI18n filtered by the meta_description column
* @method ChildFolderI18n findOneByMetaKeywords(string $meta_keywords) Return the first ChildFolderI18n filtered by the meta_keywords column
* *
* @method array findById(int $id) Return ChildFolderI18n objects filtered by the id column * @method array findById(int $id) Return ChildFolderI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildFolderI18n objects filtered by the locale column * @method array findByLocale(string $locale) Return ChildFolderI18n objects filtered by the locale column
@@ -59,6 +68,9 @@ use Thelia\Model\Map\FolderI18nTableMap;
* @method array findByDescription(string $description) Return ChildFolderI18n objects filtered by the description column * @method array findByDescription(string $description) Return ChildFolderI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildFolderI18n objects filtered by the chapo column * @method array findByChapo(string $chapo) Return ChildFolderI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildFolderI18n objects filtered by the postscriptum column * @method array findByPostscriptum(string $postscriptum) Return ChildFolderI18n objects filtered by the postscriptum column
* @method array findByMetaTitle(string $meta_title) Return ChildFolderI18n objects filtered by the meta_title column
* @method array findByMetaDescription(string $meta_description) Return ChildFolderI18n objects filtered by the meta_description column
* @method array findByMetaKeywords(string $meta_keywords) Return ChildFolderI18n objects filtered by the meta_keywords column
* *
*/ */
abstract class FolderI18nQuery extends ModelCriteria abstract class FolderI18nQuery extends ModelCriteria
@@ -147,7 +159,7 @@ abstract class FolderI18nQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM folder_i18n WHERE ID = :p0 AND LOCALE = :p1'; $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORDS FROM folder_i18n WHERE ID = :p0 AND LOCALE = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -436,6 +448,93 @@ abstract class FolderI18nQuery extends ModelCriteria
return $this->addUsingAlias(FolderI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison); return $this->addUsingAlias(FolderI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
} }
/**
* Filter the query on the meta_title column
*
* Example usage:
* <code>
* $query->filterByMetaTitle('fooValue'); // WHERE meta_title = 'fooValue'
* $query->filterByMetaTitle('%fooValue%'); // WHERE meta_title LIKE '%fooValue%'
* </code>
*
* @param string $metaTitle The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFolderI18nQuery The current query, for fluid interface
*/
public function filterByMetaTitle($metaTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaTitle)) {
$metaTitle = str_replace('*', '%', $metaTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(FolderI18nTableMap::META_TITLE, $metaTitle, $comparison);
}
/**
* Filter the query on the meta_description column
*
* Example usage:
* <code>
* $query->filterByMetaDescription('fooValue'); // WHERE meta_description = 'fooValue'
* $query->filterByMetaDescription('%fooValue%'); // WHERE meta_description LIKE '%fooValue%'
* </code>
*
* @param string $metaDescription The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFolderI18nQuery The current query, for fluid interface
*/
public function filterByMetaDescription($metaDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaDescription)) {
$metaDescription = str_replace('*', '%', $metaDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(FolderI18nTableMap::META_DESCRIPTION, $metaDescription, $comparison);
}
/**
* Filter the query on the meta_keywords column
*
* Example usage:
* <code>
* $query->filterByMetaKeywords('fooValue'); // WHERE meta_keywords = 'fooValue'
* $query->filterByMetaKeywords('%fooValue%'); // WHERE meta_keywords LIKE '%fooValue%'
* </code>
*
* @param string $metaKeywords The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildFolderI18nQuery The current query, for fluid interface
*/
public function filterByMetaKeywords($metaKeywords = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaKeywords)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaKeywords)) {
$metaKeywords = str_replace('*', '%', $metaKeywords);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(FolderI18nTableMap::META_KEYWORDS, $metaKeywords, $comparison);
}
/** /**
* Filter the query by a related \Thelia\Model\Folder object * Filter the query by a related \Thelia\Model\Folder object
* *

File diff suppressed because it is too large Load Diff

View File

@@ -5916,24 +5916,24 @@ abstract class Product implements ActiveRecordInterface
/** /**
* Get the [meta_keyword] column value. * Get the [meta_keywords] column value.
* *
* @return string * @return string
*/ */
public function getMetaKeyword() public function getMetaKeywords()
{ {
return $this->getCurrentTranslation()->getMetaKeyword(); return $this->getCurrentTranslation()->getMetaKeywords();
} }
/** /**
* Set the value of [meta_keyword] column. * Set the value of [meta_keywords] column.
* *
* @param string $v new value * @param string $v new value
* @return \Thelia\Model\ProductI18n The current object (for fluent API support) * @return \Thelia\Model\ProductI18n The current object (for fluent API support)
*/ */
public function setMetaKeyword($v) public function setMetaKeywords($v)
{ $this->getCurrentTranslation()->setMetaKeyword($v); { $this->getCurrentTranslation()->setMetaKeywords($v);
return $this; return $this;
} }

View File

@@ -103,10 +103,10 @@ abstract class ProductI18n implements ActiveRecordInterface
protected $meta_description; protected $meta_description;
/** /**
* The value for the meta_keyword field. * The value for the meta_keywords field.
* @var string * @var string
*/ */
protected $meta_keyword; protected $meta_keywords;
/** /**
* @var Product * @var Product
@@ -481,14 +481,14 @@ abstract class ProductI18n implements ActiveRecordInterface
} }
/** /**
* Get the [meta_keyword] column value. * Get the [meta_keywords] column value.
* *
* @return string * @return string
*/ */
public function getMetaKeyword() public function getMetaKeywords()
{ {
return $this->meta_keyword; return $this->meta_keywords;
} }
/** /**
@@ -664,25 +664,25 @@ abstract class ProductI18n implements ActiveRecordInterface
} // setMetaDescription() } // setMetaDescription()
/** /**
* Set the value of [meta_keyword] column. * Set the value of [meta_keywords] column.
* *
* @param string $v new value * @param string $v new value
* @return \Thelia\Model\ProductI18n The current object (for fluent API support) * @return \Thelia\Model\ProductI18n The current object (for fluent API support)
*/ */
public function setMetaKeyword($v) public function setMetaKeywords($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (string) $v; $v = (string) $v;
} }
if ($this->meta_keyword !== $v) { if ($this->meta_keywords !== $v) {
$this->meta_keyword = $v; $this->meta_keywords = $v;
$this->modifiedColumns[] = ProductI18nTableMap::META_KEYWORD; $this->modifiedColumns[] = ProductI18nTableMap::META_KEYWORDS;
} }
return $this; return $this;
} // setMetaKeyword() } // setMetaKeywords()
/** /**
* Indicates whether the columns in this object are only set to default values. * Indicates whether the columns in this object are only set to default values.
@@ -749,8 +749,8 @@ abstract class ProductI18n implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductI18nTableMap::translateFieldName('MetaDescription', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductI18nTableMap::translateFieldName('MetaDescription', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_description = (null !== $col) ? (string) $col : null; $this->meta_description = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductI18nTableMap::translateFieldName('MetaKeyword', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductI18nTableMap::translateFieldName('MetaKeywords', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_keyword = (null !== $col) ? (string) $col : null; $this->meta_keywords = (null !== $col) ? (string) $col : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@@ -1004,8 +1004,8 @@ abstract class ProductI18n implements ActiveRecordInterface
if ($this->isColumnModified(ProductI18nTableMap::META_DESCRIPTION)) { if ($this->isColumnModified(ProductI18nTableMap::META_DESCRIPTION)) {
$modifiedColumns[':p' . $index++] = 'META_DESCRIPTION'; $modifiedColumns[':p' . $index++] = 'META_DESCRIPTION';
} }
if ($this->isColumnModified(ProductI18nTableMap::META_KEYWORD)) { if ($this->isColumnModified(ProductI18nTableMap::META_KEYWORDS)) {
$modifiedColumns[':p' . $index++] = 'META_KEYWORD'; $modifiedColumns[':p' . $index++] = 'META_KEYWORDS';
} }
$sql = sprintf( $sql = sprintf(
@@ -1042,8 +1042,8 @@ abstract class ProductI18n implements ActiveRecordInterface
case 'META_DESCRIPTION': case 'META_DESCRIPTION':
$stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR);
break; break;
case 'META_KEYWORD': case 'META_KEYWORDS':
$stmt->bindValue($identifier, $this->meta_keyword, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->meta_keywords, PDO::PARAM_STR);
break; break;
} }
} }
@@ -1125,7 +1125,7 @@ abstract class ProductI18n implements ActiveRecordInterface
return $this->getMetaDescription(); return $this->getMetaDescription();
break; break;
case 8: case 8:
return $this->getMetaKeyword(); return $this->getMetaKeywords();
break; break;
default: default:
return null; return null;
@@ -1164,7 +1164,7 @@ abstract class ProductI18n implements ActiveRecordInterface
$keys[5] => $this->getPostscriptum(), $keys[5] => $this->getPostscriptum(),
$keys[6] => $this->getMetaTitle(), $keys[6] => $this->getMetaTitle(),
$keys[7] => $this->getMetaDescription(), $keys[7] => $this->getMetaDescription(),
$keys[8] => $this->getMetaKeyword(), $keys[8] => $this->getMetaKeywords(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) { foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1234,7 +1234,7 @@ abstract class ProductI18n implements ActiveRecordInterface
$this->setMetaDescription($value); $this->setMetaDescription($value);
break; break;
case 8: case 8:
$this->setMetaKeyword($value); $this->setMetaKeywords($value);
break; break;
} // switch() } // switch()
} }
@@ -1268,7 +1268,7 @@ abstract class ProductI18n implements ActiveRecordInterface
if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]); if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setMetaTitle($arr[$keys[6]]); if (array_key_exists($keys[6], $arr)) $this->setMetaTitle($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setMetaDescription($arr[$keys[7]]); if (array_key_exists($keys[7], $arr)) $this->setMetaDescription($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setMetaKeyword($arr[$keys[8]]); if (array_key_exists($keys[8], $arr)) $this->setMetaKeywords($arr[$keys[8]]);
} }
/** /**
@@ -1288,7 +1288,7 @@ abstract class ProductI18n implements ActiveRecordInterface
if ($this->isColumnModified(ProductI18nTableMap::POSTSCRIPTUM)) $criteria->add(ProductI18nTableMap::POSTSCRIPTUM, $this->postscriptum); if ($this->isColumnModified(ProductI18nTableMap::POSTSCRIPTUM)) $criteria->add(ProductI18nTableMap::POSTSCRIPTUM, $this->postscriptum);
if ($this->isColumnModified(ProductI18nTableMap::META_TITLE)) $criteria->add(ProductI18nTableMap::META_TITLE, $this->meta_title); if ($this->isColumnModified(ProductI18nTableMap::META_TITLE)) $criteria->add(ProductI18nTableMap::META_TITLE, $this->meta_title);
if ($this->isColumnModified(ProductI18nTableMap::META_DESCRIPTION)) $criteria->add(ProductI18nTableMap::META_DESCRIPTION, $this->meta_description); if ($this->isColumnModified(ProductI18nTableMap::META_DESCRIPTION)) $criteria->add(ProductI18nTableMap::META_DESCRIPTION, $this->meta_description);
if ($this->isColumnModified(ProductI18nTableMap::META_KEYWORD)) $criteria->add(ProductI18nTableMap::META_KEYWORD, $this->meta_keyword); if ($this->isColumnModified(ProductI18nTableMap::META_KEYWORDS)) $criteria->add(ProductI18nTableMap::META_KEYWORDS, $this->meta_keywords);
return $criteria; return $criteria;
} }
@@ -1367,7 +1367,7 @@ abstract class ProductI18n implements ActiveRecordInterface
$copyObj->setPostscriptum($this->getPostscriptum()); $copyObj->setPostscriptum($this->getPostscriptum());
$copyObj->setMetaTitle($this->getMetaTitle()); $copyObj->setMetaTitle($this->getMetaTitle());
$copyObj->setMetaDescription($this->getMetaDescription()); $copyObj->setMetaDescription($this->getMetaDescription());
$copyObj->setMetaKeyword($this->getMetaKeyword()); $copyObj->setMetaKeywords($this->getMetaKeywords());
if ($makeNew) { if ($makeNew) {
$copyObj->setNew(true); $copyObj->setNew(true);
} }
@@ -1459,7 +1459,7 @@ abstract class ProductI18n implements ActiveRecordInterface
$this->postscriptum = null; $this->postscriptum = null;
$this->meta_title = null; $this->meta_title = null;
$this->meta_description = null; $this->meta_description = null;
$this->meta_keyword = null; $this->meta_keywords = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
$this->clearAllReferences(); $this->clearAllReferences();
$this->applyDefaultValues(); $this->applyDefaultValues();

View File

@@ -29,7 +29,7 @@ use Thelia\Model\Map\ProductI18nTableMap;
* @method ChildProductI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column * @method ChildProductI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ChildProductI18nQuery orderByMetaTitle($order = Criteria::ASC) Order by the meta_title column * @method ChildProductI18nQuery orderByMetaTitle($order = Criteria::ASC) Order by the meta_title column
* @method ChildProductI18nQuery orderByMetaDescription($order = Criteria::ASC) Order by the meta_description column * @method ChildProductI18nQuery orderByMetaDescription($order = Criteria::ASC) Order by the meta_description column
* @method ChildProductI18nQuery orderByMetaKeyword($order = Criteria::ASC) Order by the meta_keyword column * @method ChildProductI18nQuery orderByMetaKeywords($order = Criteria::ASC) Order by the meta_keywords column
* *
* @method ChildProductI18nQuery groupById() Group by the id column * @method ChildProductI18nQuery groupById() Group by the id column
* @method ChildProductI18nQuery groupByLocale() Group by the locale column * @method ChildProductI18nQuery groupByLocale() Group by the locale column
@@ -39,7 +39,7 @@ use Thelia\Model\Map\ProductI18nTableMap;
* @method ChildProductI18nQuery groupByPostscriptum() Group by the postscriptum column * @method ChildProductI18nQuery groupByPostscriptum() Group by the postscriptum column
* @method ChildProductI18nQuery groupByMetaTitle() Group by the meta_title column * @method ChildProductI18nQuery groupByMetaTitle() Group by the meta_title column
* @method ChildProductI18nQuery groupByMetaDescription() Group by the meta_description column * @method ChildProductI18nQuery groupByMetaDescription() Group by the meta_description column
* @method ChildProductI18nQuery groupByMetaKeyword() Group by the meta_keyword column * @method ChildProductI18nQuery groupByMetaKeywords() Group by the meta_keywords column
* *
* @method ChildProductI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildProductI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildProductI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildProductI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -60,7 +60,7 @@ use Thelia\Model\Map\ProductI18nTableMap;
* @method ChildProductI18n findOneByPostscriptum(string $postscriptum) Return the first ChildProductI18n filtered by the postscriptum column * @method ChildProductI18n findOneByPostscriptum(string $postscriptum) Return the first ChildProductI18n filtered by the postscriptum column
* @method ChildProductI18n findOneByMetaTitle(string $meta_title) Return the first ChildProductI18n filtered by the meta_title column * @method ChildProductI18n findOneByMetaTitle(string $meta_title) Return the first ChildProductI18n filtered by the meta_title column
* @method ChildProductI18n findOneByMetaDescription(string $meta_description) Return the first ChildProductI18n filtered by the meta_description column * @method ChildProductI18n findOneByMetaDescription(string $meta_description) Return the first ChildProductI18n filtered by the meta_description column
* @method ChildProductI18n findOneByMetaKeyword(string $meta_keyword) Return the first ChildProductI18n filtered by the meta_keyword column * @method ChildProductI18n findOneByMetaKeywords(string $meta_keywords) Return the first ChildProductI18n filtered by the meta_keywords column
* *
* @method array findById(int $id) Return ChildProductI18n objects filtered by the id column * @method array findById(int $id) Return ChildProductI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildProductI18n objects filtered by the locale column * @method array findByLocale(string $locale) Return ChildProductI18n objects filtered by the locale column
@@ -70,7 +70,7 @@ use Thelia\Model\Map\ProductI18nTableMap;
* @method array findByPostscriptum(string $postscriptum) Return ChildProductI18n objects filtered by the postscriptum column * @method array findByPostscriptum(string $postscriptum) Return ChildProductI18n objects filtered by the postscriptum column
* @method array findByMetaTitle(string $meta_title) Return ChildProductI18n objects filtered by the meta_title column * @method array findByMetaTitle(string $meta_title) Return ChildProductI18n objects filtered by the meta_title column
* @method array findByMetaDescription(string $meta_description) Return ChildProductI18n objects filtered by the meta_description column * @method array findByMetaDescription(string $meta_description) Return ChildProductI18n objects filtered by the meta_description column
* @method array findByMetaKeyword(string $meta_keyword) Return ChildProductI18n objects filtered by the meta_keyword column * @method array findByMetaKeywords(string $meta_keywords) Return ChildProductI18n objects filtered by the meta_keywords column
* *
*/ */
abstract class ProductI18nQuery extends ModelCriteria abstract class ProductI18nQuery extends ModelCriteria
@@ -159,7 +159,7 @@ abstract class ProductI18nQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORD FROM product_i18n WHERE ID = :p0 AND LOCALE = :p1'; $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORDS FROM product_i18n WHERE ID = :p0 AND LOCALE = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -507,32 +507,32 @@ abstract class ProductI18nQuery extends ModelCriteria
} }
/** /**
* Filter the query on the meta_keyword column * Filter the query on the meta_keywords column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByMetaKeyword('fooValue'); // WHERE meta_keyword = 'fooValue' * $query->filterByMetaKeywords('fooValue'); // WHERE meta_keywords = 'fooValue'
* $query->filterByMetaKeyword('%fooValue%'); // WHERE meta_keyword LIKE '%fooValue%' * $query->filterByMetaKeywords('%fooValue%'); // WHERE meta_keywords LIKE '%fooValue%'
* </code> * </code>
* *
* @param string $metaKeyword The value to use as filter. * @param string $metaKeywords The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE) * Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildProductI18nQuery The current query, for fluid interface * @return ChildProductI18nQuery The current query, for fluid interface
*/ */
public function filterByMetaKeyword($metaKeyword = null, $comparison = null) public function filterByMetaKeywords($metaKeywords = null, $comparison = null)
{ {
if (null === $comparison) { if (null === $comparison) {
if (is_array($metaKeyword)) { if (is_array($metaKeywords)) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaKeyword)) { } elseif (preg_match('/[\%\*]/', $metaKeywords)) {
$metaKeyword = str_replace('*', '%', $metaKeyword); $metaKeywords = str_replace('*', '%', $metaKeywords);
$comparison = Criteria::LIKE; $comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(ProductI18nTableMap::META_KEYWORD, $metaKeyword, $comparison); return $this->addUsingAlias(ProductI18nTableMap::META_KEYWORDS, $metaKeywords, $comparison);
} }
/** /**

View File

@@ -106,7 +106,11 @@ class Category extends BaseCategory
public function preDelete(ConnectionInterface $con = null) public function preDelete(ConnectionInterface $con = null)
{ {
$this->dispatchEvent(TheliaEvents::BEFORE_DELETECATEGORY, new CategoryEvent($this)); $this->dispatchEvent(TheliaEvents::BEFORE_DELETECATEGORY, new CategoryEvent($this));
$this->reorderBeforeDelete(); $this->reorderBeforeDelete(
array(
"parent" => $this->getParent(),
)
);
return true; return true;
} }

View File

@@ -7,6 +7,7 @@ use Propel\Runtime\Connection\ConnectionInterface;
class CategoryDocument extends BaseCategoryDocument class CategoryDocument extends BaseCategoryDocument
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait; use \Thelia\Model\Tools\PositionManagementTrait;
/** /**
@@ -49,4 +50,14 @@ class CategoryDocument extends BaseCategoryDocument
{ {
return $this->getCategoryId(); return $this->getCategoryId();
} }
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"category_id" => $this->getCategoryId(),
)
);
return true;
}
} }

View File

@@ -9,6 +9,7 @@ use Propel\Runtime\Connection\ConnectionInterface;
class CategoryImage extends BaseCategoryImage class CategoryImage extends BaseCategoryImage
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait; use \Thelia\Model\Tools\PositionManagementTrait;
/** /**
@@ -52,4 +53,13 @@ class CategoryImage extends BaseCategoryImage
return $this->getCategoryId(); return $this->getCategoryId();
} }
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"category_id" => $this->getCategoryId(),
)
);
return true;
}
} }

View File

@@ -7,6 +7,7 @@ use Propel\Runtime\Connection\ConnectionInterface;
class ContentDocument extends BaseContentDocument class ContentDocument extends BaseContentDocument
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait; use \Thelia\Model\Tools\PositionManagementTrait;
/** /**
@@ -49,4 +50,14 @@ class ContentDocument extends BaseContentDocument
{ {
return $this->getContentId(); return $this->getContentId();
} }
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"content_id" => $this->getContentId(),
)
);
return true;
}
} }

View File

@@ -7,6 +7,7 @@ use Propel\Runtime\Connection\ConnectionInterface;
class ContentImage extends BaseContentImage class ContentImage extends BaseContentImage
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait; use \Thelia\Model\Tools\PositionManagementTrait;
/** /**
@@ -49,4 +50,14 @@ class ContentImage extends BaseContentImage
{ {
return $this->getContentId(); return $this->getContentId();
} }
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"content_id" => $this->getContentId(),
)
);
return true;
}
} }

View File

@@ -94,7 +94,11 @@ class Folder extends BaseFolder
public function preDelete(ConnectionInterface $con = null) public function preDelete(ConnectionInterface $con = null)
{ {
$this->dispatchEvent(TheliaEvents::BEFORE_DELETEFOLDER, new FolderEvent($this)); $this->dispatchEvent(TheliaEvents::BEFORE_DELETEFOLDER, new FolderEvent($this));
$this->reorderBeforeDelete(); $this->reorderBeforeDelete(
array(
"parent" => $this->getParent(),
)
);
return true; return true;
} }

View File

@@ -7,6 +7,7 @@ use Propel\Runtime\Connection\ConnectionInterface;
class FolderDocument extends BaseFolderDocument class FolderDocument extends BaseFolderDocument
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait; use \Thelia\Model\Tools\PositionManagementTrait;
/** /**
@@ -49,4 +50,14 @@ class FolderDocument extends BaseFolderDocument
{ {
return $this->getFolderId(); return $this->getFolderId();
} }
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"folder_id" => $this->getFolderId(),
)
);
return true;
}
} }

View File

@@ -7,6 +7,7 @@ use Propel\Runtime\Connection\ConnectionInterface;
class FolderImage extends BaseFolderImage class FolderImage extends BaseFolderImage
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait; use \Thelia\Model\Tools\PositionManagementTrait;
/** /**
@@ -49,4 +50,14 @@ class FolderImage extends BaseFolderImage
{ {
return $this->getFolderId(); return $this->getFolderId();
} }
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"folder_id" => $this->getFolderId(),
)
);
return true;
}
} }

View File

@@ -57,7 +57,7 @@ class CategoryI18nTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 6; const NUM_COLUMNS = 9;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class CategoryI18nTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 6; const NUM_HYDRATE_COLUMNS = 9;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -99,6 +99,21 @@ class CategoryI18nTableMap extends TableMap
*/ */
const POSTSCRIPTUM = 'category_i18n.POSTSCRIPTUM'; const POSTSCRIPTUM = 'category_i18n.POSTSCRIPTUM';
/**
* the column name for the META_TITLE field
*/
const META_TITLE = 'category_i18n.META_TITLE';
/**
* the column name for the META_DESCRIPTION field
*/
const META_DESCRIPTION = 'category_i18n.META_DESCRIPTION';
/**
* the column name for the META_KEYWORDS field
*/
const META_KEYWORDS = 'category_i18n.META_KEYWORDS';
/** /**
* The default string format for model objects of the related table * The default string format for model objects of the related table
*/ */
@@ -111,12 +126,12 @@ class CategoryI18nTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ), self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', 'MetaTitle', 'MetaDescription', 'MetaKeywords', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ), self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'metaTitle', 'metaDescription', 'metaKeywords', ),
self::TYPE_COLNAME => array(CategoryI18nTableMap::ID, CategoryI18nTableMap::LOCALE, CategoryI18nTableMap::TITLE, CategoryI18nTableMap::DESCRIPTION, CategoryI18nTableMap::CHAPO, CategoryI18nTableMap::POSTSCRIPTUM, ), self::TYPE_COLNAME => array(CategoryI18nTableMap::ID, CategoryI18nTableMap::LOCALE, CategoryI18nTableMap::TITLE, CategoryI18nTableMap::DESCRIPTION, CategoryI18nTableMap::CHAPO, CategoryI18nTableMap::POSTSCRIPTUM, CategoryI18nTableMap::META_TITLE, CategoryI18nTableMap::META_DESCRIPTION, CategoryI18nTableMap::META_KEYWORDS, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ), self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS', ),
self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ), self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'meta_title', 'meta_description', 'meta_keywords', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
); );
/** /**
@@ -126,12 +141,12 @@ class CategoryI18nTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ), self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, 'MetaTitle' => 6, 'MetaDescription' => 7, 'MetaKeywords' => 8, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'metaTitle' => 6, 'metaDescription' => 7, 'metaKeywords' => 8, ),
self::TYPE_COLNAME => array(CategoryI18nTableMap::ID => 0, CategoryI18nTableMap::LOCALE => 1, CategoryI18nTableMap::TITLE => 2, CategoryI18nTableMap::DESCRIPTION => 3, CategoryI18nTableMap::CHAPO => 4, CategoryI18nTableMap::POSTSCRIPTUM => 5, ), self::TYPE_COLNAME => array(CategoryI18nTableMap::ID => 0, CategoryI18nTableMap::LOCALE => 1, CategoryI18nTableMap::TITLE => 2, CategoryI18nTableMap::DESCRIPTION => 3, CategoryI18nTableMap::CHAPO => 4, CategoryI18nTableMap::POSTSCRIPTUM => 5, CategoryI18nTableMap::META_TITLE => 6, CategoryI18nTableMap::META_DESCRIPTION => 7, CategoryI18nTableMap::META_KEYWORDS => 8, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, 'META_TITLE' => 6, 'META_DESCRIPTION' => 7, 'META_KEYWORDS' => 8, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ), self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'meta_title' => 6, 'meta_description' => 7, 'meta_keywords' => 8, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
); );
/** /**
@@ -156,6 +171,9 @@ class CategoryI18nTableMap extends TableMap
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
$this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null); $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_TITLE', 'MetaTitle', 'VARCHAR', false, 255, null);
$this->addColumn('META_DESCRIPTION', 'MetaDescription', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_KEYWORDS', 'MetaKeywords', 'LONGVARCHAR', false, null, null);
} // initialize() } // initialize()
/** /**
@@ -359,6 +377,9 @@ class CategoryI18nTableMap extends TableMap
$criteria->addSelectColumn(CategoryI18nTableMap::DESCRIPTION); $criteria->addSelectColumn(CategoryI18nTableMap::DESCRIPTION);
$criteria->addSelectColumn(CategoryI18nTableMap::CHAPO); $criteria->addSelectColumn(CategoryI18nTableMap::CHAPO);
$criteria->addSelectColumn(CategoryI18nTableMap::POSTSCRIPTUM); $criteria->addSelectColumn(CategoryI18nTableMap::POSTSCRIPTUM);
$criteria->addSelectColumn(CategoryI18nTableMap::META_TITLE);
$criteria->addSelectColumn(CategoryI18nTableMap::META_DESCRIPTION);
$criteria->addSelectColumn(CategoryI18nTableMap::META_KEYWORDS);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE'); $criteria->addSelectColumn($alias . '.LOCALE');
@@ -366,6 +387,9 @@ class CategoryI18nTableMap extends TableMap
$criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.CHAPO'); $criteria->addSelectColumn($alias . '.CHAPO');
$criteria->addSelectColumn($alias . '.POSTSCRIPTUM'); $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
$criteria->addSelectColumn($alias . '.META_TITLE');
$criteria->addSelectColumn($alias . '.META_DESCRIPTION');
$criteria->addSelectColumn($alias . '.META_KEYWORDS');
} }
} }

View File

@@ -208,7 +208,7 @@ class CategoryTableMap extends TableMap
public function getBehaviors() public function getBehaviors()
{ {
return array( return array(
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ), 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
); );

View File

@@ -57,7 +57,7 @@ class ContentI18nTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 6; const NUM_COLUMNS = 9;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ContentI18nTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 6; const NUM_HYDRATE_COLUMNS = 9;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -99,6 +99,21 @@ class ContentI18nTableMap extends TableMap
*/ */
const POSTSCRIPTUM = 'content_i18n.POSTSCRIPTUM'; const POSTSCRIPTUM = 'content_i18n.POSTSCRIPTUM';
/**
* the column name for the META_TITLE field
*/
const META_TITLE = 'content_i18n.META_TITLE';
/**
* the column name for the META_DESCRIPTION field
*/
const META_DESCRIPTION = 'content_i18n.META_DESCRIPTION';
/**
* the column name for the META_KEYWORDS field
*/
const META_KEYWORDS = 'content_i18n.META_KEYWORDS';
/** /**
* The default string format for model objects of the related table * The default string format for model objects of the related table
*/ */
@@ -111,12 +126,12 @@ class ContentI18nTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ), self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', 'MetaTitle', 'MetaDescription', 'MetaKeywords', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ), self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'metaTitle', 'metaDescription', 'metaKeywords', ),
self::TYPE_COLNAME => array(ContentI18nTableMap::ID, ContentI18nTableMap::LOCALE, ContentI18nTableMap::TITLE, ContentI18nTableMap::DESCRIPTION, ContentI18nTableMap::CHAPO, ContentI18nTableMap::POSTSCRIPTUM, ), self::TYPE_COLNAME => array(ContentI18nTableMap::ID, ContentI18nTableMap::LOCALE, ContentI18nTableMap::TITLE, ContentI18nTableMap::DESCRIPTION, ContentI18nTableMap::CHAPO, ContentI18nTableMap::POSTSCRIPTUM, ContentI18nTableMap::META_TITLE, ContentI18nTableMap::META_DESCRIPTION, ContentI18nTableMap::META_KEYWORDS, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ), self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS', ),
self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ), self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'meta_title', 'meta_description', 'meta_keywords', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
); );
/** /**
@@ -126,12 +141,12 @@ class ContentI18nTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ), self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, 'MetaTitle' => 6, 'MetaDescription' => 7, 'MetaKeywords' => 8, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'metaTitle' => 6, 'metaDescription' => 7, 'metaKeywords' => 8, ),
self::TYPE_COLNAME => array(ContentI18nTableMap::ID => 0, ContentI18nTableMap::LOCALE => 1, ContentI18nTableMap::TITLE => 2, ContentI18nTableMap::DESCRIPTION => 3, ContentI18nTableMap::CHAPO => 4, ContentI18nTableMap::POSTSCRIPTUM => 5, ), self::TYPE_COLNAME => array(ContentI18nTableMap::ID => 0, ContentI18nTableMap::LOCALE => 1, ContentI18nTableMap::TITLE => 2, ContentI18nTableMap::DESCRIPTION => 3, ContentI18nTableMap::CHAPO => 4, ContentI18nTableMap::POSTSCRIPTUM => 5, ContentI18nTableMap::META_TITLE => 6, ContentI18nTableMap::META_DESCRIPTION => 7, ContentI18nTableMap::META_KEYWORDS => 8, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, 'META_TITLE' => 6, 'META_DESCRIPTION' => 7, 'META_KEYWORDS' => 8, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ), self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'meta_title' => 6, 'meta_description' => 7, 'meta_keywords' => 8, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
); );
/** /**
@@ -156,6 +171,9 @@ class ContentI18nTableMap extends TableMap
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
$this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null); $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_TITLE', 'MetaTitle', 'VARCHAR', false, 255, null);
$this->addColumn('META_DESCRIPTION', 'MetaDescription', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_KEYWORDS', 'MetaKeywords', 'LONGVARCHAR', false, null, null);
} // initialize() } // initialize()
/** /**
@@ -359,6 +377,9 @@ class ContentI18nTableMap extends TableMap
$criteria->addSelectColumn(ContentI18nTableMap::DESCRIPTION); $criteria->addSelectColumn(ContentI18nTableMap::DESCRIPTION);
$criteria->addSelectColumn(ContentI18nTableMap::CHAPO); $criteria->addSelectColumn(ContentI18nTableMap::CHAPO);
$criteria->addSelectColumn(ContentI18nTableMap::POSTSCRIPTUM); $criteria->addSelectColumn(ContentI18nTableMap::POSTSCRIPTUM);
$criteria->addSelectColumn(ContentI18nTableMap::META_TITLE);
$criteria->addSelectColumn(ContentI18nTableMap::META_DESCRIPTION);
$criteria->addSelectColumn(ContentI18nTableMap::META_KEYWORDS);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE'); $criteria->addSelectColumn($alias . '.LOCALE');
@@ -366,6 +387,9 @@ class ContentI18nTableMap extends TableMap
$criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.CHAPO'); $criteria->addSelectColumn($alias . '.CHAPO');
$criteria->addSelectColumn($alias . '.POSTSCRIPTUM'); $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
$criteria->addSelectColumn($alias . '.META_TITLE');
$criteria->addSelectColumn($alias . '.META_DESCRIPTION');
$criteria->addSelectColumn($alias . '.META_KEYWORDS');
} }
} }

View File

@@ -204,7 +204,7 @@ class ContentTableMap extends TableMap
{ {
return array( return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ), 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
); );
} // getBehaviors() } // getBehaviors()

View File

@@ -57,7 +57,7 @@ class FolderI18nTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 6; const NUM_COLUMNS = 9;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class FolderI18nTableMap extends TableMap
/** /**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/ */
const NUM_HYDRATE_COLUMNS = 6; const NUM_HYDRATE_COLUMNS = 9;
/** /**
* the column name for the ID field * the column name for the ID field
@@ -99,6 +99,21 @@ class FolderI18nTableMap extends TableMap
*/ */
const POSTSCRIPTUM = 'folder_i18n.POSTSCRIPTUM'; const POSTSCRIPTUM = 'folder_i18n.POSTSCRIPTUM';
/**
* the column name for the META_TITLE field
*/
const META_TITLE = 'folder_i18n.META_TITLE';
/**
* the column name for the META_DESCRIPTION field
*/
const META_DESCRIPTION = 'folder_i18n.META_DESCRIPTION';
/**
* the column name for the META_KEYWORDS field
*/
const META_KEYWORDS = 'folder_i18n.META_KEYWORDS';
/** /**
* The default string format for model objects of the related table * The default string format for model objects of the related table
*/ */
@@ -111,12 +126,12 @@ class FolderI18nTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ), self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', 'MetaTitle', 'MetaDescription', 'MetaKeywords', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ), self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'metaTitle', 'metaDescription', 'metaKeywords', ),
self::TYPE_COLNAME => array(FolderI18nTableMap::ID, FolderI18nTableMap::LOCALE, FolderI18nTableMap::TITLE, FolderI18nTableMap::DESCRIPTION, FolderI18nTableMap::CHAPO, FolderI18nTableMap::POSTSCRIPTUM, ), self::TYPE_COLNAME => array(FolderI18nTableMap::ID, FolderI18nTableMap::LOCALE, FolderI18nTableMap::TITLE, FolderI18nTableMap::DESCRIPTION, FolderI18nTableMap::CHAPO, FolderI18nTableMap::POSTSCRIPTUM, FolderI18nTableMap::META_TITLE, FolderI18nTableMap::META_DESCRIPTION, FolderI18nTableMap::META_KEYWORDS, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ), self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS', ),
self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ), self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'meta_title', 'meta_description', 'meta_keywords', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
); );
/** /**
@@ -126,12 +141,12 @@ class FolderI18nTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ), self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, 'MetaTitle' => 6, 'MetaDescription' => 7, 'MetaKeywords' => 8, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'metaTitle' => 6, 'metaDescription' => 7, 'metaKeywords' => 8, ),
self::TYPE_COLNAME => array(FolderI18nTableMap::ID => 0, FolderI18nTableMap::LOCALE => 1, FolderI18nTableMap::TITLE => 2, FolderI18nTableMap::DESCRIPTION => 3, FolderI18nTableMap::CHAPO => 4, FolderI18nTableMap::POSTSCRIPTUM => 5, ), self::TYPE_COLNAME => array(FolderI18nTableMap::ID => 0, FolderI18nTableMap::LOCALE => 1, FolderI18nTableMap::TITLE => 2, FolderI18nTableMap::DESCRIPTION => 3, FolderI18nTableMap::CHAPO => 4, FolderI18nTableMap::POSTSCRIPTUM => 5, FolderI18nTableMap::META_TITLE => 6, FolderI18nTableMap::META_DESCRIPTION => 7, FolderI18nTableMap::META_KEYWORDS => 8, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, 'META_TITLE' => 6, 'META_DESCRIPTION' => 7, 'META_KEYWORDS' => 8, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ), self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'meta_title' => 6, 'meta_description' => 7, 'meta_keywords' => 8, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
); );
/** /**
@@ -156,6 +171,9 @@ class FolderI18nTableMap extends TableMap
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
$this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null); $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_TITLE', 'MetaTitle', 'VARCHAR', false, 255, null);
$this->addColumn('META_DESCRIPTION', 'MetaDescription', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_KEYWORDS', 'MetaKeywords', 'LONGVARCHAR', false, null, null);
} // initialize() } // initialize()
/** /**
@@ -359,6 +377,9 @@ class FolderI18nTableMap extends TableMap
$criteria->addSelectColumn(FolderI18nTableMap::DESCRIPTION); $criteria->addSelectColumn(FolderI18nTableMap::DESCRIPTION);
$criteria->addSelectColumn(FolderI18nTableMap::CHAPO); $criteria->addSelectColumn(FolderI18nTableMap::CHAPO);
$criteria->addSelectColumn(FolderI18nTableMap::POSTSCRIPTUM); $criteria->addSelectColumn(FolderI18nTableMap::POSTSCRIPTUM);
$criteria->addSelectColumn(FolderI18nTableMap::META_TITLE);
$criteria->addSelectColumn(FolderI18nTableMap::META_DESCRIPTION);
$criteria->addSelectColumn(FolderI18nTableMap::META_KEYWORDS);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE'); $criteria->addSelectColumn($alias . '.LOCALE');
@@ -366,6 +387,9 @@ class FolderI18nTableMap extends TableMap
$criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.CHAPO'); $criteria->addSelectColumn($alias . '.CHAPO');
$criteria->addSelectColumn($alias . '.POSTSCRIPTUM'); $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
$criteria->addSelectColumn($alias . '.META_TITLE');
$criteria->addSelectColumn($alias . '.META_DESCRIPTION');
$criteria->addSelectColumn($alias . '.META_KEYWORDS');
} }
} }

View File

@@ -208,7 +208,7 @@ class FolderTableMap extends TableMap
{ {
return array( return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ), 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
); );
} // getBehaviors() } // getBehaviors()

View File

@@ -110,9 +110,9 @@ class ProductI18nTableMap extends TableMap
const META_DESCRIPTION = 'product_i18n.META_DESCRIPTION'; const META_DESCRIPTION = 'product_i18n.META_DESCRIPTION';
/** /**
* the column name for the META_KEYWORD field * the column name for the META_KEYWORDS field
*/ */
const META_KEYWORD = 'product_i18n.META_KEYWORD'; const META_KEYWORDS = 'product_i18n.META_KEYWORDS';
/** /**
* The default string format for model objects of the related table * The default string format for model objects of the related table
@@ -126,11 +126,11 @@ class ProductI18nTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', 'MetaTitle', 'MetaDescription', 'MetaKeyword', ), self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', 'MetaTitle', 'MetaDescription', 'MetaKeywords', ),
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'metaTitle', 'metaDescription', 'metaKeyword', ), self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'metaTitle', 'metaDescription', 'metaKeywords', ),
self::TYPE_COLNAME => array(ProductI18nTableMap::ID, ProductI18nTableMap::LOCALE, ProductI18nTableMap::TITLE, ProductI18nTableMap::DESCRIPTION, ProductI18nTableMap::CHAPO, ProductI18nTableMap::POSTSCRIPTUM, ProductI18nTableMap::META_TITLE, ProductI18nTableMap::META_DESCRIPTION, ProductI18nTableMap::META_KEYWORD, ), self::TYPE_COLNAME => array(ProductI18nTableMap::ID, ProductI18nTableMap::LOCALE, ProductI18nTableMap::TITLE, ProductI18nTableMap::DESCRIPTION, ProductI18nTableMap::CHAPO, ProductI18nTableMap::POSTSCRIPTUM, ProductI18nTableMap::META_TITLE, ProductI18nTableMap::META_DESCRIPTION, ProductI18nTableMap::META_KEYWORDS, ),
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORD', ), self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS', ),
self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'meta_title', 'meta_description', 'meta_keyword', ), self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'meta_title', 'meta_description', 'meta_keywords', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
); );
@@ -141,11 +141,11 @@ class ProductI18nTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, 'MetaTitle' => 6, 'MetaDescription' => 7, 'MetaKeyword' => 8, ), self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, 'MetaTitle' => 6, 'MetaDescription' => 7, 'MetaKeywords' => 8, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'metaTitle' => 6, 'metaDescription' => 7, 'metaKeyword' => 8, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'metaTitle' => 6, 'metaDescription' => 7, 'metaKeywords' => 8, ),
self::TYPE_COLNAME => array(ProductI18nTableMap::ID => 0, ProductI18nTableMap::LOCALE => 1, ProductI18nTableMap::TITLE => 2, ProductI18nTableMap::DESCRIPTION => 3, ProductI18nTableMap::CHAPO => 4, ProductI18nTableMap::POSTSCRIPTUM => 5, ProductI18nTableMap::META_TITLE => 6, ProductI18nTableMap::META_DESCRIPTION => 7, ProductI18nTableMap::META_KEYWORD => 8, ), self::TYPE_COLNAME => array(ProductI18nTableMap::ID => 0, ProductI18nTableMap::LOCALE => 1, ProductI18nTableMap::TITLE => 2, ProductI18nTableMap::DESCRIPTION => 3, ProductI18nTableMap::CHAPO => 4, ProductI18nTableMap::POSTSCRIPTUM => 5, ProductI18nTableMap::META_TITLE => 6, ProductI18nTableMap::META_DESCRIPTION => 7, ProductI18nTableMap::META_KEYWORDS => 8, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, 'META_TITLE' => 6, 'META_DESCRIPTION' => 7, 'META_KEYWORD' => 8, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, 'META_TITLE' => 6, 'META_DESCRIPTION' => 7, 'META_KEYWORDS' => 8, ),
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'meta_title' => 6, 'meta_description' => 7, 'meta_keyword' => 8, ), self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'meta_title' => 6, 'meta_description' => 7, 'meta_keywords' => 8, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
); );
@@ -173,7 +173,7 @@ class ProductI18nTableMap extends TableMap
$this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null); $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_TITLE', 'MetaTitle', 'VARCHAR', false, 255, null); $this->addColumn('META_TITLE', 'MetaTitle', 'VARCHAR', false, 255, null);
$this->addColumn('META_DESCRIPTION', 'MetaDescription', 'LONGVARCHAR', false, null, null); $this->addColumn('META_DESCRIPTION', 'MetaDescription', 'LONGVARCHAR', false, null, null);
$this->addColumn('META_KEYWORD', 'MetaKeyword', 'LONGVARCHAR', false, null, null); $this->addColumn('META_KEYWORDS', 'MetaKeywords', 'LONGVARCHAR', false, null, null);
} // initialize() } // initialize()
/** /**
@@ -379,7 +379,7 @@ class ProductI18nTableMap extends TableMap
$criteria->addSelectColumn(ProductI18nTableMap::POSTSCRIPTUM); $criteria->addSelectColumn(ProductI18nTableMap::POSTSCRIPTUM);
$criteria->addSelectColumn(ProductI18nTableMap::META_TITLE); $criteria->addSelectColumn(ProductI18nTableMap::META_TITLE);
$criteria->addSelectColumn(ProductI18nTableMap::META_DESCRIPTION); $criteria->addSelectColumn(ProductI18nTableMap::META_DESCRIPTION);
$criteria->addSelectColumn(ProductI18nTableMap::META_KEYWORD); $criteria->addSelectColumn(ProductI18nTableMap::META_KEYWORDS);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.LOCALE'); $criteria->addSelectColumn($alias . '.LOCALE');
@@ -389,7 +389,7 @@ class ProductI18nTableMap extends TableMap
$criteria->addSelectColumn($alias . '.POSTSCRIPTUM'); $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
$criteria->addSelectColumn($alias . '.META_TITLE'); $criteria->addSelectColumn($alias . '.META_TITLE');
$criteria->addSelectColumn($alias . '.META_DESCRIPTION'); $criteria->addSelectColumn($alias . '.META_DESCRIPTION');
$criteria->addSelectColumn($alias . '.META_KEYWORD'); $criteria->addSelectColumn($alias . '.META_KEYWORDS');
} }
} }

View File

@@ -230,7 +230,7 @@ class ProductTableMap extends TableMap
{ {
return array( return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum, meta_title, meta_description, meta_keyword', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ), 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
); );
} // getBehaviors() } // getBehaviors()

View File

@@ -5,11 +5,14 @@ namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Base\Module as BaseModule; use Thelia\Model\Base\Module as BaseModule;
use Thelia\Model\Tools\ModelEventDispatcherTrait; use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Core\Event\TheliaEvents;
class Module extends BaseModule class Module extends BaseModule
{ {
use ModelEventDispatcherTrait; use ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
public function postSave(ConnectionInterface $con = null) public function postSave(ConnectionInterface $con = null)
{ {
ModuleQuery::resetActivated(); ModuleQuery::resetActivated();
@@ -56,4 +59,30 @@ class Module extends BaseModule
public function getAbsoluteI18nPath() { public function getAbsoluteI18nPath() {
return THELIA_MODULE_DIR . $this->getI18nPath(); return THELIA_MODULE_DIR . $this->getI18nPath();
} }
/**
* Return the absolute path to one of the module's template directories
*
* @param int $templateSubdirName the name of the, probably one of TemplateDefinition::xxx_SUBDIR constants
*/
public function getAbsoluteTemplateDirectoryPath($templateSubdirName) {
return sprintf("%s%stemplates%s%s", $this->getAbsoluteBaseDir(), DS, DS, $templateSubdirName);
}
/**
* Calculate next position relative to module type
*/
protected function addCriteriaToPositionQuery($query) {
$query->filterByType($this->getType());
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setPosition($this->getNextPosition());
return true;
}
} }

View File

@@ -7,6 +7,7 @@ use Propel\Runtime\Connection\ConnectionInterface;
class ProductDocument extends BaseProductDocument class ProductDocument extends BaseProductDocument
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait; use \Thelia\Model\Tools\PositionManagementTrait;
/** /**
@@ -50,4 +51,14 @@ class ProductDocument extends BaseProductDocument
return $this->getProductId(); return $this->getProductId();
} }
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"product_id" => $this->getProductId(),
)
);
return true;
}
} }

View File

@@ -7,6 +7,7 @@ use Propel\Runtime\Connection\ConnectionInterface;
class ProductImage extends BaseProductImage class ProductImage extends BaseProductImage
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait; use \Thelia\Model\Tools\PositionManagementTrait;
/** /**
@@ -49,4 +50,14 @@ class ProductImage extends BaseProductImage
{ {
return $this->getProductId(); return $this->getProductId();
} }
public function preDelete(ConnectionInterface $con = null)
{
$this->reorderBeforeDelete(
array(
"product_id" => $this->getProductId(),
)
);
return true;
}
} }

View File

@@ -38,6 +38,7 @@ class TaxRuleQuery extends BaseTaxRuleQuery
->find() ->find()
) )
->withColumn(TaxRuleCountryTableMap::POSITION, self::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION) ->withColumn(TaxRuleCountryTableMap::POSITION, self::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION)
->orderBy(self::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION, Criteria::ASC);
; ;
return $search->find(); return $search->find();

View File

@@ -199,19 +199,26 @@ trait PositionManagementTrait {
} }
} }
protected function reorderBeforeDelete() protected function reorderBeforeDelete($fields = array())
{ {
// Find DATABASE_NAME constant // Find DATABASE_NAME constant
$mapClassName = self::TABLE_MAP; $mapClassName = self::TABLE_MAP;
$sql = sprintf("UPDATE `%s` SET position=(position-1) WHERE parent=:parent AND position>:position", $mapClassName::TABLE_NAME); $data = array();
$whereCriteria = array();
foreach($fields as $field => $value) {
$whereCriteria[] = $field . '=:' . $field;
$data[':' . $field] = $value;
}
$data[':position'] = $this->getPosition();
$sql = sprintf("UPDATE `%s` SET position=(position-1) WHERE " . (count($whereCriteria)>0 ? implode(" AND ", $whereCriteria) : '1') . " AND position>:position", $mapClassName::TABLE_NAME);
$con = Propel::getConnection($mapClassName::DATABASE_NAME); $con = Propel::getConnection($mapClassName::DATABASE_NAME);
$statement = $con->prepare($sql); $statement = $con->prepare($sql);
$statement->execute(array( $statement->execute($data);
':parent' => $this->getParent(),
':position' => $this->getPosition()
));
} }
} }

View File

@@ -163,7 +163,7 @@ trait UrlRewritingTrait {
public function setRewrittenUrl($locale, $url) public function setRewrittenUrl($locale, $url)
{ {
$currentUrl = $this->getRewrittenUrl($locale); $currentUrl = $this->getRewrittenUrl($locale);
if($currentUrl == $url) { if($currentUrl == $url || null === $url) {
/* no url update */ /* no url update */
return $this; return $this;
} }

View File

@@ -23,10 +23,12 @@
namespace Thelia\Module; namespace Thelia\Module;
use Thelia\Model\Order;
interface PaymentModuleInterface extends BaseModuleInterface interface PaymentModuleInterface extends BaseModuleInterface
{ {
/** /**
* @return mixed * @return mixed
*/ */
public function pay(); public function pay(Order $order);
} }

View File

@@ -71,7 +71,9 @@ class RewritingRetriever
$this->rewrittenUrl = null; $this->rewrittenUrl = null;
$this->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView); $this->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView);
if($this->search !== null) { if($this->search !== null) {
$this->rewrittenUrl = $this->search->getUrl(); $this->rewrittenUrl = URL::getInstance()->absoluteUrl(
$this->search->getUrl()
);
} }
} }

Some files were not shown because too many files have changed in this diff Show More