diff --git a/composer.json b/composer.json index 67fb90100..09aa606b5 100755 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "php": ">=5.4", "ezyang/htmlpurifier": "dev-master", "ircmaxell/password-compat": "dev-master", - "propel/propel": "2.0.0-alpha1", + "propel/propel": "dev-master", "psr/log" : "1.0", "symfony/class-loader": "2.2.*", "symfony/config" : "2.2.*", @@ -27,7 +27,7 @@ "symfony-cmf/routing": "1.0.0", "symfony/form": "2.2.*", - "symfony/validator": "2.3.*@dev", + "symfony/validator": "2.3.*", "smarty/smarty": "v3.1.14", "kriswallsmith/assetic": "1.2.*@dev", @@ -36,7 +36,8 @@ "simplepie/simplepie": "dev-master", - "imagine/imagine": "dev-master" + "imagine/imagine": "dev-master", + "symfony/icu": "1.0" }, "require-dev" : { "phpunit/phpunit": "3.7.*", diff --git a/composer.lock b/composer.lock index efa62a9f2..a54fe3024 100755 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "458aeccc06b7394d7653a9063b6fd981", + "hash": "db69990b239a4056558bfd694115d01b", "packages": [ { "name": "ezyang/htmlpurifier", @@ -254,16 +254,16 @@ }, { "name": "propel/propel", - "version": "2.0.0-alpha1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/propelorm/Propel2.git", - "reference": "3b9ea45a6e1b9fb3903cb910a31fbbac4a66c184" + "reference": "58a25ded43c3d04313cad2b738342d307988b1b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/propelorm/Propel2/zipball/3b9ea45a6e1b9fb3903cb910a31fbbac4a66c184", - "reference": "3b9ea45a6e1b9fb3903cb910a31fbbac4a66c184", + "url": "https://api.github.com/repos/propelorm/Propel2/zipball/58a25ded43c3d04313cad2b738342d307988b1b5", + "reference": "58a25ded43c3d04313cad2b738342d307988b1b5", "shasum": "" }, "require": { @@ -310,7 +310,7 @@ "orm", "persistence" ], - "time": "2013-06-05 06:46:14" + "time": "2013-09-01 13:29:51" }, { "name": "psr/log", @@ -397,12 +397,12 @@ "source": { "type": "git", "url": "https://github.com/simplepie/simplepie.git", - "reference": "f5436d69a8efa9d4ab3a9abc65d17317eb24b7f4" + "reference": "f97c8ef9be655c35e6fecdb608bdf5af05a4374a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/simplepie/simplepie/zipball/f5436d69a8efa9d4ab3a9abc65d17317eb24b7f4", - "reference": "f5436d69a8efa9d4ab3a9abc65d17317eb24b7f4", + "url": "https://api.github.com/repos/simplepie/simplepie/zipball/f97c8ef9be655c35e6fecdb608bdf5af05a4374a", + "reference": "f97c8ef9be655c35e6fecdb608bdf5af05a4374a", "shasum": "" }, "require": { @@ -443,7 +443,7 @@ "feeds", "rss" ], - "time": "2013-04-29 06:13:26" + "time": "2013-08-31 01:38:46" }, { "name": "smarty/smarty", @@ -1071,17 +1071,17 @@ "source": { "type": "git", "url": "https://github.com/symfony/Icu.git", - "reference": "v1.0.0" + "reference": "cac3fdfb111adbe590155f491594636d45129783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Icu/zipball/v1.0.0", - "reference": "v1.0.0", + "url": "https://api.github.com/repos/symfony/Icu/zipball/cac3fdfb111adbe590155f491594636d45129783", + "reference": "cac3fdfb111adbe590155f491594636d45129783", "shasum": "" }, "require": { "php": ">=5.3.3", - "symfony/intl": ">=2.3,<3.0" + "symfony/intl": "~2.3" }, "type": "library", "autoload": { @@ -1508,7 +1508,7 @@ }, { "name": "symfony/validator", - "version": "2.3.x-dev", + "version": "v2.3.4", "target-dir": "Symfony/Component/Validator", "source": { "type": "git", @@ -1622,12 +1622,12 @@ "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "feb6492762a77db946bc13cc44a20a01546be0e6" + "reference": "77a4e394d99a67e7fb611e8b402c2da4b80fa4f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/feb6492762a77db946bc13cc44a20a01546be0e6", - "reference": "feb6492762a77db946bc13cc44a20a01546be0e6", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/77a4e394d99a67e7fb611e8b402c2da4b80fa4f8", + "reference": "77a4e394d99a67e7fb611e8b402c2da4b80fa4f8", "shasum": "" }, "require": { @@ -1660,7 +1660,7 @@ "faker", "fixtures" ], - "time": "2013-08-12 10:05:47" + "time": "2013-08-29 19:11:59" }, { "name": "phpunit/php-code-coverage", @@ -2037,8 +2037,7 @@ "stability-flags": { "ezyang/htmlpurifier": 20, "ircmaxell/password-compat": 20, - "propel/propel": 15, - "symfony/validator": 20, + "propel/propel": 20, "kriswallsmith/assetic": 20, "leafo/lessphp": 20, "ptachoire/cssembed": 20, diff --git a/core/lib/Thelia/Action/BaseAction.php b/core/lib/Thelia/Action/BaseAction.php index ab8f4abb8..2984ddbd6 100755 --- a/core/lib/Thelia/Action/BaseAction.php +++ b/core/lib/Thelia/Action/BaseAction.php @@ -49,34 +49,4 @@ class BaseAction { return $this->container->get('event_dispatcher'); } - - /** - * Check current user authorisations. - * - * @param mixed $roles a single role or an array of roles. - * @param mixed $permissions a single permission or an array of permissions. - * - * @throws AuthenticationException if permissions are not granted to the current user. - */ - protected function checkAuth($roles, $permissions) { - - if (! $this->getSecurityContext()->isGranted( - is_array($roles) ? $roles : array($roles), - is_array($permissions) ? $permissions : array($permissions)) ) { - - Tlog::getInstance()->addAlert("Authorization roles:", $roles, " permissions:", $permissions, " refused."); - - throw new AuthorizationException("Sorry, you're not allowed to perform this action"); - } - } - - /** - * Return the security context - * - * @return Thelia\Core\Security\SecurityContext - */ - protected function getSecurityContext() - { - return $this->container->get('thelia.securityContext'); - } } \ No newline at end of file diff --git a/core/lib/Thelia/Action/Cart.php b/core/lib/Thelia/Action/Cart.php index 86674aedf..019911265 100755 --- a/core/lib/Thelia/Action/Cart.php +++ b/core/lib/Thelia/Action/Cart.php @@ -41,6 +41,7 @@ use Thelia\Model\ConfigQuery; * * Class Cart * @package Thelia\Action + * @author Manuel Raynaud */ class Cart extends BaseAction implements EventSubscriberInterface { diff --git a/core/lib/Thelia/Action/Category.php b/core/lib/Thelia/Action/Category.php index d411d2a51..59604bab9 100755 --- a/core/lib/Thelia/Action/Category.php +++ b/core/lib/Thelia/Action/Category.php @@ -42,28 +42,19 @@ class Category extends BaseAction implements EventSubscriberInterface { public function create(CategoryCreateEvent $event) { - $this->checkAuth("ADMIN", "admin.category.create"); - $category = new CategoryModel(); - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CREATECATEGORY, $event); - - $category->create( - $event->getTitle(), - $event->getParent(), - $event->getLocale() + $category + ->setDispatcher($this->getDispatcher()) + ->create( + $event->getTitle(), + $event->getParent(), + $event->getLocale() ); - - $event->setCreatedCategory($category); - - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CREATECATEGORY, $event); } public function modify(CategoryChangeEvent $event) { - $this->checkAuth("ADMIN", "admin.category.change"); - - // TODO !! } /** @@ -73,19 +64,11 @@ class Category extends BaseAction implements EventSubscriberInterface */ public function delete(CategoryDeleteEvent $event) { - $this->checkAuth("ADMIN", "admin.category.delete"); - - $category = CategoryQuery::create()->findPk($event->getId()); + $category = CategoryQuery::create()->findPk($event->getCategoryId()); if ($category !== null) { - $event->setDeletedCategory($category); - - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_DELETECATEGORY, $event); - - $category->delete(); - - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_DELETECATEGORY, $event); + $category->setDispatcher($this->getDispatcher())->delete(); } } @@ -96,21 +79,15 @@ class Category extends BaseAction implements EventSubscriberInterface */ public function toggleVisibility(CategoryToggleVisibilityEvent $event) { - $this->checkAuth("ADMIN", "admin.category.edit"); - - $category = CategoryQuery::create()->findPk($event->getId()); + $category = CategoryQuery::create()->findPk($event->getCategoryId()); if ($category !== null) { - $event->setCategory($category); - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CHANGECATEGORY, $event); - - $category->setVisible($category->getVisible() ? false : true); - - $category->save(); - - $event->setCategory($category); - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECATEGORY, $event); + $category + ->setDispatcher($this->getDispatcher()) + ->setVisible($category->getVisible() ? false : true) + ->save() + ; } } @@ -121,8 +98,6 @@ class Category extends BaseAction implements EventSubscriberInterface */ public function changePosition(CategoryChangePositionEvent $event) { - $this->checkAuth("ADMIN", "admin.category.edit"); - if ($event->getMode() == CategoryChangePositionEvent::POSITION_ABSOLUTE) return $this->changeAbsolutePosition($event); else @@ -136,13 +111,10 @@ class Category extends BaseAction implements EventSubscriberInterface */ protected function exchangePosition(CategoryChangePositionEvent $event) { - $category = CategoryQuery::create()->findPk($event->getId()); + $category = CategoryQuery::create()->findPk($event->getCategoryId()); if ($category !== null) { - $event->setCategory($category); - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CHANGECATEGORY, $event); - // The current position of the category $my_position = $category->getPosition(); @@ -171,7 +143,11 @@ class Category extends BaseAction implements EventSubscriberInterface $cnx->beginTransaction(); try { - $category->setPosition($result->getPosition())->save(); + $category + ->setDispatcher($this->getDispatcher()) + ->setPosition($result->getPosition()) + ->save() + ; $result->setPosition($my_position)->save(); @@ -180,9 +156,6 @@ class Category extends BaseAction implements EventSubscriberInterface $cnx->rollback(); } } - - $event->setCategory($category); - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECATEGORY, $event); } } @@ -193,15 +166,10 @@ class Category extends BaseAction implements EventSubscriberInterface */ protected function changeAbsolutePosition(CategoryChangePositionEvent $event) { - $this->checkAuth("ADMIN", "admin.category.edit"); - - $category = CategoryQuery::create()->findPk($event->getId()); + $category = CategoryQuery::create()->findPk($event->getCategoryId()); if ($category !== null) { - $event->setCategory($category); - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CHANGECATEGORY, $event); - // The required position $new_position = $event->getPosition(); @@ -236,16 +204,17 @@ class Category extends BaseAction implements EventSubscriberInterface $result->setPosition($result->getPosition() + $delta)->save($cnx); } - $category->setPosition($new_position)->save($cnx); + $category + ->setDispatcher($this->getDispatcher()) + ->setPosition($new_position) + ->save($cnx) + ; $cnx->commit(); } catch (Exception $e) { $cnx->rollback(); } } - - $event->setCategory($category); - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECATEGORY, $event); } } diff --git a/core/lib/Thelia/Action/Config.php b/core/lib/Thelia/Action/Config.php new file mode 100644 index 000000000..fa683f1d4 --- /dev/null +++ b/core/lib/Thelia/Action/Config.php @@ -0,0 +1,155 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +use Thelia\Model\ConfigQuery; +use Thelia\Model\Config as ConfigModel; + +use Thelia\Core\Event\TheliaEvents; + +use Thelia\Core\Event\ConfigChangeEvent; +use Thelia\Core\Event\ConfigCreateEvent; +use Thelia\Core\Event\ConfigDeleteEvent; + +class Config extends BaseAction implements EventSubscriberInterface +{ + /** + * Create a new configuration entry + * + * @param ConfigCreateEvent $event + */ + public function create(ConfigCreateEvent $event) + { + $config = new ConfigModel(); + + $config + ->setDispatcher($this->getDispatcher()) + + ->setName($event->getEventName()) + ->setValue($event->getValue()) + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + ->setHidden($event->getHidden()) + ->setSecured($event->getSecured()) + + ->save() + ; + + $event->setConfig($config); + } + + /** + * Change a configuration entry value + * + * @param ConfigChangeEvent $event + */ + public function setValue(ConfigChangeEvent $event) + { + $search = ConfigQuery::create(); + + if (null !== $config = $search->findOneById($event->getConfigId())) { + + if ($event->getValue() !== $config->getValue()) { + + $config + ->setDispatcher($this->getDispatcher()) + + ->setValue($event->getValue()) + ->save() + ; + + $event->setConfig($config); + } + } + } + + /** + * Change a configuration entry + * + * @param ConfigChangeEvent $event + */ + public function modify(ConfigChangeEvent $event) + { + $search = ConfigQuery::create(); + + if (null !== $config = ConfigQuery::create()->findOneById($event->getConfigId())) { + + $config + ->setDispatcher($this->getDispatcher()) + + ->setName($event->getEventName()) + ->setValue($event->getValue()) + ->setHidden($event->getHidden()) + ->setSecured($event->getSecured()) + + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + ->setDescription($event->getDescription()) + ->setChapo($event->getChapo()) + ->setPostscriptum($event->getPostscriptum()) + + ->save(); + + $event->setConfig($config); + } + } + + /** + * Delete a configuration entry + * + * @param ConfigDeleteEvent $event + */ + public function delete(ConfigDeleteEvent $event) + { + + if (null !== ($config = ConfigQuery::create()->findOneById($event->getConfigId()))) { + + if (! $config->getSecured()) { + + $config + ->setDispatcher($this->getDispatcher()) + ->delete() + ; + + $event->setConfig($config); + } + } + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::CONFIG_CREATE => array("create", 128), + TheliaEvents::CONFIG_SETVALUE => array("setValue", 128), + TheliaEvents::CONFIG_MODIFY => array("modify", 128), + TheliaEvents::CONFIG_DELETE => array("delete", 128), + ); + } +} diff --git a/core/lib/Thelia/Action/Customer.php b/core/lib/Thelia/Action/Customer.php index 4c7a71d5e..962e2e2cf 100755 --- a/core/lib/Thelia/Action/Customer.php +++ b/core/lib/Thelia/Action/Customer.php @@ -38,7 +38,16 @@ use Symfony\Component\Validator\Exception\ValidatorException; use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Security\Exception\UsernameNotFoundException; use Propel\Runtime\Exception\PropelException; +use Thelia\Core\Event\CustomerLoginEvent; +/** + * + * customer class where all actions are managed + * + * Class Customer + * @package Thelia\Action + * @author Manuel Raynaud + */ class Customer extends BaseAction implements EventSubscriberInterface { @@ -46,7 +55,6 @@ class Customer extends BaseAction implements EventSubscriberInterface { $customer = new CustomerModel(); - $customer->setDispatcher($this->getDispatcher()); $this->createOrUpdateCustomer($customer, $event); @@ -56,7 +64,6 @@ class Customer extends BaseAction implements EventSubscriberInterface { $customer = $event->getCustomer(); - $customer->setDispatcher($this->getDispatcher()); $this->createOrUpdateCustomer($customer, $event); @@ -64,6 +71,8 @@ class Customer extends BaseAction implements EventSubscriberInterface private function createOrUpdateCustomer(CustomerModel $customer, CustomerCreateOrUpdateEvent $event) { + $customer->setDispatcher($this->getDispatcher()); + $customer->createOrUpdate( $event->getTitle(), $event->getFirstname(), @@ -87,6 +96,12 @@ class Customer extends BaseAction implements EventSubscriberInterface $event->setCustomer($customer); } + + public function login(CustomerLoginEvent $event) + { + $this->getSecurityContext()->setCustomerUser($event->getCustomer()); + } + /** * Perform user logout. The user is redirected to the provided view, if any. * @@ -94,8 +109,6 @@ class Customer extends BaseAction implements EventSubscriberInterface */ public function logout(ActionEvent $event) { - $event->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_LOGOUT, $event); - $this->getSecurityContext()->clearCustomerUser(); } @@ -104,6 +117,16 @@ class Customer extends BaseAction implements EventSubscriberInterface // TODO } + /** + * Return the security context + * + * @return Thelia\Core\Security\SecurityContext + */ + protected function getSecurityContext() + { + return $this->container->get('thelia.securityContext'); + } + /** * Returns an array of event names this subscriber wants to listen to. * @@ -129,6 +152,8 @@ class Customer extends BaseAction implements EventSubscriberInterface return array( TheliaEvents::CUSTOMER_CREATEACCOUNT => array("create", 128), TheliaEvents::CUSTOMER_UPDATEACCOUNT => array("modify", 128), + TheliaEvents::CUSTOMER_LOGOUT => array("logout", 128), + TheliaEvents::CUSTOMER_LOGIN => array("login" , 128), ); } } diff --git a/core/lib/Thelia/Action/Message.php b/core/lib/Thelia/Action/Message.php new file mode 100644 index 000000000..dd50a5652 --- /dev/null +++ b/core/lib/Thelia/Action/Message.php @@ -0,0 +1,125 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +use Thelia\Model\MessageQuery; +use Thelia\Model\Message as MessageModel; + +use Thelia\Core\Event\TheliaEvents; + +use Thelia\Core\Event\MessageChangeEvent; +use Thelia\Core\Event\MessageCreateEvent; +use Thelia\Core\Event\MessageDeleteEvent; + +class Message extends BaseAction implements EventSubscriberInterface +{ + /** + * Create a new messageuration entry + * + * @param MessageCreateEvent $event + */ + public function create(MessageCreateEvent $event) + { + $message = new MessageModel(); + + $message + ->setDispatcher($this->getDispatcher()) + + ->setName($event->getMessageName()) + + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + + ->setSecured($event->getSecured()) + + ->save() + ; + + $event->setMessage($message); + } + + /** + * Change a message + * + * @param MessageChangeEvent $event + */ + public function modify(MessageChangeEvent $event) + { + $search = MessageQuery::create(); + + if (null !== $message = MessageQuery::create()->findOneById($event->getMessageId())) { + + $message + ->setDispatcher($this->getDispatcher()) + + ->setName($event->getMessageName()) + ->setSecured($event->getSecured()) + + ->setLocale($event->getLocale()) + + ->setTitle($event->getTitle()) + ->setSubject($event->getSubject()) + ->setHtmlMessage($event->getHtmlMessage()) + ->setTextMessage($event->getTextMessage()) + + ->save(); + + $event->setMessage($message); + } + } + + /** + * Delete a messageuration entry + * + * @param MessageDeleteEvent $event + */ + public function delete(MessageDeleteEvent $event) + { + + if (null !== ($message = MessageQuery::create()->findOneById($event->getMessageId()))) { + + $message + ->setDispatcher($this->getDispatcher()) + ->delete() + ; + + $event->setMessage($message); + } + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::MESSAGE_CREATE => array("create", 128), + TheliaEvents::MESSAGE_MODIFY => array("modify", 128), + TheliaEvents::MESSAGE_DELETE => array("delete", 128), + ); + } +} diff --git a/core/lib/Thelia/Cart/CartTrait.php b/core/lib/Thelia/Cart/CartTrait.php index 901263a32..527867d5d 100755 --- a/core/lib/Thelia/Cart/CartTrait.php +++ b/core/lib/Thelia/Cart/CartTrait.php @@ -31,6 +31,13 @@ use Thelia\Core\HttpFoundation\Session\Session; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\CartEvent; +/** + * managed cart + * + * Trait CartTrait + * @package Thelia\Cart + * @author Manuel Raynaud + */ trait CartTrait { /** diff --git a/core/lib/Thelia/Command/BaseModuleGenerate.php b/core/lib/Thelia/Command/BaseModuleGenerate.php index fab1b7707..b26db435b 100755 --- a/core/lib/Thelia/Command/BaseModuleGenerate.php +++ b/core/lib/Thelia/Command/BaseModuleGenerate.php @@ -22,6 +22,13 @@ /*************************************************************************************/ namespace Thelia\Command; +/** + * base class for module commands + * + * Class BaseModuleGenerate + * @package Thelia\Command + * @author Manuel Raynaud + */ abstract class BaseModuleGenerate extends ContainerAwareCommand { protected $module; diff --git a/core/lib/Thelia/Command/CacheClear.php b/core/lib/Thelia/Command/CacheClear.php index ed1cca8a6..82a7cbd7f 100755 --- a/core/lib/Thelia/Command/CacheClear.php +++ b/core/lib/Thelia/Command/CacheClear.php @@ -30,6 +30,14 @@ use Symfony\Component\Filesystem\Exception\IOException; use Thelia\Command\ContainerAwareCommand; +/** + * clear the cache + * + * Class CacheClear + * @package Thelia\Command + * @author Manuel Raynaud + * + */ class CacheClear extends ContainerAwareCommand { protected function configure() diff --git a/core/lib/Thelia/Command/Install.php b/core/lib/Thelia/Command/Install.php index edf459086..2e10d77ee 100755 --- a/core/lib/Thelia/Command/Install.php +++ b/core/lib/Thelia/Command/Install.php @@ -29,6 +29,13 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; use Thelia\Command\ContainerAwareCommand; +/** + * try to install a new instance of Thelia + * + * Class Install + * @package Thelia\Command + * @author Manuel Raynaud + */ class Install extends ContainerAwareCommand { /** diff --git a/core/lib/Thelia/Command/ModuleGenerateCommand.php b/core/lib/Thelia/Command/ModuleGenerateCommand.php index 842d421af..b34e43dc1 100755 --- a/core/lib/Thelia/Command/ModuleGenerateCommand.php +++ b/core/lib/Thelia/Command/ModuleGenerateCommand.php @@ -27,6 +27,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; +/** + * generate a new Module + * + * Class ModuleGenerateCommand + * @package Thelia\Command + * @author Manuel Raynaud + */ class ModuleGenerateCommand extends BaseModuleGenerate { protected function configure() diff --git a/core/lib/Thelia/Command/ModuleGenerateModelCommand.php b/core/lib/Thelia/Command/ModuleGenerateModelCommand.php index 28e96fa52..fbbe9be6c 100755 --- a/core/lib/Thelia/Command/ModuleGenerateModelCommand.php +++ b/core/lib/Thelia/Command/ModuleGenerateModelCommand.php @@ -31,6 +31,13 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; +/** + * generate class model for a specific module + * + * Class ModuleGenerateModelCommand + * @package Thelia\Command + * @author Manuel Raynaud + */ class ModuleGenerateModelCommand extends BaseModuleGenerate { protected function configure() diff --git a/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php b/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php index 89d87cb6f..2c6b310a5 100755 --- a/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php +++ b/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php @@ -30,6 +30,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; +/** + * generate sql for a specific module + * + * Class ModuleGenerateSqlCommand + * @package Thelia\Command + * @author Manuel Raynaud + */ class ModuleGenerateSqlCommand extends BaseModuleGenerate { public function configure() diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml index 2bd31ce3e..a9638fe04 100755 --- a/core/lib/Thelia/Config/Resources/action.xml +++ b/core/lib/Thelia/Config/Resources/action.xml @@ -22,12 +22,22 @@ - + - + + + + + + + + + + + diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 45c763830..4c1bf61f8 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -32,6 +32,8 @@ + + @@ -45,6 +47,12 @@
+ + + + + + @@ -113,6 +121,11 @@ + + + + + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index ece222c22..d57eb8f95 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -35,10 +35,59 @@ Thelia\Controller\Admin\CategoryController::processAction + + + + Thelia\Controller\Admin\ConfigController::defaultAction + + + + Thelia\Controller\Admin\ConfigController::changeValuesAction + + + + Thelia\Controller\Admin\ConfigController::createAction + + + + Thelia\Controller\Admin\ConfigController::changeAction + + + + Thelia\Controller\Admin\ConfigController::saveChangeAction + + + + Thelia\Controller\Admin\ConfigController::deleteAction + + + + + + Thelia\Controller\Admin\MessageController::defaultAction + + + + Thelia\Controller\Admin\MessageController::createAction + + + + Thelia\Controller\Admin\MessageController::changeAction + + + + Thelia\Controller\Admin\MessageController::saveChangeAction + + + + Thelia\Controller\Admin\MessageController::deleteAction + + Thelia\Controller\Admin\AdminController::processTemplateAction .* + diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index b235df3ee..c10549d6d 100755 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -18,10 +18,14 @@ Thelia\Controller\Front\CustomerController::updateAction - + Thelia\Controller\Front\CustomerController::loginAction + + Thelia\Controller\Front\CustomerController::logoutAction + + Thelia\Controller\Front\CartController::addItem cart diff --git a/core/lib/Thelia/Controller/Admin/AdminController.php b/core/lib/Thelia/Controller/Admin/AdminController.php index 570bbec99..fdb6b13ac 100755 --- a/core/lib/Thelia/Controller/Admin/AdminController.php +++ b/core/lib/Thelia/Controller/Admin/AdminController.php @@ -29,10 +29,4 @@ class AdminController extends BaseAdminController { return $this->render("home"); } - - public function processAction() - { - echo "not yet coded !"; - exit(); - } } diff --git a/core/lib/Thelia/Controller/Admin/BaseAdminController.php b/core/lib/Thelia/Controller/Admin/BaseAdminController.php index 271ce3c05..c4b4c44b0 100755 --- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php +++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php @@ -32,6 +32,8 @@ use Thelia\Tools\URL; use Thelia\Tools\Redirect; use Thelia\Core\Security\SecurityContext; use Thelia\Model\AdminLog; +use Thelia\Model\Lang; +use Thelia\Model\LangQuery; class BaseAdminController extends BaseController { @@ -46,17 +48,25 @@ class BaseAdminController extends BaseController AdminLog::append($message, $this->getRequest(), $this->getSecurityContext()->getAdminUser()); } + /** + * This method process the rendering of view called from an admin page + * + * @param unknown $template + * @return Response the reponse which contains the rendered view + */ public function processTemplateAction($template) { try { if (! empty($template)) { // If we have a view in the URL, render this view return $this->render($template); - } elseif (null != $view = $this->getRequest()->get('view')) { + } + elseif (null != $view = $this->getRequest()->get('view')) { return $this->render($view); } - } catch (\Exception $ex) { - // Nothing special + } + catch (\Exception $ex) { + return new Response($this->errorPage($ex->getMessage())); } return $this->pageNotFound(); @@ -87,19 +97,31 @@ class BaseAdminController extends BaseController /** * Check current admin user authorisations. An ADMIN role is assumed. * - * @param unknown $permissions a single permission or an array of permissions. + * @param mixed $permissions a single permission or an array of permissions. + * + * @return mixed null if authorization is granted, or a Response object which contains the error page otherwise * - * @throws AuthenticationException if permissions are not granted ti the current user. */ protected function checkAuth($permissions) { - if (! $this->getSecurityContext()->isGranted(array("ADMIN"), is_array($permissions) ? $permissions : array($permissions))) { - throw new AuthorizationException("Sorry, you're not allowed to perform this action"); - } + $permArr = is_array($permissions) ? $permissions : array($permissions); + + if ($this->getSecurityContext()->isGranted(array("ADMIN"), $permArr)) { + // Okay ! + return null; + } + + // Log the problem + $this->adminLogAppend("User is not granted for permissions %s", implode(", ", $permArr)); + + // Generate the proper response + $response = new Response(); + + return $response->setContent($this->errorPage("Sorry, you're not allowed to perform this action")); } /** - * @return a ParserInterfac instance parser + * @return a ParserInterface instance parser */ protected function getParser() { @@ -128,6 +150,23 @@ class BaseAdminController extends BaseController return $this->container->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST); } + /** + * Get the current edition lang ID, checking if a change was requested in the current request + */ + protected function getCurrentEditionLangId() { + return $this->getRequest()->get( + 'edition_language', + $this->getSession()->getAdminEditionLangId() + ); + } + + /** + * A simple helper to get the current edition locale, from the session edition language ID + */ + protected function getCurrentEditionLocale() { + return LangQuery::create()->findOneById($this->getCurrentEditionLangId())->getLocale(); + } + /** * Render the given template, and returns the result as an Http Response. * @@ -151,26 +190,41 @@ class BaseAdminController extends BaseController */ protected function renderRaw($templateName, $args = array()) { + // Add the template standard extension $templateName .= '.html'; $session = $this->getSession(); + // Find the current edit language ID + $edition_language = $this->getCurrentEditionLangId(); + + // Prepare common template variables $args = array_merge($args, array( - 'locale' => $session->getLocale(), - 'lang' => $session->getLang() + 'locale' => $session->getLocale(), + 'lang_code' => $session->getLang(), + 'lang_id' => $session->getLangId(), + 'edition_language' => $edition_language, + 'current_url' => htmlspecialchars($this->getRequest()->getUri()) )); + // Update the current edition language in session + $this->getSession()->setAdminEditionLangId($edition_language); + + // Render the template. try { $data = $this->getParser()->render($templateName, $args); return $data; - } catch (AuthenticationException $ex) { - + } + catch (AuthenticationException $ex) { // User is not authenticated, and templates requires authentication -> redirect to login page // We user login_tpl as a path, not a template. - Redirect::exec(URL::absoluteUrl($ex->getLoginTemplate())); } + catch (AuthorizationException $ex) { + // User is not allowed to perform the required action. Return the error page instead of the requested page. + return $this->errorPage("Sorry, you are not allowed to perform this action."); + } } } diff --git a/core/lib/Thelia/Controller/Admin/CategoryController.php b/core/lib/Thelia/Controller/Admin/CategoryController.php index 4e798d683..9966034f8 100755 --- a/core/lib/Thelia/Controller/Admin/CategoryController.php +++ b/core/lib/Thelia/Controller/Admin/CategoryController.php @@ -33,6 +33,7 @@ use Thelia\Core\Event\CategoryDeleteEvent; use Thelia\Core\Event\CategoryToggleVisibilityEvent; use Thelia\Core\Event\CategoryChangePositionEvent; use Thelia\Form\CategoryDeletionForm; +use Thelia\Model\Lang; class CategoryController extends BaseAdminController { @@ -65,7 +66,7 @@ class CategoryController extends BaseAdminController } catch (FormValidationException $e) { $categoryCreationForm->setErrorMessage($e->getMessage()); - $this->getParserContext()->setErrorForm($categoryCreationForm); + $this->getParserContext()->addForm($categoryCreationForm); } catch (Exception $e) { Tlog::getInstance()->error(sprintf("Failed to create category: %s", $e->getMessage())); @@ -78,7 +79,7 @@ class CategoryController extends BaseAdminController protected function editCategory($args) { - $this->checkAuth("ADMIN", "admin.category.edit"); + if (null !== $response = $this->checkAuth("admin.category.edit")) return $response; return $this->render('edit_category', $args); } @@ -99,14 +100,14 @@ class CategoryController extends BaseAdminController $this->adminLogAppend(sprintf("Category %s (ID %s) deleted", $category->getTitle(), $category->getId())); // Substitute _ID_ in the URL with the ID of the created category - $successUrl = str_replace('_ID_', $categoryDeleteEvent->getDeletedCategory()->getId(), $categoryDeletionForm->getSuccessUrl()); + $successUrl = str_replace('_ID_', $categoryDeleteEvent->getDeletedCategory()->getParent(), $categoryDeletionForm->getSuccessUrl()); // Redirect to the success URL $this->redirect($successUrl); } catch (FormValidationException $e) { $categoryDeletionForm->setErrorMessage($e->getMessage()); - $this->getParserContext()->setErrorForm($categoryDeletionForm); + $this->getParserContext()->addForm($categoryDeletionForm); } catch (Exception $e) { Tlog::getInstance()->error(sprintf("Failed to delete category: %s", $e->getMessage())); @@ -119,7 +120,7 @@ class CategoryController extends BaseAdminController protected function browseCategory($args) { - $this->checkAuth("AMIN", "admin.catalog.view"); + if (null !== $response = $this->checkAuth("admin.catalog.view")) return $response; return $this->render('categories', $args); } @@ -185,11 +186,31 @@ class CategoryController extends BaseAdminController // Get the category ID $id = $this->getRequest()->get('id', 0); + // Find the current order + $category_order = $this->getRequest()->get( + 'category_order', + $this->getSession()->get('admin.category_order', 'manual') + ); + + // Find the current edit language ID + $edition_language = $this->getRequest()->get( + 'edition_language', + $this->getSession()->get('admin.edition_language', Lang::getDefaultLanguage()->getId()) + ); + $args = array( 'action' => $action, - 'current_category_id' => $id + 'current_category_id' => $id, + 'category_order' => $category_order, + 'edition_language' => $edition_language, ); + // Store the current sort order in session + $this->getSession()->set('admin.category_order', $category_order); + + // Store the current edition language in session + $this->getSession()->set('admin.edition_language', $edition_language); + try { switch ($action) { case 'browse' : // Browse categories diff --git a/core/lib/Thelia/Controller/Admin/ConfigController.php b/core/lib/Thelia/Controller/Admin/ConfigController.php new file mode 100644 index 000000000..8f761ed7e --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/ConfigController.php @@ -0,0 +1,299 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + +use Thelia\Core\Event\ConfigDeleteEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Tools\URL; +use Thelia\Core\Event\ConfigChangeEvent; +use Thelia\Core\Event\ConfigCreateEvent; +use Thelia\Log\Tlog; +use Thelia\Form\Exception\FormValidationException; +use Thelia\Core\Security\Exception\AuthorizationException; +use Thelia\Model\ConfigQuery; +use Thelia\Form\ConfigModificationForm; +use Thelia\Form\ConfigCreationForm; + +/** + * Manages Thelmia system variables, aka Config objects. + * + * @author Franck Allimant + */ +class ConfigController extends BaseAdminController +{ + /** + * The default action is displaying the variables list. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function defaultAction() { + + if (null !== $response = $this->checkAuth("admin.configuration.variables.view")) return $response; + + return $this->render('variables'); + } + + /** + * Create a new config object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function createAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.variables.create")) return $response; + + $message = false; + + // Create the Creation Form + $creationForm = new ConfigCreationForm($this->getRequest()); + + try { + + // Validate the form, create the ConfigCreation event and dispatch it. + $form = $this->validateForm($creationForm, "POST"); + + $data = $form->getData(); + + $createEvent = new ConfigCreateEvent(); + + $createEvent + ->setEventName($data['name']) + ->setValue($data['value']) + ->setLocale($data["locale"]) + ->setTitle($data['title']) + ->setHidden($data['hidden']) + ->setSecured($data['secured']) + ; + + $this->dispatch(TheliaEvents::CONFIG_CREATE, $createEvent); + + $createdObject = $createEvent->getConfig(); + + // Log config creation + $this->adminLogAppend(sprintf("Variable %s (ID %s) created", $createdObject->getName(), $createdObject->getId())); + + // Substitute _ID_ in the URL with the ID of the created object + $successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl()); + + // Redirect to the success URL + $this->redirect($successUrl); + } + catch (FormValidationException $ex) { + // Form cannot be validated + $message = sprintf("Please check your input: %s", $ex->getMessage()); + } + catch (\Exception $ex) { + // Any other error + $message = sprintf("Sorry, an error occured: %s", $ex->getMessage()); + } + + if ($message !== false) { + // An error has been detected: log it + Tlog::getInstance()->error(sprintf("Error during variable creation process : %s. Exception was %s", $message, $ex->getMessage())); + + // Mark the form as errored + $creationForm->setErrorMessage($message); + + // Pass it to the parser, along with the error message + $this->getParserContext() + ->addForm($creationForm) + ->setGeneralError($message) + ; + } + + // At this point, the form has error, and should be redisplayed. + return $this->render('variables'); + } + + /** + * Load a config object for modification, and display the edit template. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function changeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.variables.change")) return $response; + + // Load the config object + $config = ConfigQuery::create() + ->joinWithI18n($this->getCurrentEditionLocale()) + ->findOneById($this->getRequest()->get('variable_id')); + + if ($config != null) { + + // Prepare the data that will hydrate the form + $data = array( + 'id' => $config->getId(), + 'name' => $config->getName(), + 'value' => $config->getValue(), + 'hidden' => $config->getHidden(), + 'secured' => $config->getSecured(), + 'locale' => $config->getLocale(), + 'title' => $config->getTitle(), + 'chapo' => $config->getChapo(), + 'description' => $config->getDescription(), + 'postscriptum' => $config->getPostscriptum() + ); + + // Setup the object form + $changeForm = new ConfigModificationForm($this->getRequest(), "form", $data); + + // Pass it to the parser + $this->getParserContext()->addForm($changeForm); + } + + // Render the edition template. + return $this->render('variable-edit', array('variable_id' => $this->getRequest()->get('variable_id'))); + } + + /** + * Save changes on a modified config object, and either go back to the variable list, or stay on the edition page. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function saveChangeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.variables.change")) return $response; + + $message = false; + + // Create the form from the request + $changeForm = new ConfigModificationForm($this->getRequest()); + + // Get the variable ID + $variable_id = $this->getRequest()->get('variable_id'); + + try { + + // Check the form against constraints violations + $form = $this->validateForm($changeForm, "POST"); + + // Get the form field values + $data = $form->getData(); + + $changeEvent = new ConfigChangeEvent($data['id']); + + // Create and dispatch the change event + $changeEvent + ->setEventName($data['name']) + ->setValue($data['value']) + ->setHidden($data['hidden']) + ->setSecured($data['secured']) + ->setLocale($data["locale"]) + ->setTitle($data['title']) + ->setChapo($data['chapo']) + ->setDescription($data['description']) + ->setPostscriptum($data['postscriptum']) + ; + + $this->dispatch(TheliaEvents::CONFIG_MODIFY, $changeEvent); + + // Log config modification + $changedObject = $changeEvent->getConfig(); + + $this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $changedObject->getName(), $changedObject->getId())); + + // If we have to stay on the same page, do not redirect to the succesUrl, + // just redirect to the edit page again. + if ($this->getRequest()->get('save_mode') == 'stay') { + $this->redirect(URL::absoluteUrl( + "admin/configuration/variables/change", + array('variable_id' => $variable_id) + )); + } + + // Redirect to the success URL + $this->redirect($changeForm->getSuccessUrl()); + } + catch (FormValidationException $ex) { + // Invalid data entered + $message = sprintf("Please check your input: %s", $ex->getMessage()); + } + catch (\Exception $ex) { + // Any other error + $message = sprintf("Sorry, an error occured: %s", $ex->getMessage()); + } + + if ($message !== false) { + // Log error message + Tlog::getInstance()->error(sprintf("Error during variable modification process : %s. Exception was %s", $message, $ex->getMessage())); + + // Mark the form as errored + $changeForm->setErrorMessage($message); + + // Pas the form and the error to the parser + $this->getParserContext() + ->addForm($changeForm) + ->setGeneralError($message) + ; + } + + // At this point, the form has errors, and should be redisplayed. + return $this->render('variable-edit', array('variable_id' => $variable_id)); + } + + /** + * Change values modified directly from the variable list + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function changeValuesAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.variables.change")) return $response; + + $variables = $this->getRequest()->get('variable', array()); + + // Process all changed variables + foreach($variables as $id => $value) { + $event = new ConfigChangeEvent($id); + $event->setValue($value); + + $this->dispatch(TheliaEvents::CONFIG_SETVALUE, $event); + } + + $this->redirect(URL::adminViewUrl('variables')); + } + + /** + * Delete a config object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function deleteAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.variables.delete")) return $response; + + // Get the config id, and dispatch the delet request + $event = new ConfigDeleteEvent($this->getRequest()->get('variable_id')); + + $this->dispatch(TheliaEvents::CONFIG_DELETE, $event); + + $this->redirect(URL::adminViewUrl('variables')); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/MessageController.php b/core/lib/Thelia/Controller/Admin/MessageController.php new file mode 100644 index 000000000..5a53fd28a --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/MessageController.php @@ -0,0 +1,270 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + +use Thelia\Core\Event\MessageDeleteEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Tools\URL; +use Thelia\Core\Event\MessageChangeEvent; +use Thelia\Core\Event\MessageCreateEvent; +use Thelia\Log\Tlog; +use Thelia\Form\Exception\FormValidationException; +use Thelia\Core\Security\Exception\AuthorizationException; +use Thelia\Model\MessageQuery; +use Thelia\Form\MessageModificationForm; +use Thelia\Form\MessageCreationForm; + +/** + * Manages messages sent by mail + * + * @author Franck Allimant + */ +class MessageController extends BaseAdminController +{ + /** + * The default action is displaying the messages list. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function defaultAction() { + + if (null !== $response = $this->checkAuth("admin.configuration.messages.view")) return $response; + + return $this->render('messages'); + } + + /** + * Create a new message object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function createAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.messages.create")) return $response; + + $message = false; + + // Create the Creation Form + $creationForm = new MessageCreationForm($this->getRequest()); + + try { + + // Validate the form, create the MessageCreation event and dispatch it. + $form = $this->validateForm($creationForm, "POST"); + + $data = $form->getData(); + + $createEvent = new MessageCreateEvent(); + + $createEvent + ->setMessageName($data['name']) + ->setLocale($data["locale"]) + ->setTitle($data['title']) + ->setSecured($data['secured']) + ; + + $this->dispatch(TheliaEvents::MESSAGE_CREATE, $createEvent); + + $createdObject = $createEvent->getMessage(); + + // Log message creation + $this->adminLogAppend(sprintf("Variable %s (ID %s) created", $createdObject->getName(), $createdObject->getId())); + + // Substitute _ID_ in the URL with the ID of the created object + $successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl()); + + // Redirect to the success URL + $this->redirect($successUrl); + } + catch (FormValidationException $ex) { + // Form cannot be validated + $message = sprintf("Please check your input: %s", $ex->getMessage()); + } + catch (\Exception $ex) { + // Any other error + $message = sprintf("Sorry, an error occured: %s", $ex->getMessage()); + } + + if ($message !== false) { + // An error has been detected: log it + Tlog::getInstance()->error(sprintf("Error during message creation process : %s. Exception was %s", $message, $ex->getMessage())); + + // Mark the form as errored + $creationForm->setErrorMessage($message); + + // Pass it to the parser, along with the error message + $this->getParserContext() + ->addForm($creationForm) + ->setGeneralError($message) + ; + } + + // At this point, the form has error, and should be redisplayed. + return $this->render('messages'); + } + + /** + * Load a message object for modification, and display the edit template. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function changeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.messages.change")) return $response; + + // Load the message object + $message = MessageQuery::create() + ->joinWithI18n($this->getCurrentEditionLocale()) + ->findOneById($this->getRequest()->get('message_id')); + + if ($message != null) { + + // Prepare the data that will hydrate the form + $data = array( + 'id' => $message->getId(), + 'name' => $message->getName(), + 'secured' => $message->getSecured(), + 'locale' => $message->getLocale(), + 'title' => $message->getTitle(), + 'subject' => $message->getSubject(), + 'html_message' => $message->getHtmlMessage(), + 'text_message' => $message->getTextMessage() + ); + + // Setup the object form + $changeForm = new MessageModificationForm($this->getRequest(), "form", $data); + + // Pass it to the parser + $this->getParserContext()->addForm($changeForm); + } + + // Render the edition template. + return $this->render('message-edit', array('message_id' => $this->getRequest()->get('message_id'))); + } + + /** + * Save changes on a modified message object, and either go back to the message list, or stay on the edition page. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function saveChangeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.messages.change")) return $response; + + $message = false; + + // Create the form from the request + $changeForm = new MessageModificationForm($this->getRequest()); + + // Get the message ID + $message_id = $this->getRequest()->get('message_id'); + + try { + + // Check the form against constraints violations + $form = $this->validateForm($changeForm, "POST"); + + // Get the form field values + $data = $form->getData(); + + $changeEvent = new MessageChangeEvent($data['id']); + + // Create and dispatch the change event + $changeEvent + ->setMessageName($data['name']) + ->setSecured($data['secured']) + ->setLocale($data["locale"]) + ->setTitle($data['title']) + ->setSubject($data['subject']) + ->setHtmlMessage($data['html_message']) + ->setTextMessage($data['text_message']) + ; + + $this->dispatch(TheliaEvents::MESSAGE_MODIFY, $changeEvent); + + // Log message modification + $changedObject = $changeEvent->getMessage(); + + $this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $changedObject->getName(), $changedObject->getId())); + + // If we have to stay on the same page, do not redirect to the succesUrl, + // just redirect to the edit page again. + if ($this->getRequest()->get('save_mode') == 'stay') { + $this->redirect(URL::absoluteUrl( + "admin/configuration/messages/change", + array('message_id' => $message_id) + )); + } + + // Redirect to the success URL + $this->redirect($changeForm->getSuccessUrl()); + } + catch (FormValidationException $ex) { + // Invalid data entered + $message = sprintf("Please check your input: %s", $ex->getMessage()); + } + catch (\Exception $ex) { + // Any other error + $message = sprintf("Sorry, an error occured: %s", $ex->getMessage()); + } + + if ($message !== false) { + // Log error message + Tlog::getInstance()->error(sprintf("Error during message modification process : %s. Exception was %s", $message, $ex->getMessage())); + + // Mark the form as errored + $changeForm->setErrorMessage($message); + + // Pas the form and the error to the parser + $this->getParserContext() + ->addForm($changeForm) + ->setGeneralError($message) + ; + } + + // At this point, the form has errors, and should be redisplayed. + return $this->render('message-edit', array('message_id' => $message_id)); + } + + /** + * Delete a message object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function deleteAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.messages.delete")) return $response; + + // Get the message id, and dispatch the delet request + $event = new MessageDeleteEvent($this->getRequest()->get('message_id')); + + $this->dispatch(TheliaEvents::MESSAGE_DELETE, $event); + + $this->redirect(URL::adminViewUrl('messages')); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/SessionController.php b/core/lib/Thelia/Controller/Admin/SessionController.php index 39dbc1205..552fea8eb 100755 --- a/core/lib/Thelia/Controller/Admin/SessionController.php +++ b/core/lib/Thelia/Controller/Admin/SessionController.php @@ -51,13 +51,16 @@ class SessionController extends BaseAdminController public function checkLoginAction() { - $adminLoginForm = new AdminLogin($this->getRequest()); - $request = $this->getRequest(); - $authenticator = new AdminUsernamePasswordFormAuthenticator($request, $adminLoginForm); + $adminLoginForm = new AdminLogin($request); try { + + $form = $this->validateForm($adminLoginForm, "post"); + + $authenticator = new AdminUsernamePasswordFormAuthenticator($request, $adminLoginForm); + $user = $authenticator->getAuthentifiedUser(); // Success -> store user in security context @@ -85,7 +88,7 @@ class SessionController extends BaseAdminController // Log authentication failure AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request); - $message = "Unable to process your request. Please try again."; + $message = "Unable to process your request. Please try again.".$ex->getMessage(); } // Store error information in the form @@ -93,7 +96,7 @@ class SessionController extends BaseAdminController $adminLoginForm->setErrorMessage($message); // Store the form name in session (see Form Smarty plugin to find usage of this parameter) - $this->getParserContext()->setErrorForm($adminLoginForm); + $this->getParserContext()->addForm($adminLoginForm); // Display the login form again return $this->render("login"); diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index 4b245a9e4..9d7c953a3 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -35,6 +35,7 @@ use Thelia\Core\Factory\ActionEventFactory; use Thelia\Form\BaseForm; use Thelia\Form\Exception\FormValidationException; use Symfony\Component\EventDispatcher\Event; +use Thelia\Core\Event\DefaultActionEvent; /** * @@ -60,10 +61,12 @@ class BaseController extends ContainerAware * Dispatch a Thelia event * * @param string $eventName a TheliaEvent name, as defined in TheliaEvents class - * @param Event $event the event + * @param Event $event the action event, or null (a DefaultActionEvent will be dispatched) */ - protected function dispatch($eventName, Event $event = null) + protected function dispatch($eventName, ActionEvent $event = null) { + if ($event == null) $event = new DefaultActionEvent(); + $this->getDispatcher()->dispatch($eventName, $event); } @@ -117,6 +120,29 @@ class BaseController extends ContainerAware return $request->getSession(); } + /** + * Get all errors that occured in a form + * + * @param \Symfony\Component\Form\Form $form + * @return string the error string + */ + private function getErrorMessages(\Symfony\Component\Form\Form $form) { + + $errors = ''; + + foreach ($form->getErrors() as $key => $error) { + $errors .= $error->getMessage() . ', '; + } + + foreach ($form->all() as $child) { + if (!$child->isValid()) { + $errors .= $this->getErrorMessages($child) . ', '; + } + } + + return rtrim($errors, ', '); + } + /** * Validate a BaseForm * @@ -135,17 +161,20 @@ class BaseController extends ContainerAware if ($form->isValid()) { return $form; - } else { - throw new FormValidationException("Missing or invalid data"); } - } else { + else { + throw new FormValidationException(sprintf("Missing or invalid data: %s", $this->getErrorMessages($form))); + } + } + else { throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod)); } } /** * - * redirect request to specify url + * redirect request to the specified url + * * @param string $url */ public function redirect($url, $status = 302) @@ -154,12 +183,21 @@ class BaseController extends ContainerAware } /** - * If success_url param is present in request, follow this link. + * If success_url param is present in request or in the provided form, redirect to this URL. + * + * @param BaseForm $form a base form, which may contains the success URL */ - protected function redirectSuccess() + protected function redirectSuccess(BaseForm $form = null) { - if (null !== $url = $this->getRequest()->get("success_url")) { - $this->redirect($url); + if ($form != null) { + $url = $form->getSuccessUrl(); } + else { + $url = $this->getRequest()->get("success_url"); + } + + echo "url=$url"; + + if (null !== $url) $this->redirect($url); } } diff --git a/core/lib/Thelia/Controller/Front/CartController.php b/core/lib/Thelia/Controller/Front/CartController.php index 62b68a3fc..8f2cdd036 100755 --- a/core/lib/Thelia/Controller/Front/CartController.php +++ b/core/lib/Thelia/Controller/Front/CartController.php @@ -63,7 +63,7 @@ class CartController extends BaseFrontController if ($message) { $cartAdd->setErrorMessage($message); - $this->getParserContext()->setErrorForm($cartAdd); + $this->getParserContext()->addForm($cartAdd); } } diff --git a/core/lib/Thelia/Controller/Front/CustomerController.php b/core/lib/Thelia/Controller/Front/CustomerController.php index 698c69d70..005fd6d01 100755 --- a/core/lib/Thelia/Controller/Front/CustomerController.php +++ b/core/lib/Thelia/Controller/Front/CustomerController.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Controller\Front; -use Propel\Runtime\Exception\PropelException; -use Symfony\Component\Validator\Exception\ValidatorException; use Thelia\Core\Event\CustomerCreateOrUpdateEvent; use Thelia\Core\Event\CustomerLoginEvent; use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator; @@ -37,65 +35,101 @@ use Thelia\Form\Exception\FormValidationException; use Thelia\Model\Customer; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\CustomerEvent; +use Thelia\Core\Factory\ActionEventFactory; +use Thelia\Tools\URL; +use Thelia\Log\Tlog; +use Thelia\Core\Security\Exception\WrongPasswordException; class CustomerController extends BaseFrontController { /** - * create a new Customer. Retrieve data in form and dispatch a action.createCustomer event - * - * if error occurs, message is set in the parserContext + * Create a new customer. + * On success, redirect to success_url if exists, otherwise, display the same view again. */ public function createAction() { - $request = $this->getRequest(); - $customerCreation = new CustomerCreation($request); - try { - $form = $this->validateForm($customerCreation, "post"); + if (! $this->getSecurityContext()->hasCustomerUser()) { - $customerCreateEvent = $this->createEventInstance($form->getData()); + $message = false; - $this->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent); + $customerCreation = new CustomerCreation($this->getRequest()); - $this->processLogin($customerCreateEvent->getCustomer()); + try { + $form = $this->validateForm($customerCreation, "post"); - $this->redirectSuccess(); + $customerCreateEvent = $this->createEventInstance($form->getData()); - } catch (FormValidationException $e) { - $customerCreation->setErrorMessage($e->getMessage()); - $this->getParserContext()->setErrorForm($customerCreation); - } catch (PropelException $e) { - \Thelia\Log\Tlog::getInstance()->error(sprintf("error during customer creation process in front context with message : %s", $e->getMessage())); - $this->getParserContext()->setGeneralError($e->getMessage()); + $this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent); + + $this->processLogin($customerCreateEvent->getCustomer()); + + $this->redirectSuccess($customerCreation); + } + catch (FormValidationException $e) { + $message = sprintf("Please check your input: %s", $ex->getMessage()); + } + catch (\Exception $e) { + $message = sprintf("Sorry, an error occured: %s", $ex->getMessage()); + } + + if ($message !== false) { + Tlog::getInstance()->error(sprintf("Error during customer creation process : %s. Exception was %s", $message, $e->getMessage())); + + $customerCreation->setErrorMessage($message); + + $this->getParserContext() + ->addForm($customerCreation) + ->setGeneralError($message) + ; + } } - } + /** + * Update customer data. On success, redirect to success_url if exists. + * Otherwise, display the same view again. + */ public function updateAction() { - $request = $this->getRequest(); - $customerModification = new CustomerModification($request); + if ($this->getSecurityContext()->hasCustomerUser()) { - try { + $message = false; - $customer = $this->getSecurityContext()->getCustomerUser(); + $customerModification = new CustomerModification($this->getRequest()); - $form = $this->validateForm($customerModification, "post"); + try { - $customerChangeEvent = $this->createEventInstance($form->getData()); - $customerChangeEvent->setCustomer($customer); + $customer = $this->getSecurityContext()->getCustomerUser(); - $this->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $customerChangeEvent); + $form = $this->validateForm($customerModification, "post"); - $this->processLogin($customerChangeEvent->getCustomer()); + $customerChangeEvent = $this->createEventInstance($form->getData()); + $customerChangeEvent->setCustomer($customer); - $this->redirectSuccess(); + $this->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $customerChangeEvent); - } catch (FormValidationException $e) { - $customerModification->setErrorMessage($e->getMessage()); - $this->getParserContext()->setErrorForm($customerModification); - } catch (PropelException $e) { - \Thelia\Log\Tlog::getInstance()->error(sprintf("error during updating customer in front context with message : %s", $e->getMessage())); - $this->getParserContext()->setGeneralError($e->getMessage()); + $this->processLogin($customerChangeEvent->getCustomer()); + + $this->redirectSuccess($customerModification); + + } + catch (FormValidationException $e) { + $message = sprintf("Please check your input: %s", $ex->getMessage()); + } + catch (\Exception $e) { + $message = sprintf("Sorry, an error occured: %s", $ex->getMessage()); + } + + if ($message !== false) { + Tlog::getInstance()->error(sprintf("Error during customer modification process : %s. Exception was %s", $message, $e->getMessage())); + + $customerModification->setErrorMessage($message); + + $this->getParserContext() + ->addForm($customerModification) + ->setGeneralError($message) + ; + } } } @@ -103,39 +137,75 @@ class CustomerController extends BaseFrontController * Perform user login. On a successful login, the user is redirected to the URL * found in the success_url form parameter, or / if none was found. * - * If login is not successfull, the same view is dispolyed again. + * If login is not successfull, the same view is displayed again. * */ public function loginAction() { - $request = $this->getRequest(); + if (! $this->getSecurityContext()->hasCustomerUser()) { + $message = false; - $customerLoginForm = new CustomerLogin($request); + $request = $this->getRequest(); - $authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm); + try { - try { - $customer = $authenticator->getAuthentifiedUser(); + $customerLoginForm = new CustomerLogin($request); - $this->processLogin($customer); + $form = $this->validateForm($customerLoginForm, "post"); - $this->redirectSuccess(); - } catch (ValidatorException $e) { + $authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm); - } catch(UsernameNotFoundException $e) { + $customer = $authenticator->getAuthentifiedUser(); - } catch(AuthenticationException $e) { + $this->processLogin($customer); - } catch (\Exception $e) { + $this->redirectSuccess($customerLoginForm); + } + catch (FormValidationException $e) { + $message = sprintf("Please check your input: %s", $ex->getMessage()); + } + catch(UsernameNotFoundException $e) { + $message = "This customer email was not found."; + } + catch (WrongPasswordException $e) { + $message = "Wrong password. Please try again."; + } + catch(AuthenticationException $e) { + $message = "Sorry, we failed to authentify you. Please try again."; + } + catch (\Exception $e) { + $message = sprintf("Sorry, an error occured: %s", $ex->getMessage()); + } + + if ($message !== false) { + Tlog::getInstance()->error(sprintf("Error during customer login process : %s. Exception was %s", $message, $e->getMessage())); + + $customerLoginForm->setErrorMessage($message); + + $this->getParserContext()->addForm($customerLoginForm); + } } } - public function processLogin(Customer $customer) + /** + * Perform customer logout. + * + * @param Customer $customer + */ + public function logoutAction() { - $this->getSecurityContext()->setCustomerUser($customer); + if ($this->getSecurityContext()->hasCustomerUser()) { + $this->dispatch(TheliaEvents::CUSTOMER_LOGOUT); + } - if($event) $this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer)); + // Redirect to home page + $this->redirect(URL::getIndexPage()); + } + + protected function processLogin(Customer $customer) + { + $this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer)); } /** @@ -161,10 +231,9 @@ class CustomerController extends BaseFrontController $this->getRequest()->getSession()->getLang(), isset($data["reseller"])?$data["reseller"]:null, isset($data["sponsor"])?$data["sponsor"]:null, - isset($data["discount"])?$data["discount"]:nullsch + isset($data["discount"])?$data["discount"]:null ); return $customerCreateEvent; } - } diff --git a/core/lib/Thelia/Core/Application.php b/core/lib/Thelia/Core/Application.php index 531d8802c..bb0eec79a 100755 --- a/core/lib/Thelia/Core/Application.php +++ b/core/lib/Thelia/Core/Application.php @@ -29,6 +29,12 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\HttpKernel\KernelInterface; +/** + * cli application for Thelia + * Class Application + * @package Thelia\Core + * mfony\Component\HttpFoundation\Session\Session + */ class Application extends BaseApplication { diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php index 9f7e9f31f..08fcd777b 100755 --- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php @@ -31,6 +31,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; * @package Thelia\Core\DependencyInjection\Compiler * * Source code come from Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RegisterKernelListenersPass class + * @author Manuel Raynaud */ class RegisterListenersPass implements CompilerPassInterface { diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php index 80c3ba933..71d96ca40 100755 --- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php @@ -31,7 +31,7 @@ use Symfony\Component\DependencyInjection\Reference; * Register parser plugins. These plugins shouild be tagged thelia.parser.register_plugin * in the configuration. * - * + * @author Manuel Raynaud */ class RegisterParserPluginPass implements CompilerPassInterface { diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php index 2bd902e64..2d7110ee5 100755 --- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php @@ -28,6 +28,14 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Reference; +/** + * + * this compiler can add many router to symfony-cms routing + * + * Class RegisterRouterPass + * @package Thelia\Core\DependencyInjection\Compiler + * @author Manuel Raynaud + */ class RegisterRouterPass implements CompilerPassInterface { diff --git a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php index a95e7d668..294c9b671 100755 --- a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php +++ b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php @@ -36,6 +36,14 @@ use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Loader\FileLoader; +/** + * + * Load, read and validate config xml files + * + * Class XmlFileLoader + * @package Thelia\Core\DependencyInjection\Loader + * @author Manuel Raynaud + */ class XmlFileLoader extends FileLoader { /** diff --git a/core/lib/Thelia/Core/Event/CategoryChangeEvent.php b/core/lib/Thelia/Core/Event/CategoryChangeEvent.php new file mode 100644 index 000000000..e8e183b3f --- /dev/null +++ b/core/lib/Thelia/Core/Event/CategoryChangeEvent.php @@ -0,0 +1,44 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Category; + +class CategoryCreateEvent extends ActionEvent +{ + protected $category_id; + protected $locale; + protected $title; + protected $chapo; + protected $description; + protected $postscriptum; + protected $url; + protected $visibility; + protected $parent; + + public function __construct($category_id) + { + $this->category_id = $category_id; + } +} diff --git a/core/lib/Thelia/Core/Event/CategoryChangePositionEvent.php b/core/lib/Thelia/Core/Event/CategoryChangePositionEvent.php index 141fc8182..94f131626 100644 --- a/core/lib/Thelia/Core/Event/CategoryChangePositionEvent.php +++ b/core/lib/Thelia/Core/Event/CategoryChangePositionEvent.php @@ -30,28 +30,18 @@ class CategoryChangePositionEvent extends ActionEvent const POSITION_DOWN = 2; const POSITION_ABSOLUTE = 3; - protected $id; + protected $category_id; protected $mode; protected $position; protected $category; - public function __construct($id, $mode, $position = null) + public function __construct($category_id, $mode, $position = null) { - $this->id = $id; + $this->category_id = $category_id; $this->mode = $mode; $this->position = $position; } - public function getId() - { - return $this->id; - } - - public function setId($id) - { - $this->id = $id; - } - public function getMode() { return $this->mode; @@ -81,4 +71,15 @@ class CategoryChangePositionEvent extends ActionEvent { $this->category = $category; } -} \ No newline at end of file + + public function getCategoryId() + { + return $this->category_id; + } + + public function setCategoryId($category_id) + { + $this->category_id = $category_id; + } + +} diff --git a/core/lib/Thelia/Core/Event/CategoryCreateEvent.php b/core/lib/Thelia/Core/Event/CategoryCreateEvent.php index 558b04277..f4d5a45ee 100644 --- a/core/lib/Thelia/Core/Event/CategoryCreateEvent.php +++ b/core/lib/Thelia/Core/Event/CategoryCreateEvent.php @@ -77,6 +77,5 @@ class CategoryCreateEvent extends ActionEvent public function setCreatedCategory(Category $created_category) { $this->created_category = $created_category; -var_dump($this->created_category); } } diff --git a/core/lib/Thelia/Core/Event/CategoryDeleteEvent.php b/core/lib/Thelia/Core/Event/CategoryDeleteEvent.php index c53cb7e10..3e863be8e 100644 --- a/core/lib/Thelia/Core/Event/CategoryDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/CategoryDeleteEvent.php @@ -26,22 +26,22 @@ use Thelia\Model\Category; class CategoryDeleteEvent extends ActionEvent { - protected $id; + protected $category_id; protected $deleted_category; - public function __construct($id) + public function __construct($category_id) { - $this->id = $id; + $this->category_id = $category_id; } - public function getId() + public function getCategoryId() { - return $this->id; + return $this->category_id; } - public function setId($id) + public function setCategoryId($category_id) { - $this->id = $id; + $this->category_id = $category_id; } public function getDeletedCategory() diff --git a/core/lib/Thelia/Core/Event/CategoryEvent.php b/core/lib/Thelia/Core/Event/CategoryEvent.php new file mode 100644 index 000000000..c29d681d8 --- /dev/null +++ b/core/lib/Thelia/Core/Event/CategoryEvent.php @@ -0,0 +1,47 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Category; +use Thelia\Core\Event\ActionEvent; + +class CategoryEvent extends ActionEvent +{ + public $category; + + public function __construct(Category $category) + { + $this->category = $category; + } + + /** + * @return \Thelia\Model\Category + */ + public function getCategory() + { + return $this->category; + } + + +} diff --git a/core/lib/Thelia/Core/Event/CategoryToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/CategoryToggleVisibilityEvent.php index b7237924e..ef921a0de 100644 --- a/core/lib/Thelia/Core/Event/CategoryToggleVisibilityEvent.php +++ b/core/lib/Thelia/Core/Event/CategoryToggleVisibilityEvent.php @@ -26,22 +26,22 @@ use Thelia\Model\Category; class CategoryToggleVisibilityEvent extends ActionEvent { - protected $id; + protected $category_id; protected $category; - public function __construct($id) + public function __construct($category_id) { - $this->id = $id; + $this->category_id = $category_id; } - public function getId() + public function getCategoryId() { - return $this->id; + return $this->category_id; } - public function setId($id) + public function setCategoryId($category_id) { - $this->id = $id; + $this->category_id = $category_id; } public function getCategory() diff --git a/core/lib/Thelia/Core/Event/ConfigChangeEvent.php b/core/lib/Thelia/Core/Event/ConfigChangeEvent.php new file mode 100644 index 000000000..e7da059ee --- /dev/null +++ b/core/lib/Thelia/Core/Event/ConfigChangeEvent.php @@ -0,0 +1,88 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Config; + +class ConfigChangeEvent extends ConfigCreateEvent +{ + protected $config_id; + + protected $description; + protected $chapo; + protected $postscriptum; + + public function __construct($config_id) + { + $this->setConfigId($config_id); + } + + public function getConfigId() + { + return $this->config_id; + } + + public function setConfigId($config_id) + { + $this->config_id = $config_id; + + return $this; + } + + public function getDescription() + { + return $this->description; + } + + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + public function getChapo() + { + return $this->chapo; + } + + public function setChapo($chapo) + { + $this->chapo = $chapo; + + return $this; + } + + public function getPostscriptum() + { + return $this->postscriptum; + } + + public function setPostscriptum($postscriptum) + { + $this->postscriptum = $postscriptum; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/ConfigCreateEvent.php b/core/lib/Thelia/Core/Event/ConfigCreateEvent.php new file mode 100644 index 000000000..79440c491 --- /dev/null +++ b/core/lib/Thelia/Core/Event/ConfigCreateEvent.php @@ -0,0 +1,108 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Config; + +class ConfigCreateEvent extends ConfigEvent +{ + protected $event_name; + protected $value; + protected $locale; + protected $title; + protected $hidden; + protected $secured; + + // Use event_name to prevent conflict with Event::name property. + public function getEventName() + { + return $this->event_name; + } + + public function setEventName($event_name) + { + $this->event_name = $event_name; + + return $this; + } + + public function getValue() + { + return $this->value; + } + + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + public function getLocale() + { + return $this->locale; + } + + public function setLocale($locale) + { + $this->locale = $locale; + + return $this; + } + + public function getTitle() + { + return $this->title; + } + + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + public function getHidden() + { + return $this->hidden; + } + + public function setHidden($hidden) + { + $this->hidden = $hidden; + + return $this; + } + + public function getSecured() + { + return $this->secured; + } + + public function setSecured($secured) + { + $this->secured = $secured; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/ConfigDeleteEvent.php b/core/lib/Thelia/Core/Event/ConfigDeleteEvent.php new file mode 100644 index 000000000..6cc39438c --- /dev/null +++ b/core/lib/Thelia/Core/Event/ConfigDeleteEvent.php @@ -0,0 +1,48 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Config; + +class ConfigDeleteEvent extends ConfigEvent +{ + protected $config_id; + + public function __construct($config_id) + { + $this->setConfigId($config_id); + } + + public function getConfigId() + { + return $this->config_id; + } + + public function setConfigId($config_id) + { + $this->config_id = $config_id; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/ConfigEvent.php b/core/lib/Thelia/Core/Event/ConfigEvent.php new file mode 100644 index 000000000..eb5ec57c7 --- /dev/null +++ b/core/lib/Thelia/Core/Event/ConfigEvent.php @@ -0,0 +1,47 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Config; + +class ConfigEvent extends ActionEvent +{ + protected $config; + + public function __construct(Config $config = null) + { + $this->config = $config; + } + + public function getConfig() + { + return $this->config; + } + + public function setConfig($config) + { + $this->config = $config; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/CustomerLoginEvent.php b/core/lib/Thelia/Core/Event/CustomerLoginEvent.php index cc363790d..9a26bba3f 100755 --- a/core/lib/Thelia/Core/Event/CustomerLoginEvent.php +++ b/core/lib/Thelia/Core/Event/CustomerLoginEvent.php @@ -26,7 +26,7 @@ namespace Thelia\Core\Event; use Thelia\Model\Customer; -class CustomerLoginEvent { +class CustomerLoginEvent extends ActionEvent { protected $customer; diff --git a/core/lib/Thelia/Core/Event/MessageChangeEvent.php b/core/lib/Thelia/Core/Event/MessageChangeEvent.php new file mode 100644 index 000000000..1d36f1d30 --- /dev/null +++ b/core/lib/Thelia/Core/Event/MessageChangeEvent.php @@ -0,0 +1,88 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Message; + +class MessageChangeEvent extends MessageCreateEvent +{ + protected $message_id; + + protected $text_message; + protected $html_message; + protected $subject; + + public function __construct($message_id) + { + $this->setMessageId($message_id); + } + + public function getMessageId() + { + return $this->message_id; + } + + public function setMessageId($message_id) + { + $this->message_id = $message_id; + + return $this; + } + + public function getTextMessage() + { + return $this->text_message; + } + + public function setTextMessage($text_message) + { + $this->text_message = $text_message; + + return $this; + } + + public function getHtmlMessage() + { + return $this->html_message; + } + + public function setHtmlMessage($html_message) + { + $this->html_message = $html_message; + + return $this; + } + + public function getSubject() + { + return $this->subject; + } + + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/MessageCreateEvent.php b/core/lib/Thelia/Core/Event/MessageCreateEvent.php new file mode 100644 index 000000000..0d698168a --- /dev/null +++ b/core/lib/Thelia/Core/Event/MessageCreateEvent.php @@ -0,0 +1,82 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Message; + +class MessageCreateEvent extends MessageEvent +{ + protected $message_name; + protected $locale; + protected $title; + protected $secured; + + // Use message_name to prevent conflict with Event::name property. + public function getMessageName() + { + return $this->message_name; + } + + public function setMessageName($message_name) + { + $this->message_name = $message_name; + + return $this; + } + + public function getLocale() + { + return $this->locale; + } + + public function setLocale($locale) + { + $this->locale = $locale; + + return $this; + } + + public function getTitle() + { + return $this->title; + } + + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + public function getSecured() + { + return $this->secured; + } + + public function setSecured($secured) + { + $this->secured = $secured; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/MessageDeleteEvent.php b/core/lib/Thelia/Core/Event/MessageDeleteEvent.php new file mode 100644 index 000000000..5513c85a9 --- /dev/null +++ b/core/lib/Thelia/Core/Event/MessageDeleteEvent.php @@ -0,0 +1,48 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Message; + +class MessageDeleteEvent extends MessageEvent +{ + protected $message_id; + + public function __construct($message_id) + { + $this->setMessageId($message_id); + } + + public function getMessageId() + { + return $this->message_id; + } + + public function setMessageId($message_id) + { + $this->message_id = $message_id; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/MessageEvent.php b/core/lib/Thelia/Core/Event/MessageEvent.php new file mode 100644 index 000000000..18433a36b --- /dev/null +++ b/core/lib/Thelia/Core/Event/MessageEvent.php @@ -0,0 +1,47 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Message; + +class MessageEvent extends ActionEvent +{ + protected $message; + + public function __construct(Message $message = null) + { + $this->message = $message; + } + + public function getMessage() + { + return $this->message; + } + + public function setMessage($message) + { + $this->message = $message; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 2dd85905d..ed0a96cdf 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -177,4 +177,37 @@ final class TheliaEvents * Sent on cimage cache clear request */ const IMAGE_CLEAR_CACHE = "action.clearImageCache"; + + // -- Configuration management --------------------------------------------- + + const CONFIG_CREATE = "action.createConfig"; + const CONFIG_SETVALUE = "action.setConfigValue"; + const CONFIG_MODIFY = "action.changeConfig"; + const CONFIG_DELETE = "action.deleteConfig"; + + const BEFORE_CREATECONFIG = "action.before_createConfig"; + const AFTER_CREATECONFIG = "action.after_createConfig"; + + const BEFORE_CHANGECONFIG = "action.before_changeConfig"; + const AFTER_CHANGECONFIG = "action.after_changeConfig"; + + const BEFORE_DELETECONFIG = "action.before_deleteConfig"; + const AFTER_DELETECONFIG = "action.after_deleteConfig"; + + + // -- Messages management --------------------------------------------- + + const MESSAGE_CREATE = "action.createMessage"; + const MESSAGE_MODIFY = "action.changeMessage"; + const MESSAGE_DELETE = "action.deleteMessage"; + + const BEFORE_CREATEMESSAGE = "action.before_createMessage"; + const AFTER_CREATEMESSAGE = "action.after_createMessage"; + + const BEFORE_CHANGEMESSAGE = "action.before_changeMessage"; + const AFTER_CHANGEMESSAGE = "action.after_changeMessage"; + + const BEFORE_DELETEMESSAGE = "action.before_deleteMessage"; + const AFTER_DELETEMESSAGE = "action.after_deleteMessage"; + } diff --git a/core/lib/Thelia/Core/EventListener/ControllerListener.php b/core/lib/Thelia/Core/EventListener/ControllerListener.php index 9bb432e6a..097afb189 100755 --- a/core/lib/Thelia/Core/EventListener/ControllerListener.php +++ b/core/lib/Thelia/Core/EventListener/ControllerListener.php @@ -36,6 +36,7 @@ use Thelia\Core\Template\ParserContext; * * Class ControllerListener * @package Thelia\Core\EventListener + * @author Manuel Raynaud */ class ControllerListener implements EventSubscriberInterface { @@ -59,12 +60,7 @@ class ControllerListener implements EventSubscriberInterface $event = new ActionEventFactory($request, $action, $event->getKernel()->getContainer()->getParameter("thelia.actionEvent")); $actionEvent = $event->createActionEvent(); $dispatcher->dispatch("action.".$action, $actionEvent); - - // Process form errors - if ($actionEvent->hasErrorForm()) { - $this->parserContext->setErrorForm($actionEvent->getErrorForm()); - } - } + } } public static function getSubscribedEvents() diff --git a/core/lib/Thelia/Core/Factory/ActionEventFactory.php b/core/lib/Thelia/Core/Factory/ActionEventFactory.php index 9ef0644ff..cbbb7caf8 100755 --- a/core/lib/Thelia/Core/Factory/ActionEventFactory.php +++ b/core/lib/Thelia/Core/Factory/ActionEventFactory.php @@ -25,6 +25,14 @@ namespace Thelia\Core\Factory; use Symfony\Component\HttpFoundation\Request; +/** + * * + * try to instanciate the good action class + * + * Class ActionEventFactory + * @package Thelia\Core\Factory + * @author Manuel Raynaud + */ class ActionEventFactory { diff --git a/core/lib/Thelia/Core/HttpFoundation/Request.php b/core/lib/Thelia/Core/HttpFoundation/Request.php index a30806a4b..e86ce8b65 100755 --- a/core/lib/Thelia/Core/HttpFoundation/Request.php +++ b/core/lib/Thelia/Core/HttpFoundation/Request.php @@ -24,6 +24,13 @@ namespace Thelia\Core\HttpFoundation; use Symfony\Component\HttpFoundation\Request as BaseRequest; +/** + * extends Symfony\Component\HttpFoundation\Request for adding some helpers + * + * Class Request + * @package Thelia\Core\HttpFoundation + * @author Manuel Raynaud + */ class Request extends BaseRequest { diff --git a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php index 784258ad3..5f311ad0e 100755 --- a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php +++ b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php @@ -29,7 +29,16 @@ use Thelia\Exception\InvalidCartException; use Thelia\Model\CartQuery; use Thelia\Model\Cart; use Thelia\Tools\URL; +use Thelia\Model\Lang; +/** + * + * extends mfony\Component\HttpFoundation\Session\Session for adding some helpers + * + * Class Session + * @package Thelia\Core\HttpFoundation\Session + * Symfony\Component\HttpFoundation\Request + */ class Session extends BaseSession { // -- Language ------------------------------------------------------------ @@ -39,9 +48,50 @@ class Session extends BaseSession return $this->get("locale", "en_US"); } + public function setLocale($locale) + { + $this->set("locale", $locale); + + return $this; + } + + /** + * @return \Thelia\Model\Lang|null + */ public function getLang() { - return substr($this->getLocale(), 0, 2); + return $this->get("lang"); + } + + public function setLang(Lang $lang) + { + $this->set("lang", $lang); + + return $this; + } + + public function getLangId() + { + return $this->get("lang_id", Lang::getDefaultLanguage()->getId()); + } + + public function setLangId($langId) + { + $this->set("lang_id", $langId); + + return $this; + } + + public function getAdminEditionLangId() + { + return $this->get('admin.edition_language', Lang::getDefaultLanguage()->getId()); + } + + public function setAdminEditionLangId($langId) + { + $this->set('admin.edition_language', $langId); + + return $this; } // -- Customer user -------------------------------------------------------- @@ -49,6 +99,7 @@ class Session extends BaseSession public function setCustomerUser(UserInterface $user) { $this->set('customer_user', $user); + return $this; } public function getCustomerUser() @@ -66,6 +117,7 @@ class Session extends BaseSession public function setAdminUser(UserInterface $user) { $this->set('admin_user', $user); + return $this; } public function getAdminUser() @@ -83,6 +135,7 @@ class Session extends BaseSession public function setReturnToUrl($url) { $this->set('return_to_url', $url); + return $this; } /** @@ -141,6 +194,6 @@ class Session extends BaseSession public function setCart($cart_id) { $this->set("cart_id", $cart_id); + return $this; } - } diff --git a/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php index 6dc938d88..d9a223430 100755 --- a/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php +++ b/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php @@ -55,8 +55,6 @@ class UsernamePasswordFormAuthenticator implements AuthenticatorInterface ); $this->options = array_merge($defaults, $options); - - $this->loginForm->bind($this->request); } /** diff --git a/core/lib/Thelia/Core/Security/SecurityContext.php b/core/lib/Thelia/Core/Security/SecurityContext.php index c09945f61..6ddb47f00 100755 --- a/core/lib/Thelia/Core/Security/SecurityContext.php +++ b/core/lib/Thelia/Core/Security/SecurityContext.php @@ -60,6 +60,16 @@ class SecurityContext return $this->getSession()->getAdminUser(); } + /** + * Check if an admin user is logged in. + * + * @return true if an admin user is logged in, false otherwise. + */ + public function hasAdminUser() + { + return $this->getSession()->getAdminUser() != null; + } + /** * Gets the currently authenticated customer, or null if none is defined * @@ -70,6 +80,16 @@ class SecurityContext return $this->getSession()->getCustomerUser(); } + /** + * Check if a customer user is logged in. + * + * @return true if a customer is logged in, false otherwise. + */ + public function hasCustomerUser() + { + return $this->getSession()->getCustomerUser() != null; + } + /** * Check if a user has at least one of the required roles * diff --git a/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php b/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php new file mode 100644 index 000000000..ef51d51b8 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php @@ -0,0 +1,79 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Element; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Thelia\Core\Template\Loop\Argument\Argument; +use Propel\Runtime\ActiveQuery\ModelCriteria; +use Thelia\Core\Security\SecurityContext; +use Thelia\Model\Tools\ModelCriteriaTools; + +/** + * + * Class BaseI18nLoop, imlplemented by loops providing internationalized data, such as title, description, etc. + * + * @package Thelia\Core\Template\Element + */ +abstract class BaseI18nLoop extends BaseLoop +{ + /** + * Define common loop arguments + * + * @return Argument[] + */ + protected function getDefaultArgs() + { + $args = parent::getDefaultArgs(); + + $args[] = Argument::createIntTypeArgument('lang'); + + return $args; + } + + /** + * Setup ModelCriteria for proper i18n processing + * + * @param ModelCriteria $search the Propel Criteria to configure + * @param array $columns the i18n columns + * @param string $foreignTable the specified table (default to criteria table) + * @param string $foreignKey the foreign key in this table (default to criteria table) + * + * @return mixed the locale + */ + protected function configureI18nProcessing(ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID', $forceReturn = false) { + + /* manage translations */ + return ModelCriteriaTools::getI18n( + $this->getBackend_context(), + $this->getLang(), + $search, + $this->request->getSession()->getLocale(), + $columns, + $foreignTable, + $foreignKey, + $forceReturn + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php index 9190e7538..befb53dc7 100755 --- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php +++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php @@ -138,7 +138,7 @@ abstract class BaseLoop } elseif ($value !== null && !$argument->type->isValid($value)) { /* check type */ $faultActor[] = $argument->name; - $faultDetails[] = sprintf('Invalid value for "%s" argument in loop type: %s, name: %s', $argument->name, $loopType, $loopName); + $faultDetails[] = sprintf('Invalid value "%s" for "%s" argument in loop type: %s, name: %s', $value, $argument->name, $loopType, $loopName); } else { /* set default */ /* did it as last checking for we consider default value is acceptable no matter type or empty restriction */ diff --git a/core/lib/Thelia/Core/Template/Loop/Attribute.php b/core/lib/Thelia/Core/Template/Loop/Attribute.php index 0608732a4..79ffd4677 100755 --- a/core/lib/Thelia/Core/Template/Loop/Attribute.php +++ b/core/lib/Thelia/Core/Template/Loop/Attribute.php @@ -25,7 +25,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Join; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -53,7 +53,7 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Attribute extends BaseLoop +class Attribute extends BaseI18nLoop { /** * @return ArgumentCollection @@ -66,7 +66,6 @@ class Attribute extends BaseLoop Argument::createIntListTypeArgument('category'), Argument::createBooleanOrBothTypeArgument('visible', 1), Argument::createIntListTypeArgument('exclude'), - Argument::createIntTypeArgument('lang'), new Argument( 'order', new TypeCollection( @@ -91,7 +90,7 @@ class Attribute extends BaseLoop $lang = $this->getLang(); /* manage translations */ - $this->configureI18nProcessing($search); + $locale = $this->configureI18nProcessing($search); $id = $this->getId(); @@ -157,6 +156,7 @@ class Attribute extends BaseLoop $loopResultRow = new LoopResultRow(); $loopResultRow->set("ID", $attribute->getId()) ->set("IS_TRANSLATED",$attribute->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) ->set("TITLE",$attribute->getVirtualColumn('i18n_TITLE')) ->set("CHAPO", $attribute->getVirtualColumn('i18n_CHAPO')) ->set("DESCRIPTION", $attribute->getVirtualColumn('i18n_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php b/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php index 0664c7d56..13e905670 100755 --- a/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php +++ b/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php @@ -25,7 +25,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Join; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -46,7 +46,7 @@ use Thelia\Type; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class AttributeAvailability extends BaseLoop +class AttributeAvailability extends BaseI18nLoop { /** * @return ArgumentCollection @@ -57,7 +57,6 @@ class AttributeAvailability extends BaseLoop Argument::createIntListTypeArgument('id'), Argument::createIntListTypeArgument('attribute'), Argument::createIntListTypeArgument('exclude'), - Argument::createIntTypeArgument('lang'), new Argument( 'order', new TypeCollection( @@ -78,7 +77,7 @@ class AttributeAvailability extends BaseLoop $search = AttributeAvQuery::create(); /* manage translations */ - $this->configureI18nProcessing($search); + $locale = $this->configureI18nProcessing($search); $id = $this->getId(); @@ -126,6 +125,7 @@ class AttributeAvailability extends BaseLoop $loopResultRow = new LoopResultRow(); $loopResultRow->set("ID", $attributeAv->getId()) ->set("IS_TRANSLATED",$attributeAv->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) ->set("TITLE",$attributeAv->getVirtualColumn('i18n_TITLE')) ->set("CHAPO", $attributeAv->getVirtualColumn('i18n_CHAPO')) ->set("DESCRIPTION", $attributeAv->getVirtualColumn('i18n_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php b/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php index 556a5a1fd..53566c053 100755 --- a/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php +++ b/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php @@ -25,7 +25,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Join; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -48,7 +48,7 @@ use Thelia\Type; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class AttributeCombination extends BaseLoop +class AttributeCombination extends BaseI18nLoop { /** * @return ArgumentCollection @@ -57,7 +57,6 @@ class AttributeCombination extends BaseLoop { return new ArgumentCollection( Argument::createIntTypeArgument('product_sale_elements', null, true), - Argument::createIntTypeArgument('lang'), new Argument( 'order', new TypeCollection( @@ -78,7 +77,7 @@ class AttributeCombination extends BaseLoop $search = AttributeCombinationQuery::create(); /* manage attribute translations */ - $this->configureI18nProcessing( + $locale = $this->configureI18nProcessing( $search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), AttributeTableMap::TABLE_NAME, @@ -86,7 +85,7 @@ class AttributeCombination extends BaseLoop ); /* manage attributeAv translations */ - $this->configureI18nProcessing( + $locale = $this->configureI18nProcessing( $search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), AttributeAvTableMap::TABLE_NAME, @@ -118,6 +117,7 @@ class AttributeCombination extends BaseLoop $loopResultRow = new LoopResultRow(); $loopResultRow + ->set("LOCALE",$locale) ->set("ATTRIBUTE_TITLE", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_TITLE')) ->set("ATTRIBUTE_CHAPO", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_CHAPO')) ->set("ATTRIBUTE_DESCRIPTION", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/Category.php b/core/lib/Thelia/Core/Template/Loop/Category.php index 81cfa8ed7..9d4a2b4ec 100755 --- a/core/lib/Thelia/Core/Template/Loop/Category.php +++ b/core/lib/Thelia/Core/Template/Loop/Category.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -62,7 +62,7 @@ use Thelia\Type\BooleanOrBothType; * @author Manuel Raynaud * @author Etienne Roudeix */ -class Category extends BaseLoop +class Category extends BaseI18nLoop { /** * @return ArgumentCollection @@ -75,11 +75,10 @@ class Category extends BaseLoop Argument::createBooleanTypeArgument('current'), Argument::createBooleanTypeArgument('not_empty', 0), Argument::createBooleanOrBothTypeArgument('visible', 1), - Argument::createIntTypeArgument('lang'), new Argument( 'order', new TypeCollection( - new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'random')) + new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'random')) ), 'manual' ), @@ -146,6 +145,12 @@ class Category extends BaseLoop case "manual": $search->orderByPosition(Criteria::ASC); break; + case "visible": + $search->orderByVisible(Criteria::ASC); + break; + case "visible_reverse": + $search->orderByVisible(Criteria::DESC); + break; case "random": $search->clearOrderByColumns(); $search->addAscendingOrderByColumn('RAND()'); @@ -173,7 +178,8 @@ class Category extends BaseLoop $loopResultRow ->set("ID", $category->getId()) ->set("IS_TRANSLATED",$category->getVirtualColumn('IS_TRANSLATED')) - ->set("TITLE",$category->getVirtualColumn('i18n_TITLE')) + ->set("LOCALE",$locale) + ->set("TITLE", $category->getVirtualColumn('i18n_TITLE')) ->set("CHAPO", $category->getVirtualColumn('i18n_CHAPO')) ->set("DESCRIPTION", $category->getVirtualColumn('i18n_DESCRIPTION')) ->set("POSTSCRIPTUM", $category->getVirtualColumn('i18n_POSTSCRIPTUM')) diff --git a/core/lib/Thelia/Core/Template/Loop/CategoryPath.php b/core/lib/Thelia/Core/Template/Loop/CategoryPath.php index 30238c26d..0582ad3ee 100755 --- a/core/lib/Thelia/Core/Template/Loop/CategoryPath.php +++ b/core/lib/Thelia/Core/Template/Loop/CategoryPath.php @@ -23,7 +23,7 @@ namespace Thelia\Core\Template\Loop; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -54,7 +54,7 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Franck Allimant */ -class CategoryPath extends BaseLoop +class CategoryPath extends BaseI18nLoop { /** * @return ArgumentCollection @@ -65,8 +65,7 @@ class CategoryPath extends BaseLoop Argument::createIntTypeArgument('category', null, true), Argument::createIntTypeArgument('depth'), Argument::createIntTypeArgument('level'), - Argument::createBooleanOrBothTypeArgument('visible', true, false), - Argument::createIntTypeArgument('lang') + Argument::createBooleanOrBothTypeArgument('visible', true, false) ); } @@ -82,7 +81,7 @@ class CategoryPath extends BaseLoop $search = CategoryQuery::create(); - $this->configureI18nProcessing($search, array('TITLE')); + $locale = $this->configureI18nProcessing($search, array('TITLE')); $search->filterById($id); if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible); @@ -100,8 +99,9 @@ class CategoryPath extends BaseLoop $loopResultRow ->set("TITLE",$category->getVirtualColumn('i18n_TITLE')) - ->set("URL", $category->getUrl()) + ->set("URL", $category->getUrl($locale)) ->set("ID", $category->getId()) + ->set("LOCALE",$locale) ; $results[] = $loopResultRow; diff --git a/core/lib/Thelia/Core/Template/Loop/CategoryTree.php b/core/lib/Thelia/Core/Template/Loop/CategoryTree.php index 330466f49..63f1e9cfb 100755 --- a/core/lib/Thelia/Core/Template/Loop/CategoryTree.php +++ b/core/lib/Thelia/Core/Template/Loop/CategoryTree.php @@ -22,9 +22,7 @@ /*************************************************************************************/ namespace Thelia\Core\Template\Loop; - use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -34,6 +32,7 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\CategoryQuery; use Thelia\Type; use Thelia\Type\BooleanOrBothType; +use Thelia\Core\Template\Element\BaseI18nLoop; /** * @@ -46,19 +45,17 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Franck Allimant */ -class CategoryTree extends BaseLoop +class CategoryTree extends BaseI18nLoop { /** * @return ArgumentCollection */ protected function getArgDefinitions() { - return new ArgumentCollection( - Argument::createIntTypeArgument('category', null, true), - Argument::createIntTypeArgument('depth', PHP_INT_MAX), - Argument::createBooleanOrBothTypeArgument('visible', true, false), - Argument::createIntListTypeArgument('exclude', array()) - ); + return new ArgumentCollection(Argument::createIntTypeArgument('category', null, true), + Argument::createIntTypeArgument('depth', PHP_INT_MAX), + Argument::createBooleanOrBothTypeArgument('visible', true, false), + Argument::createIntListTypeArgument('exclude', array())); } // changement de rubrique @@ -66,7 +63,11 @@ class CategoryTree extends BaseLoop { if ($level > $max_level) return; - $search = CategoryQuery::create(); + $search = CategoryQuery::create(); + + $locale = $this->configureI18nProcessing($search, array( + 'TITLE' + )); $search->filterByParent($parent); @@ -82,18 +83,15 @@ class CategoryTree extends BaseLoop $loopResultRow = new LoopResultRow(); - $loopResultRow - ->set("ID", $result->getId()) - ->set("TITLE",$result->getTitle()) - ->set("PARENT", $result->getParent()) - ->set("URL", $result->getUrl()) - ->set("VISIBLE", $result->getVisible() ? "1" : "0") - ->set("LEVEL", $level) + $loopResultRow + ->set("ID", $result->getId())->set("TITLE", $result->getVirtualColumn('i18n_TITLE')) + ->set("PARENT", $result->getParent())->set("URL", $result->getUrl($locale)) + ->set("VISIBLE", $result->getVisible() ? "1" : "0")->set("LEVEL", $level) ; - $loopResult->addRow($loopResultRow); + $loopResult->addRow($loopResultRow); - $this->buildCategoryTree($result->getId(), $visible, 1 + $level, $max_level, $exclude, $loopResult); + $this->buildCategoryTree($result->getId(), $visible, 1 + $level, $max_level, $exclude, $loopResult); } } @@ -105,7 +103,7 @@ class CategoryTree extends BaseLoop public function exec(&$pagination) { $id = $this->getCategory(); - $depth = $this->getDepth(); + $depth = $this->getDepth(); $visible = $this->getVisible(); $exclude = $this->getExclude(); diff --git a/core/lib/Thelia/Core/Template/Loop/Config.php b/core/lib/Thelia/Core/Template/Loop/Config.php new file mode 100644 index 000000000..02f39510d --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Config.php @@ -0,0 +1,128 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; + +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Core\Template\Element\BaseI18nLoop; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; + +use Thelia\Core\Template\Loop\Argument\Argument; + +use Thelia\Model\LangQuery; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Model\ConfigQuery; +use Thelia\Type\BooleanOrBothType; + +/** + * Config loop, to access configuration variables + * + * - id is the config id + * - name is the config name + * - hidden filters by hidden status (yes, no, both) + * - secured filters by secured status (yes, no, both) + * - exclude is a comma separated list of config IDs that will be excluded from output + * + * @package Thelia\Core\Template\Loop + * @author Franck Allimant + */ +class Config extends BaseI18nLoop +{ + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('id'), + Argument::createIntListTypeArgument('exclude'), + Argument::createAnyTypeArgument('variable'), + Argument::createBooleanOrBothTypeArgument('hidden'), + Argument::createBooleanOrBothTypeArgument('secured') + ); + } + + /** + * @param $pagination (ignored) + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $id = $this->getId(); + $name = $this->getVariable(); + $secured = $this->getSecured(); + + $search = ConfigQuery::create(); + + $locale = $this->configureI18nProcessing($search); + + if (! is_null($id)) + $search->filterById($id); + + if (! is_null($name)) + $search->filterByName($name); + + if (! is_null($exclude)) { + $search->filterById($exclude, Criteria::NOT_IN); + } + + if ($this->getHidden() != BooleanOrBothType::ANY) + $search->filterByHidden($this->getHidden() ? 1 : 0); + + if (! is_null($secured) && $secured != BooleanOrBothType::ANY) + $search->filterBySecured($secured ? 1 : 0); + + $search->orderByName(Criteria::ASC); + + $results = $this->search($search, $pagination); + + $loopResult = new LoopResult(); + + foreach ($results as $result) { + + $loopResultRow = new LoopResultRow(); + + $loopResultRow + ->set("ID" , $result->getId()) + ->set("NAME" , $result->getName()) + ->set("VALUE" , $result->getValue()) + ->set("IS_TRANSLATED", $result->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("TITLE" , $result->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO" , $result->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION" , $result->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM" , $result->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("HIDDEN" , $result->getHidden()) + ->set("SECURED" , $result->getSecured()) + ->set("CREATE_DATE" , $result->getCreatedAt()) + ->set("UPDATE_DATE" , $result->getUpdatedAt()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/core/lib/Thelia/Core/Template/Loop/Content.php b/core/lib/Thelia/Core/Template/Loop/Content.php index b26e4d79f..58836daa7 100755 --- a/core/lib/Thelia/Core/Template/Loop/Content.php +++ b/core/lib/Thelia/Core/Template/Loop/Content.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -49,7 +49,7 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Content extends BaseLoop +class Content extends BaseI18nLoop { /** * @return ArgumentCollection @@ -63,7 +63,6 @@ class Content extends BaseLoop Argument::createBooleanTypeArgument('current_folder'), Argument::createIntTypeArgument('depth', 1), Argument::createBooleanOrBothTypeArgument('visible', 1), - Argument::createIntTypeArgument('lang'), new Argument( 'order', new TypeCollection( @@ -215,6 +214,7 @@ class Content extends BaseLoop $loopResultRow->set("ID", $content->getId()) ->set("IS_TRANSLATED",$content->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) ->set("TITLE",$content->getVirtualColumn('i18n_TITLE')) ->set("CHAPO", $content->getVirtualColumn('i18n_CHAPO')) ->set("DESCRIPTION", $content->getVirtualColumn('i18n_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/Country.php b/core/lib/Thelia/Core/Template/Loop/Country.php index d93d94cb4..d031e135d 100755 --- a/core/lib/Thelia/Core/Template/Loop/Country.php +++ b/core/lib/Thelia/Core/Template/Loop/Country.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -43,7 +43,7 @@ use Thelia\Model\ConfigQuery; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Country extends BaseLoop +class Country extends BaseI18nLoop { /** * @return ArgumentCollection @@ -54,8 +54,7 @@ class Country extends BaseLoop Argument::createIntListTypeArgument('id'), Argument::createIntListTypeArgument('area'), Argument::createBooleanTypeArgument('with_area'), - Argument::createIntListTypeArgument('exclude'), - Argument::createIntTypeArgument('lang') + Argument::createIntListTypeArgument('exclude') ); } @@ -69,7 +68,7 @@ class Country extends BaseLoop $search = CountryQuery::create(); /* manage translations */ - $this->configureI18nProcessing($search); + $locale = $this->configureI18nProcessing($search); $id = $this->getId(); @@ -108,6 +107,7 @@ class Country extends BaseLoop $loopResultRow = new LoopResultRow(); $loopResultRow->set("ID", $country->getId()) ->set("IS_TRANSLATED",$country->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) ->set("TITLE",$country->getVirtualColumn('i18n_TITLE')) ->set("CHAPO", $country->getVirtualColumn('i18n_CHAPO')) ->set("DESCRIPTION", $country->getVirtualColumn('i18n_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/Currency.php b/core/lib/Thelia/Core/Template/Loop/Currency.php index b793b86fd..8076e2276 100755 --- a/core/lib/Thelia/Core/Template/Loop/Currency.php +++ b/core/lib/Thelia/Core/Template/Loop/Currency.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -43,7 +43,7 @@ use Thelia\Model\ConfigQuery; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Currency extends BaseLoop +class Currency extends BaseI18nLoop { /** * @return ArgumentCollection @@ -53,8 +53,7 @@ class Currency extends BaseLoop return new ArgumentCollection( Argument::createIntListTypeArgument('id'), Argument::createIntListTypeArgument('exclude'), - Argument::createBooleanTypeArgument('default_only', false), - Argument::createIntTypeArgument('lang') + Argument::createBooleanTypeArgument('default_only', false) ); } @@ -68,7 +67,7 @@ class Currency extends BaseLoop $search = CurrencyQuery::create(); /* manage translations */ - $this->configureI18nProcessing($search, array('NAME')); + $locale = $this->configureI18nProcessing($search, array('NAME')); $id = $this->getId(); @@ -99,6 +98,7 @@ class Currency extends BaseLoop $loopResultRow = new LoopResultRow(); $loopResultRow->set("ID", $currency->getId()) ->set("IS_TRANSLATED",$currency->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) ->set("NAME",$currency->getVirtualColumn('i18n_NAME')) ->set("ISOCODE", $currency->getCode()) ->set("SYMBOL", $currency->getSymbol()) diff --git a/core/lib/Thelia/Core/Template/Loop/Feature.php b/core/lib/Thelia/Core/Template/Loop/Feature.php index e2de85dbc..4a631dda8 100755 --- a/core/lib/Thelia/Core/Template/Loop/Feature.php +++ b/core/lib/Thelia/Core/Template/Loop/Feature.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -49,7 +49,7 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Feature extends BaseLoop +class Feature extends BaseI18nLoop { /** * @return ArgumentCollection @@ -62,7 +62,6 @@ class Feature extends BaseLoop Argument::createIntListTypeArgument('category'), Argument::createBooleanOrBothTypeArgument('visible', 1), Argument::createIntListTypeArgument('exclude'), - Argument::createIntTypeArgument('lang'), new Argument( 'order', new TypeCollection( @@ -83,7 +82,7 @@ class Feature extends BaseLoop $search = FeatureQuery::create(); /* manage translations */ - $this->configureI18nProcessing($search); + $locale = $this->configureI18nProcessing($search); $id = $this->getId(); @@ -149,6 +148,7 @@ class Feature extends BaseLoop $loopResultRow = new LoopResultRow(); $loopResultRow->set("ID", $feature->getId()) ->set("IS_TRANSLATED",$feature->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) ->set("TITLE",$feature->getVirtualColumn('i18n_TITLE')) ->set("CHAPO", $feature->getVirtualColumn('i18n_CHAPO')) ->set("DESCRIPTION", $feature->getVirtualColumn('i18n_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php b/core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php index c04d70031..d298a5234 100755 --- a/core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php +++ b/core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -44,7 +44,7 @@ use Thelia\Type; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class FeatureAvailability extends BaseLoop +class FeatureAvailability extends BaseI18nLoop { /** * @return ArgumentCollection @@ -55,7 +55,6 @@ class FeatureAvailability extends BaseLoop Argument::createIntListTypeArgument('id'), Argument::createIntListTypeArgument('feature'), Argument::createIntListTypeArgument('exclude'), - Argument::createIntTypeArgument('lang'), new Argument( 'order', new TypeCollection( @@ -76,7 +75,7 @@ class FeatureAvailability extends BaseLoop $search = FeatureAvQuery::create(); /* manage translations */ - $this->configureI18nProcessing($search); + $locale = $this->configureI18nProcessing($search); $id = $this->getId(); @@ -124,6 +123,7 @@ class FeatureAvailability extends BaseLoop $loopResultRow = new LoopResultRow(); $loopResultRow->set("ID", $featureAv->getId()) ->set("IS_TRANSLATED",$featureAv->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) ->set("TITLE",$featureAv->getVirtualColumn('i18n_TITLE')) ->set("CHAPO", $featureAv->getVirtualColumn('i18n_CHAPO')) ->set("DESCRIPTION", $featureAv->getVirtualColumn('i18n_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php index 7fef63c28..a91e25cd0 100755 --- a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php +++ b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php @@ -25,7 +25,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Join; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -49,7 +49,7 @@ use Thelia\Type; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class FeatureValue extends BaseLoop +class FeatureValue extends BaseI18nLoop { /** * @return ArgumentCollection @@ -68,8 +68,7 @@ class FeatureValue extends BaseLoop new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse')) ), 'manual' - ), - Argument::createIntTypeArgument('lang') + ) ); } @@ -83,7 +82,7 @@ class FeatureValue extends BaseLoop $search = FeatureProductQuery::create(); /* manage featureAv translations */ - $this->configureI18nProcessing( + $locale = $this->configureI18nProcessing( $search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), FeatureAvTableMap::TABLE_NAME, @@ -142,7 +141,9 @@ class FeatureValue extends BaseLoop $loopResultRow = new LoopResultRow(); $loopResultRow->set("ID", $featureValue->getId()); - $loopResultRow->set("PERSONAL_VALUE", $featureValue->getByDefault()) + $loopResultRow + ->set("LOCALE",$locale) + ->set("PERSONAL_VALUE", $featureValue->getByDefault()) ->set("TITLE",$featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE')) ->set("CHAPO", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_CHAPO')) ->set("DESCRIPTION", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/Folder.php b/core/lib/Thelia/Core/Template/Loop/Folder.php index eb64d9996..95aedaed6 100755 --- a/core/lib/Thelia/Core/Template/Loop/Folder.php +++ b/core/lib/Thelia/Core/Template/Loop/Folder.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -44,7 +44,7 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Folder extends BaseLoop +class Folder extends BaseI18nLoop { /** * @return ArgumentCollection @@ -57,7 +57,6 @@ class Folder extends BaseLoop Argument::createBooleanTypeArgument('current'), Argument::createBooleanTypeArgument('not_empty', 0), Argument::createBooleanOrBothTypeArgument('visible', 1), - Argument::createIntTypeArgument('lang'), new Argument( 'order', new TypeCollection( @@ -157,6 +156,7 @@ class Folder extends BaseLoop $loopResultRow ->set("ID", $folder->getId()) ->set("IS_TRANSLATED",$folder->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) ->set("TITLE",$folder->getVirtualColumn('i18n_TITLE')) ->set("CHAPO", $folder->getVirtualColumn('i18n_CHAPO')) ->set("DESCRIPTION", $folder->getVirtualColumn('i18n_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/Image.php b/core/lib/Thelia/Core/Template/Loop/Image.php index 638905dc2..fc34a40b6 100755 --- a/core/lib/Thelia/Core/Template/Loop/Image.php +++ b/core/lib/Thelia/Core/Template/Loop/Image.php @@ -22,7 +22,7 @@ /*************************************************************************************/ namespace Thelia\Core\Template\Loop; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Event\ImageEvent; use Thelia\Model\CategoryImageQuery; @@ -43,7 +43,7 @@ use Thelia\Log\Tlog; * * @author Franck Allimant */ -class Image extends BaseLoop +class Image extends BaseI18nLoop { /** * @var array Possible image sources @@ -63,7 +63,6 @@ class Image extends BaseLoop $queryClass = sprintf("\Thelia\Model\%sImageQuery", $object); $filterMethod = sprintf("filterBy%sId", $object); - $mapClass = sprintf("\Thelia\Model\Map\%sI18nTableMap", $object); // xxxImageQuery::create() $method = new \ReflectionMethod($queryClass, 'create'); @@ -73,19 +72,16 @@ class Image extends BaseLoop $method = new \ReflectionMethod($queryClass, $filterMethod); $method->invoke($search, $object_id); - $map = new \ReflectionClass($mapClass); - $title_map = $map->getConstant('TITLE'); - $orders = $this->getOrder(); // Results ordering foreach ($orders as $order) { switch ($order) { case "alpha": - $search->addAscendingOrderByColumn($title_map); + $search->addAscendingOrderByColumn('i18n_TITLE'); break; case "alpha-reverse": - $search->addDescendingOrderByColumn($title_map); + $search->addDescendingOrderByColumn('i18n_TITLE'); break; case "manual-reverse": $search->orderByPosition(Criteria::DESC); @@ -122,7 +118,7 @@ class Image extends BaseLoop $source_id = $this->getSourceId(); - // echo "source = ".$this->getSource().", id=".$id."
"; + // echo "source = ".$this->getSource().", id=".$source_id." - ".$this->getArg('source_id')->getValue()."
"; if (is_null($source_id)) { throw new \InvalidArgumentException("'source_id' argument cannot be null if 'source' argument is specified."); @@ -167,6 +163,9 @@ class Image extends BaseLoop $search = $this->getSearchQuery($object_type, $object_id); + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + $id = $this->getId(); if (! is_null($id)) { @@ -187,7 +186,7 @@ class Image extends BaseLoop $background_color = $this->getBackgroundColor(); $quality = $this->getQuality(); $effects = $this->getEffects(); - $effects = $this->getEffects(); + if (! is_null($effects)) { $effects = explode(',', $effects); } @@ -207,8 +206,7 @@ class Image extends BaseLoop } - /* manage translations */ - $this->configureI18nProcessing($search); + // echo "sql=".$search->toString(); $results = $this->search($search, $pagination); @@ -247,14 +245,15 @@ class Image extends BaseLoop $loopResultRow ->set("ID", $result->getId()) + ->set("LOCALE",$locale) ->set("IMAGE_URL", $event->getFileUrl()) ->set("ORIGINAL_IMAGE_URL", $event->getOriginalFileUrl()) ->set("IMAGE_PATH", $event->getCacheFilepath()) ->set("ORIGINAL_IMAGE_PATH", $source_filepath) - ->set("TITLE", $result->getTitle()) - ->set("CHAPO", $result->getChapo()) - ->set("DESCRIPTION", $result->getDescription()) - ->set("POSTSCRIPTUM", $result->getPostscriptum()) + ->set("TITLE",$folder->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $folder->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $folder->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSITION", $result->getPosition()) ->set("OBJECT_TYPE", $object_type) ->set("OBJECT_ID", $object_id) @@ -314,9 +313,7 @@ class Image extends BaseLoop new EnumType($this->possible_sources) ) ), - Argument::createIntTypeArgument('source_id'), - - Argument::createIntListTypeArgument('lang') + Argument::createIntTypeArgument('source_id') ); // Add possible image sources diff --git a/core/lib/Thelia/Core/Template/Loop/Message.php b/core/lib/Thelia/Core/Template/Loop/Message.php new file mode 100644 index 000000000..9a73312dd --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Message.php @@ -0,0 +1,129 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; + +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Core\Template\Element\BaseI18nLoop; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; + +use Thelia\Core\Template\Loop\Argument\Argument; + +use Thelia\Model\LangQuery; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Model\MessageQuery; +use Thelia\Type\BooleanOrBothType; + +/** + * Message loop, to access messageuration variables + * + * - id is the message id + * - name is the message name + * - hidden filters by hidden status (yes, no, both) + * - secured filters by secured status (yes, no, both) + * - exclude is a comma separated list of message IDs that will be excluded from output + * + * @package Thelia\Core\Template\Loop + * @author Franck Allimant + */ +class Message extends BaseI18nLoop +{ + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('id'), + Argument::createIntListTypeArgument('exclude'), + Argument::createAnyTypeArgument('variable'), + Argument::createBooleanOrBothTypeArgument('hidden'), + Argument::createBooleanOrBothTypeArgument('secured') + ); + } + + /** + * @param $pagination (ignored) + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $id = $this->getId(); + $name = $this->getVariable(); + $secured = $this->getSecured(); + + $search = MessageQuery::create(); + + $locale = $this->configureI18nProcessing($search, array( + 'TITLE', + 'SUBJECT', + 'TEXT_MESSAGE', + 'HTML_MESSAGE' + ) + ); + + if (! is_null($id)) + $search->filterById($id); + + if (! is_null($name)) + $search->filterByName($name); + + if (! is_null($exclude)) { + $search->filterById($exclude, Criteria::NOT_IN); + } + + if (! is_null($secured) && $secured != BooleanOrBothType::ANY) + $search->filterBySecured($secured ? 1 : 0); + + $search->orderByName(Criteria::ASC); + + $results = $this->search($search, $pagination); + + $loopResult = new LoopResult(); + + foreach ($results as $result) { + + $loopResultRow = new LoopResultRow(); + + $loopResultRow + ->set("ID" , $result->getId()) + ->set("NAME" , $result->getName()) + ->set("IS_TRANSLATED", $result->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE" , $locale) + ->set("TITLE" , $result->getVirtualColumn('i18n_TITLE')) + ->set("SUBJECT" , $result->getVirtualColumn('i18n_SUBJECT')) + ->set("TEXT_MESSAGE" , $result->getVirtualColumn('i18n_TEXT_MESSAGE')) + ->set("HTML_MESSAGE" , $result->getVirtualColumn('i18n_HTML_MESSAGE')) + ->set("SECURED" , $result->getSecured()) + ->set("CREATE_DATE" , $result->getCreatedAt()) + ->set("UPDATE_DATE" , $result->getUpdatedAt()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php index 4c1acdcc6..a35ff90b3 100755 --- a/core/lib/Thelia/Core/Template/Loop/Product.php +++ b/core/lib/Thelia/Core/Template/Loop/Product.php @@ -25,7 +25,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Join; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -56,7 +56,7 @@ use Thelia\Type\BooleanOrBothType; * * @todo : manage currency in price filter */ -class Product extends BaseLoop +class Product extends BaseI18nLoop { /** * @return ArgumentCollection @@ -83,7 +83,6 @@ class Product extends BaseLoop Argument::createBooleanTypeArgument('current_category'), Argument::createIntTypeArgument('depth', 1), Argument::createBooleanOrBothTypeArgument('visible', 1), - Argument::createIntTypeArgument('lang'), new Argument( 'order', new TypeCollection( @@ -510,6 +509,7 @@ class Product extends BaseLoop $loopResultRow->set("ID", $product->getId()) ->set("REF",$product->getRef()) ->set("IS_TRANSLATED",$product->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) ->set("TITLE",$product->getVirtualColumn('i18n_TITLE')) ->set("CHAPO", $product->getVirtualColumn('i18n_CHAPO')) ->set("DESCRIPTION", $product->getVirtualColumn('i18n_DESCRIPTION')) diff --git a/core/lib/Thelia/Core/Template/Loop/Title.php b/core/lib/Thelia/Core/Template/Loop/Title.php index c53be086a..cd7ec7d5d 100755 --- a/core/lib/Thelia/Core/Template/Loop/Title.php +++ b/core/lib/Thelia/Core/Template/Loop/Title.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -43,7 +43,7 @@ use Thelia\Model\ConfigQuery; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Title extends BaseLoop +class Title extends BaseI18nLoop { /** * @return ArgumentCollection @@ -51,8 +51,7 @@ class Title extends BaseLoop protected function getArgDefinitions() { return new ArgumentCollection( - Argument::createIntListTypeArgument('id'), - Argument::createIntTypeArgument('lang') + Argument::createIntListTypeArgument('id') ); } @@ -66,7 +65,7 @@ class Title extends BaseLoop $search = CustomerTitleQuery::create(); /* manage translations */ - $this->configureI18nProcessing($search, array('SHORT', 'LONG')); + $locale = $this->configureI18nProcessing($search, array('SHORT', 'LONG')); $id = $this->getId(); @@ -85,6 +84,7 @@ class Title extends BaseLoop $loopResultRow = new LoopResultRow(); $loopResultRow->set("ID", $title->getId()) ->set("IS_TRANSLATED",$title->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) ->set("DEFAULT", $title->getByDefault()) ->set("SHORT", $title->getVirtualColumn('i18n_SHORT')) ->set("LONG", $title->getVirtualColumn('i18n_LONG')); diff --git a/core/lib/Thelia/Core/Template/ParserContext.php b/core/lib/Thelia/Core/Template/ParserContext.php index af12018e6..90079abf5 100755 --- a/core/lib/Thelia/Core/Template/ParserContext.php +++ b/core/lib/Thelia/Core/Template/ParserContext.php @@ -49,24 +49,23 @@ class ParserContext implements \IteratorAggregate /** * @param BaseForm $form the errored form */ - public function setErrorForm(BaseForm $form) + public function addForm(BaseForm $form) { - $this->set('error_form', $form); + $this->set($form->getName(), $form); + + return $this; + } + + public function getForm($name) + { + return $this->get($name, null); } public function setGeneralError($error) { $this->set('general_error', $error); - } - public function getErrorForm() - { - return $this->get('error_form', null); - } - - public function clearErrorForm() - { - return $this->remove('error_form'); + return $this; } // -- Internal table manipulation ------------------------------------------ diff --git a/core/lib/Thelia/Core/Template/Smarty/Exception/SmartyPluginException.php b/core/lib/Thelia/Core/Template/Smarty/Exception/SmartyPluginException.php new file mode 100644 index 000000000..fdaf93608 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Smarty/Exception/SmartyPluginException.php @@ -0,0 +1,33 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Smarty\Exception; + + +/** + * Class SmartyPluginException + * @package Thelia\Core\Template\Smarty\Exception + * @author Manuel Raynaud + */ +class SmartyPluginException extends \SmartyException +{} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php index 5216dbfbe..554d3f9de 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php @@ -82,6 +82,7 @@ class Form extends AbstractSmartyPlugin public function generateForm($params, $content, \Smarty_Internal_Template $template, &$repeat) { + if ($repeat) { $name = $this->getParam($params, 'name'); @@ -93,15 +94,11 @@ class Form extends AbstractSmartyPlugin $instance = $this->createInstance($name); // Check if parser context contains our form - $errorForm = $this->parserContext->getErrorForm(); + $form = $this->parserContext->getForm($instance->getName()); - if (null != $errorForm && $errorForm->getName() == $instance->getName()) { - - // Re-use the errored form - $instance = $errorForm; - - // Don't do that, as we may want to use this form firther in the template code - //$this->parserContext->clearErrorForm(); + if (null != $form) { + // Re-use the form + $instance = $form; } $instance->createView(); @@ -110,7 +107,8 @@ class Form extends AbstractSmartyPlugin $template->assign("form_error", $instance->hasError() ? true : false); $template->assign("form_error_message", $instance->getErrorMessage()); - } else { + } + else { return $content; } } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php new file mode 100644 index 000000000..a095f214a --- /dev/null +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php @@ -0,0 +1,154 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Smarty\Plugins; + +use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; +use Thelia\Core\Template\Smarty\Exception\SmartyPluginException; +use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; + +/** + * + * format_date and format_date smarty function. + * + * Class Format + * @package Thelia\Core\Template\Smarty\Plugins + * @author Manuel Raynaud + */ +class Format extends AbstractSmartyPlugin +{ + protected $request; + + public function __construct(Request $request) + { + $this->request = $request; + } + + /** + * return date in expected format + * + * available parameters : + * date => DateTime object (mandatory) + * format => expected format + * output => list of default system format. Values available : + * date => date format + * time => time format + * datetime => datetime format (default) + * + * ex : + * {format_date date=$dateTimeObject format="Y-m-d H:i:s"} will output the format with specific format + * {format_date date=$dateTimeObject output="date"} will output the date using the default date system format + * {format_date date=$dateTimeObject} will output with the default datetime system format + * + * @param array $params + * @param null $template + * @throws \Thelia\Core\Template\Smarty\Exception\SmartyPluginException + * @return string + */ + public function formatDate($params, $template = null) + { + + if (array_key_exists("date", $params) === false) { + throw new SmartyPluginException("date is a mandatory parameter in format_date function"); + } + + $date = $params["date"]; + + if(!$date instanceof \DateTime) { + return ""; + } + + $format = null; + $output = array_key_exists("output", $params) ? $params["output"] : null; + + if (array_key_exists("format", $params)) { + $format = $params["format"]; + } else { + $session = $this->request->getSession(); + $lang = $session->getLang(); + + if($lang) { + switch ($output) { + case "date" : + $format = $lang->getDateFormat(); + break; + case "time" : + $format = $lang->getTimeFormat(); + break; + default: + case "datetime" : + $format = $lang->getDateTimeFormat(); + break; + } + } + } + + return $date->format($format); + + } + + /** + * + * display numbers in expected format + * + * available parameters : + * number => int or float number + * decimals => how many decimals format expected + * dec_point => separator for the decimal point + * thousands_sep => thousands separator + * + * ex : {format_number number="1246.12" decimals="1" dec_point="," thousands_sep=" "} will output "1 246,1" + * + * @param $params + * @param null $template + * @throws \Thelia\Core\Template\Smarty\Exception\SmartyPluginException + * @return string the expected number formatted + */ + public function formatNumber($params, $template = null) + { + if (array_key_exists("number", $params) === false) { + throw new SmartyPluginException("number is a mandatory parameter in format_number function"); + } + + $lang = $this->request->getSession()->getLang(); + + $number = $params["number"]; + $decimals = array_key_exists("decimals", $params) ? $params["decimals"] : $lang->getDecimals(); + $decPoint = array_key_exists("dec_point", $params) ? $params["dec_point"] : $lang->getDecimalSeparator(); + $thousandsSep = array_key_exists("thousands_sep", $params) ? $params["thousands_sep"] : $lang->getThousandsSeparator(); + + return number_format($number, $decimals, $decPoint, $thousandsSep); + } + + /** + * @return an array of SmartyPluginDescriptor + */ + public function getPluginDescriptors() + { + return array( + new SmartyPluginDescriptor("function", "format_date", $this, "formatDate"), + new SmartyPluginDescriptor("function", "format_number", $this, "formatNumber") + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php index 0163d6a71..91036517a 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php @@ -311,13 +311,13 @@ class TheliaLoop extends AbstractSmartyPlugin $type = strtolower($smartyParams['type']); if (! isset($this->loopDefinition[$type])) { - throw new ElementNotFoundException(sprintf("%s loop does not exists", $type)); + throw new ElementNotFoundException(sprintf("'%s' loop type does not exists", $type)); } $class = new \ReflectionClass($this->loopDefinition[$type]); if ($class->isSubclassOf("Thelia\Core\Template\Element\BaseLoop") === false) { - throw new InvalidElementException(sprintf("%s Loop class have to extends Thelia\Core\Template\Element\BaseLoop", + throw new InvalidElementException(sprintf("'%s' Loop class should extends Thelia\Core\Template\Element\BaseLoop", $type)); } diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php index ed74fe3f0..12014e817 100755 --- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php +++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php @@ -212,14 +212,14 @@ class SmartyParser extends Smarty implements ParserInterface $templateDir = realpath(THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/"); if (strpos($pathFileName, $templateDir) !== 0) { - throw new ResourceNotFoundException(sprintf("%s view does not exists", $file)); + throw new ResourceNotFoundException(sprintf("'%s' view does not exists", $file)); } if (!file_exists($fileName)) { $fileName .= ".html"; if (!file_exists($fileName)) { - throw new ResourceNotFoundException(sprintf("%s file not found in %s template", $file, $this->template)); + throw new ResourceNotFoundException(sprintf("'%s' file not found in %s template", $file, $this->template)); } } diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index 54a3fd13c..b28b23156 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -26,7 +26,7 @@ namespace Thelia\Core; /** * Root class of Thelia * - * It extends Symfony\Component\HttpKernel\Kernel for changing some fonctionnality + * It extends Symfony\Component\HttpKernel\Kernel for changing some features * * * @author Manuel Raynaud diff --git a/core/lib/Thelia/Core/TheliaContainerBuilder.php b/core/lib/Thelia/Core/TheliaContainerBuilder.php index a97019b60..7e49a8141 100755 --- a/core/lib/Thelia/Core/TheliaContainerBuilder.php +++ b/core/lib/Thelia/Core/TheliaContainerBuilder.php @@ -25,6 +25,13 @@ namespace Thelia\Core; use Symfony\Component\DependencyInjection\ContainerBuilder; +/** + * extends Symfony\Component\DependencyInjection\ContainerBuilder for changing some behavior + * + * Class TheliaContainerBuilder + * @package Thelia\Core + * @author Manuel Raynaud + */ class TheliaContainerBuilder extends ContainerBuilder { diff --git a/core/lib/Thelia/Core/TheliaHttpKernel.php b/core/lib/Thelia/Core/TheliaHttpKernel.php index b34eb4bed..7109f5ba2 100755 --- a/core/lib/Thelia/Core/TheliaHttpKernel.php +++ b/core/lib/Thelia/Core/TheliaHttpKernel.php @@ -125,8 +125,10 @@ class TheliaHttpKernel extends HttpKernel $lang = $this->detectLang($request); if ($lang) { - $request->getSession()->set("lang", $lang->getCode()); - $request->getSession()->set("locale", $lang->getLocale()); + $request->getSession() + ->setLang($lang) + ->setLocale($lang->getLocale()) + ; } } @@ -164,7 +166,7 @@ class TheliaHttpKernel extends HttpKernel } //check if lang is not defined. If not we have to search the good one. - if (null === $request->getSession()->get("lang")) { + if (null === $request->getSession()->getLang()) { if (Model\ConfigQuery::read("one_domain_foreach_lang", false) == 1) { //find lang with domain @@ -173,9 +175,7 @@ class TheliaHttpKernel extends HttpKernel //find default lang return Model\LangQuery::create()->findOneByByDefault(1); - } - } protected function initSession(Request $request) diff --git a/core/lib/Thelia/Form/BaseDescForm.php b/core/lib/Thelia/Form/BaseDescForm.php new file mode 100644 index 000000000..c4f4f90c3 --- /dev/null +++ b/core/lib/Thelia/Form/BaseDescForm.php @@ -0,0 +1,54 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints\NotBlank; + +/** + * A base form for all objects with standard contents. + * + * @author Franck Allimant + */ +abstract class BaseDescForm extends BaseForm +{ + protected function buildForm() + { + $this->formBuilder + ->add("locale", "hidden", array( + "constraints" => array( + new NotBlank() + ) + ) + ) + ->add("title", "text", array( + "constraints" => array( + new NotBlank() + ) + ) + ) + ->add("chapo", "text", array()) + ->add("description", "text", array()) + ->add("postscriptum", "text", array()) + ; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Form/BaseForm.php b/core/lib/Thelia/Form/BaseForm.php index ac336f994..edb51ad2a 100755 --- a/core/lib/Thelia/Form/BaseForm.php +++ b/core/lib/Thelia/Form/BaseForm.php @@ -32,6 +32,13 @@ use Symfony\Component\Validator\Validation; use Thelia\Model\ConfigQuery; use Thelia\Tools\URL; +/** + * Base form class for creating form objects + * + * Class BaseForm + * @package Thelia\Form + * @author Manuel Raynaud + */ abstract class BaseForm { /** diff --git a/core/lib/Thelia/Form/CartAdd.php b/core/lib/Thelia/Form/CartAdd.php index 25ca9ce57..fb6347cd9 100755 --- a/core/lib/Thelia/Form/CartAdd.php +++ b/core/lib/Thelia/Form/CartAdd.php @@ -30,6 +30,11 @@ use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\ConfigQuery; use Thelia\Model\ProductQuery; +/** + * Class CartAdd + * @package Thelia\Form + * @author Manuel Raynaud + */ class CartAdd extends BaseForm { diff --git a/core/lib/Thelia/Form/ConfigCreationForm.php b/core/lib/Thelia/Form/ConfigCreationForm.php new file mode 100644 index 000000000..5594830bc --- /dev/null +++ b/core/lib/Thelia/Form/ConfigCreationForm.php @@ -0,0 +1,75 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints; +use Thelia\Model\ConfigQuery; +use Symfony\Component\Validator\ExecutionContextInterface; + +class ConfigCreationForm extends BaseForm +{ + protected function buildForm($change_mode = false) + { + $name_constraints = array(new Constraints\NotBlank()); + + if (!$change_mode) { + $name_constraints[] = new Constraints\Callback(array( + "methods" => array(array($this, "checkDuplicateName")) + )); + } + + $this->formBuilder + ->add("name", "text", array( + "constraints" => $name_constraints + )) + ->add("title", "text", array( + "constraints" => array( + new Constraints\NotBlank() + ) + )) + ->add("locale", "hidden", array( + "constraints" => array( + new Constraints\NotBlank() + ) + )) + ->add("value", "text", array()) + ->add("hidden", "hidden", array()) + ->add("secured", "hidden", array()) + ; + } + + public function getName() + { + return "thelia_config_creation"; + } + + public function checkDuplicateName($value, ExecutionContextInterface $context) + { + $config = ConfigQuery::create()->findOneByName($value); + + if ($config) { + $context->addViolation(sprintf("A variable with name \"%s\" already exists.", $value)); + } + } + +} diff --git a/core/lib/Thelia/Form/ConfigModificationForm.php b/core/lib/Thelia/Form/ConfigModificationForm.php new file mode 100644 index 000000000..dd0a0e42f --- /dev/null +++ b/core/lib/Thelia/Form/ConfigModificationForm.php @@ -0,0 +1,59 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Model\LangQuery; +use Propel\Runtime\ActiveQuery\Criteria; +use Symfony\Component\Validator\Constraints\GreaterThan; + +class ConfigModificationForm extends BaseDescForm +{ + protected function buildForm() + { + parent::buildForm(true); + + $this->formBuilder + ->add("id", "hidden", array( + "constraints" => array( + new GreaterThan( + array('value' => 0) + ) + ) + )) + ->add("name", "text", array( + "constraints" => array( + new NotBlank() + ) + )) + ->add("value", "text", array()) + ->add("hidden", "hidden", array()) + ->add("secured", "hidden", array()) + ; + } + + public function getName() + { + return "thelia_config_modification"; + } +} diff --git a/core/lib/Thelia/Form/CustomerCreation.php b/core/lib/Thelia/Form/CustomerCreation.php index 0d7172510..1bc88407b 100755 --- a/core/lib/Thelia/Form/CustomerCreation.php +++ b/core/lib/Thelia/Form/CustomerCreation.php @@ -27,6 +27,11 @@ use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Model\ConfigQuery; use Thelia\Model\CustomerQuery; +/** + * Class CustomerCreation + * @package Thelia\Form + * @author Manuel Raynaud + */ class CustomerCreation extends BaseForm { diff --git a/core/lib/Thelia/Form/CustomerModification.php b/core/lib/Thelia/Form/CustomerModification.php index 8f5167d52..61f1e0834 100755 --- a/core/lib/Thelia/Form/CustomerModification.php +++ b/core/lib/Thelia/Form/CustomerModification.php @@ -25,6 +25,11 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; +/** + * Class CustomerModification + * @package Thelia\Form + * @author Manuel Raynaud + */ class CustomerModification extends BaseForm { /** diff --git a/core/lib/Thelia/Form/MessageCreationForm.php b/core/lib/Thelia/Form/MessageCreationForm.php new file mode 100644 index 000000000..a3444c733 --- /dev/null +++ b/core/lib/Thelia/Form/MessageCreationForm.php @@ -0,0 +1,73 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints; +use Thelia\Model\MessageQuery; +use Symfony\Component\Validator\ExecutionContextInterface; + +class MessageCreationForm extends BaseForm +{ + protected function buildForm($change_mode = false) + { + $name_constraints = array(new Constraints\NotBlank()); + + if (!$change_mode) { + $name_constraints[] = new Constraints\Callback(array( + "methods" => array(array($this, "checkDuplicateName")) + )); + } + + $this->formBuilder + ->add("name", "text", array( + "constraints" => $name_constraints + )) + ->add("title", "text", array( + "constraints" => array( + new Constraints\NotBlank() + ) + )) + ->add("locale", "hidden", array( + "constraints" => array( + new Constraints\NotBlank() + ) + )) + ->add("secured", "hidden", array()) + ; + } + + public function getName() + { + return "thelia_message_creation"; + } + + public function checkDuplicateName($value, ExecutionContextInterface $context) + { + $message = MessageQuery::create()->findOneByName($value); + + if ($message) { + $context->addViolation(sprintf("A message with name \"%s\" already exists.", $value)); + } + } + +} diff --git a/core/lib/Thelia/Form/MessageModificationForm.php b/core/lib/Thelia/Form/MessageModificationForm.php new file mode 100644 index 000000000..539a8babc --- /dev/null +++ b/core/lib/Thelia/Form/MessageModificationForm.php @@ -0,0 +1,50 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Model\LangQuery; +use Propel\Runtime\ActiveQuery\Criteria; +use Symfony\Component\Validator\Constraints\GreaterThan; + +class MessageModificationForm extends BaseForm +{ + protected function buildForm() + { + $this->formBuilder + ->add("id" , "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) + ->add("name" , "text" , array("constraints" => array(new NotBlank()))) + ->add("secured" , "text" , array()) + ->add("locale" , "text" , array()) + ->add("title" , "text" , array("constraints" => array(new NotBlank()))) + ->add("subject" , "text" , array("constraints" => array(new NotBlank()))) + ->add("html_message" , "text" , array()) + ->add("text_message" , "text" , array()) + ; + } + + public function getName() + { + return "thelia_message_modification"; + } +} diff --git a/core/lib/Thelia/Model/Base/Attribute.php b/core/lib/Thelia/Model/Base/Attribute.php index 21fb3389a..3c754c3b5 100755 --- a/core/lib/Thelia/Model/Base/Attribute.php +++ b/core/lib/Thelia/Model/Base/Attribute.php @@ -132,7 +132,7 @@ abstract class Attribute implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -2554,7 +2554,7 @@ abstract class Attribute implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collAttributeAvs instanceof Collection) { @@ -2612,7 +2612,7 @@ abstract class Attribute implements ActiveRecordInterface * * @return ChildAttribute The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -2636,7 +2636,7 @@ abstract class Attribute implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildAttributeI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collAttributeI18ns) { @@ -2671,7 +2671,7 @@ abstract class Attribute implements ActiveRecordInterface * * @return ChildAttribute The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildAttributeI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/AttributeAv.php b/core/lib/Thelia/Model/Base/AttributeAv.php index 817c9738d..b94288753 100755 --- a/core/lib/Thelia/Model/Base/AttributeAv.php +++ b/core/lib/Thelia/Model/Base/AttributeAv.php @@ -122,7 +122,7 @@ abstract class AttributeAv implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1903,7 +1903,7 @@ abstract class AttributeAv implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collAttributeCombinations instanceof Collection) { @@ -1950,7 +1950,7 @@ abstract class AttributeAv implements ActiveRecordInterface * * @return ChildAttributeAv The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1974,7 +1974,7 @@ abstract class AttributeAv implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildAttributeAvI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collAttributeAvI18ns) { @@ -2009,7 +2009,7 @@ abstract class AttributeAv implements ActiveRecordInterface * * @return ChildAttributeAv The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildAttributeAvI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/AttributeAvI18n.php b/core/lib/Thelia/Model/Base/AttributeAvI18n.php index 8b2b14a32..ec6f8811f 100755 --- a/core/lib/Thelia/Model/Base/AttributeAvI18n.php +++ b/core/lib/Thelia/Model/Base/AttributeAvI18n.php @@ -61,7 +61,7 @@ abstract class AttributeAvI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class AttributeAvI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class AttributeAvI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/AttributeAvQuery.php b/core/lib/Thelia/Model/Base/AttributeAvQuery.php index 4f724b4f4..8ebfaa8c9 100755 --- a/core/lib/Thelia/Model/Base/AttributeAvQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeAvQuery.php @@ -841,7 +841,7 @@ abstract class AttributeAvQuery extends ModelCriteria * * @return ChildAttributeAvQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'AttributeAvI18n'; @@ -859,7 +859,7 @@ abstract class AttributeAvQuery extends ModelCriteria * * @return ChildAttributeAvQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -880,7 +880,7 @@ abstract class AttributeAvQuery extends ModelCriteria * * @return ChildAttributeAvI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/AttributeI18n.php b/core/lib/Thelia/Model/Base/AttributeI18n.php index 8a0456192..d75c24412 100755 --- a/core/lib/Thelia/Model/Base/AttributeI18n.php +++ b/core/lib/Thelia/Model/Base/AttributeI18n.php @@ -61,7 +61,7 @@ abstract class AttributeI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class AttributeI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class AttributeI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/AttributeQuery.php b/core/lib/Thelia/Model/Base/AttributeQuery.php index cbb690efb..cabbaf7ac 100755 --- a/core/lib/Thelia/Model/Base/AttributeQuery.php +++ b/core/lib/Thelia/Model/Base/AttributeQuery.php @@ -886,7 +886,7 @@ abstract class AttributeQuery extends ModelCriteria * * @return ChildAttributeQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'AttributeI18n'; @@ -904,7 +904,7 @@ abstract class AttributeQuery extends ModelCriteria * * @return ChildAttributeQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -925,7 +925,7 @@ abstract class AttributeQuery extends ModelCriteria * * @return ChildAttributeI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Category.php b/core/lib/Thelia/Model/Base/Category.php index 46a8876ef..ee56670a1 100755 --- a/core/lib/Thelia/Model/Base/Category.php +++ b/core/lib/Thelia/Model/Base/Category.php @@ -210,7 +210,7 @@ abstract class Category implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -4454,7 +4454,7 @@ abstract class Category implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collProductCategories instanceof Collection) { @@ -4522,7 +4522,7 @@ abstract class Category implements ActiveRecordInterface * * @return ChildCategory The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -4546,7 +4546,7 @@ abstract class Category implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildCategoryI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collCategoryI18ns) { @@ -4581,7 +4581,7 @@ abstract class Category implements ActiveRecordInterface * * @return ChildCategory The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildCategoryI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/CategoryDocument.php b/core/lib/Thelia/Model/Base/CategoryDocument.php index a5493815d..7539312cc 100755 --- a/core/lib/Thelia/Model/Base/CategoryDocument.php +++ b/core/lib/Thelia/Model/Base/CategoryDocument.php @@ -120,7 +120,7 @@ abstract class CategoryDocument implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1640,7 +1640,7 @@ abstract class CategoryDocument implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collCategoryDocumentI18ns instanceof Collection) { @@ -1683,7 +1683,7 @@ abstract class CategoryDocument implements ActiveRecordInterface * * @return ChildCategoryDocument The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1707,7 +1707,7 @@ abstract class CategoryDocument implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildCategoryDocumentI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collCategoryDocumentI18ns) { @@ -1742,7 +1742,7 @@ abstract class CategoryDocument implements ActiveRecordInterface * * @return ChildCategoryDocument The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildCategoryDocumentI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php b/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php index 2d5f76fcf..4d284b57e 100755 --- a/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php @@ -61,7 +61,7 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/CategoryDocumentQuery.php b/core/lib/Thelia/Model/Base/CategoryDocumentQuery.php index 239ec6c83..8c0a177ac 100755 --- a/core/lib/Thelia/Model/Base/CategoryDocumentQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryDocumentQuery.php @@ -797,7 +797,7 @@ abstract class CategoryDocumentQuery extends ModelCriteria * * @return ChildCategoryDocumentQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'CategoryDocumentI18n'; @@ -815,7 +815,7 @@ abstract class CategoryDocumentQuery extends ModelCriteria * * @return ChildCategoryDocumentQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -836,7 +836,7 @@ abstract class CategoryDocumentQuery extends ModelCriteria * * @return ChildCategoryDocumentI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/CategoryI18n.php b/core/lib/Thelia/Model/Base/CategoryI18n.php index 3e3d36521..9ae8c8cf3 100755 --- a/core/lib/Thelia/Model/Base/CategoryI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryI18n.php @@ -61,7 +61,7 @@ abstract class CategoryI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class CategoryI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class CategoryI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/CategoryImage.php b/core/lib/Thelia/Model/Base/CategoryImage.php index 6fd905453..353c79c4f 100755 --- a/core/lib/Thelia/Model/Base/CategoryImage.php +++ b/core/lib/Thelia/Model/Base/CategoryImage.php @@ -120,7 +120,7 @@ abstract class CategoryImage implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1640,7 +1640,7 @@ abstract class CategoryImage implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collCategoryImageI18ns instanceof Collection) { @@ -1683,7 +1683,7 @@ abstract class CategoryImage implements ActiveRecordInterface * * @return ChildCategoryImage The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1707,7 +1707,7 @@ abstract class CategoryImage implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildCategoryImageI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collCategoryImageI18ns) { @@ -1742,7 +1742,7 @@ abstract class CategoryImage implements ActiveRecordInterface * * @return ChildCategoryImage The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildCategoryImageI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/CategoryImageI18n.php b/core/lib/Thelia/Model/Base/CategoryImageI18n.php index 0c65b8036..61b4fc413 100755 --- a/core/lib/Thelia/Model/Base/CategoryImageI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryImageI18n.php @@ -61,7 +61,7 @@ abstract class CategoryImageI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class CategoryImageI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class CategoryImageI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/CategoryImageQuery.php b/core/lib/Thelia/Model/Base/CategoryImageQuery.php index 305b01755..2130e757b 100755 --- a/core/lib/Thelia/Model/Base/CategoryImageQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryImageQuery.php @@ -797,7 +797,7 @@ abstract class CategoryImageQuery extends ModelCriteria * * @return ChildCategoryImageQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'CategoryImageI18n'; @@ -815,7 +815,7 @@ abstract class CategoryImageQuery extends ModelCriteria * * @return ChildCategoryImageQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -836,7 +836,7 @@ abstract class CategoryImageQuery extends ModelCriteria * * @return ChildCategoryImageI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/CategoryQuery.php b/core/lib/Thelia/Model/Base/CategoryQuery.php index 1fe81871b..7f0fb8f1c 100755 --- a/core/lib/Thelia/Model/Base/CategoryQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryQuery.php @@ -1384,7 +1384,7 @@ abstract class CategoryQuery extends ModelCriteria * * @return ChildCategoryQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'CategoryI18n'; @@ -1402,7 +1402,7 @@ abstract class CategoryQuery extends ModelCriteria * * @return ChildCategoryQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -1423,7 +1423,7 @@ abstract class CategoryQuery extends ModelCriteria * * @return ChildCategoryI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Config.php b/core/lib/Thelia/Model/Base/Config.php index b4d909de4..9f2080d1f 100755 --- a/core/lib/Thelia/Model/Base/Config.php +++ b/core/lib/Thelia/Model/Base/Config.php @@ -121,7 +121,7 @@ abstract class Config implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1642,7 +1642,7 @@ abstract class Config implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collConfigI18ns instanceof Collection) { @@ -1684,7 +1684,7 @@ abstract class Config implements ActiveRecordInterface * * @return ChildConfig The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1708,7 +1708,7 @@ abstract class Config implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildConfigI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collConfigI18ns) { @@ -1743,7 +1743,7 @@ abstract class Config implements ActiveRecordInterface * * @return ChildConfig The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildConfigI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/ConfigI18n.php b/core/lib/Thelia/Model/Base/ConfigI18n.php index 57c72ace8..71f1d5287 100755 --- a/core/lib/Thelia/Model/Base/ConfigI18n.php +++ b/core/lib/Thelia/Model/Base/ConfigI18n.php @@ -61,7 +61,7 @@ abstract class ConfigI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class ConfigI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class ConfigI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/ConfigQuery.php b/core/lib/Thelia/Model/Base/ConfigQuery.php index b2ddc3409..ef47308a4 100755 --- a/core/lib/Thelia/Model/Base/ConfigQuery.php +++ b/core/lib/Thelia/Model/Base/ConfigQuery.php @@ -749,7 +749,7 @@ abstract class ConfigQuery extends ModelCriteria * * @return ChildConfigQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'ConfigI18n'; @@ -767,7 +767,7 @@ abstract class ConfigQuery extends ModelCriteria * * @return ChildConfigQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -788,7 +788,7 @@ abstract class ConfigQuery extends ModelCriteria * * @return ChildConfigI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Content.php b/core/lib/Thelia/Model/Base/Content.php index 64b99508b..aa53fb9b5 100755 --- a/core/lib/Thelia/Model/Base/Content.php +++ b/core/lib/Thelia/Model/Base/Content.php @@ -182,7 +182,7 @@ abstract class Content implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -3645,7 +3645,7 @@ abstract class Content implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collContentFolders instanceof Collection) { @@ -3715,7 +3715,7 @@ abstract class Content implements ActiveRecordInterface * * @return ChildContent The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -3739,7 +3739,7 @@ abstract class Content implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildContentI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collContentI18ns) { @@ -3774,7 +3774,7 @@ abstract class Content implements ActiveRecordInterface * * @return ChildContent The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildContentI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/ContentDocument.php b/core/lib/Thelia/Model/Base/ContentDocument.php index 01f631208..a8207bb14 100755 --- a/core/lib/Thelia/Model/Base/ContentDocument.php +++ b/core/lib/Thelia/Model/Base/ContentDocument.php @@ -120,7 +120,7 @@ abstract class ContentDocument implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1640,7 +1640,7 @@ abstract class ContentDocument implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collContentDocumentI18ns instanceof Collection) { @@ -1683,7 +1683,7 @@ abstract class ContentDocument implements ActiveRecordInterface * * @return ChildContentDocument The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1707,7 +1707,7 @@ abstract class ContentDocument implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildContentDocumentI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collContentDocumentI18ns) { @@ -1742,7 +1742,7 @@ abstract class ContentDocument implements ActiveRecordInterface * * @return ChildContentDocument The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildContentDocumentI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/ContentDocumentI18n.php b/core/lib/Thelia/Model/Base/ContentDocumentI18n.php index f11cd8a08..1e1f1bd52 100755 --- a/core/lib/Thelia/Model/Base/ContentDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/ContentDocumentI18n.php @@ -61,7 +61,7 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/ContentDocumentQuery.php b/core/lib/Thelia/Model/Base/ContentDocumentQuery.php index 72cc8cae4..89cf5d48b 100755 --- a/core/lib/Thelia/Model/Base/ContentDocumentQuery.php +++ b/core/lib/Thelia/Model/Base/ContentDocumentQuery.php @@ -797,7 +797,7 @@ abstract class ContentDocumentQuery extends ModelCriteria * * @return ChildContentDocumentQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'ContentDocumentI18n'; @@ -815,7 +815,7 @@ abstract class ContentDocumentQuery extends ModelCriteria * * @return ChildContentDocumentQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -836,7 +836,7 @@ abstract class ContentDocumentQuery extends ModelCriteria * * @return ChildContentDocumentI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/ContentI18n.php b/core/lib/Thelia/Model/Base/ContentI18n.php index 244862800..6ffc1d4bf 100755 --- a/core/lib/Thelia/Model/Base/ContentI18n.php +++ b/core/lib/Thelia/Model/Base/ContentI18n.php @@ -61,7 +61,7 @@ abstract class ContentI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class ContentI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class ContentI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/ContentImage.php b/core/lib/Thelia/Model/Base/ContentImage.php index 33e1eca09..8a0a5a77c 100755 --- a/core/lib/Thelia/Model/Base/ContentImage.php +++ b/core/lib/Thelia/Model/Base/ContentImage.php @@ -120,7 +120,7 @@ abstract class ContentImage implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1640,7 +1640,7 @@ abstract class ContentImage implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collContentImageI18ns instanceof Collection) { @@ -1683,7 +1683,7 @@ abstract class ContentImage implements ActiveRecordInterface * * @return ChildContentImage The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1707,7 +1707,7 @@ abstract class ContentImage implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildContentImageI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collContentImageI18ns) { @@ -1742,7 +1742,7 @@ abstract class ContentImage implements ActiveRecordInterface * * @return ChildContentImage The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildContentImageI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/ContentImageI18n.php b/core/lib/Thelia/Model/Base/ContentImageI18n.php index cba4fba17..54016f0df 100755 --- a/core/lib/Thelia/Model/Base/ContentImageI18n.php +++ b/core/lib/Thelia/Model/Base/ContentImageI18n.php @@ -61,7 +61,7 @@ abstract class ContentImageI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class ContentImageI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class ContentImageI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/ContentImageQuery.php b/core/lib/Thelia/Model/Base/ContentImageQuery.php index 26e0ffe5c..f69464dd7 100755 --- a/core/lib/Thelia/Model/Base/ContentImageQuery.php +++ b/core/lib/Thelia/Model/Base/ContentImageQuery.php @@ -797,7 +797,7 @@ abstract class ContentImageQuery extends ModelCriteria * * @return ChildContentImageQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'ContentImageI18n'; @@ -815,7 +815,7 @@ abstract class ContentImageQuery extends ModelCriteria * * @return ChildContentImageQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -836,7 +836,7 @@ abstract class ContentImageQuery extends ModelCriteria * * @return ChildContentImageI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/ContentQuery.php b/core/lib/Thelia/Model/Base/ContentQuery.php index 11275cdc6..0dc2f57a4 100755 --- a/core/lib/Thelia/Model/Base/ContentQuery.php +++ b/core/lib/Thelia/Model/Base/ContentQuery.php @@ -1294,7 +1294,7 @@ abstract class ContentQuery extends ModelCriteria * * @return ChildContentQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'ContentI18n'; @@ -1312,7 +1312,7 @@ abstract class ContentQuery extends ModelCriteria * * @return ChildContentQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -1333,7 +1333,7 @@ abstract class ContentQuery extends ModelCriteria * * @return ChildContentI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Country.php b/core/lib/Thelia/Model/Base/Country.php index 3794bff3c..e0541a151 100755 --- a/core/lib/Thelia/Model/Base/Country.php +++ b/core/lib/Thelia/Model/Base/Country.php @@ -142,7 +142,7 @@ abstract class Country implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -2323,7 +2323,7 @@ abstract class Country implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collTaxRuleCountries instanceof Collection) { @@ -2374,7 +2374,7 @@ abstract class Country implements ActiveRecordInterface * * @return ChildCountry The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -2398,7 +2398,7 @@ abstract class Country implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildCountryI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collCountryI18ns) { @@ -2433,7 +2433,7 @@ abstract class Country implements ActiveRecordInterface * * @return ChildCountry The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildCountryI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/CountryI18n.php b/core/lib/Thelia/Model/Base/CountryI18n.php index fbba979a1..3e3e314cb 100755 --- a/core/lib/Thelia/Model/Base/CountryI18n.php +++ b/core/lib/Thelia/Model/Base/CountryI18n.php @@ -61,7 +61,7 @@ abstract class CountryI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class CountryI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class CountryI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/CountryQuery.php b/core/lib/Thelia/Model/Base/CountryQuery.php index 2c709f800..6c3a1c950 100755 --- a/core/lib/Thelia/Model/Base/CountryQuery.php +++ b/core/lib/Thelia/Model/Base/CountryQuery.php @@ -972,7 +972,7 @@ abstract class CountryQuery extends ModelCriteria * * @return ChildCountryQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'CountryI18n'; @@ -990,7 +990,7 @@ abstract class CountryQuery extends ModelCriteria * * @return ChildCountryQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -1011,7 +1011,7 @@ abstract class CountryQuery extends ModelCriteria * * @return ChildCountryI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Coupon.php b/core/lib/Thelia/Model/Base/Coupon.php index 29477cc8b..a8db4b459 100755 --- a/core/lib/Thelia/Model/Base/Coupon.php +++ b/core/lib/Thelia/Model/Base/Coupon.php @@ -203,7 +203,7 @@ abstract class Coupon implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -2876,7 +2876,7 @@ abstract class Coupon implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collCouponOrders instanceof Collection) { @@ -2926,7 +2926,7 @@ abstract class Coupon implements ActiveRecordInterface * * @return ChildCoupon The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -2950,7 +2950,7 @@ abstract class Coupon implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildCouponI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collCouponI18ns) { @@ -2985,7 +2985,7 @@ abstract class Coupon implements ActiveRecordInterface * * @return ChildCoupon The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildCouponI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/CouponI18n.php b/core/lib/Thelia/Model/Base/CouponI18n.php index c15ba0309..a2849556d 100644 --- a/core/lib/Thelia/Model/Base/CouponI18n.php +++ b/core/lib/Thelia/Model/Base/CouponI18n.php @@ -61,7 +61,7 @@ abstract class CouponI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -87,7 +87,7 @@ abstract class CouponI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -424,7 +424,7 @@ abstract class CouponI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/CouponQuery.php b/core/lib/Thelia/Model/Base/CouponQuery.php index c7ae0eabd..1e7a95408 100755 --- a/core/lib/Thelia/Model/Base/CouponQuery.php +++ b/core/lib/Thelia/Model/Base/CouponQuery.php @@ -1345,7 +1345,7 @@ abstract class CouponQuery extends ModelCriteria * * @return ChildCouponQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'CouponI18n'; @@ -1363,7 +1363,7 @@ abstract class CouponQuery extends ModelCriteria * * @return ChildCouponQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -1384,7 +1384,7 @@ abstract class CouponQuery extends ModelCriteria * * @return ChildCouponI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Currency.php b/core/lib/Thelia/Model/Base/Currency.php index f99288679..767e2dc37 100755 --- a/core/lib/Thelia/Model/Base/Currency.php +++ b/core/lib/Thelia/Model/Base/Currency.php @@ -149,7 +149,7 @@ abstract class Currency implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -2681,7 +2681,7 @@ abstract class Currency implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collOrders instanceof Collection) { @@ -2735,7 +2735,7 @@ abstract class Currency implements ActiveRecordInterface * * @return ChildCurrency The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -2759,7 +2759,7 @@ abstract class Currency implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildCurrencyI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collCurrencyI18ns) { @@ -2794,7 +2794,7 @@ abstract class Currency implements ActiveRecordInterface * * @return ChildCurrency The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildCurrencyI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/CurrencyI18n.php b/core/lib/Thelia/Model/Base/CurrencyI18n.php index 931c3acbf..df5ff7240 100755 --- a/core/lib/Thelia/Model/Base/CurrencyI18n.php +++ b/core/lib/Thelia/Model/Base/CurrencyI18n.php @@ -61,7 +61,7 @@ abstract class CurrencyI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -93,7 +93,7 @@ abstract class CurrencyI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -462,7 +462,7 @@ abstract class CurrencyI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/CurrencyQuery.php b/core/lib/Thelia/Model/Base/CurrencyQuery.php index 9b4ecf51e..eb4b1b2f7 100755 --- a/core/lib/Thelia/Model/Base/CurrencyQuery.php +++ b/core/lib/Thelia/Model/Base/CurrencyQuery.php @@ -1025,7 +1025,7 @@ abstract class CurrencyQuery extends ModelCriteria * * @return ChildCurrencyQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'CurrencyI18n'; @@ -1043,7 +1043,7 @@ abstract class CurrencyQuery extends ModelCriteria * * @return ChildCurrencyQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -1064,7 +1064,7 @@ abstract class CurrencyQuery extends ModelCriteria * * @return ChildCurrencyI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/CustomerTitle.php b/core/lib/Thelia/Model/Base/CustomerTitle.php index dcf271206..6b1295d2b 100755 --- a/core/lib/Thelia/Model/Base/CustomerTitle.php +++ b/core/lib/Thelia/Model/Base/CustomerTitle.php @@ -124,7 +124,7 @@ abstract class CustomerTitle implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -2106,7 +2106,7 @@ abstract class CustomerTitle implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collCustomers instanceof Collection) { @@ -2156,7 +2156,7 @@ abstract class CustomerTitle implements ActiveRecordInterface * * @return ChildCustomerTitle The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -2180,7 +2180,7 @@ abstract class CustomerTitle implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildCustomerTitleI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collCustomerTitleI18ns) { @@ -2215,7 +2215,7 @@ abstract class CustomerTitle implements ActiveRecordInterface * * @return ChildCustomerTitle The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildCustomerTitleI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/CustomerTitleI18n.php b/core/lib/Thelia/Model/Base/CustomerTitleI18n.php index 4ea186061..b384210b1 100755 --- a/core/lib/Thelia/Model/Base/CustomerTitleI18n.php +++ b/core/lib/Thelia/Model/Base/CustomerTitleI18n.php @@ -61,7 +61,7 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -99,7 +99,7 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -500,7 +500,7 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/CustomerTitleQuery.php b/core/lib/Thelia/Model/Base/CustomerTitleQuery.php index 1c4be4081..ea34c8c91 100755 --- a/core/lib/Thelia/Model/Base/CustomerTitleQuery.php +++ b/core/lib/Thelia/Model/Base/CustomerTitleQuery.php @@ -825,7 +825,7 @@ abstract class CustomerTitleQuery extends ModelCriteria * * @return ChildCustomerTitleQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'CustomerTitleI18n'; @@ -843,7 +843,7 @@ abstract class CustomerTitleQuery extends ModelCriteria * * @return ChildCustomerTitleQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -864,7 +864,7 @@ abstract class CustomerTitleQuery extends ModelCriteria * * @return ChildCustomerTitleI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Feature.php b/core/lib/Thelia/Model/Base/Feature.php index 070bac50b..2860a4155 100755 --- a/core/lib/Thelia/Model/Base/Feature.php +++ b/core/lib/Thelia/Model/Base/Feature.php @@ -139,7 +139,7 @@ abstract class Feature implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -2628,7 +2628,7 @@ abstract class Feature implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collFeatureAvs instanceof Collection) { @@ -2686,7 +2686,7 @@ abstract class Feature implements ActiveRecordInterface * * @return ChildFeature The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -2710,7 +2710,7 @@ abstract class Feature implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildFeatureI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collFeatureI18ns) { @@ -2745,7 +2745,7 @@ abstract class Feature implements ActiveRecordInterface * * @return ChildFeature The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildFeatureI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/FeatureAv.php b/core/lib/Thelia/Model/Base/FeatureAv.php index 14e6cd35c..bf1bfc41e 100755 --- a/core/lib/Thelia/Model/Base/FeatureAv.php +++ b/core/lib/Thelia/Model/Base/FeatureAv.php @@ -122,7 +122,7 @@ abstract class FeatureAv implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1900,7 +1900,7 @@ abstract class FeatureAv implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collFeatureProducts instanceof Collection) { @@ -1947,7 +1947,7 @@ abstract class FeatureAv implements ActiveRecordInterface * * @return ChildFeatureAv The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1971,7 +1971,7 @@ abstract class FeatureAv implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildFeatureAvI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collFeatureAvI18ns) { @@ -2006,7 +2006,7 @@ abstract class FeatureAv implements ActiveRecordInterface * * @return ChildFeatureAv The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildFeatureAvI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/FeatureAvI18n.php b/core/lib/Thelia/Model/Base/FeatureAvI18n.php index a508d6075..44e7893a2 100755 --- a/core/lib/Thelia/Model/Base/FeatureAvI18n.php +++ b/core/lib/Thelia/Model/Base/FeatureAvI18n.php @@ -61,7 +61,7 @@ abstract class FeatureAvI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class FeatureAvI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class FeatureAvI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/FeatureAvQuery.php b/core/lib/Thelia/Model/Base/FeatureAvQuery.php index 6b3af4ed9..fb3796c97 100755 --- a/core/lib/Thelia/Model/Base/FeatureAvQuery.php +++ b/core/lib/Thelia/Model/Base/FeatureAvQuery.php @@ -841,7 +841,7 @@ abstract class FeatureAvQuery extends ModelCriteria * * @return ChildFeatureAvQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'FeatureAvI18n'; @@ -859,7 +859,7 @@ abstract class FeatureAvQuery extends ModelCriteria * * @return ChildFeatureAvQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -880,7 +880,7 @@ abstract class FeatureAvQuery extends ModelCriteria * * @return ChildFeatureAvI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/FeatureI18n.php b/core/lib/Thelia/Model/Base/FeatureI18n.php index 06964ee19..57c7a0b30 100755 --- a/core/lib/Thelia/Model/Base/FeatureI18n.php +++ b/core/lib/Thelia/Model/Base/FeatureI18n.php @@ -61,7 +61,7 @@ abstract class FeatureI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class FeatureI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class FeatureI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/FeatureQuery.php b/core/lib/Thelia/Model/Base/FeatureQuery.php index f1fc81a3f..9b00e812e 100755 --- a/core/lib/Thelia/Model/Base/FeatureQuery.php +++ b/core/lib/Thelia/Model/Base/FeatureQuery.php @@ -931,7 +931,7 @@ abstract class FeatureQuery extends ModelCriteria * * @return ChildFeatureQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'FeatureI18n'; @@ -949,7 +949,7 @@ abstract class FeatureQuery extends ModelCriteria * * @return ChildFeatureQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -970,7 +970,7 @@ abstract class FeatureQuery extends ModelCriteria * * @return ChildFeatureI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Folder.php b/core/lib/Thelia/Model/Base/Folder.php index a864711c0..4457c5042 100755 --- a/core/lib/Thelia/Model/Base/Folder.php +++ b/core/lib/Thelia/Model/Base/Folder.php @@ -172,7 +172,7 @@ abstract class Folder implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -3117,7 +3117,7 @@ abstract class Folder implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collContentFolders instanceof Collection) { @@ -3179,7 +3179,7 @@ abstract class Folder implements ActiveRecordInterface * * @return ChildFolder The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -3203,7 +3203,7 @@ abstract class Folder implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildFolderI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collFolderI18ns) { @@ -3238,7 +3238,7 @@ abstract class Folder implements ActiveRecordInterface * * @return ChildFolder The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildFolderI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/FolderDocument.php b/core/lib/Thelia/Model/Base/FolderDocument.php index fbe0c91b1..8e24ee9d4 100755 --- a/core/lib/Thelia/Model/Base/FolderDocument.php +++ b/core/lib/Thelia/Model/Base/FolderDocument.php @@ -120,7 +120,7 @@ abstract class FolderDocument implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1640,7 +1640,7 @@ abstract class FolderDocument implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collFolderDocumentI18ns instanceof Collection) { @@ -1683,7 +1683,7 @@ abstract class FolderDocument implements ActiveRecordInterface * * @return ChildFolderDocument The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1707,7 +1707,7 @@ abstract class FolderDocument implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildFolderDocumentI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collFolderDocumentI18ns) { @@ -1742,7 +1742,7 @@ abstract class FolderDocument implements ActiveRecordInterface * * @return ChildFolderDocument The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildFolderDocumentI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/FolderDocumentI18n.php b/core/lib/Thelia/Model/Base/FolderDocumentI18n.php index 57a38034f..b68c8ce9d 100755 --- a/core/lib/Thelia/Model/Base/FolderDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/FolderDocumentI18n.php @@ -61,7 +61,7 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/FolderDocumentQuery.php b/core/lib/Thelia/Model/Base/FolderDocumentQuery.php index 85ed5c241..b1c41a29e 100755 --- a/core/lib/Thelia/Model/Base/FolderDocumentQuery.php +++ b/core/lib/Thelia/Model/Base/FolderDocumentQuery.php @@ -797,7 +797,7 @@ abstract class FolderDocumentQuery extends ModelCriteria * * @return ChildFolderDocumentQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'FolderDocumentI18n'; @@ -815,7 +815,7 @@ abstract class FolderDocumentQuery extends ModelCriteria * * @return ChildFolderDocumentQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -836,7 +836,7 @@ abstract class FolderDocumentQuery extends ModelCriteria * * @return ChildFolderDocumentI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/FolderI18n.php b/core/lib/Thelia/Model/Base/FolderI18n.php index 12d627cac..976c6b041 100755 --- a/core/lib/Thelia/Model/Base/FolderI18n.php +++ b/core/lib/Thelia/Model/Base/FolderI18n.php @@ -61,7 +61,7 @@ abstract class FolderI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class FolderI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class FolderI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/FolderImage.php b/core/lib/Thelia/Model/Base/FolderImage.php index f1eb8a5ab..525dc9d48 100755 --- a/core/lib/Thelia/Model/Base/FolderImage.php +++ b/core/lib/Thelia/Model/Base/FolderImage.php @@ -120,7 +120,7 @@ abstract class FolderImage implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1640,7 +1640,7 @@ abstract class FolderImage implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collFolderImageI18ns instanceof Collection) { @@ -1683,7 +1683,7 @@ abstract class FolderImage implements ActiveRecordInterface * * @return ChildFolderImage The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1707,7 +1707,7 @@ abstract class FolderImage implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildFolderImageI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collFolderImageI18ns) { @@ -1742,7 +1742,7 @@ abstract class FolderImage implements ActiveRecordInterface * * @return ChildFolderImage The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildFolderImageI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/FolderImageI18n.php b/core/lib/Thelia/Model/Base/FolderImageI18n.php index 894b6ec0f..6ac9575e1 100755 --- a/core/lib/Thelia/Model/Base/FolderImageI18n.php +++ b/core/lib/Thelia/Model/Base/FolderImageI18n.php @@ -61,7 +61,7 @@ abstract class FolderImageI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class FolderImageI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class FolderImageI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/FolderImageQuery.php b/core/lib/Thelia/Model/Base/FolderImageQuery.php index 4ea930e20..ca12e098e 100755 --- a/core/lib/Thelia/Model/Base/FolderImageQuery.php +++ b/core/lib/Thelia/Model/Base/FolderImageQuery.php @@ -797,7 +797,7 @@ abstract class FolderImageQuery extends ModelCriteria * * @return ChildFolderImageQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'FolderImageI18n'; @@ -815,7 +815,7 @@ abstract class FolderImageQuery extends ModelCriteria * * @return ChildFolderImageQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -836,7 +836,7 @@ abstract class FolderImageQuery extends ModelCriteria * * @return ChildFolderImageI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/FolderQuery.php b/core/lib/Thelia/Model/Base/FolderQuery.php index 28f9bc8a3..d7d6794c5 100755 --- a/core/lib/Thelia/Model/Base/FolderQuery.php +++ b/core/lib/Thelia/Model/Base/FolderQuery.php @@ -1185,7 +1185,7 @@ abstract class FolderQuery extends ModelCriteria * * @return ChildFolderQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'FolderI18n'; @@ -1203,7 +1203,7 @@ abstract class FolderQuery extends ModelCriteria * * @return ChildFolderQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -1224,7 +1224,7 @@ abstract class FolderQuery extends ModelCriteria * * @return ChildFolderI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Group.php b/core/lib/Thelia/Model/Base/Group.php index eed65d778..19d41e38c 100755 --- a/core/lib/Thelia/Model/Base/Group.php +++ b/core/lib/Thelia/Model/Base/Group.php @@ -139,7 +139,7 @@ abstract class Group implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -2786,7 +2786,7 @@ abstract class Group implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collAdminGroups instanceof Collection) { @@ -2848,7 +2848,7 @@ abstract class Group implements ActiveRecordInterface * * @return ChildGroup The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -2872,7 +2872,7 @@ abstract class Group implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildGroupI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collGroupI18ns) { @@ -2907,7 +2907,7 @@ abstract class Group implements ActiveRecordInterface * * @return ChildGroup The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildGroupI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/GroupI18n.php b/core/lib/Thelia/Model/Base/GroupI18n.php index 4ba0aac29..df8f3f81a 100755 --- a/core/lib/Thelia/Model/Base/GroupI18n.php +++ b/core/lib/Thelia/Model/Base/GroupI18n.php @@ -61,7 +61,7 @@ abstract class GroupI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class GroupI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class GroupI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/GroupQuery.php b/core/lib/Thelia/Model/Base/GroupQuery.php index 8ca963848..d0eded79b 100755 --- a/core/lib/Thelia/Model/Base/GroupQuery.php +++ b/core/lib/Thelia/Model/Base/GroupQuery.php @@ -891,7 +891,7 @@ abstract class GroupQuery extends ModelCriteria * * @return ChildGroupQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'GroupI18n'; @@ -909,7 +909,7 @@ abstract class GroupQuery extends ModelCriteria * * @return ChildGroupQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -930,7 +930,7 @@ abstract class GroupQuery extends ModelCriteria * * @return ChildGroupI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Message.php b/core/lib/Thelia/Model/Base/Message.php index 5245c3765..4ee6b4cab 100755 --- a/core/lib/Thelia/Model/Base/Message.php +++ b/core/lib/Thelia/Model/Base/Message.php @@ -67,10 +67,10 @@ abstract class Message implements ActiveRecordInterface protected $id; /** - * The value for the code field. + * The value for the name field. * @var string */ - protected $code; + protected $name; /** * The value for the secured field. @@ -78,12 +78,6 @@ abstract class Message implements ActiveRecordInterface */ protected $secured; - /** - * The value for the ref field. - * @var string - */ - protected $ref; - /** * The value for the created_at field. * @var string @@ -141,7 +135,7 @@ abstract class Message implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -448,14 +442,14 @@ abstract class Message implements ActiveRecordInterface } /** - * Get the [code] column value. + * Get the [name] column value. * * @return string */ - public function getCode() + public function getName() { - return $this->code; + return $this->name; } /** @@ -469,17 +463,6 @@ abstract class Message implements ActiveRecordInterface return $this->secured; } - /** - * Get the [ref] column value. - * - * @return string - */ - public function getRef() - { - - return $this->ref; - } - /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -584,25 +567,25 @@ abstract class Message implements ActiveRecordInterface } // setId() /** - * Set the value of [code] column. + * Set the value of [name] column. * * @param string $v new value * @return \Thelia\Model\Message The current object (for fluent API support) */ - public function setCode($v) + public function setName($v) { if ($v !== null) { $v = (string) $v; } - if ($this->code !== $v) { - $this->code = $v; - $this->modifiedColumns[] = MessageTableMap::CODE; + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = MessageTableMap::NAME; } return $this; - } // setCode() + } // setName() /** * Set the value of [secured] column. @@ -625,27 +608,6 @@ abstract class Message implements ActiveRecordInterface return $this; } // setSecured() - /** - * Set the value of [ref] column. - * - * @param string $v new value - * @return \Thelia\Model\Message The current object (for fluent API support) - */ - public function setRef($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->ref !== $v) { - $this->ref = $v; - $this->modifiedColumns[] = MessageTableMap::REF; - } - - - return $this; - } // setRef() - /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -795,37 +757,34 @@ abstract class Message implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : MessageTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MessageTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; - $this->code = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MessageTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]; + $this->name = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MessageTableMap::translateFieldName('Secured', TableMap::TYPE_PHPNAME, $indexType)]; $this->secured = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageTableMap::translateFieldName('Ref', TableMap::TYPE_PHPNAME, $indexType)]; - $this->ref = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $this->version = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : MessageTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; $this->version_created_by = (null !== $col) ? (string) $col : null; $this->resetModified(); @@ -835,7 +794,7 @@ abstract class Message implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 9; // 9 = MessageTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 8; // 8 = MessageTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Message object", 0, $e); @@ -1108,15 +1067,12 @@ abstract class Message implements ActiveRecordInterface if ($this->isColumnModified(MessageTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(MessageTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + if ($this->isColumnModified(MessageTableMap::NAME)) { + $modifiedColumns[':p' . $index++] = 'NAME'; } if ($this->isColumnModified(MessageTableMap::SECURED)) { $modifiedColumns[':p' . $index++] = 'SECURED'; } - if ($this->isColumnModified(MessageTableMap::REF)) { - $modifiedColumns[':p' . $index++] = 'REF'; - } if ($this->isColumnModified(MessageTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -1146,15 +1102,12 @@ abstract class Message implements ActiveRecordInterface case 'ID': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': - $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); + case 'NAME': + $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; case 'SECURED': $stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT); break; - case 'REF': - $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); - break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -1236,27 +1189,24 @@ abstract class Message implements ActiveRecordInterface return $this->getId(); break; case 1: - return $this->getCode(); + return $this->getName(); break; case 2: return $this->getSecured(); break; case 3: - return $this->getRef(); - break; - case 4: return $this->getCreatedAt(); break; - case 5: + case 4: return $this->getUpdatedAt(); break; - case 6: + case 5: return $this->getVersion(); break; - case 7: + case 6: return $this->getVersionCreatedAt(); break; - case 8: + case 7: return $this->getVersionCreatedBy(); break; default: @@ -1289,14 +1239,13 @@ abstract class Message implements ActiveRecordInterface $keys = MessageTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), - $keys[1] => $this->getCode(), + $keys[1] => $this->getName(), $keys[2] => $this->getSecured(), - $keys[3] => $this->getRef(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), - $keys[6] => $this->getVersion(), - $keys[7] => $this->getVersionCreatedAt(), - $keys[8] => $this->getVersionCreatedBy(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), + $keys[5] => $this->getVersion(), + $keys[6] => $this->getVersionCreatedAt(), + $keys[7] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1349,27 +1298,24 @@ abstract class Message implements ActiveRecordInterface $this->setId($value); break; case 1: - $this->setCode($value); + $this->setName($value); break; case 2: $this->setSecured($value); break; case 3: - $this->setRef($value); - break; - case 4: $this->setCreatedAt($value); break; - case 5: + case 4: $this->setUpdatedAt($value); break; - case 6: + case 5: $this->setVersion($value); break; - case 7: + case 6: $this->setVersionCreatedAt($value); break; - case 8: + case 7: $this->setVersionCreatedBy($value); break; } // switch() @@ -1397,14 +1343,13 @@ abstract class Message implements ActiveRecordInterface $keys = MessageTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setSecured($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setRef($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedBy($arr[$keys[8]]); + if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setVersion($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setVersionCreatedAt($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedBy($arr[$keys[7]]); } /** @@ -1417,9 +1362,8 @@ abstract class Message implements ActiveRecordInterface $criteria = new Criteria(MessageTableMap::DATABASE_NAME); if ($this->isColumnModified(MessageTableMap::ID)) $criteria->add(MessageTableMap::ID, $this->id); - if ($this->isColumnModified(MessageTableMap::CODE)) $criteria->add(MessageTableMap::CODE, $this->code); + if ($this->isColumnModified(MessageTableMap::NAME)) $criteria->add(MessageTableMap::NAME, $this->name); if ($this->isColumnModified(MessageTableMap::SECURED)) $criteria->add(MessageTableMap::SECURED, $this->secured); - if ($this->isColumnModified(MessageTableMap::REF)) $criteria->add(MessageTableMap::REF, $this->ref); if ($this->isColumnModified(MessageTableMap::CREATED_AT)) $criteria->add(MessageTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(MessageTableMap::UPDATED_AT)) $criteria->add(MessageTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(MessageTableMap::VERSION)) $criteria->add(MessageTableMap::VERSION, $this->version); @@ -1488,9 +1432,8 @@ abstract class Message implements ActiveRecordInterface */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setCode($this->getCode()); + $copyObj->setName($this->getName()); $copyObj->setSecured($this->getSecured()); - $copyObj->setRef($this->getRef()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setVersion($this->getVersion()); @@ -2015,9 +1958,8 @@ abstract class Message implements ActiveRecordInterface public function clear() { $this->id = null; - $this->code = null; + $this->name = null; $this->secured = null; - $this->ref = null; $this->created_at = null; $this->updated_at = null; $this->version = null; @@ -2056,7 +1998,7 @@ abstract class Message implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collMessageI18ns instanceof Collection) { @@ -2102,7 +2044,7 @@ abstract class Message implements ActiveRecordInterface * * @return ChildMessage The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -2126,7 +2068,7 @@ abstract class Message implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildMessageI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collMessageI18ns) { @@ -2161,7 +2103,7 @@ abstract class Message implements ActiveRecordInterface * * @return ChildMessage The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildMessageI18nQuery::create() @@ -2218,48 +2160,72 @@ abstract class Message implements ActiveRecordInterface /** - * Get the [description] column value. + * Get the [subject] column value. * * @return string */ - public function getDescription() + public function getSubject() { - return $this->getCurrentTranslation()->getDescription(); + return $this->getCurrentTranslation()->getSubject(); } /** - * Set the value of [description] column. + * Set the value of [subject] column. * * @param string $v new value * @return \Thelia\Model\MessageI18n The current object (for fluent API support) */ - public function setDescription($v) - { $this->getCurrentTranslation()->setDescription($v); + public function setSubject($v) + { $this->getCurrentTranslation()->setSubject($v); return $this; } /** - * Get the [description_html] column value. + * Get the [text_message] column value. * * @return string */ - public function getDescriptionHtml() + public function getTextMessage() { - return $this->getCurrentTranslation()->getDescriptionHtml(); + return $this->getCurrentTranslation()->getTextMessage(); } /** - * Set the value of [description_html] column. + * Set the value of [text_message] column. * * @param string $v new value * @return \Thelia\Model\MessageI18n The current object (for fluent API support) */ - public function setDescriptionHtml($v) - { $this->getCurrentTranslation()->setDescriptionHtml($v); + public function setTextMessage($v) + { $this->getCurrentTranslation()->setTextMessage($v); + + return $this; + } + + + /** + * Get the [html_message] column value. + * + * @return string + */ + public function getHtmlMessage() + { + return $this->getCurrentTranslation()->getHtmlMessage(); + } + + + /** + * Set the value of [html_message] column. + * + * @param string $v new value + * @return \Thelia\Model\MessageI18n The current object (for fluent API support) + */ + public function setHtmlMessage($v) + { $this->getCurrentTranslation()->setHtmlMessage($v); return $this; } @@ -2313,9 +2279,8 @@ abstract class Message implements ActiveRecordInterface $version = new ChildMessageVersion(); $version->setId($this->getId()); - $version->setCode($this->getCode()); + $version->setName($this->getName()); $version->setSecured($this->getSecured()); - $version->setRef($this->getRef()); $version->setCreatedAt($this->getCreatedAt()); $version->setUpdatedAt($this->getUpdatedAt()); $version->setVersion($this->getVersion()); @@ -2359,9 +2324,8 @@ abstract class Message implements ActiveRecordInterface { $loadedObjects['ChildMessage'][$version->getId()][$version->getVersion()] = $this; $this->setId($version->getId()); - $this->setCode($version->getCode()); + $this->setName($version->getName()); $this->setSecured($version->getSecured()); - $this->setRef($version->getRef()); $this->setCreatedAt($version->getCreatedAt()); $this->setUpdatedAt($version->getUpdatedAt()); $this->setVersion($version->getVersion()); diff --git a/core/lib/Thelia/Model/Base/MessageI18n.php b/core/lib/Thelia/Model/Base/MessageI18n.php index 575e22907..d37682f97 100755 --- a/core/lib/Thelia/Model/Base/MessageI18n.php +++ b/core/lib/Thelia/Model/Base/MessageI18n.php @@ -61,7 +61,7 @@ abstract class MessageI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -73,16 +73,22 @@ abstract class MessageI18n implements ActiveRecordInterface protected $title; /** - * The value for the description field. + * The value for the subject field. * @var string */ - protected $description; + protected $subject; /** - * The value for the description_html field. + * The value for the text_message field. * @var string */ - protected $description_html; + protected $text_message; + + /** + * The value for the html_message field. + * @var string + */ + protected $html_message; /** * @var Message @@ -105,7 +111,7 @@ abstract class MessageI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -398,25 +404,36 @@ abstract class MessageI18n implements ActiveRecordInterface } /** - * Get the [description] column value. + * Get the [subject] column value. * * @return string */ - public function getDescription() + public function getSubject() { - return $this->description; + return $this->subject; } /** - * Get the [description_html] column value. + * Get the [text_message] column value. * * @return string */ - public function getDescriptionHtml() + public function getTextMessage() { - return $this->description_html; + return $this->text_message; + } + + /** + * Get the [html_message] column value. + * + * @return string + */ + public function getHtmlMessage() + { + + return $this->html_message; } /** @@ -487,46 +504,67 @@ abstract class MessageI18n implements ActiveRecordInterface } // setTitle() /** - * Set the value of [description] column. + * Set the value of [subject] column. * * @param string $v new value * @return \Thelia\Model\MessageI18n The current object (for fluent API support) */ - public function setDescription($v) + public function setSubject($v) { if ($v !== null) { $v = (string) $v; } - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = MessageI18nTableMap::DESCRIPTION; + if ($this->subject !== $v) { + $this->subject = $v; + $this->modifiedColumns[] = MessageI18nTableMap::SUBJECT; } return $this; - } // setDescription() + } // setSubject() /** - * Set the value of [description_html] column. + * Set the value of [text_message] column. * * @param string $v new value * @return \Thelia\Model\MessageI18n The current object (for fluent API support) */ - public function setDescriptionHtml($v) + public function setTextMessage($v) { if ($v !== null) { $v = (string) $v; } - if ($this->description_html !== $v) { - $this->description_html = $v; - $this->modifiedColumns[] = MessageI18nTableMap::DESCRIPTION_HTML; + if ($this->text_message !== $v) { + $this->text_message = $v; + $this->modifiedColumns[] = MessageI18nTableMap::TEXT_MESSAGE; } return $this; - } // setDescriptionHtml() + } // setTextMessage() + + /** + * Set the value of [html_message] column. + * + * @param string $v new value + * @return \Thelia\Model\MessageI18n The current object (for fluent API support) + */ + public function setHtmlMessage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->html_message !== $v) { + $this->html_message = $v; + $this->modifiedColumns[] = MessageI18nTableMap::HTML_MESSAGE; + } + + + return $this; + } // setHtmlMessage() /** * Indicates whether the columns in this object are only set to default values. @@ -538,7 +576,7 @@ abstract class MessageI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } @@ -578,11 +616,14 @@ abstract class MessageI18n implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MessageI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; $this->title = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; - $this->description = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageI18nTableMap::translateFieldName('Subject', TableMap::TYPE_PHPNAME, $indexType)]; + $this->subject = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageI18nTableMap::translateFieldName('DescriptionHtml', TableMap::TYPE_PHPNAME, $indexType)]; - $this->description_html = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageI18nTableMap::translateFieldName('TextMessage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->text_message = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageI18nTableMap::translateFieldName('HtmlMessage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->html_message = (null !== $col) ? (string) $col : null; $this->resetModified(); $this->setNew(false); @@ -591,7 +632,7 @@ abstract class MessageI18n implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 5; // 5 = MessageI18nTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = MessageI18nTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\MessageI18n object", 0, $e); @@ -821,11 +862,14 @@ abstract class MessageI18n implements ActiveRecordInterface if ($this->isColumnModified(MessageI18nTableMap::TITLE)) { $modifiedColumns[':p' . $index++] = 'TITLE'; } - if ($this->isColumnModified(MessageI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + if ($this->isColumnModified(MessageI18nTableMap::SUBJECT)) { + $modifiedColumns[':p' . $index++] = 'SUBJECT'; } - if ($this->isColumnModified(MessageI18nTableMap::DESCRIPTION_HTML)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION_HTML'; + if ($this->isColumnModified(MessageI18nTableMap::TEXT_MESSAGE)) { + $modifiedColumns[':p' . $index++] = 'TEXT_MESSAGE'; + } + if ($this->isColumnModified(MessageI18nTableMap::HTML_MESSAGE)) { + $modifiedColumns[':p' . $index++] = 'HTML_MESSAGE'; } $sql = sprintf( @@ -847,11 +891,14 @@ abstract class MessageI18n implements ActiveRecordInterface case 'TITLE': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + case 'SUBJECT': + $stmt->bindValue($identifier, $this->subject, PDO::PARAM_STR); break; - case 'DESCRIPTION_HTML': - $stmt->bindValue($identifier, $this->description_html, PDO::PARAM_STR); + case 'TEXT_MESSAGE': + $stmt->bindValue($identifier, $this->text_message, PDO::PARAM_STR); + break; + case 'HTML_MESSAGE': + $stmt->bindValue($identifier, $this->html_message, PDO::PARAM_STR); break; } } @@ -918,10 +965,13 @@ abstract class MessageI18n implements ActiveRecordInterface return $this->getTitle(); break; case 3: - return $this->getDescription(); + return $this->getSubject(); break; case 4: - return $this->getDescriptionHtml(); + return $this->getTextMessage(); + break; + case 5: + return $this->getHtmlMessage(); break; default: return null; @@ -955,8 +1005,9 @@ abstract class MessageI18n implements ActiveRecordInterface $keys[0] => $this->getId(), $keys[1] => $this->getLocale(), $keys[2] => $this->getTitle(), - $keys[3] => $this->getDescription(), - $keys[4] => $this->getDescriptionHtml(), + $keys[3] => $this->getSubject(), + $keys[4] => $this->getTextMessage(), + $keys[5] => $this->getHtmlMessage(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1012,10 +1063,13 @@ abstract class MessageI18n implements ActiveRecordInterface $this->setTitle($value); break; case 3: - $this->setDescription($value); + $this->setSubject($value); break; case 4: - $this->setDescriptionHtml($value); + $this->setTextMessage($value); + break; + case 5: + $this->setHtmlMessage($value); break; } // switch() } @@ -1044,8 +1098,9 @@ abstract class MessageI18n implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescriptionHtml($arr[$keys[4]]); + if (array_key_exists($keys[3], $arr)) $this->setSubject($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setTextMessage($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setHtmlMessage($arr[$keys[5]]); } /** @@ -1060,8 +1115,9 @@ abstract class MessageI18n implements ActiveRecordInterface if ($this->isColumnModified(MessageI18nTableMap::ID)) $criteria->add(MessageI18nTableMap::ID, $this->id); if ($this->isColumnModified(MessageI18nTableMap::LOCALE)) $criteria->add(MessageI18nTableMap::LOCALE, $this->locale); if ($this->isColumnModified(MessageI18nTableMap::TITLE)) $criteria->add(MessageI18nTableMap::TITLE, $this->title); - if ($this->isColumnModified(MessageI18nTableMap::DESCRIPTION)) $criteria->add(MessageI18nTableMap::DESCRIPTION, $this->description); - if ($this->isColumnModified(MessageI18nTableMap::DESCRIPTION_HTML)) $criteria->add(MessageI18nTableMap::DESCRIPTION_HTML, $this->description_html); + if ($this->isColumnModified(MessageI18nTableMap::SUBJECT)) $criteria->add(MessageI18nTableMap::SUBJECT, $this->subject); + if ($this->isColumnModified(MessageI18nTableMap::TEXT_MESSAGE)) $criteria->add(MessageI18nTableMap::TEXT_MESSAGE, $this->text_message); + if ($this->isColumnModified(MessageI18nTableMap::HTML_MESSAGE)) $criteria->add(MessageI18nTableMap::HTML_MESSAGE, $this->html_message); return $criteria; } @@ -1135,8 +1191,9 @@ abstract class MessageI18n implements ActiveRecordInterface $copyObj->setId($this->getId()); $copyObj->setLocale($this->getLocale()); $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setDescriptionHtml($this->getDescriptionHtml()); + $copyObj->setSubject($this->getSubject()); + $copyObj->setTextMessage($this->getTextMessage()); + $copyObj->setHtmlMessage($this->getHtmlMessage()); if ($makeNew) { $copyObj->setNew(true); } @@ -1223,8 +1280,9 @@ abstract class MessageI18n implements ActiveRecordInterface $this->id = null; $this->locale = null; $this->title = null; - $this->description = null; - $this->description_html = null; + $this->subject = null; + $this->text_message = null; + $this->html_message = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->applyDefaultValues(); diff --git a/core/lib/Thelia/Model/Base/MessageI18nQuery.php b/core/lib/Thelia/Model/Base/MessageI18nQuery.php index 478c737e8..f63ca675a 100755 --- a/core/lib/Thelia/Model/Base/MessageI18nQuery.php +++ b/core/lib/Thelia/Model/Base/MessageI18nQuery.php @@ -24,14 +24,16 @@ use Thelia\Model\Map\MessageI18nTableMap; * @method ChildMessageI18nQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildMessageI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column * @method ChildMessageI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column - * @method ChildMessageI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column - * @method ChildMessageI18nQuery orderByDescriptionHtml($order = Criteria::ASC) Order by the description_html column + * @method ChildMessageI18nQuery orderBySubject($order = Criteria::ASC) Order by the subject column + * @method ChildMessageI18nQuery orderByTextMessage($order = Criteria::ASC) Order by the text_message column + * @method ChildMessageI18nQuery orderByHtmlMessage($order = Criteria::ASC) Order by the html_message column * * @method ChildMessageI18nQuery groupById() Group by the id column * @method ChildMessageI18nQuery groupByLocale() Group by the locale column * @method ChildMessageI18nQuery groupByTitle() Group by the title column - * @method ChildMessageI18nQuery groupByDescription() Group by the description column - * @method ChildMessageI18nQuery groupByDescriptionHtml() Group by the description_html column + * @method ChildMessageI18nQuery groupBySubject() Group by the subject column + * @method ChildMessageI18nQuery groupByTextMessage() Group by the text_message column + * @method ChildMessageI18nQuery groupByHtmlMessage() Group by the html_message column * * @method ChildMessageI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildMessageI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -47,14 +49,16 @@ use Thelia\Model\Map\MessageI18nTableMap; * @method ChildMessageI18n findOneById(int $id) Return the first ChildMessageI18n filtered by the id column * @method ChildMessageI18n findOneByLocale(string $locale) Return the first ChildMessageI18n filtered by the locale column * @method ChildMessageI18n findOneByTitle(string $title) Return the first ChildMessageI18n filtered by the title column - * @method ChildMessageI18n findOneByDescription(string $description) Return the first ChildMessageI18n filtered by the description column - * @method ChildMessageI18n findOneByDescriptionHtml(string $description_html) Return the first ChildMessageI18n filtered by the description_html column + * @method ChildMessageI18n findOneBySubject(string $subject) Return the first ChildMessageI18n filtered by the subject column + * @method ChildMessageI18n findOneByTextMessage(string $text_message) Return the first ChildMessageI18n filtered by the text_message column + * @method ChildMessageI18n findOneByHtmlMessage(string $html_message) Return the first ChildMessageI18n filtered by the html_message column * * @method array findById(int $id) Return ChildMessageI18n objects filtered by the id column * @method array findByLocale(string $locale) Return ChildMessageI18n objects filtered by the locale column * @method array findByTitle(string $title) Return ChildMessageI18n objects filtered by the title column - * @method array findByDescription(string $description) Return ChildMessageI18n objects filtered by the description column - * @method array findByDescriptionHtml(string $description_html) Return ChildMessageI18n objects filtered by the description_html column + * @method array findBySubject(string $subject) Return ChildMessageI18n objects filtered by the subject column + * @method array findByTextMessage(string $text_message) Return ChildMessageI18n objects filtered by the text_message column + * @method array findByHtmlMessage(string $html_message) Return ChildMessageI18n objects filtered by the html_message column * */ abstract class MessageI18nQuery extends ModelCriteria @@ -143,7 +147,7 @@ abstract class MessageI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, DESCRIPTION_HTML FROM message_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT ID, LOCALE, TITLE, SUBJECT, TEXT_MESSAGE, HTML_MESSAGE FROM message_i18n WHERE ID = :p0 AND LOCALE = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -346,61 +350,90 @@ abstract class MessageI18nQuery extends ModelCriteria } /** - * Filter the query on the description column + * Filter the query on the subject column * * Example usage: * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' + * $query->filterBySubject('fooValue'); // WHERE subject = 'fooValue' + * $query->filterBySubject('%fooValue%'); // WHERE subject LIKE '%fooValue%' * * - * @param string $description The value to use as filter. + * @param string $subject 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 ChildMessageI18nQuery The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterBySubject($subject = null, $comparison = null) { if (null === $comparison) { - if (is_array($description)) { + if (is_array($subject)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); + } elseif (preg_match('/[\%\*]/', $subject)) { + $subject = str_replace('*', '%', $subject); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(MessageI18nTableMap::DESCRIPTION, $description, $comparison); + return $this->addUsingAlias(MessageI18nTableMap::SUBJECT, $subject, $comparison); } /** - * Filter the query on the description_html column + * Filter the query on the text_message column * * Example usage: * - * $query->filterByDescriptionHtml('fooValue'); // WHERE description_html = 'fooValue' - * $query->filterByDescriptionHtml('%fooValue%'); // WHERE description_html LIKE '%fooValue%' + * $query->filterByTextMessage('fooValue'); // WHERE text_message = 'fooValue' + * $query->filterByTextMessage('%fooValue%'); // WHERE text_message LIKE '%fooValue%' * * - * @param string $descriptionHtml The value to use as filter. + * @param string $textMessage 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 ChildMessageI18nQuery The current query, for fluid interface */ - public function filterByDescriptionHtml($descriptionHtml = null, $comparison = null) + public function filterByTextMessage($textMessage = null, $comparison = null) { if (null === $comparison) { - if (is_array($descriptionHtml)) { + if (is_array($textMessage)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $descriptionHtml)) { - $descriptionHtml = str_replace('*', '%', $descriptionHtml); + } elseif (preg_match('/[\%\*]/', $textMessage)) { + $textMessage = str_replace('*', '%', $textMessage); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(MessageI18nTableMap::DESCRIPTION_HTML, $descriptionHtml, $comparison); + return $this->addUsingAlias(MessageI18nTableMap::TEXT_MESSAGE, $textMessage, $comparison); + } + + /** + * Filter the query on the html_message column + * + * Example usage: + * + * $query->filterByHtmlMessage('fooValue'); // WHERE html_message = 'fooValue' + * $query->filterByHtmlMessage('%fooValue%'); // WHERE html_message LIKE '%fooValue%' + * + * + * @param string $htmlMessage 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 ChildMessageI18nQuery The current query, for fluid interface + */ + public function filterByHtmlMessage($htmlMessage = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($htmlMessage)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $htmlMessage)) { + $htmlMessage = str_replace('*', '%', $htmlMessage); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(MessageI18nTableMap::HTML_MESSAGE, $htmlMessage, $comparison); } /** diff --git a/core/lib/Thelia/Model/Base/MessageQuery.php b/core/lib/Thelia/Model/Base/MessageQuery.php index 938a16aab..d72dc7bed 100755 --- a/core/lib/Thelia/Model/Base/MessageQuery.php +++ b/core/lib/Thelia/Model/Base/MessageQuery.php @@ -23,9 +23,8 @@ use Thelia\Model\Map\MessageTableMap; * * * @method ChildMessageQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildMessageQuery orderByCode($order = Criteria::ASC) Order by the code column + * @method ChildMessageQuery orderByName($order = Criteria::ASC) Order by the name column * @method ChildMessageQuery orderBySecured($order = Criteria::ASC) Order by the secured column - * @method ChildMessageQuery orderByRef($order = Criteria::ASC) Order by the ref column * @method ChildMessageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildMessageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildMessageQuery orderByVersion($order = Criteria::ASC) Order by the version column @@ -33,9 +32,8 @@ use Thelia\Model\Map\MessageTableMap; * @method ChildMessageQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column * * @method ChildMessageQuery groupById() Group by the id column - * @method ChildMessageQuery groupByCode() Group by the code column + * @method ChildMessageQuery groupByName() Group by the name column * @method ChildMessageQuery groupBySecured() Group by the secured column - * @method ChildMessageQuery groupByRef() Group by the ref column * @method ChildMessageQuery groupByCreatedAt() Group by the created_at column * @method ChildMessageQuery groupByUpdatedAt() Group by the updated_at column * @method ChildMessageQuery groupByVersion() Group by the version column @@ -58,9 +56,8 @@ use Thelia\Model\Map\MessageTableMap; * @method ChildMessage findOneOrCreate(ConnectionInterface $con = null) Return the first ChildMessage matching the query, or a new ChildMessage object populated from the query conditions when no match is found * * @method ChildMessage findOneById(int $id) Return the first ChildMessage filtered by the id column - * @method ChildMessage findOneByCode(string $code) Return the first ChildMessage filtered by the code column + * @method ChildMessage findOneByName(string $name) Return the first ChildMessage filtered by the name column * @method ChildMessage findOneBySecured(int $secured) Return the first ChildMessage filtered by the secured column - * @method ChildMessage findOneByRef(string $ref) Return the first ChildMessage filtered by the ref column * @method ChildMessage findOneByCreatedAt(string $created_at) Return the first ChildMessage filtered by the created_at column * @method ChildMessage findOneByUpdatedAt(string $updated_at) Return the first ChildMessage filtered by the updated_at column * @method ChildMessage findOneByVersion(int $version) Return the first ChildMessage filtered by the version column @@ -68,9 +65,8 @@ use Thelia\Model\Map\MessageTableMap; * @method ChildMessage findOneByVersionCreatedBy(string $version_created_by) Return the first ChildMessage filtered by the version_created_by column * * @method array findById(int $id) Return ChildMessage objects filtered by the id column - * @method array findByCode(string $code) Return ChildMessage objects filtered by the code column + * @method array findByName(string $name) Return ChildMessage objects filtered by the name column * @method array findBySecured(int $secured) Return ChildMessage objects filtered by the secured column - * @method array findByRef(string $ref) Return ChildMessage objects filtered by the ref column * @method array findByCreatedAt(string $created_at) Return ChildMessage objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildMessage objects filtered by the updated_at column * @method array findByVersion(int $version) Return ChildMessage objects filtered by the version column @@ -171,7 +167,7 @@ abstract class MessageQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, SECURED, REF, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message WHERE ID = :p0'; + $sql = 'SELECT ID, NAME, SECURED, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -302,32 +298,32 @@ abstract class MessageQuery extends ModelCriteria } /** - * Filter the query on the code column + * Filter the query on the name column * * Example usage: * - * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' - * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' + * $query->filterByName('fooValue'); // WHERE name = 'fooValue' + * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' * * - * @param string $code The value to use as filter. + * @param string $name 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 ChildMessageQuery The current query, for fluid interface */ - public function filterByCode($code = null, $comparison = null) + public function filterByName($name = null, $comparison = null) { if (null === $comparison) { - if (is_array($code)) { + if (is_array($name)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $code)) { - $code = str_replace('*', '%', $code); + } elseif (preg_match('/[\%\*]/', $name)) { + $name = str_replace('*', '%', $name); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(MessageTableMap::CODE, $code, $comparison); + return $this->addUsingAlias(MessageTableMap::NAME, $name, $comparison); } /** @@ -371,35 +367,6 @@ abstract class MessageQuery extends ModelCriteria return $this->addUsingAlias(MessageTableMap::SECURED, $secured, $comparison); } - /** - * Filter the query on the ref column - * - * Example usage: - * - * $query->filterByRef('fooValue'); // WHERE ref = 'fooValue' - * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%' - * - * - * @param string $ref 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 ChildMessageQuery The current query, for fluid interface - */ - public function filterByRef($ref = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($ref)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $ref)) { - $ref = str_replace('*', '%', $ref); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(MessageTableMap::REF, $ref, $comparison); - } - /** * Filter the query on the created_at column * @@ -913,7 +880,7 @@ abstract class MessageQuery extends ModelCriteria * * @return ChildMessageQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'MessageI18n'; @@ -931,7 +898,7 @@ abstract class MessageQuery extends ModelCriteria * * @return ChildMessageQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -952,7 +919,7 @@ abstract class MessageQuery extends ModelCriteria * * @return ChildMessageI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/MessageVersion.php b/core/lib/Thelia/Model/Base/MessageVersion.php index e425b5c50..60e12da8d 100755 --- a/core/lib/Thelia/Model/Base/MessageVersion.php +++ b/core/lib/Thelia/Model/Base/MessageVersion.php @@ -62,10 +62,10 @@ abstract class MessageVersion implements ActiveRecordInterface protected $id; /** - * The value for the code field. + * The value for the name field. * @var string */ - protected $code; + protected $name; /** * The value for the secured field. @@ -73,12 +73,6 @@ abstract class MessageVersion implements ActiveRecordInterface */ protected $secured; - /** - * The value for the ref field. - * @var string - */ - protected $ref; - /** * The value for the created_at field. * @var string @@ -402,14 +396,14 @@ abstract class MessageVersion implements ActiveRecordInterface } /** - * Get the [code] column value. + * Get the [name] column value. * * @return string */ - public function getCode() + public function getName() { - return $this->code; + return $this->name; } /** @@ -423,17 +417,6 @@ abstract class MessageVersion implements ActiveRecordInterface return $this->secured; } - /** - * Get the [ref] column value. - * - * @return string - */ - public function getRef() - { - - return $this->ref; - } - /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -542,25 +525,25 @@ abstract class MessageVersion implements ActiveRecordInterface } // setId() /** - * Set the value of [code] column. + * Set the value of [name] column. * * @param string $v new value * @return \Thelia\Model\MessageVersion The current object (for fluent API support) */ - public function setCode($v) + public function setName($v) { if ($v !== null) { $v = (string) $v; } - if ($this->code !== $v) { - $this->code = $v; - $this->modifiedColumns[] = MessageVersionTableMap::CODE; + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = MessageVersionTableMap::NAME; } return $this; - } // setCode() + } // setName() /** * Set the value of [secured] column. @@ -583,27 +566,6 @@ abstract class MessageVersion implements ActiveRecordInterface return $this; } // setSecured() - /** - * Set the value of [ref] column. - * - * @param string $v new value - * @return \Thelia\Model\MessageVersion The current object (for fluent API support) - */ - public function setRef($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->ref !== $v) { - $this->ref = $v; - $this->modifiedColumns[] = MessageVersionTableMap::REF; - } - - - return $this; - } // setRef() - /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -753,37 +715,34 @@ abstract class MessageVersion implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : MessageVersionTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MessageVersionTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; - $this->code = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MessageVersionTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]; + $this->name = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MessageVersionTableMap::translateFieldName('Secured', TableMap::TYPE_PHPNAME, $indexType)]; $this->secured = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageVersionTableMap::translateFieldName('Ref', TableMap::TYPE_PHPNAME, $indexType)]; - $this->ref = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $this->version = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; $this->version_created_by = (null !== $col) ? (string) $col : null; $this->resetModified(); @@ -793,7 +752,7 @@ abstract class MessageVersion implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 9; // 9 = MessageVersionTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 8; // 8 = MessageVersionTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\MessageVersion object", 0, $e); @@ -1017,15 +976,12 @@ abstract class MessageVersion implements ActiveRecordInterface if ($this->isColumnModified(MessageVersionTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(MessageVersionTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + if ($this->isColumnModified(MessageVersionTableMap::NAME)) { + $modifiedColumns[':p' . $index++] = 'NAME'; } if ($this->isColumnModified(MessageVersionTableMap::SECURED)) { $modifiedColumns[':p' . $index++] = 'SECURED'; } - if ($this->isColumnModified(MessageVersionTableMap::REF)) { - $modifiedColumns[':p' . $index++] = 'REF'; - } if ($this->isColumnModified(MessageVersionTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -1055,15 +1011,12 @@ abstract class MessageVersion implements ActiveRecordInterface case 'ID': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': - $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); + case 'NAME': + $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; case 'SECURED': $stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT); break; - case 'REF': - $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); - break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -1138,27 +1091,24 @@ abstract class MessageVersion implements ActiveRecordInterface return $this->getId(); break; case 1: - return $this->getCode(); + return $this->getName(); break; case 2: return $this->getSecured(); break; case 3: - return $this->getRef(); - break; - case 4: return $this->getCreatedAt(); break; - case 5: + case 4: return $this->getUpdatedAt(); break; - case 6: + case 5: return $this->getVersion(); break; - case 7: + case 6: return $this->getVersionCreatedAt(); break; - case 8: + case 7: return $this->getVersionCreatedBy(); break; default: @@ -1191,14 +1141,13 @@ abstract class MessageVersion implements ActiveRecordInterface $keys = MessageVersionTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), - $keys[1] => $this->getCode(), + $keys[1] => $this->getName(), $keys[2] => $this->getSecured(), - $keys[3] => $this->getRef(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), - $keys[6] => $this->getVersion(), - $keys[7] => $this->getVersionCreatedAt(), - $keys[8] => $this->getVersionCreatedBy(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), + $keys[5] => $this->getVersion(), + $keys[6] => $this->getVersionCreatedAt(), + $keys[7] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1248,27 +1197,24 @@ abstract class MessageVersion implements ActiveRecordInterface $this->setId($value); break; case 1: - $this->setCode($value); + $this->setName($value); break; case 2: $this->setSecured($value); break; case 3: - $this->setRef($value); - break; - case 4: $this->setCreatedAt($value); break; - case 5: + case 4: $this->setUpdatedAt($value); break; - case 6: + case 5: $this->setVersion($value); break; - case 7: + case 6: $this->setVersionCreatedAt($value); break; - case 8: + case 7: $this->setVersionCreatedBy($value); break; } // switch() @@ -1296,14 +1242,13 @@ abstract class MessageVersion implements ActiveRecordInterface $keys = MessageVersionTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setSecured($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setRef($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedBy($arr[$keys[8]]); + if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setVersion($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setVersionCreatedAt($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedBy($arr[$keys[7]]); } /** @@ -1316,9 +1261,8 @@ abstract class MessageVersion implements ActiveRecordInterface $criteria = new Criteria(MessageVersionTableMap::DATABASE_NAME); if ($this->isColumnModified(MessageVersionTableMap::ID)) $criteria->add(MessageVersionTableMap::ID, $this->id); - if ($this->isColumnModified(MessageVersionTableMap::CODE)) $criteria->add(MessageVersionTableMap::CODE, $this->code); + if ($this->isColumnModified(MessageVersionTableMap::NAME)) $criteria->add(MessageVersionTableMap::NAME, $this->name); if ($this->isColumnModified(MessageVersionTableMap::SECURED)) $criteria->add(MessageVersionTableMap::SECURED, $this->secured); - if ($this->isColumnModified(MessageVersionTableMap::REF)) $criteria->add(MessageVersionTableMap::REF, $this->ref); if ($this->isColumnModified(MessageVersionTableMap::CREATED_AT)) $criteria->add(MessageVersionTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(MessageVersionTableMap::UPDATED_AT)) $criteria->add(MessageVersionTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(MessageVersionTableMap::VERSION)) $criteria->add(MessageVersionTableMap::VERSION, $this->version); @@ -1395,9 +1339,8 @@ abstract class MessageVersion implements ActiveRecordInterface public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setId($this->getId()); - $copyObj->setCode($this->getCode()); + $copyObj->setName($this->getName()); $copyObj->setSecured($this->getSecured()); - $copyObj->setRef($this->getRef()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setVersion($this->getVersion()); @@ -1487,9 +1430,8 @@ abstract class MessageVersion implements ActiveRecordInterface public function clear() { $this->id = null; - $this->code = null; + $this->name = null; $this->secured = null; - $this->ref = null; $this->created_at = null; $this->updated_at = null; $this->version = null; diff --git a/core/lib/Thelia/Model/Base/MessageVersionQuery.php b/core/lib/Thelia/Model/Base/MessageVersionQuery.php index ac9b0ece0..088234eb5 100755 --- a/core/lib/Thelia/Model/Base/MessageVersionQuery.php +++ b/core/lib/Thelia/Model/Base/MessageVersionQuery.php @@ -22,9 +22,8 @@ use Thelia\Model\Map\MessageVersionTableMap; * * * @method ChildMessageVersionQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildMessageVersionQuery orderByCode($order = Criteria::ASC) Order by the code column + * @method ChildMessageVersionQuery orderByName($order = Criteria::ASC) Order by the name column * @method ChildMessageVersionQuery orderBySecured($order = Criteria::ASC) Order by the secured column - * @method ChildMessageVersionQuery orderByRef($order = Criteria::ASC) Order by the ref column * @method ChildMessageVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildMessageVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildMessageVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column @@ -32,9 +31,8 @@ use Thelia\Model\Map\MessageVersionTableMap; * @method ChildMessageVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column * * @method ChildMessageVersionQuery groupById() Group by the id column - * @method ChildMessageVersionQuery groupByCode() Group by the code column + * @method ChildMessageVersionQuery groupByName() Group by the name column * @method ChildMessageVersionQuery groupBySecured() Group by the secured column - * @method ChildMessageVersionQuery groupByRef() Group by the ref column * @method ChildMessageVersionQuery groupByCreatedAt() Group by the created_at column * @method ChildMessageVersionQuery groupByUpdatedAt() Group by the updated_at column * @method ChildMessageVersionQuery groupByVersion() Group by the version column @@ -53,9 +51,8 @@ use Thelia\Model\Map\MessageVersionTableMap; * @method ChildMessageVersion findOneOrCreate(ConnectionInterface $con = null) Return the first ChildMessageVersion matching the query, or a new ChildMessageVersion object populated from the query conditions when no match is found * * @method ChildMessageVersion findOneById(int $id) Return the first ChildMessageVersion filtered by the id column - * @method ChildMessageVersion findOneByCode(string $code) Return the first ChildMessageVersion filtered by the code column + * @method ChildMessageVersion findOneByName(string $name) Return the first ChildMessageVersion filtered by the name column * @method ChildMessageVersion findOneBySecured(int $secured) Return the first ChildMessageVersion filtered by the secured column - * @method ChildMessageVersion findOneByRef(string $ref) Return the first ChildMessageVersion filtered by the ref column * @method ChildMessageVersion findOneByCreatedAt(string $created_at) Return the first ChildMessageVersion filtered by the created_at column * @method ChildMessageVersion findOneByUpdatedAt(string $updated_at) Return the first ChildMessageVersion filtered by the updated_at column * @method ChildMessageVersion findOneByVersion(int $version) Return the first ChildMessageVersion filtered by the version column @@ -63,9 +60,8 @@ use Thelia\Model\Map\MessageVersionTableMap; * @method ChildMessageVersion findOneByVersionCreatedBy(string $version_created_by) Return the first ChildMessageVersion filtered by the version_created_by column * * @method array findById(int $id) Return ChildMessageVersion objects filtered by the id column - * @method array findByCode(string $code) Return ChildMessageVersion objects filtered by the code column + * @method array findByName(string $name) Return ChildMessageVersion objects filtered by the name column * @method array findBySecured(int $secured) Return ChildMessageVersion objects filtered by the secured column - * @method array findByRef(string $ref) Return ChildMessageVersion objects filtered by the ref column * @method array findByCreatedAt(string $created_at) Return ChildMessageVersion objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildMessageVersion objects filtered by the updated_at column * @method array findByVersion(int $version) Return ChildMessageVersion objects filtered by the version column @@ -159,7 +155,7 @@ abstract class MessageVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, SECURED, REF, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT ID, NAME, SECURED, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message_version WHERE ID = :p0 AND VERSION = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -304,32 +300,32 @@ abstract class MessageVersionQuery extends ModelCriteria } /** - * Filter the query on the code column + * Filter the query on the name column * * Example usage: * - * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' - * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' + * $query->filterByName('fooValue'); // WHERE name = 'fooValue' + * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' * * - * @param string $code The value to use as filter. + * @param string $name 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 ChildMessageVersionQuery The current query, for fluid interface */ - public function filterByCode($code = null, $comparison = null) + public function filterByName($name = null, $comparison = null) { if (null === $comparison) { - if (is_array($code)) { + if (is_array($name)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $code)) { - $code = str_replace('*', '%', $code); + } elseif (preg_match('/[\%\*]/', $name)) { + $name = str_replace('*', '%', $name); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(MessageVersionTableMap::CODE, $code, $comparison); + return $this->addUsingAlias(MessageVersionTableMap::NAME, $name, $comparison); } /** @@ -373,35 +369,6 @@ abstract class MessageVersionQuery extends ModelCriteria return $this->addUsingAlias(MessageVersionTableMap::SECURED, $secured, $comparison); } - /** - * Filter the query on the ref column - * - * Example usage: - * - * $query->filterByRef('fooValue'); // WHERE ref = 'fooValue' - * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%' - * - * - * @param string $ref 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 ChildMessageVersionQuery The current query, for fluid interface - */ - public function filterByRef($ref = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($ref)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $ref)) { - $ref = str_replace('*', '%', $ref); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(MessageVersionTableMap::REF, $ref, $comparison); - } - /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Base/Module.php b/core/lib/Thelia/Model/Base/Module.php index 76c391207..556ef9ff6 100755 --- a/core/lib/Thelia/Model/Base/Module.php +++ b/core/lib/Thelia/Model/Base/Module.php @@ -127,7 +127,7 @@ abstract class Module implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1910,7 +1910,7 @@ abstract class Module implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collGroupModules instanceof Collection) { @@ -1956,7 +1956,7 @@ abstract class Module implements ActiveRecordInterface * * @return ChildModule The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1980,7 +1980,7 @@ abstract class Module implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildModuleI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collModuleI18ns) { @@ -2015,7 +2015,7 @@ abstract class Module implements ActiveRecordInterface * * @return ChildModule The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildModuleI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/ModuleI18n.php b/core/lib/Thelia/Model/Base/ModuleI18n.php index d31dda0ba..9c7d603d1 100755 --- a/core/lib/Thelia/Model/Base/ModuleI18n.php +++ b/core/lib/Thelia/Model/Base/ModuleI18n.php @@ -61,7 +61,7 @@ abstract class ModuleI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class ModuleI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class ModuleI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/ModuleQuery.php b/core/lib/Thelia/Model/Base/ModuleQuery.php index 7db21ca22..e1bd9de68 100755 --- a/core/lib/Thelia/Model/Base/ModuleQuery.php +++ b/core/lib/Thelia/Model/Base/ModuleQuery.php @@ -838,7 +838,7 @@ abstract class ModuleQuery extends ModelCriteria * * @return ChildModuleQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'ModuleI18n'; @@ -856,7 +856,7 @@ abstract class ModuleQuery extends ModelCriteria * * @return ChildModuleQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -877,7 +877,7 @@ abstract class ModuleQuery extends ModelCriteria * * @return ChildModuleI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/OrderStatus.php b/core/lib/Thelia/Model/Base/OrderStatus.php index 99bb87879..d249b4865 100755 --- a/core/lib/Thelia/Model/Base/OrderStatus.php +++ b/core/lib/Thelia/Model/Base/OrderStatus.php @@ -109,7 +109,7 @@ abstract class OrderStatus implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1812,7 +1812,7 @@ abstract class OrderStatus implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collOrders instanceof Collection) { @@ -1858,7 +1858,7 @@ abstract class OrderStatus implements ActiveRecordInterface * * @return ChildOrderStatus The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1882,7 +1882,7 @@ abstract class OrderStatus implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildOrderStatusI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collOrderStatusI18ns) { @@ -1917,7 +1917,7 @@ abstract class OrderStatus implements ActiveRecordInterface * * @return ChildOrderStatus The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildOrderStatusI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/OrderStatusI18n.php b/core/lib/Thelia/Model/Base/OrderStatusI18n.php index 249944854..2946cc55b 100755 --- a/core/lib/Thelia/Model/Base/OrderStatusI18n.php +++ b/core/lib/Thelia/Model/Base/OrderStatusI18n.php @@ -61,7 +61,7 @@ abstract class OrderStatusI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class OrderStatusI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class OrderStatusI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/OrderStatusQuery.php b/core/lib/Thelia/Model/Base/OrderStatusQuery.php index 07fcdb8dc..908efd6b6 100755 --- a/core/lib/Thelia/Model/Base/OrderStatusQuery.php +++ b/core/lib/Thelia/Model/Base/OrderStatusQuery.php @@ -703,7 +703,7 @@ abstract class OrderStatusQuery extends ModelCriteria * * @return ChildOrderStatusQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'OrderStatusI18n'; @@ -721,7 +721,7 @@ abstract class OrderStatusQuery extends ModelCriteria * * @return ChildOrderStatusQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -742,7 +742,7 @@ abstract class OrderStatusQuery extends ModelCriteria * * @return ChildOrderStatusI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Product.php b/core/lib/Thelia/Model/Base/Product.php index af5b7319d..f7457d47b 100755 --- a/core/lib/Thelia/Model/Base/Product.php +++ b/core/lib/Thelia/Model/Base/Product.php @@ -242,7 +242,7 @@ abstract class Product implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -5447,7 +5447,7 @@ abstract class Product implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collProductCategories instanceof Collection) { @@ -5542,7 +5542,7 @@ abstract class Product implements ActiveRecordInterface * * @return ChildProduct The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -5566,7 +5566,7 @@ abstract class Product implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildProductI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collProductI18ns) { @@ -5601,7 +5601,7 @@ abstract class Product implements ActiveRecordInterface * * @return ChildProduct The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildProductI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/ProductDocument.php b/core/lib/Thelia/Model/Base/ProductDocument.php index 96a584dab..4223679c1 100755 --- a/core/lib/Thelia/Model/Base/ProductDocument.php +++ b/core/lib/Thelia/Model/Base/ProductDocument.php @@ -120,7 +120,7 @@ abstract class ProductDocument implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1640,7 +1640,7 @@ abstract class ProductDocument implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collProductDocumentI18ns instanceof Collection) { @@ -1683,7 +1683,7 @@ abstract class ProductDocument implements ActiveRecordInterface * * @return ChildProductDocument The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1707,7 +1707,7 @@ abstract class ProductDocument implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildProductDocumentI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collProductDocumentI18ns) { @@ -1742,7 +1742,7 @@ abstract class ProductDocument implements ActiveRecordInterface * * @return ChildProductDocument The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildProductDocumentI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/ProductDocumentI18n.php b/core/lib/Thelia/Model/Base/ProductDocumentI18n.php index ba04b5ccc..1a6017966 100755 --- a/core/lib/Thelia/Model/Base/ProductDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/ProductDocumentI18n.php @@ -61,7 +61,7 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/ProductDocumentQuery.php b/core/lib/Thelia/Model/Base/ProductDocumentQuery.php index 32321554d..06af05a9c 100755 --- a/core/lib/Thelia/Model/Base/ProductDocumentQuery.php +++ b/core/lib/Thelia/Model/Base/ProductDocumentQuery.php @@ -797,7 +797,7 @@ abstract class ProductDocumentQuery extends ModelCriteria * * @return ChildProductDocumentQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'ProductDocumentI18n'; @@ -815,7 +815,7 @@ abstract class ProductDocumentQuery extends ModelCriteria * * @return ChildProductDocumentQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -836,7 +836,7 @@ abstract class ProductDocumentQuery extends ModelCriteria * * @return ChildProductDocumentI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/ProductI18n.php b/core/lib/Thelia/Model/Base/ProductI18n.php index ee7514fd4..3ef14e787 100755 --- a/core/lib/Thelia/Model/Base/ProductI18n.php +++ b/core/lib/Thelia/Model/Base/ProductI18n.php @@ -61,7 +61,7 @@ abstract class ProductI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class ProductI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class ProductI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/ProductImage.php b/core/lib/Thelia/Model/Base/ProductImage.php index 152a298a5..a54d22cd0 100755 --- a/core/lib/Thelia/Model/Base/ProductImage.php +++ b/core/lib/Thelia/Model/Base/ProductImage.php @@ -120,7 +120,7 @@ abstract class ProductImage implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1640,7 +1640,7 @@ abstract class ProductImage implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collProductImageI18ns instanceof Collection) { @@ -1683,7 +1683,7 @@ abstract class ProductImage implements ActiveRecordInterface * * @return ChildProductImage The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1707,7 +1707,7 @@ abstract class ProductImage implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildProductImageI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collProductImageI18ns) { @@ -1742,7 +1742,7 @@ abstract class ProductImage implements ActiveRecordInterface * * @return ChildProductImage The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildProductImageI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/ProductImageI18n.php b/core/lib/Thelia/Model/Base/ProductImageI18n.php index c84f99af2..679ded79c 100755 --- a/core/lib/Thelia/Model/Base/ProductImageI18n.php +++ b/core/lib/Thelia/Model/Base/ProductImageI18n.php @@ -61,7 +61,7 @@ abstract class ProductImageI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class ProductImageI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class ProductImageI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/ProductImageQuery.php b/core/lib/Thelia/Model/Base/ProductImageQuery.php index e351c6f40..94cb1b361 100755 --- a/core/lib/Thelia/Model/Base/ProductImageQuery.php +++ b/core/lib/Thelia/Model/Base/ProductImageQuery.php @@ -797,7 +797,7 @@ abstract class ProductImageQuery extends ModelCriteria * * @return ChildProductImageQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'ProductImageI18n'; @@ -815,7 +815,7 @@ abstract class ProductImageQuery extends ModelCriteria * * @return ChildProductImageQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -836,7 +836,7 @@ abstract class ProductImageQuery extends ModelCriteria * * @return ChildProductImageI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/ProductQuery.php b/core/lib/Thelia/Model/Base/ProductQuery.php index 3254bb08b..75f05dfcf 100755 --- a/core/lib/Thelia/Model/Base/ProductQuery.php +++ b/core/lib/Thelia/Model/Base/ProductQuery.php @@ -1795,7 +1795,7 @@ abstract class ProductQuery extends ModelCriteria * * @return ChildProductQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'ProductI18n'; @@ -1813,7 +1813,7 @@ abstract class ProductQuery extends ModelCriteria * * @return ChildProductQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -1834,7 +1834,7 @@ abstract class ProductQuery extends ModelCriteria * * @return ChildProductI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Resource.php b/core/lib/Thelia/Model/Base/Resource.php index b513ea326..5a51bdc29 100755 --- a/core/lib/Thelia/Model/Base/Resource.php +++ b/core/lib/Thelia/Model/Base/Resource.php @@ -116,7 +116,7 @@ abstract class Resource implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1968,7 +1968,7 @@ abstract class Resource implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collGroupResources instanceof Collection) { @@ -2018,7 +2018,7 @@ abstract class Resource implements ActiveRecordInterface * * @return ChildResource The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -2042,7 +2042,7 @@ abstract class Resource implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildResourceI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collResourceI18ns) { @@ -2077,7 +2077,7 @@ abstract class Resource implements ActiveRecordInterface * * @return ChildResource The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildResourceI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/ResourceI18n.php b/core/lib/Thelia/Model/Base/ResourceI18n.php index 4419f7fc8..ac9ca106f 100755 --- a/core/lib/Thelia/Model/Base/ResourceI18n.php +++ b/core/lib/Thelia/Model/Base/ResourceI18n.php @@ -61,7 +61,7 @@ abstract class ResourceI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -111,7 +111,7 @@ abstract class ResourceI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -576,7 +576,7 @@ abstract class ResourceI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/ResourceQuery.php b/core/lib/Thelia/Model/Base/ResourceQuery.php index e12ee8f53..6559d6522 100755 --- a/core/lib/Thelia/Model/Base/ResourceQuery.php +++ b/core/lib/Thelia/Model/Base/ResourceQuery.php @@ -720,7 +720,7 @@ abstract class ResourceQuery extends ModelCriteria * * @return ChildResourceQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'ResourceI18n'; @@ -738,7 +738,7 @@ abstract class ResourceQuery extends ModelCriteria * * @return ChildResourceQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -759,7 +759,7 @@ abstract class ResourceQuery extends ModelCriteria * * @return ChildResourceI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Tax.php b/core/lib/Thelia/Model/Base/Tax.php index c1ddbf23a..02e6bc3b0 100755 --- a/core/lib/Thelia/Model/Base/Tax.php +++ b/core/lib/Thelia/Model/Base/Tax.php @@ -109,7 +109,7 @@ abstract class Tax implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -1762,7 +1762,7 @@ abstract class Tax implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collTaxRuleCountries instanceof Collection) { @@ -1808,7 +1808,7 @@ abstract class Tax implements ActiveRecordInterface * * @return ChildTax The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -1832,7 +1832,7 @@ abstract class Tax implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildTaxI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collTaxI18ns) { @@ -1867,7 +1867,7 @@ abstract class Tax implements ActiveRecordInterface * * @return ChildTax The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildTaxI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/TaxI18n.php b/core/lib/Thelia/Model/Base/TaxI18n.php index a066fe4a8..abb659135 100755 --- a/core/lib/Thelia/Model/Base/TaxI18n.php +++ b/core/lib/Thelia/Model/Base/TaxI18n.php @@ -61,7 +61,7 @@ abstract class TaxI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -99,7 +99,7 @@ abstract class TaxI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -500,7 +500,7 @@ abstract class TaxI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/TaxQuery.php b/core/lib/Thelia/Model/Base/TaxQuery.php index 0a61cbb3c..307ace57c 100755 --- a/core/lib/Thelia/Model/Base/TaxQuery.php +++ b/core/lib/Thelia/Model/Base/TaxQuery.php @@ -715,7 +715,7 @@ abstract class TaxQuery extends ModelCriteria * * @return ChildTaxQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'TaxI18n'; @@ -733,7 +733,7 @@ abstract class TaxQuery extends ModelCriteria * * @return ChildTaxQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -754,7 +754,7 @@ abstract class TaxQuery extends ModelCriteria * * @return ChildTaxI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/TaxRule.php b/core/lib/Thelia/Model/Base/TaxRule.php index e363541d7..d33d47e2b 100755 --- a/core/lib/Thelia/Model/Base/TaxRule.php +++ b/core/lib/Thelia/Model/Base/TaxRule.php @@ -129,7 +129,7 @@ abstract class TaxRule implements ActiveRecordInterface * Current locale * @var string */ - protected $currentLocale = 'en_EN'; + protected $currentLocale = 'en_US'; /** * Current translation objects @@ -2146,7 +2146,7 @@ abstract class TaxRule implements ActiveRecordInterface } // if ($deep) // i18n behavior - $this->currentLocale = 'en_EN'; + $this->currentLocale = 'en_US'; $this->currentTranslations = null; if ($this->collProducts instanceof Collection) { @@ -2196,7 +2196,7 @@ abstract class TaxRule implements ActiveRecordInterface * * @return ChildTaxRule The current object (for fluent API support) */ - public function setLocale($locale = 'en_EN') + public function setLocale($locale = 'en_US') { $this->currentLocale = $locale; @@ -2220,7 +2220,7 @@ abstract class TaxRule implements ActiveRecordInterface * @param ConnectionInterface $con an optional connection object * * @return ChildTaxRuleI18n */ - public function getTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { if (null !== $this->collTaxRuleI18ns) { @@ -2255,7 +2255,7 @@ abstract class TaxRule implements ActiveRecordInterface * * @return ChildTaxRule The current object (for fluent API support) */ - public function removeTranslation($locale = 'en_EN', ConnectionInterface $con = null) + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { ChildTaxRuleI18nQuery::create() diff --git a/core/lib/Thelia/Model/Base/TaxRuleI18n.php b/core/lib/Thelia/Model/Base/TaxRuleI18n.php index f685dd3cc..b1efadd6a 100755 --- a/core/lib/Thelia/Model/Base/TaxRuleI18n.php +++ b/core/lib/Thelia/Model/Base/TaxRuleI18n.php @@ -61,7 +61,7 @@ abstract class TaxRuleI18n implements ActiveRecordInterface /** * The value for the locale field. - * Note: this column has a database default value of: 'en_EN' + * Note: this column has a database default value of: 'en_US' * @var string */ protected $locale; @@ -87,7 +87,7 @@ abstract class TaxRuleI18n implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->locale = 'en_EN'; + $this->locale = 'en_US'; } /** @@ -424,7 +424,7 @@ abstract class TaxRuleI18n implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->locale !== 'en_EN') { + if ($this->locale !== 'en_US') { return false; } diff --git a/core/lib/Thelia/Model/Base/TaxRuleQuery.php b/core/lib/Thelia/Model/Base/TaxRuleQuery.php index 36f2edd99..2fb478b7a 100755 --- a/core/lib/Thelia/Model/Base/TaxRuleQuery.php +++ b/core/lib/Thelia/Model/Base/TaxRuleQuery.php @@ -846,7 +846,7 @@ abstract class TaxRuleQuery extends ModelCriteria * * @return ChildTaxRuleQuery The current query, for fluid interface */ - public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { $relationName = $relationAlias ? $relationAlias : 'TaxRuleI18n'; @@ -864,7 +864,7 @@ abstract class TaxRuleQuery extends ModelCriteria * * @return ChildTaxRuleQuery The current query, for fluid interface */ - public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN) + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) @@ -885,7 +885,7 @@ abstract class TaxRuleQuery extends ModelCriteria * * @return ChildTaxRuleI18nQuery A secondary query class using the current class as primary query */ - public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { return $this ->joinI18n($locale, $relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php index b1d92cfdd..ac3b2fff6 100755 --- a/core/lib/Thelia/Model/Category.php +++ b/core/lib/Thelia/Model/Category.php @@ -5,9 +5,13 @@ namespace Thelia\Model; use Thelia\Model\Base\Category as BaseCategory; use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Tools\URL; +use Thelia\Core\Event\TheliaEvents; +use Propel\Runtime\Connection\ConnectionInterface; class Category extends BaseCategory { + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + /** * @return int number of child for the current category */ @@ -74,6 +78,39 @@ class Category extends BaseCategory } return $countProduct; - } -} + + public function preInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY, new CategoryEvent($this)); + + return true; + } + + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATECATEGORY, new CategoryEvent($this)); + } + + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CHANGECATEGORY, new CategoryEvent($this)); + + return true; + } + + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CHANGECATEGORY, new CategoryEvent($this)); + } + + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETECATEGORY, new CategoryEvent($this)); + } + + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETECATEGORY, new CategoryEvent($this)); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/Config.php b/core/lib/Thelia/Model/Config.php index 04f760bd4..70880151c 100755 --- a/core/lib/Thelia/Model/Config.php +++ b/core/lib/Thelia/Model/Config.php @@ -1,9 +1,88 @@ . */ +/* */ +/*************************************************************************************/ namespace Thelia\Model; use Thelia\Model\Base\Config as BaseConfig; +use Propel\Runtime\Connection\ConnectionInterface; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Event\ConfigEvent; class Config extends BaseConfig { -} + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CREATECONFIG, new ConfigEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATECONFIG, new ConfigEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CHANGECONFIG, new ConfigEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CHANGECONFIG, new ConfigEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETECONFIG, new ConfigEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETECONFIG, new ConfigEvent($this)); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php index d7418a4ea..8f3de28d1 100755 --- a/core/lib/Thelia/Model/Customer.php +++ b/core/lib/Thelia/Model/Customer.php @@ -31,10 +31,7 @@ use Thelia\Core\Event\CustomerEvent; */ class Customer extends BaseCustomer implements UserInterface { - /** - * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface - */ - protected $dispatcher; + use \Thelia\Model\Tools\ModelEventDispatcherTrait; /** * @param int $titleId customer title id (from customer_title table) @@ -105,45 +102,6 @@ class Customer extends BaseCustomer implements UserInterface } } - public function preInsert(ConnectionInterface $con = null) - { - $this->setRef($this->generateRef()); - $customerEvent = new CustomerEvent($this); - - $this->dispatchEvent(TheliaEvents::BEFORE_CREATECUSTOMER, $customerEvent); - - return true; - } - - public function postInsert(ConnectionInterface $con = null) - { - $customerEvent = new CustomerEvent($this); - - $this->dispatchEvent(TheliaEvents::AFTER_CREATECUSTOMER, $customerEvent); - - } - - public function preUpdate(ConnectionInterface $con = null) - { - $customerEvent = new CustomerEvent($this); - $this->dispatchEvent(TheliaEvents::BEFORE_CHANGECUSTOMER, $customerEvent); - - return true; - } - - public function postUpdate(ConnectionInterface $con = null) - { - $customerEvent = new CustomerEvent($this); - $this->dispatchEvent(TheliaEvents::AFTER_CHANGECUSTOMER, $customerEvent); - } - - protected function dispatchEvent($eventName, CustomerEvent $customerEvent) - { - if (!is_null($this->dispatcher)) { - $this->dispatcher->dispatch($eventName, $customerEvent); - } - } - protected function generateRef() { return uniqid(substr($this->getLastname(), 0, (strlen($this->getLastname()) >= 3) ? 3 : strlen($this->getLastname())), true); @@ -184,11 +142,6 @@ class Customer extends BaseCustomer implements UserInterface return parent::setEmail($email); } - public function setDispatcher(EventDispatcherInterface $dispatcher) - { - $this->dispatcher = $dispatcher; - } - /** * {@inheritDoc} */ @@ -217,4 +170,57 @@ class Customer extends BaseCustomer implements UserInterface public function getRoles() { return array(new Role('CUSTOMER')); } + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->setRef($this->generateRef()); + + $this->dispatchEvent(TheliaEvents::BEFORE_CREATECUSTOMER, new CustomerEvent($this)); + return true; + } + + /** + * {@inheritDoc} + */ + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATECUSTOMER, new CustomerEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CHANGECUSTOMER, new CustomerEvent($this)); + return true; + } + + /** + * {@inheritDoc} + */ + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CHANGECUSTOMER, new CustomerEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETECONFIG, new CustomerEvent($this)); + return true; + } + + /** + * {@inheritDoc} + */ + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETECONFIG, new CustomerEvent($this)); + } } diff --git a/core/lib/Thelia/Model/Lang.php b/core/lib/Thelia/Model/Lang.php index d63422680..654c89719 100755 --- a/core/lib/Thelia/Model/Lang.php +++ b/core/lib/Thelia/Model/Lang.php @@ -6,4 +6,51 @@ use Thelia\Model\Base\Lang as BaseLang; class Lang extends BaseLang { + /** + * Return the default language object, using a local variable to cache it. + * + * @throws RuntimeException + */ + private static $default_lang = null; + + public static function getDefaultLanguage() { + + if (self::$default_lang == null) { + $default_lang = LangQuery::create()->findOneByByDefault(true); + + if ($default_lang == null) throw new RuntimeException("No default language is defined. Please define one."); + } + + return $default_lang; + } + + public function getDateFormat() + { + return "d/m/Y"; + } + + public function getTimeFormat() + { + return "H:i:s"; + } + + public function getDateTimeFormat() + { + return "d/m/Y H:i:s"; + } + + public function getDecimalSeparator() + { + return "."; + } + + public function getThousandsSeparator() + { + return " "; + } + + public function getDecimals() + { + return 2; + } } diff --git a/core/lib/Thelia/Model/Map/AttributeAvI18nTableMap.php b/core/lib/Thelia/Model/Map/AttributeAvI18nTableMap.php index 14fc79eeb..02a20540e 100755 --- a/core/lib/Thelia/Model/Map/AttributeAvI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/AttributeAvI18nTableMap.php @@ -151,7 +151,7 @@ class AttributeAvI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_av', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/AttributeAvTableMap.php b/core/lib/Thelia/Model/Map/AttributeAvTableMap.php index 138f0fa9c..0c5c2e1c9 100755 --- a/core/lib/Thelia/Model/Map/AttributeAvTableMap.php +++ b/core/lib/Thelia/Model/Map/AttributeAvTableMap.php @@ -106,7 +106,7 @@ class AttributeAvTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/AttributeI18nTableMap.php b/core/lib/Thelia/Model/Map/AttributeI18nTableMap.php index b60cae5b8..8471d3e26 100755 --- a/core/lib/Thelia/Model/Map/AttributeI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/AttributeI18nTableMap.php @@ -151,7 +151,7 @@ class AttributeI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/AttributeTableMap.php b/core/lib/Thelia/Model/Map/AttributeTableMap.php index dca811cbc..773e13cab 100755 --- a/core/lib/Thelia/Model/Map/AttributeTableMap.php +++ b/core/lib/Thelia/Model/Map/AttributeTableMap.php @@ -101,7 +101,7 @@ class AttributeTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/CategoryDocumentI18nTableMap.php b/core/lib/Thelia/Model/Map/CategoryDocumentI18nTableMap.php index 1ad7dfe2f..956afae4a 100755 --- a/core/lib/Thelia/Model/Map/CategoryDocumentI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/CategoryDocumentI18nTableMap.php @@ -151,7 +151,7 @@ class CategoryDocumentI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'category_document', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/CategoryDocumentTableMap.php b/core/lib/Thelia/Model/Map/CategoryDocumentTableMap.php index 83e748a1e..8b307ea1e 100755 --- a/core/lib/Thelia/Model/Map/CategoryDocumentTableMap.php +++ b/core/lib/Thelia/Model/Map/CategoryDocumentTableMap.php @@ -111,7 +111,7 @@ class CategoryDocumentTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/CategoryI18nTableMap.php b/core/lib/Thelia/Model/Map/CategoryI18nTableMap.php index 1611b2ebf..8c52aa7b2 100755 --- a/core/lib/Thelia/Model/Map/CategoryI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/CategoryI18nTableMap.php @@ -151,7 +151,7 @@ class CategoryI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'category', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/CategoryImageI18nTableMap.php b/core/lib/Thelia/Model/Map/CategoryImageI18nTableMap.php index 1c59c9db2..1d27e16ad 100755 --- a/core/lib/Thelia/Model/Map/CategoryImageI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/CategoryImageI18nTableMap.php @@ -151,7 +151,7 @@ class CategoryImageI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'category_image', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/CategoryImageTableMap.php b/core/lib/Thelia/Model/Map/CategoryImageTableMap.php index 9eafe2ade..1c7694d05 100755 --- a/core/lib/Thelia/Model/Map/CategoryImageTableMap.php +++ b/core/lib/Thelia/Model/Map/CategoryImageTableMap.php @@ -111,7 +111,7 @@ class CategoryImageTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/CategoryTableMap.php b/core/lib/Thelia/Model/Map/CategoryTableMap.php index 5e692c00f..6a2d052a1 100755 --- a/core/lib/Thelia/Model/Map/CategoryTableMap.php +++ b/core/lib/Thelia/Model/Map/CategoryTableMap.php @@ -126,7 +126,7 @@ class CategoryTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/ConfigI18nTableMap.php b/core/lib/Thelia/Model/Map/ConfigI18nTableMap.php index a83f87b76..b953b0ac9 100755 --- a/core/lib/Thelia/Model/Map/ConfigI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ConfigI18nTableMap.php @@ -151,7 +151,7 @@ class ConfigI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'config', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/ConfigTableMap.php b/core/lib/Thelia/Model/Map/ConfigTableMap.php index 8bd68a964..ebd5d6edf 100755 --- a/core/lib/Thelia/Model/Map/ConfigTableMap.php +++ b/core/lib/Thelia/Model/Map/ConfigTableMap.php @@ -116,7 +116,7 @@ class ConfigTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/ContentDocumentI18nTableMap.php b/core/lib/Thelia/Model/Map/ContentDocumentI18nTableMap.php index a6ff890d7..7ebde93e6 100755 --- a/core/lib/Thelia/Model/Map/ContentDocumentI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ContentDocumentI18nTableMap.php @@ -151,7 +151,7 @@ class ContentDocumentI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content_document', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/ContentDocumentTableMap.php b/core/lib/Thelia/Model/Map/ContentDocumentTableMap.php index 4344b70ae..3d876a570 100755 --- a/core/lib/Thelia/Model/Map/ContentDocumentTableMap.php +++ b/core/lib/Thelia/Model/Map/ContentDocumentTableMap.php @@ -111,7 +111,7 @@ class ContentDocumentTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/ContentI18nTableMap.php b/core/lib/Thelia/Model/Map/ContentI18nTableMap.php index ee9122a6c..f718623b0 100755 --- a/core/lib/Thelia/Model/Map/ContentI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ContentI18nTableMap.php @@ -151,7 +151,7 @@ class ContentI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/ContentImageI18nTableMap.php b/core/lib/Thelia/Model/Map/ContentImageI18nTableMap.php index 6ff343d16..759349d27 100755 --- a/core/lib/Thelia/Model/Map/ContentImageI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ContentImageI18nTableMap.php @@ -151,7 +151,7 @@ class ContentImageI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content_image', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/ContentImageTableMap.php b/core/lib/Thelia/Model/Map/ContentImageTableMap.php index c95761ab2..f731c51a8 100755 --- a/core/lib/Thelia/Model/Map/ContentImageTableMap.php +++ b/core/lib/Thelia/Model/Map/ContentImageTableMap.php @@ -111,7 +111,7 @@ class ContentImageTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/ContentTableMap.php b/core/lib/Thelia/Model/Map/ContentTableMap.php index f89e7fd20..ae9b908c0 100755 --- a/core/lib/Thelia/Model/Map/ContentTableMap.php +++ b/core/lib/Thelia/Model/Map/ContentTableMap.php @@ -121,7 +121,7 @@ class ContentTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/CountryI18nTableMap.php b/core/lib/Thelia/Model/Map/CountryI18nTableMap.php index cc60b09d2..272231464 100755 --- a/core/lib/Thelia/Model/Map/CountryI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/CountryI18nTableMap.php @@ -151,7 +151,7 @@ class CountryI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'country', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/CountryTableMap.php b/core/lib/Thelia/Model/Map/CountryTableMap.php index 2e4931e37..e7c356f08 100755 --- a/core/lib/Thelia/Model/Map/CountryTableMap.php +++ b/core/lib/Thelia/Model/Map/CountryTableMap.php @@ -116,7 +116,7 @@ class CountryTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/CouponI18nTableMap.php b/core/lib/Thelia/Model/Map/CouponI18nTableMap.php index 99d49216c..5718d6a74 100644 --- a/core/lib/Thelia/Model/Map/CouponI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponI18nTableMap.php @@ -131,7 +131,7 @@ class CouponI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); } // initialize() /** diff --git a/core/lib/Thelia/Model/Map/CouponTableMap.php b/core/lib/Thelia/Model/Map/CouponTableMap.php index d3ba620bf..0daa3b0ed 100755 --- a/core/lib/Thelia/Model/Map/CouponTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponTableMap.php @@ -171,7 +171,7 @@ class CouponTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/CurrencyI18nTableMap.php b/core/lib/Thelia/Model/Map/CurrencyI18nTableMap.php index d280f8601..c7e4725c1 100755 --- a/core/lib/Thelia/Model/Map/CurrencyI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/CurrencyI18nTableMap.php @@ -136,7 +136,7 @@ class CurrencyI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'currency', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('NAME', 'Name', 'VARCHAR', false, 45, null); } // initialize() diff --git a/core/lib/Thelia/Model/Map/CurrencyTableMap.php b/core/lib/Thelia/Model/Map/CurrencyTableMap.php index 08ecf6966..b37a6b30a 100755 --- a/core/lib/Thelia/Model/Map/CurrencyTableMap.php +++ b/core/lib/Thelia/Model/Map/CurrencyTableMap.php @@ -121,7 +121,7 @@ class CurrencyTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/CustomerTitleI18nTableMap.php b/core/lib/Thelia/Model/Map/CustomerTitleI18nTableMap.php index d403756fa..5344099c5 100755 --- a/core/lib/Thelia/Model/Map/CustomerTitleI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/CustomerTitleI18nTableMap.php @@ -141,7 +141,7 @@ class CustomerTitleI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'customer_title', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('SHORT', 'Short', 'VARCHAR', false, 10, null); $this->addColumn('LONG', 'Long', 'VARCHAR', false, 45, null); } // initialize() diff --git a/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php b/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php index 2769f365e..c10ce2500 100755 --- a/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php +++ b/core/lib/Thelia/Model/Map/CustomerTitleTableMap.php @@ -106,7 +106,7 @@ class CustomerTitleTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/FeatureAvI18nTableMap.php b/core/lib/Thelia/Model/Map/FeatureAvI18nTableMap.php index b3114e7ba..ba592b4b0 100755 --- a/core/lib/Thelia/Model/Map/FeatureAvI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/FeatureAvI18nTableMap.php @@ -151,7 +151,7 @@ class FeatureAvI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_av', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/FeatureAvTableMap.php b/core/lib/Thelia/Model/Map/FeatureAvTableMap.php index 0559f7ce6..4dd944bb7 100755 --- a/core/lib/Thelia/Model/Map/FeatureAvTableMap.php +++ b/core/lib/Thelia/Model/Map/FeatureAvTableMap.php @@ -106,7 +106,7 @@ class FeatureAvTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/FeatureI18nTableMap.php b/core/lib/Thelia/Model/Map/FeatureI18nTableMap.php index af0dfc263..dba05fb67 100755 --- a/core/lib/Thelia/Model/Map/FeatureI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/FeatureI18nTableMap.php @@ -151,7 +151,7 @@ class FeatureI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/FeatureTableMap.php b/core/lib/Thelia/Model/Map/FeatureTableMap.php index 7d0af0d45..76c2fe724 100755 --- a/core/lib/Thelia/Model/Map/FeatureTableMap.php +++ b/core/lib/Thelia/Model/Map/FeatureTableMap.php @@ -106,7 +106,7 @@ class FeatureTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/FolderDocumentI18nTableMap.php b/core/lib/Thelia/Model/Map/FolderDocumentI18nTableMap.php index 5875031fb..28dab9d8f 100755 --- a/core/lib/Thelia/Model/Map/FolderDocumentI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/FolderDocumentI18nTableMap.php @@ -151,7 +151,7 @@ class FolderDocumentI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'folder_document', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/FolderDocumentTableMap.php b/core/lib/Thelia/Model/Map/FolderDocumentTableMap.php index 467b7a65b..1d0e3b74a 100755 --- a/core/lib/Thelia/Model/Map/FolderDocumentTableMap.php +++ b/core/lib/Thelia/Model/Map/FolderDocumentTableMap.php @@ -111,7 +111,7 @@ class FolderDocumentTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/FolderI18nTableMap.php b/core/lib/Thelia/Model/Map/FolderI18nTableMap.php index fc85b17ec..d10344811 100755 --- a/core/lib/Thelia/Model/Map/FolderI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/FolderI18nTableMap.php @@ -151,7 +151,7 @@ class FolderI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'folder', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/FolderImageI18nTableMap.php b/core/lib/Thelia/Model/Map/FolderImageI18nTableMap.php index 1c89165a4..f0f87fd85 100755 --- a/core/lib/Thelia/Model/Map/FolderImageI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/FolderImageI18nTableMap.php @@ -151,7 +151,7 @@ class FolderImageI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'folder_image', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/FolderImageTableMap.php b/core/lib/Thelia/Model/Map/FolderImageTableMap.php index c559f9437..6dc186658 100755 --- a/core/lib/Thelia/Model/Map/FolderImageTableMap.php +++ b/core/lib/Thelia/Model/Map/FolderImageTableMap.php @@ -111,7 +111,7 @@ class FolderImageTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/FolderTableMap.php b/core/lib/Thelia/Model/Map/FolderTableMap.php index 7f4dde6d0..b35f63ae3 100755 --- a/core/lib/Thelia/Model/Map/FolderTableMap.php +++ b/core/lib/Thelia/Model/Map/FolderTableMap.php @@ -126,7 +126,7 @@ class FolderTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/GroupI18nTableMap.php b/core/lib/Thelia/Model/Map/GroupI18nTableMap.php index 585127821..57788593a 100755 --- a/core/lib/Thelia/Model/Map/GroupI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/GroupI18nTableMap.php @@ -151,7 +151,7 @@ class GroupI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'group', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/GroupTableMap.php b/core/lib/Thelia/Model/Map/GroupTableMap.php index a8c830005..881a2fa84 100755 --- a/core/lib/Thelia/Model/Map/GroupTableMap.php +++ b/core/lib/Thelia/Model/Map/GroupTableMap.php @@ -101,7 +101,7 @@ class GroupTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/MessageI18nTableMap.php b/core/lib/Thelia/Model/Map/MessageI18nTableMap.php index f084515c0..ea5d69766 100755 --- a/core/lib/Thelia/Model/Map/MessageI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/MessageI18nTableMap.php @@ -57,7 +57,7 @@ class MessageI18nTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 5; + const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class MessageI18nTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the ID field @@ -85,14 +85,19 @@ class MessageI18nTableMap extends TableMap const TITLE = 'message_i18n.TITLE'; /** - * the column name for the DESCRIPTION field + * the column name for the SUBJECT field */ - const DESCRIPTION = 'message_i18n.DESCRIPTION'; + const SUBJECT = 'message_i18n.SUBJECT'; /** - * the column name for the DESCRIPTION_HTML field + * the column name for the TEXT_MESSAGE field */ - const DESCRIPTION_HTML = 'message_i18n.DESCRIPTION_HTML'; + const TEXT_MESSAGE = 'message_i18n.TEXT_MESSAGE'; + + /** + * the column name for the HTML_MESSAGE field + */ + const HTML_MESSAGE = 'message_i18n.HTML_MESSAGE'; /** * The default string format for model objects of the related table @@ -106,12 +111,12 @@ class MessageI18nTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'DescriptionHtml', ), - self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'descriptionHtml', ), - self::TYPE_COLNAME => array(MessageI18nTableMap::ID, MessageI18nTableMap::LOCALE, MessageI18nTableMap::TITLE, MessageI18nTableMap::DESCRIPTION, MessageI18nTableMap::DESCRIPTION_HTML, ), - self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'DESCRIPTION_HTML', ), - self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'description_html', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Subject', 'TextMessage', 'HtmlMessage', ), + self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'subject', 'textMessage', 'htmlMessage', ), + self::TYPE_COLNAME => array(MessageI18nTableMap::ID, MessageI18nTableMap::LOCALE, MessageI18nTableMap::TITLE, MessageI18nTableMap::SUBJECT, MessageI18nTableMap::TEXT_MESSAGE, MessageI18nTableMap::HTML_MESSAGE, ), + self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'SUBJECT', 'TEXT_MESSAGE', 'HTML_MESSAGE', ), + self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'subject', 'text_message', 'html_message', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -121,12 +126,12 @@ class MessageI18nTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'DescriptionHtml' => 4, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'descriptionHtml' => 4, ), - self::TYPE_COLNAME => array(MessageI18nTableMap::ID => 0, MessageI18nTableMap::LOCALE => 1, MessageI18nTableMap::TITLE => 2, MessageI18nTableMap::DESCRIPTION => 3, MessageI18nTableMap::DESCRIPTION_HTML => 4, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'DESCRIPTION_HTML' => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'description_html' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Subject' => 3, 'TextMessage' => 4, 'HtmlMessage' => 5, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'subject' => 3, 'textMessage' => 4, 'htmlMessage' => 5, ), + self::TYPE_COLNAME => array(MessageI18nTableMap::ID => 0, MessageI18nTableMap::LOCALE => 1, MessageI18nTableMap::TITLE => 2, MessageI18nTableMap::SUBJECT => 3, MessageI18nTableMap::TEXT_MESSAGE => 4, MessageI18nTableMap::HTML_MESSAGE => 5, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'SUBJECT' => 3, 'TEXT_MESSAGE' => 4, 'HTML_MESSAGE' => 5, ), + self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'subject' => 3, 'text_message' => 4, 'html_message' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -146,10 +151,11 @@ class MessageI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'message', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'LONGVARCHAR', false, null, null); - $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); - $this->addColumn('DESCRIPTION_HTML', 'DescriptionHtml', 'CLOB', false, null, null); + $this->addColumn('SUBJECT', 'Subject', 'LONGVARCHAR', false, null, null); + $this->addColumn('TEXT_MESSAGE', 'TextMessage', 'CLOB', false, null, null); + $this->addColumn('HTML_MESSAGE', 'HtmlMessage', 'CLOB', false, null, null); } // initialize() /** @@ -350,14 +356,16 @@ class MessageI18nTableMap extends TableMap $criteria->addSelectColumn(MessageI18nTableMap::ID); $criteria->addSelectColumn(MessageI18nTableMap::LOCALE); $criteria->addSelectColumn(MessageI18nTableMap::TITLE); - $criteria->addSelectColumn(MessageI18nTableMap::DESCRIPTION); - $criteria->addSelectColumn(MessageI18nTableMap::DESCRIPTION_HTML); + $criteria->addSelectColumn(MessageI18nTableMap::SUBJECT); + $criteria->addSelectColumn(MessageI18nTableMap::TEXT_MESSAGE); + $criteria->addSelectColumn(MessageI18nTableMap::HTML_MESSAGE); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.LOCALE'); $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.DESCRIPTION_HTML'); + $criteria->addSelectColumn($alias . '.SUBJECT'); + $criteria->addSelectColumn($alias . '.TEXT_MESSAGE'); + $criteria->addSelectColumn($alias . '.HTML_MESSAGE'); } } diff --git a/core/lib/Thelia/Model/Map/MessageTableMap.php b/core/lib/Thelia/Model/Map/MessageTableMap.php index de2a205f9..d56b1210c 100755 --- a/core/lib/Thelia/Model/Map/MessageTableMap.php +++ b/core/lib/Thelia/Model/Map/MessageTableMap.php @@ -57,7 +57,7 @@ class MessageTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 9; + const NUM_COLUMNS = 8; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class MessageTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 9; + const NUM_HYDRATE_COLUMNS = 8; /** * the column name for the ID field @@ -75,20 +75,15 @@ class MessageTableMap extends TableMap const ID = 'message.ID'; /** - * the column name for the CODE field + * the column name for the NAME field */ - const CODE = 'message.CODE'; + const NAME = 'message.NAME'; /** * the column name for the SECURED field */ const SECURED = 'message.SECURED'; - /** - * the column name for the REF field - */ - const REF = 'message.REF'; - /** * the column name for the CREATED_AT field */ @@ -126,7 +121,7 @@ class MessageTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames @@ -135,12 +130,12 @@ class MessageTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Secured', 'Ref', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'secured', 'ref', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), - self::TYPE_COLNAME => array(MessageTableMap::ID, MessageTableMap::CODE, MessageTableMap::SECURED, MessageTableMap::REF, MessageTableMap::CREATED_AT, MessageTableMap::UPDATED_AT, MessageTableMap::VERSION, MessageTableMap::VERSION_CREATED_AT, MessageTableMap::VERSION_CREATED_BY, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'SECURED', 'REF', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), - self::TYPE_FIELDNAME => array('id', 'code', 'secured', 'ref', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) + self::TYPE_PHPNAME => array('Id', 'Name', 'Secured', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), + self::TYPE_STUDLYPHPNAME => array('id', 'name', 'secured', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), + self::TYPE_COLNAME => array(MessageTableMap::ID, MessageTableMap::NAME, MessageTableMap::SECURED, MessageTableMap::CREATED_AT, MessageTableMap::UPDATED_AT, MessageTableMap::VERSION, MessageTableMap::VERSION_CREATED_AT, MessageTableMap::VERSION_CREATED_BY, ), + self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'SECURED', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), + self::TYPE_FIELDNAME => array('id', 'name', 'secured', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -150,12 +145,12 @@ class MessageTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Secured' => 2, 'Ref' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, 'Version' => 6, 'VersionCreatedAt' => 7, 'VersionCreatedBy' => 8, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'createdAt' => 4, 'updatedAt' => 5, 'version' => 6, 'versionCreatedAt' => 7, 'versionCreatedBy' => 8, ), - self::TYPE_COLNAME => array(MessageTableMap::ID => 0, MessageTableMap::CODE => 1, MessageTableMap::SECURED => 2, MessageTableMap::REF => 3, MessageTableMap::CREATED_AT => 4, MessageTableMap::UPDATED_AT => 5, MessageTableMap::VERSION => 6, MessageTableMap::VERSION_CREATED_AT => 7, MessageTableMap::VERSION_CREATED_BY => 8, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'SECURED' => 2, 'REF' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, 'VERSION' => 6, 'VERSION_CREATED_AT' => 7, 'VERSION_CREATED_BY' => 8, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'created_at' => 4, 'updated_at' => 5, 'version' => 6, 'version_created_at' => 7, 'version_created_by' => 8, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Secured' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, 'Version' => 5, 'VersionCreatedAt' => 6, 'VersionCreatedBy' => 7, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'createdAt' => 3, 'updatedAt' => 4, 'version' => 5, 'versionCreatedAt' => 6, 'versionCreatedBy' => 7, ), + self::TYPE_COLNAME => array(MessageTableMap::ID => 0, MessageTableMap::NAME => 1, MessageTableMap::SECURED => 2, MessageTableMap::CREATED_AT => 3, MessageTableMap::UPDATED_AT => 4, MessageTableMap::VERSION => 5, MessageTableMap::VERSION_CREATED_AT => 6, MessageTableMap::VERSION_CREATED_BY => 7, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'SECURED' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, 'VERSION' => 5, 'VERSION_CREATED_AT' => 6, 'VERSION_CREATED_BY' => 7, ), + self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'created_at' => 3, 'updated_at' => 4, 'version' => 5, 'version_created_at' => 6, 'version_created_by' => 7, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -175,9 +170,8 @@ class MessageTableMap extends TableMap $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); + $this->addColumn('NAME', 'Name', 'VARCHAR', true, 255, null); $this->addColumn('SECURED', 'Secured', 'TINYINT', false, null, null); - $this->addColumn('REF', 'Ref', 'VARCHAR', false, 255, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0); @@ -204,7 +198,7 @@ class MessageTableMap extends TableMap { return array( 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), - 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, description_html', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), + 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, subject, text_message, html_message', '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', ), ); } // getBehaviors() @@ -358,9 +352,8 @@ class MessageTableMap extends TableMap { if (null === $alias) { $criteria->addSelectColumn(MessageTableMap::ID); - $criteria->addSelectColumn(MessageTableMap::CODE); + $criteria->addSelectColumn(MessageTableMap::NAME); $criteria->addSelectColumn(MessageTableMap::SECURED); - $criteria->addSelectColumn(MessageTableMap::REF); $criteria->addSelectColumn(MessageTableMap::CREATED_AT); $criteria->addSelectColumn(MessageTableMap::UPDATED_AT); $criteria->addSelectColumn(MessageTableMap::VERSION); @@ -368,9 +361,8 @@ class MessageTableMap extends TableMap $criteria->addSelectColumn(MessageTableMap::VERSION_CREATED_BY); } else { $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.CODE'); + $criteria->addSelectColumn($alias . '.NAME'); $criteria->addSelectColumn($alias . '.SECURED'); - $criteria->addSelectColumn($alias . '.REF'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.VERSION'); diff --git a/core/lib/Thelia/Model/Map/MessageVersionTableMap.php b/core/lib/Thelia/Model/Map/MessageVersionTableMap.php index f6587e60a..db043cdc5 100755 --- a/core/lib/Thelia/Model/Map/MessageVersionTableMap.php +++ b/core/lib/Thelia/Model/Map/MessageVersionTableMap.php @@ -57,7 +57,7 @@ class MessageVersionTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 9; + const NUM_COLUMNS = 8; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class MessageVersionTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 9; + const NUM_HYDRATE_COLUMNS = 8; /** * the column name for the ID field @@ -75,20 +75,15 @@ class MessageVersionTableMap extends TableMap const ID = 'message_version.ID'; /** - * the column name for the CODE field + * the column name for the NAME field */ - const CODE = 'message_version.CODE'; + const NAME = 'message_version.NAME'; /** * the column name for the SECURED field */ const SECURED = 'message_version.SECURED'; - /** - * the column name for the REF field - */ - const REF = 'message_version.REF'; - /** * the column name for the CREATED_AT field */ @@ -126,12 +121,12 @@ class MessageVersionTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Secured', 'Ref', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'secured', 'ref', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), - self::TYPE_COLNAME => array(MessageVersionTableMap::ID, MessageVersionTableMap::CODE, MessageVersionTableMap::SECURED, MessageVersionTableMap::REF, MessageVersionTableMap::CREATED_AT, MessageVersionTableMap::UPDATED_AT, MessageVersionTableMap::VERSION, MessageVersionTableMap::VERSION_CREATED_AT, MessageVersionTableMap::VERSION_CREATED_BY, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'SECURED', 'REF', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), - self::TYPE_FIELDNAME => array('id', 'code', 'secured', 'ref', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) + self::TYPE_PHPNAME => array('Id', 'Name', 'Secured', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), + self::TYPE_STUDLYPHPNAME => array('id', 'name', 'secured', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), + self::TYPE_COLNAME => array(MessageVersionTableMap::ID, MessageVersionTableMap::NAME, MessageVersionTableMap::SECURED, MessageVersionTableMap::CREATED_AT, MessageVersionTableMap::UPDATED_AT, MessageVersionTableMap::VERSION, MessageVersionTableMap::VERSION_CREATED_AT, MessageVersionTableMap::VERSION_CREATED_BY, ), + self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'SECURED', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), + self::TYPE_FIELDNAME => array('id', 'name', 'secured', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -141,12 +136,12 @@ class MessageVersionTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Secured' => 2, 'Ref' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, 'Version' => 6, 'VersionCreatedAt' => 7, 'VersionCreatedBy' => 8, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'createdAt' => 4, 'updatedAt' => 5, 'version' => 6, 'versionCreatedAt' => 7, 'versionCreatedBy' => 8, ), - self::TYPE_COLNAME => array(MessageVersionTableMap::ID => 0, MessageVersionTableMap::CODE => 1, MessageVersionTableMap::SECURED => 2, MessageVersionTableMap::REF => 3, MessageVersionTableMap::CREATED_AT => 4, MessageVersionTableMap::UPDATED_AT => 5, MessageVersionTableMap::VERSION => 6, MessageVersionTableMap::VERSION_CREATED_AT => 7, MessageVersionTableMap::VERSION_CREATED_BY => 8, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'SECURED' => 2, 'REF' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, 'VERSION' => 6, 'VERSION_CREATED_AT' => 7, 'VERSION_CREATED_BY' => 8, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'created_at' => 4, 'updated_at' => 5, 'version' => 6, 'version_created_at' => 7, 'version_created_by' => 8, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Secured' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, 'Version' => 5, 'VersionCreatedAt' => 6, 'VersionCreatedBy' => 7, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'createdAt' => 3, 'updatedAt' => 4, 'version' => 5, 'versionCreatedAt' => 6, 'versionCreatedBy' => 7, ), + self::TYPE_COLNAME => array(MessageVersionTableMap::ID => 0, MessageVersionTableMap::NAME => 1, MessageVersionTableMap::SECURED => 2, MessageVersionTableMap::CREATED_AT => 3, MessageVersionTableMap::UPDATED_AT => 4, MessageVersionTableMap::VERSION => 5, MessageVersionTableMap::VERSION_CREATED_AT => 6, MessageVersionTableMap::VERSION_CREATED_BY => 7, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'SECURED' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, 'VERSION' => 5, 'VERSION_CREATED_AT' => 6, 'VERSION_CREATED_BY' => 7, ), + self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'created_at' => 3, 'updated_at' => 4, 'version' => 5, 'version_created_at' => 6, 'version_created_by' => 7, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -166,9 +161,8 @@ class MessageVersionTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'message', 'ID', true, null, null); - $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); + $this->addColumn('NAME', 'Name', 'VARCHAR', true, 255, null); $this->addColumn('SECURED', 'Secured', 'TINYINT', false, null, null); - $this->addColumn('REF', 'Ref', 'VARCHAR', false, 255, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0); @@ -251,11 +245,11 @@ class MessageVersionTableMap extends TableMap public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { // If the PK cannot be derived from the row, return NULL. - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 6 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) { + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 5 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) { return null; } - return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 6 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); + return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 5 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); } /** @@ -372,9 +366,8 @@ class MessageVersionTableMap extends TableMap { if (null === $alias) { $criteria->addSelectColumn(MessageVersionTableMap::ID); - $criteria->addSelectColumn(MessageVersionTableMap::CODE); + $criteria->addSelectColumn(MessageVersionTableMap::NAME); $criteria->addSelectColumn(MessageVersionTableMap::SECURED); - $criteria->addSelectColumn(MessageVersionTableMap::REF); $criteria->addSelectColumn(MessageVersionTableMap::CREATED_AT); $criteria->addSelectColumn(MessageVersionTableMap::UPDATED_AT); $criteria->addSelectColumn(MessageVersionTableMap::VERSION); @@ -382,9 +375,8 @@ class MessageVersionTableMap extends TableMap $criteria->addSelectColumn(MessageVersionTableMap::VERSION_CREATED_BY); } else { $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.CODE'); + $criteria->addSelectColumn($alias . '.NAME'); $criteria->addSelectColumn($alias . '.SECURED'); - $criteria->addSelectColumn($alias . '.REF'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.VERSION'); diff --git a/core/lib/Thelia/Model/Map/ModuleI18nTableMap.php b/core/lib/Thelia/Model/Map/ModuleI18nTableMap.php index 67b7a34ef..a8e680f1c 100755 --- a/core/lib/Thelia/Model/Map/ModuleI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ModuleI18nTableMap.php @@ -151,7 +151,7 @@ class ModuleI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'module', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/ModuleTableMap.php b/core/lib/Thelia/Model/Map/ModuleTableMap.php index 5370c1da1..cccaa890a 100755 --- a/core/lib/Thelia/Model/Map/ModuleTableMap.php +++ b/core/lib/Thelia/Model/Map/ModuleTableMap.php @@ -116,7 +116,7 @@ class ModuleTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/OrderStatusI18nTableMap.php b/core/lib/Thelia/Model/Map/OrderStatusI18nTableMap.php index 5d78c474c..1b2052c2e 100755 --- a/core/lib/Thelia/Model/Map/OrderStatusI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/OrderStatusI18nTableMap.php @@ -151,7 +151,7 @@ class OrderStatusI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order_status', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/OrderStatusTableMap.php b/core/lib/Thelia/Model/Map/OrderStatusTableMap.php index eecfe5a03..18406d9aa 100755 --- a/core/lib/Thelia/Model/Map/OrderStatusTableMap.php +++ b/core/lib/Thelia/Model/Map/OrderStatusTableMap.php @@ -101,7 +101,7 @@ class OrderStatusTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/ProductDocumentI18nTableMap.php b/core/lib/Thelia/Model/Map/ProductDocumentI18nTableMap.php index 103914ee6..09e1dc0e4 100755 --- a/core/lib/Thelia/Model/Map/ProductDocumentI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductDocumentI18nTableMap.php @@ -151,7 +151,7 @@ class ProductDocumentI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product_document', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/ProductDocumentTableMap.php b/core/lib/Thelia/Model/Map/ProductDocumentTableMap.php index f1420cc43..ff50bad77 100755 --- a/core/lib/Thelia/Model/Map/ProductDocumentTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductDocumentTableMap.php @@ -111,7 +111,7 @@ class ProductDocumentTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/ProductI18nTableMap.php b/core/lib/Thelia/Model/Map/ProductI18nTableMap.php index 8da33f15d..79a01514a 100755 --- a/core/lib/Thelia/Model/Map/ProductI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductI18nTableMap.php @@ -151,7 +151,7 @@ class ProductI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/ProductImageI18nTableMap.php b/core/lib/Thelia/Model/Map/ProductImageI18nTableMap.php index de3455c07..39ad567f9 100755 --- a/core/lib/Thelia/Model/Map/ProductImageI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductImageI18nTableMap.php @@ -151,7 +151,7 @@ class ProductImageI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product_image', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/ProductImageTableMap.php b/core/lib/Thelia/Model/Map/ProductImageTableMap.php index 945799020..36aabed3e 100755 --- a/core/lib/Thelia/Model/Map/ProductImageTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductImageTableMap.php @@ -111,7 +111,7 @@ class ProductImageTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/ProductTableMap.php b/core/lib/Thelia/Model/Map/ProductTableMap.php index 1d46d483e..f69f6f702 100755 --- a/core/lib/Thelia/Model/Map/ProductTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductTableMap.php @@ -131,7 +131,7 @@ class ProductTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/ResourceI18nTableMap.php b/core/lib/Thelia/Model/Map/ResourceI18nTableMap.php index 8a8ce501a..ec22e2fd3 100755 --- a/core/lib/Thelia/Model/Map/ResourceI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ResourceI18nTableMap.php @@ -151,7 +151,7 @@ class ResourceI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'resource', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); diff --git a/core/lib/Thelia/Model/Map/ResourceTableMap.php b/core/lib/Thelia/Model/Map/ResourceTableMap.php index e56960892..8d7708ddd 100755 --- a/core/lib/Thelia/Model/Map/ResourceTableMap.php +++ b/core/lib/Thelia/Model/Map/ResourceTableMap.php @@ -101,7 +101,7 @@ class ResourceTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/RewritingUrlTableMap.php b/core/lib/Thelia/Model/Map/RewritingUrlTableMap.php index 1d6129ed8..c6d5e5473 100644 --- a/core/lib/Thelia/Model/Map/RewritingUrlTableMap.php +++ b/core/lib/Thelia/Model/Map/RewritingUrlTableMap.php @@ -162,9 +162,9 @@ class RewritingUrlTableMap extends TableMap // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addColumn('URL', 'Url', 'VARCHAR', true, 255, null); - $this->addColumn('VIEW', 'View', 'VARCHAR', true, 255, null); + $this->addColumn('VIEW', 'View', 'VARCHAR', false, 255, null); $this->addColumn('VIEW_ID', 'ViewId', 'VARCHAR', false, 255, null); - $this->addColumn('VIEW_LOCALE', 'ViewLocale', 'VARCHAR', true, 255, null); + $this->addColumn('VIEW_LOCALE', 'ViewLocale', 'VARCHAR', false, 255, null); $this->addForeignKey('REDIRECTED', 'Redirected', 'INTEGER', 'rewriting_url', 'ID', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); diff --git a/core/lib/Thelia/Model/Map/TaxI18nTableMap.php b/core/lib/Thelia/Model/Map/TaxI18nTableMap.php index 2c4c92f4f..a06230c37 100755 --- a/core/lib/Thelia/Model/Map/TaxI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/TaxI18nTableMap.php @@ -141,7 +141,7 @@ class TaxI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); } // initialize() diff --git a/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php b/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php index 689f30728..1f0ed1e96 100755 --- a/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php @@ -131,7 +131,7 @@ class TaxRuleI18nTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule', 'ID', true, null, null); - $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN'); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); } // initialize() /** diff --git a/core/lib/Thelia/Model/Map/TaxRuleTableMap.php b/core/lib/Thelia/Model/Map/TaxRuleTableMap.php index 9b862de99..cc5f628b9 100755 --- a/core/lib/Thelia/Model/Map/TaxRuleTableMap.php +++ b/core/lib/Thelia/Model/Map/TaxRuleTableMap.php @@ -111,7 +111,7 @@ class TaxRuleTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Map/TaxTableMap.php b/core/lib/Thelia/Model/Map/TaxTableMap.php index b941e7b52..6d43f20e9 100755 --- a/core/lib/Thelia/Model/Map/TaxTableMap.php +++ b/core/lib/Thelia/Model/Map/TaxTableMap.php @@ -101,7 +101,7 @@ class TaxTableMap extends TableMap * * @var string */ - const DEFAULT_LOCALE = 'en_EN'; + const DEFAULT_LOCALE = 'en_US'; /** * holds an array of fieldnames diff --git a/core/lib/Thelia/Model/Message.php b/core/lib/Thelia/Model/Message.php index 777c9eaaf..97fb45469 100755 --- a/core/lib/Thelia/Model/Message.php +++ b/core/lib/Thelia/Model/Message.php @@ -3,7 +3,65 @@ namespace Thelia\Model; use Thelia\Model\Base\Message as BaseMessage; +use Propel\Runtime\Connection\ConnectionInterface; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Event\MessageEvent; class Message extends BaseMessage { + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CREATEMESSAGE, new MessageEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATEMESSAGE, new MessageEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CHANGEMESSAGE, new MessageEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CHANGEMESSAGE, new MessageEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETEMESSAGE, new MessageEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETEMESSAGE, new MessageEvent($this)); + } } diff --git a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php index 5bcb88789..5e22f08e9 100755 --- a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php +++ b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php @@ -7,6 +7,7 @@ use Propel\Runtime\ActiveQuery\Join; use Propel\Runtime\ActiveQuery\ModelCriteria; use Thelia\Model\Base\LangQuery; use Thelia\Model\ConfigQuery; +use Thelia\Model\Lang; /** * Class ModelCriteriaTools @@ -52,7 +53,7 @@ class ModelCriteriaTools $search->withColumn('`' . $requestedLocaleI18nAlias . '`.`' . $column . '`', $aliasPrefix . 'i18n_' . $column); } } else { - $defaultLocale = LangQuery::create()->findOneById($defaultLangWithoutTranslation)->getLocale(); + $defaultLocale = Lang::getDefaultLanguage()->getLocale(); $defaultLocaleJoin = new Join(); $defaultLocaleJoin->addExplicitCondition($search->getTableMap()->getName(), $foreignKey, null, $foreignTable . '_i18n', 'ID', $defaultLocaleI18nAlias); diff --git a/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php b/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php new file mode 100644 index 000000000..7e2e34d83 --- /dev/null +++ b/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php @@ -0,0 +1,53 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Model\Tools; + +use Thelia\Core\Event\ActionEvent; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; + +/** + * A trait to provide event dispatching mechanism to Model objects + */ +trait ModelEventDispatcherTrait { + + /** + * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface + */ + protected $dispatcher = null; + + + public function setDispatcher(EventDispatcherInterface $dispatcher) + { + $this->dispatcher = $dispatcher; + + return $this; + } + + protected function dispatchEvent($eventName, ActionEvent $event) + { + if (!is_null($this->dispatcher)) { + $this->dispatcher->dispatch($eventName, $event); + } + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Tests/Cart/CartTraitTest.php b/core/lib/Thelia/Tests/Cart/CartTraitTest.php index 586de3d11..039e4448e 100755 --- a/core/lib/Thelia/Tests/Cart/CartTraitTest.php +++ b/core/lib/Thelia/Tests/Cart/CartTraitTest.php @@ -34,6 +34,7 @@ use Thelia\Model\Customer; * * Class CartTraitTest * @package Thelia\Tests\Cart\CartTraitTest + * @author Manuel Raynaud */ class CartTraitTest extends \PHPUnit_Framework_TestCase { diff --git a/core/lib/Thelia/Tests/Command/BaseCommandTest.php b/core/lib/Thelia/Tests/Command/BaseCommandTest.php index 09a84d54e..54b62e3f5 100755 --- a/core/lib/Thelia/Tests/Command/BaseCommandTest.php +++ b/core/lib/Thelia/Tests/Command/BaseCommandTest.php @@ -22,6 +22,13 @@ /*************************************************************************************/ namespace Thelia\Tests\Command; +/** + * base class for testing command line command + * + * Class BaseCommandTest + * @package Thelia\Tests\Command + * @author Manuel Raynaud + */ abstract class BaseCommandTest extends \PHPUnit_Framework_TestCase { public function getKernel() diff --git a/core/lib/Thelia/Tests/Command/CacheClearTest.php b/core/lib/Thelia/Tests/Command/CacheClearTest.php index 4e05e5611..ed2e512b6 100755 --- a/core/lib/Thelia/Tests/Command/CacheClearTest.php +++ b/core/lib/Thelia/Tests/Command/CacheClearTest.php @@ -28,6 +28,13 @@ use Thelia\Command\CacheClear; use Symfony\Component\Filesystem\Filesystem; +/** + * test the cache:clear command + * + * Class CacheClearTest + * @package Thelia\Tests\Command + * @author Manuel Raynaud + */ class CacheClearTest extends \PHPUnit_Framework_TestCase { diff --git a/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php b/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php index f1167fe09..78d84ea78 100755 --- a/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php +++ b/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php @@ -27,6 +27,13 @@ use Symfony\Component\Filesystem\Filesystem; use Thelia\Core\Application; use Thelia\Command\ModuleGenerateCommand; +/** + * test the module:generate command + * + * Class ModuleGenerateCommandTest + * @package Thelia\Tests\Command + * @author Manuel Raynaud + */ class ModuleGenerateCommandTest extends BaseCommandTest { protected $command; diff --git a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php index e787403df..fda569435 100755 --- a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php +++ b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php @@ -26,6 +26,11 @@ namespace Thelia\Tests\Controller; use Symfony\Component\HttpFoundation\Request; use Thelia\Controller\Front\DefaultController; +/** + * Class DefaultControllerTest + * @package Thelia\Tests\Controller + * @author Manuel Raynaud + */ class DefaultControllerTest extends \PHPUnit_Framework_TestCase { diff --git a/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php b/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php index f94b5607f..d7437efb9 100755 --- a/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php +++ b/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php @@ -4,6 +4,13 @@ namespace Thelia\Tests\Core\HttpFoundation; use Thelia\Core\HttpFoundation\Request; +/** + * the the helpers addinf in Request class + * + * Class RequestTest + * @package Thelia\Tests\Core\HttpFoundation + * @author Manuel Raynaud + */ class RequestTest extends \PHPUnit_Framework_TestCase { diff --git a/core/lib/Thelia/Tests/Core/HttpFoundation/Session/SessionTest.php b/core/lib/Thelia/Tests/Core/HttpFoundation/Session/SessionTest.php index 7efebdedf..317b19dea 100755 --- a/core/lib/Thelia/Tests/Core/HttpFoundation/Session/SessionTest.php +++ b/core/lib/Thelia/Tests/Core/HttpFoundation/Session/SessionTest.php @@ -28,6 +28,13 @@ use Thelia\Core\HttpFoundation\Session\Session; use Thelia\Model\Cart; use Thelia\Model\Customer; +/** + * Test the helpers adding in Session class + * + * Class SessionTest + * @package Thelia\Tests\Core\HttpFoundation\Session + * @author Manuel Raynaud + */ class SessionTest extends \PHPUnit_Framework_TestCase { diff --git a/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php b/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php new file mode 100644 index 000000000..38c00b55f --- /dev/null +++ b/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php @@ -0,0 +1,274 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Tests\Core\Smarty\Plugins; + +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; +use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\HttpFoundation\Session\Session; +use Thelia\Core\Template\Smarty\Plugins\Format; + +/** + * @coversDefaultClass \Thelia\Core\Template\Smarty\Plugins\Format + */ +class FormatTest extends \PHPUnit_Framework_TestCase +{ + protected $request; + + public function setUp() + { + $this->request = new Request(); + + $this->request->setSession(new Session(new MockArraySessionStorage())); + } + + /** + * + * test formatDate method with expected format + * + * @covers ::formatDate + */ + public function testFormatDateWithSpecificFormat() + { + $dateTime = new \DateTime(); + $format = "Y-m-d H:i:s"; + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array( + "date" => $dateTime, + "format" => $format + )); + + $this->assertEquals($dateTime->format($format), $render); + } + + /** + * + * test formatDate method with date default format + * + * @covers ::formatDate + */ + public function testFormatDateWithDefaultSessionParam() + { + $dateTime = new \DateTime(); + + $langMock = $this->getLangMock(); + $this->request->getSession()->setLang($langMock); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array("date" => $dateTime)); + + $this->assertEquals($dateTime->format("Y-m-d H:i:s"), $render); + } + + /** + * + * test formatDate method with time default format + * + * @covers ::formatDate + */ + public function testFormatDateWithDateSessionParam() + { + $dateTime = new \DateTime(); + + $langMock = $this->getLangMock(); + $this->request->getSession()->setLang($langMock); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array( + "date" => $dateTime, + "output" => "date" + )); + + $this->assertEquals($dateTime->format("Y-m-d"), $render); + } + + /** + * + * test formatDate method with datetime default format + * + * @covers ::formatDate + */ + public function testFormatDateWithTimeSessionParam() + { + $dateTime = new \DateTime(); + + $langMock = $this->getLangMock(); + $this->request->getSession()->setLang($langMock); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array( + "date" => $dateTime, + "output" => "time" + )); + + $this->assertEquals($dateTime->format("H:i:s"), $render); + } + + /** + * + * test formatDate method without output or expected format. datetime format must be return + * + * @covers ::formatDate + */ + public function testFormatDateWithDateTimeSessionParam() + { + $dateTime = new \DateTime(); + + $langMock = $this->getLangMock(); + $this->request->getSession()->setLang($langMock); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array( + "date" => $dateTime, + "output" => "datetime" + )); + + $this->assertEquals($dateTime->format("Y-m-d H:i:s"), $render); + } + + /** + * test formatDate without mandatory parameters + * + * @covers ::formatDate + * @expectedException \Thelia\Core\Template\Smarty\Exception\SmartyPluginException + */ + public function testFormatDateWithoutDate() + { + $dateTime = new \DateTime(); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array()); + + $this->assertEquals($dateTime->format("Y-m-d H:i:s"), $render); + } + + + /** + * test formatNumber without mandatory parameters + * + * @covers ::formatNumber + * @expectedException \Thelia\Core\Template\Smarty\Exception\SmartyPluginException + */ + public function testFormatNumberWithoutParams() + { + $formatClass = new Format($this->request); + + $render = $formatClass->formatNumber(array()); + } + + /** + * test formatDate specifying all parameters + * + * @covers ::formatNumber + */ + public function testFormatNumberWithAllParams() + { + $formatClass = new Format($this->request); + + $number = 1256.12; + $decimals = 1; + $decPoint = ","; + $thousandsSep = " "; + + $render = $formatClass->formatNumber(array( + "number" => $number, + "decimals" => $decimals, + "dec_point" => $decPoint, + "thousands_sep" => $thousandsSep + )); + + $this->assertEquals($render, "1 256,1"); + } + + /** + * @covers ::formatNumber + */ + public function testFormatNumberWithDefaultParameters() + { + $number = 1234.56; + $langMock = $this->getLangMock(); + $this->request->getSession()->setLang($langMock); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatNumber(array( + "number" => $number + )); + + $this->assertEquals( $render, number_format($number, 2, ",", " ")); + } + + /** + * create a mock for Thelia\Model\Lang class + * @return \Thelia\Model\Lang instance + */ + public function getLangMock() + { + $mock = $this->getMock( + "Thelia\Model\Lang", + array( + "getDateFormat", + "getTimeFormat", + "getDateTimeFormat", + "getDecimalSeparator", + "getThousandsSeparator", + "getDecimals" + ) + ); + + $mock->expects($this->any()) + ->method("getDateFormat") + ->will($this->returnValue("Y-m-d")); + + $mock->expects($this->any()) + ->method("getTimeFormat") + ->will($this->returnValue("H:i:s")); + + $mock->expects($this->any()) + ->method("getDateTimeFormat") + ->will($this->returnValue("Y-m-d H:i:s")); + + $mock->expects($this->any()) + ->method("getDecimals") + ->will($this->returnValue(2)); + + $mock->expects($this->any()) + ->method("getDecimalSeparator") + ->will($this->returnValue(",")); + + $mock->expects($this->any()) + ->method("getThousandsSeparator") + ->will($this->returnValue(" ")); + + return $mock; + } + + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php index e51ed5abb..207befa4b 100755 --- a/core/lib/Thelia/Tools/URL.php +++ b/core/lib/Thelia/Tools/URL.php @@ -56,15 +56,15 @@ class URL /** * @etienne : can't be done here for it's already done in ::viewUrl / ::adminViewUrl + * @franck : should be done, as absoluteUrl() is sometimes called directly (see UrlGenerator::generateUrlFunction()) */ - //$root = $path_only == self::PATH_TO_FILE ? ConfigQuery::read('base_url', '/') : self::getIndexPage(); - $root = $path_only == self::PATH_TO_FILE ? ConfigQuery::read('base_url', '/') : ''; + $root = $path_only == self::PATH_TO_FILE ? ConfigQuery::read('base_url', '/') : self::getIndexPage(); + //$root = $path_only == self::PATH_TO_FILE ? ConfigQuery::read('base_url', '/') : ''; $base = rtrim($root, '/') . '/' . ltrim($path, '/'); } else $base = $path; - $queryString = ''; if (! is_null($parameters)) { diff --git a/install/faker.php b/install/faker.php index 81edd767d..f1e7691d7 100755 --- a/install/faker.php +++ b/install/faker.php @@ -240,7 +240,7 @@ try { //categories and products $productIdList = array(); $categoryIdList = array(); - for($i=0; $i<4; $i++) { + for($i=1; $i<5; $i++) { $category = createCategory($faker, 0, $i, $categoryIdList, $contentIdList); for($j=1; $jsetProductId($productId); generate_image($image, 1, 'product', $productId); - + return $product; } @@ -415,7 +415,7 @@ function createCategory($faker, $parent, $position, &$categoryIdList, $contentId $image = new CategoryImage(); $image->setCategoryId($categoryId); generate_image($image, 1, 'category', $categoryId); - + return $category; } diff --git a/install/thelia.sql b/install/thelia.sql index 99b18513e..c62b8738d 100755 --- a/install/thelia.sql +++ b/install/thelia.sql @@ -410,7 +410,8 @@ CREATE TABLE `config` `hidden` TINYINT DEFAULT 1 NOT NULL, `created_at` DATETIME, `updated_at` DATETIME, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + UNIQUE INDEX `name_UNIQUE` (`name`) ) ENGINE=InnoDB; -- --------------------------------------------------------------------- @@ -1017,15 +1018,15 @@ DROP TABLE IF EXISTS `message`; CREATE TABLE `message` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `code` VARCHAR(45) NOT NULL, + `name` VARCHAR(255) NOT NULL, `secured` TINYINT, - `ref` VARCHAR(255), `created_at` DATETIME, `updated_at` DATETIME, `version` INTEGER DEFAULT 0, `version_created_at` DATETIME, `version_created_by` VARCHAR(100), - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + UNIQUE INDEX `name_UNIQUE` (`name`) ) ENGINE=InnoDB; -- --------------------------------------------------------------------- @@ -1443,9 +1444,9 @@ CREATE TABLE `rewriting_url` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `url` VARCHAR(255) NOT NULL, - `view` VARCHAR(255) NOT NULL, + `view` VARCHAR(255), `view_id` VARCHAR(255), - `view_locale` VARCHAR(255) NOT NULL, + `view_locale` VARCHAR(255), `redirected` INTEGER, `created_at` DATETIME, `updated_at` DATETIME, @@ -1474,7 +1475,7 @@ CREATE TABLE `rewriting_argument` `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`rewriting_url_id`,`parameter`,`value`), - INDEX `fk_rewriting_argument_rewirting_url_id` (`rewriting_url_id`), + INDEX `idx_rewriting_argument_rewirting_url_id` (`rewriting_url_id`), CONSTRAINT `fk_rewriting_argument_rewirting_url_id` FOREIGN KEY (`rewriting_url_id`) REFERENCES `rewriting_url` (`id`) @@ -1491,7 +1492,7 @@ DROP TABLE IF EXISTS `category_i18n`; CREATE TABLE `category_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1512,7 +1513,7 @@ DROP TABLE IF EXISTS `product_i18n`; CREATE TABLE `product_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1533,7 +1534,7 @@ DROP TABLE IF EXISTS `country_i18n`; CREATE TABLE `country_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1554,7 +1555,7 @@ DROP TABLE IF EXISTS `tax_i18n`; CREATE TABLE `tax_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` TEXT, PRIMARY KEY (`id`,`locale`), @@ -1573,7 +1574,7 @@ DROP TABLE IF EXISTS `tax_rule_i18n`; CREATE TABLE `tax_rule_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, PRIMARY KEY (`id`,`locale`), CONSTRAINT `tax_rule_i18n_FK_1` FOREIGN KEY (`id`) @@ -1590,7 +1591,7 @@ DROP TABLE IF EXISTS `feature_i18n`; CREATE TABLE `feature_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1611,7 +1612,7 @@ DROP TABLE IF EXISTS `feature_av_i18n`; CREATE TABLE `feature_av_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1632,7 +1633,7 @@ DROP TABLE IF EXISTS `attribute_i18n`; CREATE TABLE `attribute_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1653,7 +1654,7 @@ DROP TABLE IF EXISTS `attribute_av_i18n`; CREATE TABLE `attribute_av_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1674,7 +1675,7 @@ DROP TABLE IF EXISTS `config_i18n`; CREATE TABLE `config_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1695,7 +1696,7 @@ DROP TABLE IF EXISTS `customer_title_i18n`; CREATE TABLE `customer_title_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `short` VARCHAR(10), `long` VARCHAR(45), PRIMARY KEY (`id`,`locale`), @@ -1714,7 +1715,7 @@ DROP TABLE IF EXISTS `folder_i18n`; CREATE TABLE `folder_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1735,7 +1736,7 @@ DROP TABLE IF EXISTS `content_i18n`; CREATE TABLE `content_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1756,7 +1757,7 @@ DROP TABLE IF EXISTS `product_image_i18n`; CREATE TABLE `product_image_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1777,7 +1778,7 @@ DROP TABLE IF EXISTS `product_document_i18n`; CREATE TABLE `product_document_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1798,7 +1799,7 @@ DROP TABLE IF EXISTS `currency_i18n`; CREATE TABLE `currency_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `name` VARCHAR(45), PRIMARY KEY (`id`,`locale`), CONSTRAINT `currency_i18n_FK_1` @@ -1816,7 +1817,7 @@ DROP TABLE IF EXISTS `order_status_i18n`; CREATE TABLE `order_status_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1837,7 +1838,7 @@ DROP TABLE IF EXISTS `module_i18n`; CREATE TABLE `module_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1858,7 +1859,7 @@ DROP TABLE IF EXISTS `group_i18n`; CREATE TABLE `group_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1879,7 +1880,7 @@ DROP TABLE IF EXISTS `resource_i18n`; CREATE TABLE `resource_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1900,10 +1901,11 @@ DROP TABLE IF EXISTS `message_i18n`; CREATE TABLE `message_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` TEXT, - `description` LONGTEXT, - `description_html` LONGTEXT, + `subject` TEXT, + `text_message` LONGTEXT, + `html_message` LONGTEXT, PRIMARY KEY (`id`,`locale`), CONSTRAINT `message_i18n_FK_1` FOREIGN KEY (`id`) @@ -1920,7 +1922,7 @@ DROP TABLE IF EXISTS `coupon_i18n`; CREATE TABLE `coupon_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, PRIMARY KEY (`id`,`locale`), CONSTRAINT `coupon_i18n_FK_1` FOREIGN KEY (`id`) @@ -1937,7 +1939,7 @@ DROP TABLE IF EXISTS `category_image_i18n`; CREATE TABLE `category_image_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1958,7 +1960,7 @@ DROP TABLE IF EXISTS `folder_image_i18n`; CREATE TABLE `folder_image_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -1979,7 +1981,7 @@ DROP TABLE IF EXISTS `content_image_i18n`; CREATE TABLE `content_image_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -2000,7 +2002,7 @@ DROP TABLE IF EXISTS `category_document_i18n`; CREATE TABLE `category_document_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -2021,7 +2023,7 @@ DROP TABLE IF EXISTS `content_document_i18n`; CREATE TABLE `content_document_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -2042,7 +2044,7 @@ DROP TABLE IF EXISTS `folder_document_i18n`; CREATE TABLE `folder_document_i18n` ( `id` INTEGER NOT NULL, - `locale` VARCHAR(5) DEFAULT 'en_EN' NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255), `description` LONGTEXT, `chapo` TEXT, @@ -2159,9 +2161,8 @@ DROP TABLE IF EXISTS `message_version`; CREATE TABLE `message_version` ( `id` INTEGER NOT NULL, - `code` VARCHAR(45) NOT NULL, + `name` VARCHAR(255) NOT NULL, `secured` TINYINT, - `ref` VARCHAR(255), `created_at` DATETIME, `updated_at` DATETIME, `version` INTEGER DEFAULT 0 NOT NULL, diff --git a/local/config/schema.xml b/local/config/schema.xml index 17fcf612f..757e9141f 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -1,1129 +1,1135 @@ - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
-
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+
diff --git a/reset_install.sh b/reset_install.sh new file mode 100755 index 000000000..5c51ac60c --- /dev/null +++ b/reset_install.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# @author Guillaume MOREL +# v0.1 + +echo -e "\033[47m\033[1;31m\n[WARN] This script will reset this Thelia2 install\n\033[0m" + +if [ ! -f local/config/database.yml ]; then + cp local/config/database.yml.sample local/config/database.yml + echo "[FAILED] Please add your database informations in local/config/database.yml and start this script again." +else + echo -e "\n\e[01;34m[INFO] Downloading vendors\e[00m\n" + composer install + + cd local/config/ + + echo -e "\n\e[01;34m[INFO] Building Models file\e[00m\n" + ../../bin/propel build -v --output-dir=../../core/lib/ + + echo -e "\n\e[01;34m[INFO] Building SQL CREATE file\e[00m\n" + ../../bin/propel sql:build -v --output-dir=../../install/ + + # Not working : insert manually + # echo -e "\n\e[01;34m[INFO] Inserting SQL\e[00m\n" + # ../../bin/propel insert-sql -v --output-dir=../../install/ + # install/thelia.sql + # install/insert.sql + echo -e "\n\e[01;34m[INFO] Reinstalling Thelia2\e[00m\n" + cd ../.. + php Thelia thelia:install + + echo -e "\n\e[01;34m[INFO] Installing fixtures\e[00m\n" + php install/faker.php + + echo -e "\n\e[01;34m[INFO] Adding admin\e[00m\n" + php Thelia thelia:create-admin + + echo -e "\n\e[00;32m[SUCCESS] Reset done\e[00m\n" +fi diff --git a/templates/admin/default/assets/css/admin.less b/templates/admin/default/assets/css/admin.less index 9d9f2c482..6c5c76a8d 100755 --- a/templates/admin/default/assets/css/admin.less +++ b/templates/admin/default/assets/css/admin.less @@ -216,6 +216,10 @@ hr { width: 23px; height: @top-bar-height; } + + a.profile { + color: #fff; + } } .view-shop { @@ -233,10 +237,6 @@ hr { .loginpage { - .brandbar { - width: 100%; - } - .hero-unit { background-color: transparent !important; @@ -316,6 +316,10 @@ hr { } } +.brandbar-wide { + width: 100%; +} + // -- Navigation bar ---------------------------------------------------------- .navbar { @@ -571,6 +575,11 @@ form .info .input-append .add-on { line-height: 30px; } + .title-without-tabs { + border-bottom: 2px solid #A5CED8; + margin-bottom: 0.5em; + } + // The action bar on the right .actions { text-align: right; @@ -590,6 +599,8 @@ form .info .input-append .add-on { line-height: 30px; margin-bottom: 1em; + border-bottom: 1px dotted #A5CED8; + padding-bottom: 0.5em; .inner-actions { text-align: right; @@ -629,7 +640,7 @@ label { } .input-append.input-block-level .add-on img { - max-height: 18px; + max-height: 16px; } // Information in field label @@ -699,9 +710,12 @@ label { line-height: 30px; - .btn-add-item { + .action-btn { display: block; float: right; + margin-left: 10px; + + text-transform: none; } } @@ -717,4 +731,59 @@ label { // Center the alert box (20px bottom margin) in the table cell padding: 20px 20px 0 20px; } + + th { + a { + color: inherit; + } + } + + td { + vertical-align: middle; + + img { + border: 2px solid white; + border-radius: 4px 4px 4px 4px; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); + } + + &.actions { + text-align: right; + } + } +} + +.menu-list-table .table-striped { + td, th { + text-align: left; + } + + td:nth-child(2) { + text-align: right; + } + + caption { + background-color: #FFFFFF; + border-bottom: 2px solid #A5CED8; + color: #5A6876; + font-weight: bold; + line-height: 30px; + text-align: left; + text-transform: uppercase; + } +} + +.table-left-aligned { + th, td { + text-align: left; + } + + select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input { + margin-bottom: 0; + } +} + +// Modal is no longer limited +.modal-body { + max-height: none; } \ No newline at end of file diff --git a/templates/admin/default/categories.html b/templates/admin/default/categories.html index 7bf76988c..2cc6b633c 100755 --- a/templates/admin/default/categories.html +++ b/templates/admin/default/categories.html @@ -1,4 +1,4 @@ -{check_auth context="admin" roles="ADMIN" permissions="admin.catalog.view" login_tpl="/admin/login"} +{check_auth roles="ADMIN" permissions="admin.catalog.view" login_tpl="/admin/login"} {$page_title={intl l='Catalog'}} @@ -31,8 +31,8 @@ {module_include location='category_list_caption'} - {loop type="auth" name="can_create" context="admin" roles="ADMIN" permissions="admin.category.create"} - + {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.category.create"} + {/loop} @@ -41,25 +41,77 @@ {ifloop rel="category_list"} - {intl l="Category title"} +   + + {if $category_order == 'alpha'} + + {$order_change = 'alpha_reverse'} + {elseif $category_order == 'alpha_reverse'} + + {$order_change = 'alpha'} + {else} + {$order_change = 'alpha'} + {/if} + + {intl l="Category title"} + + {module_include location='category_list_header'} - {intl l="Online"} - {intl l="Position"} + + {if $category_order == 'visible'} + + {$order_change = 'visible_reverse'} + {elseif $category_order == 'visible_reverse'} + + {$order_change = 'visible'} + {else} + {$order_change = 'visible'} + {/if} + + + {intl l="Online"} + + + + + {if $category_order == 'manual'} + + {$order_change = 'manual_reverse'} + {elseif $category_order == 'manual_reverse'} + + {$order_change = 'manual'} + {else} + {$order_change = 'manual'} + {/if} + + {intl l="Position"} + + {intl l="Actions"} - {loop name="category_list" type="category" visible="*" parent="{$current_category_id}" order="manual"} + {loop name="category_list" type="category" visible="*" parent="{$current_category_id}" order="$category_order"} - {$TITLE} + + {loop type="image" name="cat_image" source="category" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"} + #TITLE + {/loop} + + + + + {$TITLE} + + {module_include location='category_list_row'} - {loop type="auth" name="can_change" context="admin" roles="ADMIN" permissions="admin.category.edit"} + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"} {/loop} @@ -69,7 +121,7 @@ - {loop type="auth" name="can_change" context="admin" roles="ADMIN" permissions="admin.category.edit"} + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"} {$POSITION} @@ -83,11 +135,11 @@ - {loop type="auth" name="can_change" context="admin" roles="ADMIN" permissions="admin.category.edit"} + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"} {/loop} - {loop type="auth" name="can_delete" context="admin" roles="ADMIN" permissions="admin.category.delete"} + {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.category.delete"} {/loop} @@ -101,7 +153,7 @@
- {loop type="auth" name="can_create" context="admin" roles="ADMIN" permissions="admin.category.create"} + {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.category.create"} {intl l="This category has no sub-categories. To create a new one, click the + button above."} {/loop} @@ -133,7 +185,7 @@ {module_include location='product_list_caption'} - + @@ -141,7 +193,7 @@ {ifloop rel="product_list"} - {intl l="Image"} +   {intl l="Product title"} @@ -156,7 +208,12 @@ {loop name="product_list" type="product" category="{$current_category_id}" order="manual"} - Image ! + + {loop type="image" name="cat_image" source="product" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"} + + #TITLE + + {/loop} {$TITLE} diff --git a/templates/admin/default/configuration.html b/templates/admin/default/configuration.html new file mode 100644 index 000000000..259a0f3d7 --- /dev/null +++ b/templates/admin/default/configuration.html @@ -0,0 +1,174 @@ +{check_auth roles="ADMIN" permissions="admin.configuration.view" login_tpl="/admin/login"} + +{$page_title={intl l='Configuration'}} + +{include file='includes/header.inc.html'} + +
+ +
+ + {module_include location='configuration_top'} + +

{intl l="Thelia configuration"}

+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + {module_include location='configuration_bottom'} +
+
+
+ +{include file='includes/js.inc.html'} + +{include file='includes/footer.inc.html'} \ No newline at end of file diff --git a/templates/admin/default/edit_category.html b/templates/admin/default/edit_category.html index c1e19809f..d58c251fd 100755 --- a/templates/admin/default/edit_category.html +++ b/templates/admin/default/edit_category.html @@ -1,17 +1,17 @@ -{check_auth context="admin" roles="ADMIN" permissions="admin.catalog.view" login_tpl="/admin/login"} +{check_auth roles="ADMIN" permissions="admin.catalog.view" login_tpl="/admin/login"} {$page_title={intl l='Edit category'}} {include file='includes/header.inc.html'} -
+
- + {loop name="category_edit" type="category" visible="*" id="{$current_category_id}" backend_context="1" lang="$edition_language"}
@@ -25,156 +25,187 @@
-
- -
+
-
- -
+
+
+
- {include file="includes/inner-form-toolbar.html"} + {include file="includes/inner-form-toolbar.html"} -
-
-
- +
+
+
+ -
- -
-
+
+ +
+
-
- +
+ -
- -
-
+
+ +
+
-
- +
+ -
- +
+ -
-
+
+
-
- +
+ -
- -
-
+
+ +
+
-
- +
+ -
-
- - {intl l='Use default'} +
+ +
{intl l="The rewritten URL to the category page. Click \"Use Default\" button to use the default URL. Use only digits, letters, - and _ characters."}
+
+
+ +
+
+ +
+
+
+   +
+

{intl l='Category created on %date_create. Last modification: %date_change' date_create=$CREATE_DATE->format($datetime_format) date_change=$UPDATE_DATE->format($datetime_format)}

+
+
+
+
+ +
+
+
+ +
+
+
+ {include file="includes/inner-form-toolbar.html"} + +
+
+
+ + +
+
-
{intl l="The rewritten URL to the category page. Click \"Use Default\" button to use the default URL. Use only digits, letters, - and _ characters."}
-
-
+
+
+ -
-
+
+ - + +
+
+
+
- {loop name="cat-parent" type="category-tree" visible="*" category="0" exclude="{$current_category_id}"} - - {/loop} +
+
+
+ - -
-
+
+ +
+
+
-
-
- +
+
+
-
- -
-
-
-
-

aff Date creation ?

-

aff date modif ?

- - -
+
+

Images

+
-
-

Détails divers

-
+
+

Documents

+
-
-

Images

-
+
+

Modules

+
-
-

Documents

-
- -
-

Modules

-
- -
-
+
+
+ + {/loop} @@ -189,6 +220,12 @@ $(function() { e.preventDefault(); $(this).tab('show'); }); + + $('.use_default_rewriten_url').click(function(ev) { + alert("Not functionnal"); + + ev.preventDefault(); + }); }) diff --git a/templates/admin/default/general_error.html b/templates/admin/default/general_error.html index c41fee7a4..b8f9e8661 100755 --- a/templates/admin/default/general_error.html +++ b/templates/admin/default/general_error.html @@ -1,4 +1,4 @@ -{$page_title={intl l='AN error occured'}} +{$page_title={intl l='An error occured'}} {include file='includes/header.inc.html'} diff --git a/templates/admin/default/home.html b/templates/admin/default/home.html index 6b429ae29..a48e30ec6 100755 --- a/templates/admin/default/home.html +++ b/templates/admin/default/home.html @@ -1,4 +1,4 @@ -{check_auth context="admin" roles="ADMIN" login_tpl="/admin/login"} +{check_auth roles="ADMIN" login_tpl="/admin/login"} {$page_title={intl l='Home'}} {include file='includes/header.inc.html'} diff --git a/templates/admin/default/includes/category_breadcrumb.html b/templates/admin/default/includes/category_breadcrumb.html index cf03c4082..f3eed7705 100755 --- a/templates/admin/default/includes/category_breadcrumb.html +++ b/templates/admin/default/includes/category_breadcrumb.html @@ -1,26 +1,13 @@ {* Breadcrumb for categories browsing and editing *}
  • Home /
  • -
  • Catalog +
  • Catalog {ifloop rel="category_path"} /
  • -{ifloop rel="category_path"} - / - - {loop name="category_path" type="category-path" visible="*" category="{$current_category_id}"} - {if $ID == $current_category_id} -
  • - {if $action == 'edit'} - {intl l='Editing %cat' cat="{$TITLE}"} - {else} - {$TITLE} {intl l="(edit)"} - {/if} -
  • - {else} -
  • {$TITLE} /
  • - {/if} - {/loop} -{/ifloop} - -{elseloop rel="category_path"} - -{/elseloop} \ No newline at end of file +{loop name="category_path" type="category-path" visible="*" category="{$current_category_id}"} {if $ID == $current_category_id} +
  • {if $action == 'edit'} {intl l='Editing %cat' cat="{$TITLE}"} {else} {$TITLE} {intl l="(edit)"} {/if} +
  • +{else} +
  • {$TITLE} /
  • +{/if} {/loop} {/ifloop} {elseloop rel="category_path"} + +{/elseloop} diff --git a/templates/admin/default/includes/header.inc.html b/templates/admin/default/includes/header.inc.html index 05578de6b..2ee435b4b 100755 --- a/templates/admin/default/includes/header.inc.html +++ b/templates/admin/default/includes/header.inc.html @@ -1,5 +1,5 @@ - + {intl l='Thelia Back Office'}{if ! empty($page_title)} - {$page_title}{/if} @@ -43,7 +43,7 @@ {* display top bar once admin is connected *} -{loop name="top-bar-auth" type="auth" context="admin" roles="ADMIN"} +{loop name="top-bar-auth" type="auth" roles="ADMIN"} {module_include location='before_topbar'} @@ -54,9 +54,11 @@ {module_include location='inside_topbar'} - + - {loop name="top-bar-search" type="auth" context="admin" roles="ADMIN" permissions="admin.search"} + {loop name="top-bar-search" type="auth" roles="ADMIN" permissions="admin.search"}