diff --git a/.gitignore b/.gitignore index 8cf78452c..2219e9c48 100755 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ coverage .buildpath .project .settings/ -local/cache/* local/media/documents/* local/media/images/* web/assets/* @@ -25,3 +24,5 @@ xhprof/ phpunit.phar .DS_Store phpmyadmin +templates/default-esi +local/modules/TemplateEsiModule diff --git a/.travis.yml b/.travis.yml index 3ee2064b8..184a98fbe 100755 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,11 @@ env: - DB_USER=root before_script: + - phpenv config-add travis.php.ini - composer self-update - composer install --prefer-dist --dev - sh -c "mysql -u$DB_USER -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS thelia;SET FOREIGN_KEY_CHECKS = 1;'; fi" - php Thelia thelia:install --db_host=localhost --db_username=$DB_USER --db_name=thelia - php install/faker.php + - php Thelia module:activate Colissimo + - php Thelia module:activate Cheque \ No newline at end of file diff --git a/Readme.md b/Readme.md index ed4edf9ef..1134ccb68 100755 --- a/Readme.md +++ b/Readme.md @@ -5,10 +5,10 @@ Thelia ------ [![Build Status](https://travis-ci.org/thelia/thelia.png?branch=master)](https://travis-ci.org/thelia/thelia) -Thelia is an open source tool for creating e-business websites and managing online content. This software is published under GPL. +[Thelia](http://thelia.net) is an open source tool for creating e-business websites and managing online content. This software is published under GPL. Here is the current developping next major version. You can download this version for testing or see the code. -Here is the most recent developed code for the next major version (v2). You can download this version for testing or having a look on the code (or anything you wish, respecting GPL). +Here is the most recent developed code for the next major version (v2). You can download this version for testing or having a look on the code (or anything you wish, respecting GPL). See http://thelia.net/v2 web site for more information. Most part of the code can possibly change, a large part will be refactor soon, graphical setup does not exist yet. @@ -16,6 +16,16 @@ Requirements ------------ * php 5.4 + * Required extensions : + * PDO_Mysql + * mcrypt + * intl + * gd + * curl + * safe_mode off + * memory_limit at least 150M, preferably 256. + * post_max_size 20M + * upload_max_filesize 2M * apache 2 * mysql 5 diff --git a/composer.json b/composer.json index afef9e30b..a3395bcf5 100755 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "symfony/form": "2.2.*", "symfony/validator": "2.3.*", - "smarty/smarty": "v3.1.14", + "smarty/smarty": "v3.1.15", "kriswallsmith/assetic": "1.2.*@dev", "leafo/lessphp": "0.3.*@dev", "ptachoire/cssembed": "dev-master", @@ -38,7 +38,8 @@ "imagine/imagine": "dev-master", "symfony/icu": "1.0", "swiftmailer/swiftmailer": "5.0.*", - "symfony/serializer": "2.3.*" + "symfony/serializer": "2.3.*", + "ensepar/html2pdf": "1.0.1" }, "require-dev" : { "phpunit/phpunit": "3.7.*", diff --git a/composer.lock b/composer.lock index f90373a84..0e5c079ad 100755 --- a/composer.lock +++ b/composer.lock @@ -3,8 +3,112 @@ "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": "097481390dc87b3482d895b3b6a65479", + "hash": "9c5ea1a9fd0f8ba533c41ff3676e0970", "packages": [ + { + "name": "ensepar/html2pdf", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/OwlyCode/html2pdf.git", + "reference": "b53a27430cc35b29bbe2faaa55ed4a7d5c156cd3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/OwlyCode/html2pdf/zipball/b53a27430cc35b29bbe2faaa55ed4a7d5c156cd3", + "reference": "b53a27430cc35b29bbe2faaa55ed4a7d5c156cd3", + "shasum": "" + }, + "require": { + "ensepar/tcpdf": "5.0.003", + "php": ">=5.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "HTML2PDF": "." + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Spipu", + "homepage": "http://sourceforge.net/users/spipu", + "role": "Developer" + }, + { + "name": "OwlyCode", + "homepage": "http://www.github.com/OwlyCode", + "role": "Developer" + } + ], + "description": "Unofficial fork of 'html2pdf' with Composer support. (Fixed composer dependency problem)", + "homepage": "https://github.com/jwronsky/html2pdf", + "keywords": [ + "html", + "html2pdf", + "pdf" + ], + "time": "2013-09-13 12:23:43" + }, + { + "name": "ensepar/tcpdf", + "version": "5.0.003", + "source": { + "type": "git", + "url": "https://github.com/OwlyCode/tcpdf.git", + "reference": "ae578409e9454fdf6c794cce6f063b0c95bfa518" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/OwlyCode/tcpdf/zipball/ae578409e9454fdf6c794cce6f063b0c95bfa518", + "reference": "ae578409e9454fdf6c794cce6f063b0c95bfa518", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "fonts", + "config/lang", + "config", + "2dbarcodes.php", + "barcodes.php", + "htmlcolors.php", + "qrcode.php", + "tcpdf.php", + "unicode_data.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPLv3" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "homepage": "http://nicolaasuni.tecnick.com" + }, + { + "name": "Tristan Maindron", + "email": "tmaindron@gmail.com", + "homepage": "http://www.github.com/OwlyCode" + } + ], + "description": "TCPDF is a PHP class for generating PDF documents.", + "homepage": "http://www.tcpdf.org/", + "keywords": [ + "TCPDF", + "pdf" + ], + "time": "2013-09-12 17:00:40" + }, { "name": "imagine/imagine", "version": "dev-master", @@ -214,12 +318,12 @@ "source": { "type": "git", "url": "https://github.com/propelorm/Propel2.git", - "reference": "58a25ded43c3d04313cad2b738342d307988b1b5" + "reference": "fb9a10939abdd6efea7a066f0ef28f82ad06e435" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/propelorm/Propel2/zipball/58a25ded43c3d04313cad2b738342d307988b1b5", - "reference": "58a25ded43c3d04313cad2b738342d307988b1b5", + "url": "https://api.github.com/repos/propelorm/Propel2/zipball/fb9a10939abdd6efea7a066f0ef28f82ad06e435", + "reference": "fb9a10939abdd6efea7a066f0ef28f82ad06e435", "shasum": "" }, "require": { @@ -266,7 +370,7 @@ "orm", "persistence" ], - "time": "2013-09-01 13:29:51" + "time": "2013-09-30 08:26:26" }, { "name": "psr/log", @@ -403,11 +507,11 @@ }, { "name": "smarty/smarty", - "version": "v3.1.14", + "version": "v3.1.15", "source": { "type": "svn", "url": "http://smarty-php.googlecode.com/svn", - "reference": "/tags/v3.1.14/@4752" + "reference": "/tags/v3.1.15/@4782" }, "require": { "php": ">=5.2" @@ -443,7 +547,7 @@ "keywords": [ "templating" ], - "time": "2013-07-02 16:38:47" + "time": "2013-10-01 21:08:54" }, { "name": "swiftmailer/swiftmailer", @@ -845,17 +949,17 @@ }, { "name": "symfony/finder", - "version": "v2.3.4", + "version": "v2.3.5", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1" + "reference": "a175521f680b178e63c5d0ab87c6b046c0990c3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1", - "reference": "4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1", + "url": "https://api.github.com/repos/symfony/Finder/zipball/a175521f680b178e63c5d0ab87c6b046c0990c3f", + "reference": "a175521f680b178e63c5d0ab87c6b046c0990c3f", "shasum": "" }, "require": { @@ -888,7 +992,7 @@ ], "description": "Symfony Finder Component", "homepage": "http://symfony.com", - "time": "2013-08-13 20:18:00" + "time": "2013-09-19 09:45:20" }, { "name": "symfony/form", @@ -1763,18 +1867,52 @@ ], "time": "2013-09-11 13:01:19" }, + { + "name": "phenx/php-font-lib", + "version": "0.2.1", + "source": { + "type": "git", + "url": "https://github.com/PhenX/php-font-lib.git", + "reference": "42a1ca6d19f14076911a118705b771c3a5a8b179" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/42a1ca6d19f14076911a118705b771c3a5a8b179", + "reference": "42a1ca6d19f14076911a118705b771c3a5a8b179", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "classes/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse, export and make subsets of different types of font files.", + "homepage": "https://github.com/PhenX/php-font-lib", + "time": "2013-02-22 23:30:49" + }, { "name": "phpunit/php-code-coverage", "version": "1.2.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "0e9958c459d675fb497d8dc5001c91d335734e48" + "reference": "1.2.12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e9958c459d675fb497d8dc5001c91d335734e48", - "reference": "0e9958c459d675fb497d8dc5001c91d335734e48", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.12", + "reference": "1.2.12", "shasum": "" }, "require": { @@ -1963,12 +2101,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "31babf400e5b5868573bf49a000a3519d3978233" + "reference": "1.2.0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/31babf400e5b5868573bf49a000a3519d3978233", - "reference": "31babf400e5b5868573bf49a000a3519d3978233", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1.2.0", + "reference": "1.2.0", "shasum": "" }, "require": { @@ -2013,12 +2151,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "af7b77ccb5c64458bdfca95665d29558d1df7d08" + "reference": "3.7.24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/af7b77ccb5c64458bdfca95665d29558d1df7d08", - "reference": "af7b77ccb5c64458bdfca95665d29558d1df7d08", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.24", + "reference": "3.7.24", "shasum": "" }, "require": { diff --git a/core/lib/Thelia/Action/Address.php b/core/lib/Thelia/Action/Address.php index a912888c8..f6c6a81ad 100644 --- a/core/lib/Thelia/Action/Address.php +++ b/core/lib/Thelia/Action/Address.php @@ -25,8 +25,8 @@ namespace Thelia\Action; use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Propel; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Thelia\Core\Event\AddressCreateOrUpdateEvent; -use Thelia\Core\Event\AddressEvent; +use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent; +use Thelia\Core\Event\Address\AddressEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Address as AddressModel; use Thelia\Model\Map\AddressTableMap; @@ -60,6 +60,13 @@ class Address extends BaseAction implements EventSubscriberInterface $address->delete(); } + public function useDefault(AddressEvent $event) + { + $address = $event->getAddress(); + + $address->makeItDefault(); + } + protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event) { $addressModel->setDispatcher($this->getDispatcher()); @@ -86,14 +93,14 @@ class Address extends BaseAction implements EventSubscriberInterface ->save() ; - if($event->getIsDefault()) { + if ($event->getIsDefault()) { $addressModel->makeItDefault(); } $event->setAddress($addressModel); $con->commit(); - } catch(PropelException $e) { + } catch (PropelException $e) { $con->rollback(); throw $e; } @@ -125,7 +132,8 @@ class Address extends BaseAction implements EventSubscriberInterface return array( TheliaEvents::ADDRESS_CREATE => array("create", 128), TheliaEvents::ADDRESS_UPDATE => array("update", 128), - TheliaEvents::ADDRESS_DELETE => array("delete", 128) + TheliaEvents::ADDRESS_DELETE => array("delete", 128), + TheliaEvents::ADDRESS_DEFAULT => array('useDefault', 128), ); } } diff --git a/core/lib/Thelia/Action/Attribute.php b/core/lib/Thelia/Action/Attribute.php index 12478e8a1..7db04518a 100644 --- a/core/lib/Thelia/Action/Attribute.php +++ b/core/lib/Thelia/Action/Attribute.php @@ -30,15 +30,11 @@ use Thelia\Model\Attribute as AttributeModel; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\AttributeUpdateEvent; -use Thelia\Core\Event\AttributeCreateEvent; -use Thelia\Core\Event\AttributeDeleteEvent; -use Thelia\Model\ConfigQuery; -use Thelia\Model\AttributeAv; -use Thelia\Model\AttributeAvQuery; +use Thelia\Core\Event\Attribute\AttributeUpdateEvent; +use Thelia\Core\Event\Attribute\AttributeCreateEvent; +use Thelia\Core\Event\Attribute\AttributeDeleteEvent; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\CategoryEvent; -use Thelia\Core\Event\AttributeEvent; +use Thelia\Core\Event\Attribute\AttributeEvent; use Thelia\Model\AttributeTemplate; use Thelia\Model\AttributeTemplateQuery; use Thelia\Model\TemplateQuery; @@ -130,7 +126,7 @@ class Attribute extends BaseAction implements EventSubscriberInterface { $templates = TemplateQuery::create()->find(); - foreach($templates as $template) { + foreach ($templates as $template) { $attribute_template = new AttributeTemplate(); @@ -171,4 +167,4 @@ class Attribute extends BaseAction implements EventSubscriberInterface ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/AttributeAv.php b/core/lib/Thelia/Action/AttributeAv.php index 0a72739d1..83d85b398 100644 --- a/core/lib/Thelia/Action/AttributeAv.php +++ b/core/lib/Thelia/Action/AttributeAv.php @@ -30,10 +30,9 @@ use Thelia\Model\AttributeAv as AttributeAvModel; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\AttributeAvUpdateEvent; -use Thelia\Core\Event\AttributeAvCreateEvent; -use Thelia\Core\Event\AttributeAvDeleteEvent; -use Thelia\Model\ConfigQuery; +use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent; +use Thelia\Core\Event\Attribute\AttributeAvCreateEvent; +use Thelia\Core\Event\Attribute\AttributeAvDeleteEvent; use Thelia\Core\Event\UpdatePositionEvent; class AttributeAv extends BaseAction implements EventSubscriberInterface @@ -63,7 +62,7 @@ class AttributeAv extends BaseAction implements EventSubscriberInterface /** * Change a product attribute * - * @param AttributeAvUpdateEvent $event + * @param \Thelia\Core\Event\Attribute\AttributeAvUpdateEvent $event */ public function update(AttributeAvUpdateEvent $event) { @@ -115,7 +114,6 @@ class AttributeAv extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(AttributeAvQuery::create(), $event); } - /** * {@inheritDoc} */ @@ -128,4 +126,4 @@ class AttributeAv extends BaseAction implements EventSubscriberInterface TheliaEvents::ATTRIBUTE_AV_UPDATE_POSITION => array("updatePosition", 128), ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/BaseAction.php b/core/lib/Thelia/Action/BaseAction.php index d371919eb..33deddf2b 100755 --- a/core/lib/Thelia/Action/BaseAction.php +++ b/core/lib/Thelia/Action/BaseAction.php @@ -24,7 +24,6 @@ namespace Thelia\Action; use Symfony\Component\DependencyInjection\ContainerInterface; use Thelia\Model\AdminLog; -use Propel\Runtime\ActiveQuery\PropelQuery; use Propel\Runtime\ActiveQuery\ModelCriteria; use Thelia\Core\Event\UpdatePositionEvent; @@ -50,7 +49,6 @@ class BaseAction return $this->container->get('event_dispatcher'); } - /** * Changes object position, selecting absolute ou relative change. * diff --git a/core/lib/Thelia/Action/BaseCachedFile.php b/core/lib/Thelia/Action/BaseCachedFile.php index b66496e07..caa7c8ada 100644 --- a/core/lib/Thelia/Action/BaseCachedFile.php +++ b/core/lib/Thelia/Action/BaseCachedFile.php @@ -23,10 +23,7 @@ namespace Thelia\Action; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - use Thelia\Core\Event\CachedFileEvent; -use Thelia\Model\ConfigQuery; use Thelia\Tools\URL; /** @@ -50,7 +47,7 @@ abstract class BaseCachedFile extends BaseAction /** * @return string root of the file cache directory in web space */ - protected abstract function getCacheDirFromWebRoot(); + abstract protected function getCacheDirFromWebRoot(); /** * Clear the file cache. Is a subdirectory is specified, only this directory is cleared. @@ -104,9 +101,9 @@ abstract class BaseCachedFile extends BaseAction /** * Return the full path of the cached file * - * @param string $subdir the subdirectory related to cache base - * @param string $filename the filename - * @param string $hashed_options a hash of transformation options, or null if no transformations have been applied + * @param string $subdir the subdirectory related to cache base + * @param string $filename the filename + * @param string $hashed_options a hash of transformation options, or null if no transformations have been applied * @param boolean $forceOriginalDocument if true, the original file path in the cache dir is returned. * @return string the cache directory path relative to Web Root */ @@ -175,4 +172,4 @@ abstract class BaseCachedFile extends BaseAction return $path; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/Cart.php b/core/lib/Thelia/Action/Cart.php index 22760a4c7..89be6ea0a 100755 --- a/core/lib/Thelia/Action/Cart.php +++ b/core/lib/Thelia/Action/Cart.php @@ -25,7 +25,7 @@ namespace Thelia\Action; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Thelia\Core\Event\CartEvent; +use Thelia\Core\Event\Cart\CartEvent; use Thelia\Model\ProductPrice; use Thelia\Model\ProductPriceQuery; use Thelia\Model\CartItem; @@ -45,7 +45,7 @@ class Cart extends BaseAction implements EventSubscriberInterface /** * * add an article in the current cart - * @param \Thelia\Core\Event\CartEvent $event + * @param \Thelia\Core\Event\Cart\CartEvent $event */ public function addItem(CartEvent $event) { @@ -77,7 +77,7 @@ class Cart extends BaseAction implements EventSubscriberInterface * * Delete specify article present into cart * - * @param \Thelia\Core\Event\CartEvent $event + * @param \Thelia\Core\Event\Cart\CartEvent $event */ public function deleteItem(CartEvent $event) { @@ -97,7 +97,7 @@ class Cart extends BaseAction implements EventSubscriberInterface * * don't use Form here just test the Request. * - * @param \Thelia\Core\Event\CartEvent $event + * @param \Thelia\Core\Event\Cart\CartEvent $event */ public function changeItem(CartEvent $event) { diff --git a/core/lib/Thelia/Action/Category.php b/core/lib/Thelia/Action/Category.php index 8429a7c4e..815ea162a 100755 --- a/core/lib/Thelia/Action/Category.php +++ b/core/lib/Thelia/Action/Category.php @@ -30,14 +30,13 @@ use Thelia\Model\Category as CategoryModel; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\CategoryUpdateEvent; -use Thelia\Core\Event\CategoryCreateEvent; -use Thelia\Core\Event\CategoryDeleteEvent; -use Thelia\Model\ConfigQuery; +use Thelia\Core\Event\Category\CategoryUpdateEvent; +use Thelia\Core\Event\Category\CategoryCreateEvent; +use Thelia\Core\Event\Category\CategoryDeleteEvent; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\CategoryToggleVisibilityEvent; -use Thelia\Core\Event\CategoryAddContentEvent; -use Thelia\Core\Event\CategoryDeleteContentEvent; +use Thelia\Core\Event\Category\CategoryToggleVisibilityEvent; +use Thelia\Core\Event\Category\CategoryAddContentEvent; +use Thelia\Core\Event\Category\CategoryDeleteContentEvent; use Thelia\Model\CategoryAssociatedContent; use Thelia\Model\CategoryAssociatedContentQuery; @@ -46,7 +45,7 @@ class Category extends BaseAction implements EventSubscriberInterface /** * Create a new category entry * - * @param CategoryCreateEvent $event + * @param \Thelia\Core\Event\Category\CategoryCreateEvent $event */ public function create(CategoryCreateEvent $event) { @@ -69,7 +68,7 @@ class Category extends BaseAction implements EventSubscriberInterface /** * Change a category * - * @param CategoryUpdateEvent $event + * @param \Thelia\Core\Event\Category\CategoryUpdateEvent $event */ public function update(CategoryUpdateEvent $event) { @@ -98,7 +97,7 @@ class Category extends BaseAction implements EventSubscriberInterface /** * Delete a category entry * - * @param CategoryDeleteEvent $event + * @param \Thelia\Core\Event\Category\CategoryDeleteEvent $event */ public function delete(CategoryDeleteEvent $event) { @@ -139,8 +138,8 @@ class Category extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(CategoryQuery::create(), $event); } - public function addContent(CategoryAddContentEvent $event) { - + public function addContent(CategoryAddContentEvent $event) + { if (CategoryAssociatedContentQuery::create() ->filterByContentId($event->getContentId()) ->filterByCategory($event->getCategory())->count() <= 0) { @@ -156,8 +155,8 @@ class Category extends BaseAction implements EventSubscriberInterface } } - public function removeContent(CategoryDeleteContentEvent $event) { - + public function removeContent(CategoryDeleteContentEvent $event) + { $content = CategoryAssociatedContentQuery::create() ->filterByContentId($event->getContentId()) ->filterByCategory($event->getCategory())->findOne() @@ -170,7 +169,6 @@ class Category extends BaseAction implements EventSubscriberInterface } } - /** * {@inheritDoc} */ diff --git a/core/lib/Thelia/Action/Config.php b/core/lib/Thelia/Action/Config.php index f8a7c027c..e925811d3 100644 --- a/core/lib/Thelia/Action/Config.php +++ b/core/lib/Thelia/Action/Config.php @@ -29,16 +29,16 @@ use Thelia\Model\Config as ConfigModel; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\ConfigUpdateEvent; -use Thelia\Core\Event\ConfigCreateEvent; -use Thelia\Core\Event\ConfigDeleteEvent; +use Thelia\Core\Event\Config\ConfigUpdateEvent; +use Thelia\Core\Event\Config\ConfigCreateEvent; +use Thelia\Core\Event\Config\ConfigDeleteEvent; class Config extends BaseAction implements EventSubscriberInterface { /** * Create a new configuration entry * - * @param ConfigCreateEvent $event + * @param \Thelia\Core\Event\Config\ConfigCreateEvent $event */ public function create(ConfigCreateEvent $event) { @@ -54,7 +54,7 @@ class Config extends BaseAction implements EventSubscriberInterface /** * Change a configuration entry value * - * @param ConfigUpdateEvent $event + * @param \Thelia\Core\Event\Config\ConfigUpdateEvent $event */ public function setValue(ConfigUpdateEvent $event) { @@ -74,7 +74,7 @@ class Config extends BaseAction implements EventSubscriberInterface /** * Change a configuration entry * - * @param ConfigUpdateEvent $event + * @param \Thelia\Core\Event\Config\ConfigUpdateEvent $event */ public function modify(ConfigUpdateEvent $event) { @@ -94,7 +94,7 @@ class Config extends BaseAction implements EventSubscriberInterface /** * Delete a configuration entry * - * @param ConfigDeleteEvent $event + * @param \Thelia\Core\Event\Config\ConfigDeleteEvent $event */ public function delete(ConfigDeleteEvent $event) { diff --git a/core/lib/Thelia/Action/Content.php b/core/lib/Thelia/Action/Content.php index 4e59cafad..8560aa00e 100644 --- a/core/lib/Thelia/Action/Content.php +++ b/core/lib/Thelia/Action/Content.php @@ -22,17 +22,20 @@ /*************************************************************************************/ namespace Thelia\Action; + use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Thelia\Core\Event\Content\ContentAddFolderEvent; use Thelia\Core\Event\Content\ContentCreateEvent; use Thelia\Core\Event\Content\ContentDeleteEvent; +use Thelia\Core\Event\Content\ContentRemoveFolderEvent; use Thelia\Core\Event\Content\ContentToggleVisibilityEvent; use Thelia\Core\Event\Content\ContentUpdateEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\UpdatePositionEvent; +use Thelia\Model\ContentFolder; +use Thelia\Model\ContentFolderQuery; use Thelia\Model\ContentQuery; use Thelia\Model\Content as ContentModel; -use Thelia\Model\FolderQuery; - /** * Class Content @@ -76,17 +79,18 @@ class Content extends BaseAction implements EventSubscriberInterface ->save() ; + $content->updateDefaultFolder($event->getDefaultFolder()); + $event->setContent($content); } } public function updatePosition(UpdatePositionEvent $event) { - if(null !== $content = ContentQuery::create()->findPk($event->getObjectId())) { + if (null !== $content = ContentQuery::create()->findPk($event->getObjectId())) { $content->setDispatcher($this->getDispatcher()); - switch($event->getMode()) - { + switch ($event->getMode()) { case UpdatePositionEvent::POSITION_ABSOLUTE: $content->changeAbsolutePosition($event->getPosition()); break; @@ -109,6 +113,8 @@ class Content extends BaseAction implements EventSubscriberInterface ->setVisible(!$content->getVisible()) ->save(); + $event->setContent($content); + } public function delete(ContentDeleteEvent $event) @@ -124,6 +130,40 @@ class Content extends BaseAction implements EventSubscriberInterface } } + /** + * + * associate a folder to a content if the association already does not exists + * + * @param ContentAddFolderEvent $event + */ + public function addFolder(ContentAddFolderEvent $event) + { + if(ContentFolderQuery::create() + ->filterByContent($event->getContent()) + ->filterByFolderId($event->getFolderId()) + ->count() <= 0 + ) { + $contentFolder = new ContentFolder(); + + $contentFolder + ->setFolderId($event->getFolderId()) + ->setContent($event->getContent()) + ->setDefaultFolder(false) + ->save(); + } + } + + public function removeFolder(ContentRemoveFolderEvent $event) + { + $contentFolder = ContentFolderQuery::create() + ->filterByContent($event->getContent()) + ->filterByFolderId($event->getFolderId()) + ->findOne(); + + if(null !== $contentFolder) { + $contentFolder->delete(); + } + } /** * Returns an array of event names this subscriber wants to listen to. @@ -148,13 +188,16 @@ class Content extends BaseAction implements EventSubscriberInterface public static function getSubscribedEvents() { return array( - TheliaEvents::CONTENT_CREATE => array("create", 128), - TheliaEvents::CONTENT_UPDATE => array("update", 128), - TheliaEvents::CONTENT_DELETE => array("delete", 128), - TheliaEvents::CONTENT_TOGGLE_VISIBILITY => array("toggleVisibility", 128), + TheliaEvents::CONTENT_CREATE => array('create', 128), + TheliaEvents::CONTENT_UPDATE => array('update', 128), + TheliaEvents::CONTENT_DELETE => array('delete', 128), + TheliaEvents::CONTENT_TOGGLE_VISIBILITY => array('toggleVisibility', 128), - TheliaEvents::CONTENT_UPDATE_POSITION => array("updatePosition", 128), + TheliaEvents::CONTENT_UPDATE_POSITION => array('updatePosition', 128), + + TheliaEvents::CONTENT_ADD_FOLDER => array('addFolder', 128), + TheliaEvents::CONTENT_REMOVE_FOLDER => array('removeFolder', 128), ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/Country.php b/core/lib/Thelia/Action/Country.php new file mode 100644 index 000000000..9bccfcea5 --- /dev/null +++ b/core/lib/Thelia/Action/Country.php @@ -0,0 +1,114 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Thelia\Core\Event\Country\CountryCreateEvent; +use Thelia\Core\Event\Country\CountryDeleteEvent; +use Thelia\Core\Event\Country\CountryToggleDefaultEvent; +use Thelia\Core\Event\Country\CountryUpdateEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Model\Country as CountryModel; +use Thelia\Model\CountryQuery; + + +/** + * Class Country + * @package Thelia\Action + * @author Manuel Raynaud + */ +class Country extends BaseAction implements EventSubscriberInterface +{ + + public function create(CountryCreateEvent $event) + { + $country = new CountryModel(); + + $country + ->setIsocode($event->getIsocode()) + ->setIsoalpha2($event->getIsoAlpha2()) + ->setIsoalpha3($event->getIsoAlpha3()) + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + ->save(); + + $event->setCountry($country); + + } + + public function update(CountryUpdateEvent $event) + { + + } + + public function delete(CountryDeleteEvent $event) + { + if (null !== $country = CountryQuery::create()->findPk($event->getCountryId())) { + $country->delete(); + + $event->setCountry($country); + } + } + + public function toggleDefault(CountryToggleDefaultEvent $event) + { + if( null !== $country = CountryQuery::create()->findPk($event->getCountryId())) + { + $country->toggleDefault(); + + $event->setCountry($country); + } + } + + + /** + * Returns an array of event names this subscriber wants to listen to. + * + * The array keys are event names and the value can be: + * + * * The method name to call (priority defaults to 0) + * * An array composed of the method name to call and the priority + * * An array of arrays composed of the method names to call and respective + * priorities, or 0 if unset + * + * For instance: + * + * * array('eventName' => 'methodName') + * * array('eventName' => array('methodName', $priority)) + * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) + * + * @return array The event names to listen to + * + * @api + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::COUNTRY_CREATE => array('create', 128), + TheliaEvents::COUNTRY_UPDATE => array('update', 128), + TheliaEvents::COUNTRY_DELETE => array('delete', 128), + TheliaEvents::COUNTRY_TOGGLE_DEFAULT => array('toggleDefault', 128) + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Action/Currency.php b/core/lib/Thelia/Action/Currency.php index 3c428683b..3fe24326a 100644 --- a/core/lib/Thelia/Action/Currency.php +++ b/core/lib/Thelia/Action/Currency.php @@ -30,9 +30,9 @@ use Thelia\Model\Currency as CurrencyModel; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\CurrencyUpdateEvent; -use Thelia\Core\Event\CurrencyCreateEvent; -use Thelia\Core\Event\CurrencyDeleteEvent; +use Thelia\Core\Event\Currency\CurrencyUpdateEvent; +use Thelia\Core\Event\Currency\CurrencyCreateEvent; +use Thelia\Core\Event\Currency\CurrencyDeleteEvent; use Thelia\Model\ConfigQuery; use Thelia\Core\Event\UpdatePositionEvent; @@ -41,7 +41,7 @@ class Currency extends BaseAction implements EventSubscriberInterface /** * Create a new currencyuration entry * - * @param CurrencyCreateEvent $event + * @param \Thelia\Core\Event\Currency\CurrencyCreateEvent $event */ public function create(CurrencyCreateEvent $event) { @@ -65,7 +65,7 @@ class Currency extends BaseAction implements EventSubscriberInterface /** * Change a currency * - * @param CurrencyUpdateEvent $event + * @param \Thelia\Core\Event\Currency\CurrencyUpdateEvent $event */ public function update(CurrencyUpdateEvent $event) { @@ -118,7 +118,7 @@ class Currency extends BaseAction implements EventSubscriberInterface /** * Delete a currencyuration entry * - * @param CurrencyDeleteEvent $event + * @param \Thelia\Core\Event\Currency\CurrencyDeleteEvent $event */ public function delete(CurrencyDeleteEvent $event) { diff --git a/core/lib/Thelia/Action/Customer.php b/core/lib/Thelia/Action/Customer.php index f132a01da..85643cb88 100755 --- a/core/lib/Thelia/Action/Customer.php +++ b/core/lib/Thelia/Action/Customer.php @@ -25,11 +25,12 @@ namespace Thelia\Action; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Thelia\Core\Event\ActionEvent; -use Thelia\Core\Event\CustomerCreateOrUpdateEvent; -use Thelia\Core\Event\CustomerEvent; +use Thelia\Core\Event\Customer\CustomerAddressEvent; +use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent; +use Thelia\Core\Event\Customer\CustomerEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Customer as CustomerModel; -use Thelia\Core\Event\CustomerLoginEvent; +use Thelia\Core\Event\Customer\CustomerLoginEvent; /** * @@ -148,11 +149,11 @@ class Customer extends BaseAction implements EventSubscriberInterface public static function getSubscribedEvents() { 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), - TheliaEvents::CUSTOMER_DELETEACCOUNT => array("delete", 128), + TheliaEvents::CUSTOMER_CREATEACCOUNT => array('create', 128), + TheliaEvents::CUSTOMER_UPDATEACCOUNT => array('modify', 128), + TheliaEvents::CUSTOMER_LOGOUT => array('logout', 128), + TheliaEvents::CUSTOMER_LOGIN => array('login', 128), + TheliaEvents::CUSTOMER_DELETEACCOUNT => array('delete', 128), ); } } diff --git a/core/lib/Thelia/Action/Document.php b/core/lib/Thelia/Action/Document.php index 6b5188ba8..f048c208e 100644 --- a/core/lib/Thelia/Action/Document.php +++ b/core/lib/Thelia/Action/Document.php @@ -25,19 +25,15 @@ namespace Thelia\Action; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Thelia\Core\Event\DocumentCreateOrUpdateEvent; -use Thelia\Core\Event\DocumentDeleteEvent; -use Thelia\Core\Event\DocumentEvent; +use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent; +use Thelia\Core\Event\Document\DocumentDeleteEvent; +use Thelia\Core\Event\Document\DocumentEvent; use Thelia\Exception\ImageException; use Thelia\Model\ConfigQuery; use Thelia\Tools\FileManager; use Thelia\Tools\URL; -use Imagine\Document\ImagineInterface; -use Imagine\Document\DocumentInterface; -use Imagine\Document\Box; use Imagine\Document\Color; -use Imagine\Document\Point; use Thelia\Exception\DocumentException; use Thelia\Core\Event\TheliaEvents; @@ -80,7 +76,8 @@ class Document extends BaseCachedFile implements EventSubscriberInterface /** * @return string root of the document cache directory in web space */ - protected function getCacheDirFromWebRoot() { + protected function getCacheDirFromWebRoot() + { return ConfigQuery::read('document_cache_dir_from_web_root', 'cache'); } @@ -95,7 +92,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface * @param DocumentEvent $event Event * * @throws \Thelia\Exception\DocumentException - * @throws \InvalidArgumentException , DocumentException + * @throws \InvalidArgumentException , DocumentException */ public function processDocument(DocumentEvent $event) { @@ -139,7 +136,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface /** * Take care of saving document in the database and file storage * - * @param DocumentCreateOrUpdateEvent $event Document event + * @param \Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent $event Document event * * @throws \Thelia\Exception\ImageException * @todo refactor make all documents using propel inheritance and factorise image behaviour into one single clean action @@ -183,7 +180,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface /** * Take care of updating document in the database and file storage * - * @param DocumentCreateOrUpdateEvent $event Document event + * @param \Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent $event Document event * * @throws \Thelia\Exception\ImageException * @todo refactor make all documents using propel inheritance and factorise image behaviour into one single clean action @@ -225,7 +222,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface /** * Take care of deleting document in the database and file storage * - * @param DocumentDeleteEvent $event Image event + * @param \Thelia\Core\Event\Document\DocumentDeleteEvent $event Image event * * @throws \Exception * @todo refactor make all documents using propel inheritance and factorise image behaviour into one single clean action @@ -247,7 +244,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface 'document' ) ); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->adminLogAppend( $this->container->get('thelia.translator')->trans( 'Fail to delete document for %id% with parent id %parentId% (Exception : %e%)', diff --git a/core/lib/Thelia/Action/Feature.php b/core/lib/Thelia/Action/Feature.php index 01799510c..6ae7645e3 100644 --- a/core/lib/Thelia/Action/Feature.php +++ b/core/lib/Thelia/Action/Feature.php @@ -30,15 +30,11 @@ use Thelia\Model\Feature as FeatureModel; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\FeatureUpdateEvent; -use Thelia\Core\Event\FeatureCreateEvent; -use Thelia\Core\Event\FeatureDeleteEvent; -use Thelia\Model\ConfigQuery; -use Thelia\Model\FeatureAv; -use Thelia\Model\FeatureAvQuery; +use Thelia\Core\Event\Feature\FeatureUpdateEvent; +use Thelia\Core\Event\Feature\FeatureCreateEvent; +use Thelia\Core\Event\Feature\FeatureDeleteEvent; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\CategoryEvent; -use Thelia\Core\Event\FeatureEvent; +use Thelia\Core\Event\Feature\FeatureEvent; use Thelia\Model\FeatureTemplate; use Thelia\Model\FeatureTemplateQuery; use Thelia\Model\TemplateQuery; @@ -48,7 +44,7 @@ class Feature extends BaseAction implements EventSubscriberInterface /** * Create a new feature entry * - * @param FeatureCreateEvent $event + * @param \Thelia\Core\Event\Feature\FeatureCreateEvent $event */ public function create(FeatureCreateEvent $event) { @@ -74,7 +70,7 @@ class Feature extends BaseAction implements EventSubscriberInterface /** * Change a product feature * - * @param FeatureUpdateEvent $event + * @param \Thelia\Core\Event\Feature\FeatureUpdateEvent $event */ public function update(FeatureUpdateEvent $event) { @@ -130,7 +126,7 @@ class Feature extends BaseAction implements EventSubscriberInterface { $templates = TemplateQuery::create()->find(); - foreach($templates as $template) { + foreach ($templates as $template) { $feature_template = new FeatureTemplate(); @@ -171,4 +167,4 @@ class Feature extends BaseAction implements EventSubscriberInterface ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/FeatureAv.php b/core/lib/Thelia/Action/FeatureAv.php index 25f9ae5f2..c2ef4f7bc 100644 --- a/core/lib/Thelia/Action/FeatureAv.php +++ b/core/lib/Thelia/Action/FeatureAv.php @@ -30,10 +30,9 @@ use Thelia\Model\FeatureAv as FeatureAvModel; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\FeatureAvUpdateEvent; -use Thelia\Core\Event\FeatureAvCreateEvent; -use Thelia\Core\Event\FeatureAvDeleteEvent; -use Thelia\Model\ConfigQuery; +use Thelia\Core\Event\Feature\FeatureAvUpdateEvent; +use Thelia\Core\Event\Feature\FeatureAvCreateEvent; +use Thelia\Core\Event\Feature\FeatureAvDeleteEvent; use Thelia\Core\Event\UpdatePositionEvent; class FeatureAv extends BaseAction implements EventSubscriberInterface @@ -115,7 +114,6 @@ class FeatureAv extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(FeatureAvQuery::create(), $event); } - /** * {@inheritDoc} */ @@ -128,4 +126,4 @@ class FeatureAv extends BaseAction implements EventSubscriberInterface TheliaEvents::FEATURE_AV_UPDATE_POSITION => array("updatePosition", 128), ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/Folder.php b/core/lib/Thelia/Action/Folder.php index b830947cc..a42330e47 100644 --- a/core/lib/Thelia/Action/Folder.php +++ b/core/lib/Thelia/Action/Folder.php @@ -23,24 +23,22 @@ namespace Thelia\Action; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Thelia\Core\Event\FolderCreateEvent; -use Thelia\Core\Event\FolderDeleteEvent; -use Thelia\Core\Event\FolderToggleVisibilityEvent; -use Thelia\Core\Event\FolderUpdateEvent; +use Thelia\Core\Event\Folder\FolderCreateEvent; +use Thelia\Core\Event\Folder\FolderDeleteEvent; +use Thelia\Core\Event\Folder\FolderToggleVisibilityEvent; +use Thelia\Core\Event\Folder\FolderUpdateEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Model\FolderQuery; use Thelia\Model\Folder as FolderModel; - /** * Class Folder * @package Thelia\Action * @author Manuel Raynaud */ -class Folder extends BaseAction implements EventSubscriberInterface { - - +class Folder extends BaseAction implements EventSubscriberInterface +{ public function update(FolderUpdateEvent $event) { @@ -99,15 +97,16 @@ class Folder extends BaseAction implements EventSubscriberInterface { ->setVisible(!$folder->getVisible()) ->save(); + $event->setFolder($folder); + } public function updatePosition(UpdatePositionEvent $event) { - if(null !== $folder = FolderQuery::create()->findPk($event->getObjectId())) { + if (null !== $folder = FolderQuery::create()->findPk($event->getObjectId())) { $folder->setDispatcher($this->getDispatcher()); - switch($event->getMode()) - { + switch ($event->getMode()) { case UpdatePositionEvent::POSITION_ABSOLUTE: $folder->changeAbsolutePosition($event->getPosition()); break; @@ -152,4 +151,4 @@ class Folder extends BaseAction implements EventSubscriberInterface { TheliaEvents::FOLDER_UPDATE_POSITION => array("updatePosition", 128), ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/HttpException.php b/core/lib/Thelia/Action/HttpException.php index 9beadeb7b..50ee92d5e 100755 --- a/core/lib/Thelia/Action/HttpException.php +++ b/core/lib/Thelia/Action/HttpException.php @@ -45,7 +45,7 @@ class HttpException extends BaseAction implements EventSubscriberInterface $this->display404($event); } - if($event->getException() instanceof AccessDeniedHttpException) { + if ($event->getException() instanceof AccessDeniedHttpException) { $this->display403($event); } } diff --git a/core/lib/Thelia/Action/Image.php b/core/lib/Thelia/Action/Image.php index b15b00f0b..97d4bd095 100755 --- a/core/lib/Thelia/Action/Image.php +++ b/core/lib/Thelia/Action/Image.php @@ -23,19 +23,12 @@ namespace Thelia\Action; -use Propel\Runtime\ActiveRecord\ActiveRecordInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Thelia\Core\Event\ImageCreateOrUpdateEvent; -use Thelia\Core\Event\ImagesCreateOrUpdateEvent; -use Thelia\Core\Event\ImageDeleteEvent; -use Thelia\Core\Event\ImageEvent; -use Thelia\Model\CategoryImage; +use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent; +use Thelia\Core\Event\Image\ImageDeleteEvent; +use Thelia\Core\Event\Image\ImageEvent; use Thelia\Model\ConfigQuery; -use Thelia\Model\ContentImage; -use Thelia\Model\FolderImage; -use Thelia\Model\ProductImage; use Thelia\Tools\FileManager; use Thelia\Tools\URL; @@ -88,12 +81,11 @@ class Image extends BaseCachedFile implements EventSubscriberInterface const EXACT_RATIO_WITH_CROP = 2; const KEEP_IMAGE_RATIO = 3; - - /** * @return string root of the image cache directory in web space */ - protected function getCacheDirFromWebRoot() { + protected function getCacheDirFromWebRoot() + { return ConfigQuery::read('image_cache_dir_from_web_root', 'cache'); } @@ -106,8 +98,8 @@ class Image extends BaseCachedFile implements EventSubscriberInterface * * This method updates the cache_file_path and file_url attributes of the event * - * @param ImageEvent $event - * @throws \InvalidArgumentException, ImageException + * @param \Thelia\Core\Event\Image\ImageEvent $event + * @throws \InvalidArgumentException, ImageException */ public function processImage(ImageEvent $event) { @@ -255,7 +247,7 @@ class Image extends BaseCachedFile implements EventSubscriberInterface /** * Take care of saving image in the database and file storage * - * @param ImageCreateOrUpdateEvent $event Image event + * @param \Thelia\Core\Event\Image\ImageCreateOrUpdateEvent $event Image event * * @throws \Thelia\Exception\ImageException * @todo refactor make all pictures using propel inheritance and factorise image behaviour into one single clean action @@ -358,7 +350,7 @@ class Image extends BaseCachedFile implements EventSubscriberInterface 'image' ) ); - } catch(\Exception $e){ + } catch (\Exception $e) { $this->adminLogAppend( $this->container->get('thelia.translator')->trans( 'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)', diff --git a/core/lib/Thelia/Action/Message.php b/core/lib/Thelia/Action/Message.php index 8918913fe..fa9b13db5 100644 --- a/core/lib/Thelia/Action/Message.php +++ b/core/lib/Thelia/Action/Message.php @@ -30,16 +30,16 @@ use Thelia\Model\Message as MessageModel; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\MessageUpdateEvent; -use Thelia\Core\Event\MessageCreateEvent; -use Thelia\Core\Event\MessageDeleteEvent; +use Thelia\Core\Event\Message\MessageUpdateEvent; +use Thelia\Core\Event\Message\MessageCreateEvent; +use Thelia\Core\Event\Message\MessageDeleteEvent; class Message extends BaseAction implements EventSubscriberInterface { /** * Create a new messageuration entry * - * @param MessageCreateEvent $event + * @param \Thelia\Core\Event\Message\MessageCreateEvent $event */ public function create(MessageCreateEvent $event) { @@ -64,7 +64,7 @@ class Message extends BaseAction implements EventSubscriberInterface /** * Change a message * - * @param MessageUpdateEvent $event + * @param \Thelia\Core\Event\Message\MessageUpdateEvent $event */ public function modify(MessageUpdateEvent $event) { @@ -94,7 +94,7 @@ class Message extends BaseAction implements EventSubscriberInterface /** * Delete a messageuration entry * - * @param MessageDeleteEvent $event + * @param \Thelia\Core\Event\Message\MessageDeleteEvent $event */ public function delete(MessageDeleteEvent $event) { diff --git a/core/lib/Thelia/Action/Order.php b/core/lib/Thelia/Action/Order.php index f93733da3..b48f72439 100755 --- a/core/lib/Thelia/Action/Order.php +++ b/core/lib/Thelia/Action/Order.php @@ -23,12 +23,11 @@ namespace Thelia\Action; -use Propel\Runtime\ActiveQuery\ModelCriteria; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Thelia\Core\Event\OrderEvent; +use Thelia\Core\Event\Order\OrderAddressEvent; +use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Exception\OrderException; use Thelia\Exception\TheliaProcessException; use Thelia\Model\AddressQuery; use Thelia\Model\OrderProductAttributeCombination; @@ -38,7 +37,6 @@ use Thelia\Model\OrderStatus; use Thelia\Model\Map\OrderTableMap; use Thelia\Model\OrderAddress; use Thelia\Model\OrderStatusQuery; -use Thelia\Model\ConfigQuery; use Thelia\Tools\I18n; /** @@ -50,7 +48,7 @@ use Thelia\Tools\I18n; class Order extends BaseAction implements EventSubscriberInterface { /** - * @param \Thelia\Core\Event\OrderEvent $event + * @param \Thelia\Core\Event\Order\OrderEvent $event */ public function setDeliveryAddress(OrderEvent $event) { @@ -62,7 +60,7 @@ class Order extends BaseAction implements EventSubscriberInterface } /** - * @param \Thelia\Core\Event\OrderEvent $event + * @param \Thelia\Core\Event\Order\OrderEvent $event */ public function setDeliveryModule(OrderEvent $event) { @@ -75,7 +73,7 @@ class Order extends BaseAction implements EventSubscriberInterface } /** - * @param \Thelia\Core\Event\OrderEvent $event + * @param \Thelia\Core\Event\Order\OrderEvent $event */ public function setInvoiceAddress(OrderEvent $event) { @@ -87,7 +85,7 @@ class Order extends BaseAction implements EventSubscriberInterface } /** - * @param \Thelia\Core\Event\OrderEvent $event + * @param \Thelia\Core\Event\Order\OrderEvent $event */ public function setPaymentModule(OrderEvent $event) { @@ -99,7 +97,7 @@ class Order extends BaseAction implements EventSubscriberInterface } /** - * @param \Thelia\Core\Event\OrderEvent $event + * @param \Thelia\Core\Event\Order\OrderEvent $event */ public function create(OrderEvent $event) { @@ -176,7 +174,7 @@ class Order extends BaseAction implements EventSubscriberInterface /* fulfill order_products and decrease stock */ - foreach($cartItems as $cartItem) { + foreach ($cartItems as $cartItem) { $product = $cartItem->getProduct(); /* get translation */ @@ -185,7 +183,7 @@ class Order extends BaseAction implements EventSubscriberInterface $pse = $cartItem->getProductSaleElements(); /* check still in stock */ - if($cartItem->getQuantity() > $pse->getQuantity()) { + if ($cartItem->getQuantity() > $pse->getQuantity()) { throw new TheliaProcessException("Not enough stock", TheliaProcessException::CART_ITEM_NOT_ENOUGH_STOCK, $cartItem); } @@ -200,7 +198,8 @@ class Order extends BaseAction implements EventSubscriberInterface $taxDetail = $product->getTaxRule()->getTaxDetail( $taxCountry, - $cartItem->getPromo() == 1 ? $cartItem->getPromoPrice() : $cartItem->getPrice(), + $cartItem->getPrice(), + $cartItem->getPromoPrice(), $this->getSession()->getLang()->getLocale() ); @@ -226,13 +225,13 @@ class Order extends BaseAction implements EventSubscriberInterface $orderProduct->save($con); /* fulfill order_product_tax */ - foreach($taxDetail as $tax) { + foreach ($taxDetail as $tax) { $tax->setOrderProductId($orderProduct->getId()); $tax->save($con); } /* fulfill order_attribute_combination and decrease stock */ - foreach($pse->getAttributeCombinations() as $attributeCombination) { + foreach ($pse->getAttributeCombinations() as $attributeCombination) { $attribute = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'Attribute', $attributeCombination->getAttributeId()); $attributeAv = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'AttributeAv', $attributeCombination->getAttributeAvId()); @@ -242,7 +241,7 @@ class Order extends BaseAction implements EventSubscriberInterface ->setAttributeTitle($attribute->getTitle()) ->setAttributeChapo($attribute->getChapo()) ->setAttributeDescription($attribute->getDescription()) - ->setAttributePostscriptumn($attribute->getPostscriptum()) + ->setAttributePostscriptum($attribute->getPostscriptum()) ->setAttributeAvTitle($attributeAv->getTitle()) ->setAttributeAvChapo($attributeAv->getChapo()) ->setAttributeAvDescription($attributeAv->getDescription()) @@ -279,13 +278,64 @@ class Order extends BaseAction implements EventSubscriberInterface } /** - * @param \Thelia\Core\Event\OrderEvent $event + * @param \Thelia\Core\Event\Order\OrderEvent $event */ public function sendOrderEmail(OrderEvent $event) { /* @todo */ } + /** + * @param OrderEvent $event + */ + public function updateStatus(OrderEvent $event) + { + $order = $event->getOrder(); + + $order->setStatusId($event->getStatus()); + $order->save(); + + $event->setOrder($order); + } + + /** + * @param OrderEvent $event + */ + public function updateDeliveryRef(OrderEvent $event) + { + $order = $event->getOrder(); + + $order->setDeliveryRef($event->getDeliveryRef()); + $order->save(); + + $event->setOrder($order); + } + + /** + * @param OrderAddressEvent $event + */ + public function updateAddress(OrderAddressEvent $event) + { + $orderAddress = $event->getOrderAddress(); + + $orderAddress + ->setCustomerTitleId($event->getTitle()) + ->setCompany($event->getCompany()) + ->setFirstname($event->getFirstname()) + ->setLastname($event->getLastname()) + ->setAddress1($event->getAddress1()) + ->setAddress2($event->getAddress2()) + ->setAddress3($event->getAddress3()) + ->setZipcode($event->getZipcode()) + ->setCity($event->getCity()) + ->setCountryId($event->getCountry()) + ->setPhone($event->getPhone()) + ; + $orderAddress->save(); + + $event->setOrderAddress($orderAddress); + } + /** * Returns an array of event names this subscriber wants to listen to. * @@ -315,6 +365,9 @@ class Order extends BaseAction implements EventSubscriberInterface TheliaEvents::ORDER_SET_PAYMENT_MODULE => array("setPaymentModule", 128), TheliaEvents::ORDER_PAY => array("create", 128), TheliaEvents::ORDER_BEFORE_PAYMENT => array("sendOrderEmail", 128), + TheliaEvents::ORDER_UPDATE_STATUS => array("updateStatus", 128), + TheliaEvents::ORDER_UPDATE_DELIVERY_REF => array("updateDeliveryRef", 128), + TheliaEvents::ORDER_UPDATE_ADDRESS => array("updateAddress", 128), ); } diff --git a/core/lib/Thelia/Action/Pdf.php b/core/lib/Thelia/Action/Pdf.php new file mode 100644 index 000000000..52ce0b92d --- /dev/null +++ b/core/lib/Thelia/Action/Pdf.php @@ -0,0 +1,75 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Thelia\Core\Event\PdfEvent; +use Thelia\Core\Event\TheliaEvents; + + +/** + * Class Pdf + * @package Thelia\Action + * @author Manuel Raynaud + */ +class Pdf extends BaseAction implements EventSubscriberInterface +{ + + public function generatePdf(PdfEvent $event) + { + + $html2pdf = new \HTML2PDF($event->getOrientation(), $event->getFormat(), $event->getLang(), $event->getUnicode(), $event->getEncoding(), $event->getMarges()); + + $html2pdf->pdf->SetDisplayMode('real'); + + $html2pdf->writeHTML($event->getContent()); + $event->setPdf($html2pdf->output(null, 'S')); + } + + /** + * Returns an array of event names this subscriber wants to listen to. + * + * The array keys are event names and the value can be: + * + * * The method name to call (priority defaults to 0) + * * An array composed of the method name to call and the priority + * * An array of arrays composed of the method names to call and respective + * priorities, or 0 if unset + * + * For instance: + * + * * array('eventName' => 'methodName') + * * array('eventName' => array('methodName', $priority)) + * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) + * + * @return array The event names to listen to + * + * @api + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::GENERATE_PDF => array("generatePdf", 128) + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Action/Product.php b/core/lib/Thelia/Action/Product.php index cecc1df39..bd918c5e6 100644 --- a/core/lib/Thelia/Action/Product.php +++ b/core/lib/Thelia/Action/Product.php @@ -30,51 +30,45 @@ use Thelia\Model\Product as ProductModel; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\ProductUpdateEvent; -use Thelia\Core\Event\ProductCreateEvent; -use Thelia\Core\Event\ProductDeleteEvent; -use Thelia\Model\ConfigQuery; +use Thelia\Core\Event\Product\ProductUpdateEvent; +use Thelia\Core\Event\Product\ProductCreateEvent; +use Thelia\Core\Event\Product\ProductDeleteEvent; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\ProductToggleVisibilityEvent; -use Thelia\Core\Event\ProductAddContentEvent; -use Thelia\Core\Event\ProductDeleteContentEvent; +use Thelia\Core\Event\Product\ProductToggleVisibilityEvent; +use Thelia\Core\Event\Product\ProductAddContentEvent; +use Thelia\Core\Event\Product\ProductDeleteContentEvent; use Thelia\Model\ProductAssociatedContent; use Thelia\Model\ProductAssociatedContentQuery; use Thelia\Model\ProductCategory; -use Thelia\Model\TaxRule; use Thelia\Model\TaxRuleQuery; -use Thelia\Model\TaxQuery; use Thelia\Model\AccessoryQuery; use Thelia\Model\Accessory; -use Thelia\Core\Event\ProductAddAccessoryEvent; -use Thelia\Core\Event\ProductDeleteAccessoryEvent; -use Thelia\Core\Event\FeatureProductUpdateEvent; +use Thelia\Core\Event\FeatureProduct\FeatureProductUpdateEvent; use Thelia\Model\FeatureProduct; -use Thelia\Model\FeatureQuery; -use Thelia\Core\Event\FeatureProductDeleteEvent; +use Thelia\Core\Event\FeatureProduct\FeatureProductDeleteEvent; use Thelia\Model\FeatureProductQuery; use Thelia\Model\ProductCategoryQuery; -use Thelia\Core\Event\ProductSetTemplateEvent; -use Thelia\Model\AttributeCombinationQuery; +use Thelia\Core\Event\Product\ProductSetTemplateEvent; use Thelia\Model\ProductSaleElementsQuery; -use Propel\Runtime\ActiveQuery\PropelQuery; -use Thelia\Core\Event\ProductDeleteCategoryEvent; -use Thelia\Core\Event\ProductAddCategoryEvent; +use Thelia\Core\Event\Product\ProductDeleteCategoryEvent; +use Thelia\Core\Event\Product\ProductAddCategoryEvent; use Thelia\Model\AttributeAvQuery; use Thelia\Model\AttributeCombination; -use Thelia\Core\Event\ProductCreateCombinationEvent; +use Thelia\Core\Event\Product\ProductCreateCombinationEvent; use Propel\Runtime\Propel; use Thelia\Model\Map\ProductTableMap; -use Thelia\Core\Event\ProductDeleteCombinationEvent; +use Thelia\Core\Event\Product\ProductDeleteCombinationEvent; use Thelia\Model\ProductPrice; use Thelia\Model\ProductSaleElements; +use Thelia\Core\Event\Product\ProductAddAccessoryEvent; +use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent; class Product extends BaseAction implements EventSubscriberInterface { /** * Create a new product entry * - * @param ProductCreateEvent $event + * @param \Thelia\Core\Event\Product\ProductCreateEvent $event */ public function create(ProductCreateEvent $event) { @@ -108,7 +102,7 @@ class Product extends BaseAction implements EventSubscriberInterface /** * Change a product * - * @param ProductUpdateEvent $event + * @param \Thelia\Core\Event\Product\ProductUpdateEvent $event */ public function update(ProductUpdateEvent $event) { @@ -140,7 +134,7 @@ class Product extends BaseAction implements EventSubscriberInterface /** * Delete a product entry * - * @param ProductDeleteEvent $event + * @param \Thelia\Core\Event\Product\ProductDeleteEvent $event */ public function delete(ProductDeleteEvent $event) { @@ -181,8 +175,8 @@ class Product extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(ProductQuery::create(), $event); } - public function addContent(ProductAddContentEvent $event) { - + public function addContent(ProductAddContentEvent $event) + { if (ProductAssociatedContentQuery::create() ->filterByContentId($event->getContentId()) ->filterByProduct($event->getProduct())->count() <= 0) { @@ -198,8 +192,8 @@ class Product extends BaseAction implements EventSubscriberInterface } } - public function removeContent(ProductDeleteContentEvent $event) { - + public function removeContent(ProductDeleteContentEvent $event) + { $content = ProductAssociatedContentQuery::create() ->filterByContentId($event->getContentId()) ->filterByProduct($event->getProduct())->findOne() @@ -212,8 +206,8 @@ class Product extends BaseAction implements EventSubscriberInterface ; } - public function addCategory(ProductAddCategoryEvent $event) { - + public function addCategory(ProductAddCategoryEvent $event) + { if (ProductCategoryQuery::create() ->filterByProduct($event->getProduct()) ->filterByCategoryId($event->getCategoryId()) @@ -230,8 +224,8 @@ class Product extends BaseAction implements EventSubscriberInterface } } - public function removeCategory(ProductDeleteCategoryEvent $event) { - + public function removeCategory(ProductDeleteCategoryEvent $event) + { $productCategory = ProductCategoryQuery::create() ->filterByProduct($event->getProduct()) ->filterByCategoryId($event->getCategoryId()) @@ -240,8 +234,8 @@ class Product extends BaseAction implements EventSubscriberInterface if ($productCategory != null) $productCategory->delete(); } - public function addAccessory(ProductAddAccessoryEvent $event) { - + public function addAccessory(ProductAddAccessoryEvent $event) + { if (AccessoryQuery::create() ->filterByAccessory($event->getAccessoryId()) ->filterByProductId($event->getProduct()->getId())->count() <= 0) { @@ -257,8 +251,8 @@ class Product extends BaseAction implements EventSubscriberInterface } } - public function removeAccessory(ProductDeleteAccessoryEvent $event) { - + public function removeAccessory(ProductDeleteAccessoryEvent $event) + { $accessory = AccessoryQuery::create() ->filterByAccessory($event->getAccessoryId()) ->filterByProductId($event->getProduct()->getId())->findOne() @@ -271,8 +265,8 @@ class Product extends BaseAction implements EventSubscriberInterface ; } - public function setProductTemplate(ProductSetTemplateEvent $event) { - + public function setProductTemplate(ProductSetTemplateEvent $event) + { $product = $event->getProduct(); // Delete all product feature relations @@ -310,8 +304,8 @@ class Product extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(ProductAssociatedContentQuery::create(), $event); } - public function updateFeatureProductValue(FeatureProductUpdateEvent $event) { - + public function updateFeatureProductValue(FeatureProductUpdateEvent $event) + { // If the feature is not free text, it may have one ore more values. // If the value exists, we do not change it // If the value does not exists, we create it. @@ -343,8 +337,7 @@ class Product extends BaseAction implements EventSubscriberInterface if ($event->getIsTextValue() == true) { $featureProduct->setFreeTextValue($event->getFeatureValue()); - } - else { + } else { $featureProduct->setFeatureAvId($event->getFeatureValue()); } @@ -353,8 +346,8 @@ class Product extends BaseAction implements EventSubscriberInterface $event->setFeatureProduct($featureProduct); } - public function deleteFeatureProductValue(FeatureProductDeleteEvent $event) { - + public function deleteFeatureProductValue(FeatureProductDeleteEvent $event) + { $featureProduct = FeatureProductQuery::create() ->filterByProductId($event->getProductId()) ->filterByFeatureId($event->getFeatureId()) @@ -362,8 +355,8 @@ class Product extends BaseAction implements EventSubscriberInterface ; } - public function createProductCombination(ProductCreateCombinationEvent $event) { - + public function createProductCombination(ProductCreateCombinationEvent $event) + { $con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME); $con->beginTransaction(); @@ -399,7 +392,7 @@ class Product extends BaseAction implements EventSubscriberInterface if (count($combinationAttributes) > 0) { - foreach($combinationAttributes as $attributeAvId) { + foreach ($combinationAttributes as $attributeAvId) { $attributeAv = AttributeAvQuery::create()->findPk($attributeAvId); @@ -417,8 +410,7 @@ class Product extends BaseAction implements EventSubscriberInterface // Store all the stuff ! $con->commit(); - } - catch(\Exception $ex) { + } catch (\Exception $ex) { $con->rollback(); @@ -426,8 +418,8 @@ class Product extends BaseAction implements EventSubscriberInterface } } - public function deleteProductCombination(ProductDeleteCombinationEvent $event) { - + public function deleteProductCombination(ProductDeleteCombinationEvent $event) + { if (null !== $pse = ProductSaleElementsQuery::create()->findPk($event->getProductSaleElementId())) { $pse->delete(); } diff --git a/core/lib/Thelia/Action/Template.php b/core/lib/Thelia/Action/Template.php index 47d5d7a4d..c5ea6b03e 100644 --- a/core/lib/Thelia/Action/Template.php +++ b/core/lib/Thelia/Action/Template.php @@ -30,24 +30,17 @@ use Thelia\Model\Template as TemplateModel; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\TemplateUpdateEvent; -use Thelia\Core\Event\TemplateCreateEvent; -use Thelia\Core\Event\TemplateDeleteEvent; -use Thelia\Model\ConfigQuery; -use Thelia\Model\TemplateAv; -use Thelia\Model\TemplateAvQuery; +use Thelia\Core\Event\Template\TemplateUpdateEvent; +use Thelia\Core\Event\Template\TemplateCreateEvent; +use Thelia\Core\Event\Template\TemplateDeleteEvent; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\CategoryEvent; -use Thelia\Core\Event\TemplateEvent; -use Thelia\Model\TemplateTemplate; -use Thelia\Model\TemplateTemplateQuery; use Thelia\Model\ProductQuery; -use Thelia\Core\Event\TemplateAddAttributeEvent; -use Thelia\Core\Event\TemplateDeleteAttributeEvent; +use Thelia\Core\Event\Template\TemplateAddAttributeEvent; +use Thelia\Core\Event\Template\TemplateDeleteAttributeEvent; use Thelia\Model\AttributeTemplateQuery; use Thelia\Model\AttributeTemplate; -use Thelia\Core\Event\TemplateDeleteFeatureEvent; -use Thelia\Core\Event\TemplateAddFeatureEvent; +use Thelia\Core\Event\Template\TemplateDeleteFeatureEvent; +use Thelia\Core\Event\Template\TemplateAddFeatureEvent; use Thelia\Model\FeatureTemplateQuery; use Thelia\Model\FeatureTemplate; @@ -56,7 +49,7 @@ class Template extends BaseAction implements EventSubscriberInterface /** * Create a new template entry * - * @param TemplateCreateEvent $event + * @param \Thelia\Core\Event\Template\TemplateCreateEvent $event */ public function create(TemplateCreateEvent $event) { @@ -77,7 +70,7 @@ class Template extends BaseAction implements EventSubscriberInterface /** * Change a product template * - * @param TemplateUpdateEvent $event + * @param \Thelia\Core\Event\Template\TemplateUpdateEvent $event */ public function update(TemplateUpdateEvent $event) { @@ -99,7 +92,7 @@ class Template extends BaseAction implements EventSubscriberInterface /** * Delete a product template entry * - * @param TemplateDeleteEvent $event + * @param \Thelia\Core\Event\Template\TemplateDeleteEvent $event */ public function delete(TemplateDeleteEvent $event) { @@ -121,8 +114,8 @@ class Template extends BaseAction implements EventSubscriberInterface } } - public function addAttribute(TemplateAddAttributeEvent $event) { - + public function addAttribute(TemplateAddAttributeEvent $event) + { if (null === AttributeTemplateQuery::create()->filterByAttributeId($event->getAttributeId())->filterByTemplate($event->getTemplate())->findOne()) { $attribute_template = new AttributeTemplate(); @@ -155,8 +148,8 @@ class Template extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(FeatureTemplateQuery::create(), $event); } - public function deleteAttribute(TemplateDeleteAttributeEvent $event) { - + public function deleteAttribute(TemplateDeleteAttributeEvent $event) + { $attribute_template = AttributeTemplateQuery::create() ->filterByAttributeId($event->getAttributeId()) ->filterByTemplate($event->getTemplate())->findOne() @@ -165,8 +158,8 @@ class Template extends BaseAction implements EventSubscriberInterface if ($attribute_template !== null) $attribute_template->delete(); } - public function addFeature(TemplateAddFeatureEvent $event) { - + public function addFeature(TemplateAddFeatureEvent $event) + { if (null === FeatureTemplateQuery::create()->filterByFeatureId($event->getFeatureId())->filterByTemplate($event->getTemplate())->findOne()) { $feature_template = new FeatureTemplate(); @@ -179,8 +172,8 @@ class Template extends BaseAction implements EventSubscriberInterface } } - public function deleteFeature(TemplateDeleteFeatureEvent $event) { - + public function deleteFeature(TemplateDeleteFeatureEvent $event) + { $feature_template = FeatureTemplateQuery::create() ->filterByFeatureId($event->getFeatureId()) ->filterByTemplate($event->getTemplate())->findOne() @@ -210,4 +203,4 @@ class Template extends BaseAction implements EventSubscriberInterface ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Cart/CartTrait.php b/core/lib/Thelia/Cart/CartTrait.php index 8ced1b6c1..116a26da9 100755 --- a/core/lib/Thelia/Cart/CartTrait.php +++ b/core/lib/Thelia/Cart/CartTrait.php @@ -29,7 +29,7 @@ use Thelia\Model\Customer; use Symfony\Component\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Session\Session; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\CartEvent; +use Thelia\Core\Event\Cart\CartEvent; /** * managed cart diff --git a/core/lib/Thelia/Command/CacheClear.php b/core/lib/Thelia/Command/CacheClear.php index 1126f99a6..e85e29741 100755 --- a/core/lib/Thelia/Command/CacheClear.php +++ b/core/lib/Thelia/Command/CacheClear.php @@ -73,10 +73,11 @@ class CacheClear extends ContainerAwareCommand try { $directoryBrowser = new \DirectoryIterator($dir); - } catch(\UnexpectedValueException $e) { + } catch (\UnexpectedValueException $e) { // throws same exception code for does not exist and permission denied ... - if(!file_exists($dir)) { + if (!file_exists($dir)) { $output->writeln(sprintf("%s cache dir already clear", $dir)); + return; } diff --git a/core/lib/Thelia/Command/ClearImageCache.php b/core/lib/Thelia/Command/ClearImageCache.php index d2010ead1..8401e47f3 100755 --- a/core/lib/Thelia/Command/ClearImageCache.php +++ b/core/lib/Thelia/Command/ClearImageCache.php @@ -27,7 +27,7 @@ use Thelia\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Thelia\Core\Event\ImageEvent; +use Thelia\Core\Event\Image\ImageEvent; use Thelia\Core\HttpFoundation\Request; use Symfony\Component\Console\Input\InputArgument; use Thelia\Core\Event\TheliaEvents; diff --git a/core/lib/Thelia/Command/Install.php b/core/lib/Thelia/Command/Install.php index 03b7fda48..6423d861a 100755 --- a/core/lib/Thelia/Command/Install.php +++ b/core/lib/Thelia/Command/Install.php @@ -28,6 +28,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; use Thelia\Command\ContainerAwareCommand; +use Thelia\Install\CheckPermission; use Thelia\Install\Database; /** @@ -82,6 +83,9 @@ class Install extends ContainerAwareCommand '', 'Welcome to Thelia install process', 'You need information about your database configuration (host, username, password, database name, etc)', + '', + 'Caution : You are installing Thelia in cli mode, we verify some information, but this information are only available for the cli php sapi', + 'This informations can be different in your apache or cgi php.ini files', '' )); @@ -136,40 +140,35 @@ class Install extends ContainerAwareCommand "Checking some permissions" )); - $confDir = THELIA_ROOT . "local/config"; - $cacheDir = THELIA_ROOT . "cache"; - $logDir = THELIA_ROOT . "log"; + $permissions = new CheckPermission(false, $this->getContainer()->get('thelia.translator')); + $isValid = $permissions->exec(); - $conf = is_writable($confDir); - $cache = is_writable($cacheDir); - $log = is_writable($logDir); + foreach($permissions->getValidationMessages() as $item => $data) { + if($data['status']) { + $output->writeln(array( + sprintf("%s ... %s", + $data['text'], + "Ok") + ) + ); + } else { + $output->writeln(array( + sprintf("%s %s", + $data['text'], + sprintf("%s", $data["hint"]) + ) + )); + } - $output->writeln(array( - sprintf( - "config directory(%s)... %s", - $confDir, - $conf ? "Ok" : "Fail" - ), - sprintf( - "cache directory(%s)... %s" - ,$cacheDir, - $cache ? "Ok" : "Fail" - ), - sprintf( - "log directory(%s)... %s", - $logDir, - $log ? "Ok" : "Fail" - ), - )); - - if ($conf === false || $cache === false || $log === false) { - $output->writeln(array( - "", - "Please put correct permission and reload install process" - )); - exit; } + if(false === $isValid) { + $output->writeln(array( + "", + "Please put correct permissions and reload install process" + )); + exit; + } } /** diff --git a/core/lib/Thelia/Command/ModuleActivateCommand.php b/core/lib/Thelia/Command/ModuleActivateCommand.php index cddfd5290..d5ca8156d 100755 --- a/core/lib/Thelia/Command/ModuleActivateCommand.php +++ b/core/lib/Thelia/Command/ModuleActivateCommand.php @@ -25,12 +25,9 @@ namespace Thelia\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Filesystem\Exception\IOException; -use Thelia\Command\ContainerAwareCommand; use Thelia\Model\ModuleQuery; /** @@ -62,7 +59,7 @@ class ModuleActivateCommand extends BaseModuleGenerate $module = ModuleQuery::create()->findOneByCode($moduleCode); - if(null === $module) { + if (null === $module) { throw new \RuntimeException(sprintf("module %s not found", $moduleCode)); } @@ -74,7 +71,7 @@ class ModuleActivateCommand extends BaseModuleGenerate $moduleInstance = $moduleReflection->newInstance(); $moduleInstance->activate(); - } catch(\Exception $e) { + } catch (\Exception $e) { throw new \RuntimeException(sprintf("Activation fail with Exception : [%d] %s", $e->getCode(), $e->getMessage())); } diff --git a/core/lib/Thelia/Command/ReloadDatabaseCommand.php b/core/lib/Thelia/Command/ReloadDatabaseCommand.php index 311b20552..20aad0265 100644 --- a/core/lib/Thelia/Command/ReloadDatabaseCommand.php +++ b/core/lib/Thelia/Command/ReloadDatabaseCommand.php @@ -56,7 +56,7 @@ class ReloadDatabaseCommand extends BaseModuleGenerate $tables = $connection->query("SHOW TABLES"); $connection->query("SET FOREIGN_KEY_CHECKS = 0"); - foreach($tables as $table) { + foreach ($tables as $table) { $connection->query(sprintf("DROP TABLE `%s`", $table[0])); } $connection->query("SET FOREIGN_KEY_CHECKS = 1"); diff --git a/core/lib/Thelia/Command/Skeleton/Module/Class.php b/core/lib/Thelia/Command/Skeleton/Module/Class.php index c9c7109ac..c4c90aa60 100755 --- a/core/lib/Thelia/Command/Skeleton/Module/Class.php +++ b/core/lib/Thelia/Command/Skeleton/Module/Class.php @@ -25,7 +25,7 @@ namespace %%NAMESPACE%%; use Thelia\Module\BaseModule; -class Class extends BaseModule +class %%CLASSNAME%% extends BaseModule { /** * YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class diff --git a/core/lib/Thelia/Config/DatabaseConfiguration.php b/core/lib/Thelia/Config/DatabaseConfiguration.php index 1c0622623..6d74a03fb 100755 --- a/core/lib/Thelia/Config/DatabaseConfiguration.php +++ b/core/lib/Thelia/Config/DatabaseConfiguration.php @@ -60,7 +60,7 @@ class DatabaseConfiguration implements ConfigurationInterface ->cannotBeEmpty() ->end() ->scalarNode("classname") - ->defaultValue("\Propel\Runtime\Connection\PropelPDO") + ->defaultValue("\Propel\Runtime\Connection\ConnectionWrapper") ->end() ->end() ->end() diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml index f153a8de0..a9b3e247d 100755 --- a/core/lib/Thelia/Config/Resources/action.xml +++ b/core/lib/Thelia/Config/Resources/action.xml @@ -111,6 +111,16 @@ + + + + + + + + + + diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 66ab0f69f..d4d63ac77 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -21,8 +21,12 @@ + + + + @@ -84,6 +88,7 @@
+ @@ -204,6 +209,10 @@ + + + + diff --git a/core/lib/Thelia/Config/Resources/routing.xml b/core/lib/Thelia/Config/Resources/routing.xml index efeea61e8..54159734c 100755 --- a/core/lib/Thelia/Config/Resources/routing.xml +++ b/core/lib/Thelia/Config/Resources/routing.xml @@ -64,7 +64,7 @@ %kernel.debug% - + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index fa71f7240..5df02e5bd 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -123,9 +123,35 @@ - + - + + Thelia\Controller\Admin\AddressController::deleteAction + + + + Thelia\Controller\Admin\AddressController::useAddressAction + + + + Thelia\Controller\Admin\AddressController::createAction + + + + Thelia\Controller\Admin\AddressController::updateAction + \d+ + + + + Thelia\Controller\Admin\AddressController::processUpdateAction + \d+ + + + + + + + Thelia\Controller\Admin\OrderController::indexAction @@ -134,7 +160,33 @@ \d+ - + + Thelia\Controller\Admin\OrderController::updateStatus + + + + Thelia\Controller\Admin\OrderController::updateStatus + + + + Thelia\Controller\Admin\OrderController::updateDeliveryRef + + + + Thelia\Controller\Admin\OrderController::updateAddress + + + + Thelia\Controller\Admin\OrderController::generateInvoicePdf + \d+ + + + + Thelia\Controller\Admin\OrderController::generateDeliveryPdf + \d+ + + + @@ -353,8 +405,31 @@ Thelia\Controller\Admin\FolderController::updatePositionAction + + + + Thelia\Controller\Admin\CountryController::defaultAction + + + + Thelia\Controller\Admin\CountryController::createAction + + + + Thelia\Controller\Admin\CountryController::updateAction + \d+ + + + + Thelia\Controller\Admin\CountryController::deleteAction + + + + Thelia\Controller\Admin\CountryController::toggleDefaultAction + + - + Thelia\Controller\Admin\ContentController::createAction @@ -379,6 +454,14 @@ Thelia\Controller\Admin\ContentController::deleteAction + + Thelia\Controller\Admin\ContentController::addAdditionalFolderAction + + + + Thelia\Controller\Admin\ContentController::removeAdditionalFolderAction + + @@ -608,20 +691,7 @@ - - - Thelia\Controller\Admin\CountryController::indexAction - - - - Thelia\Controller\Admin\CountryController::createAction - - - - Thelia\Controller\Admin\CountryController::updateAction - \d+ - diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index 5b26a6ed6..53a0408a0 100755 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -117,22 +117,22 @@ Thelia\Controller\Front\OrderController::deliver - order_delivery + order-delivery Thelia\Controller\Front\DefaultController::noAction - order_delivery + order-delivery Thelia\Controller\Front\OrderController::invoice - order_invoice + order-invoice Thelia\Controller\Front\DefaultController::noAction - order_invoice + order-invoice @@ -141,7 +141,7 @@ Thelia\Controller\Front\OrderController::orderPlaced - order_placed + order-placed diff --git a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php index d2e7e5508..170c35c4f 100644 --- a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php +++ b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php @@ -25,7 +25,6 @@ namespace Thelia\Controller\Admin; use Thelia\Form\Exception\FormValidationException; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\ToggleVisibilityEvent; /** * An abstract CRUD controller for Thelia ADMIN, to manage basic CRUD operations on a givent object. @@ -53,14 +52,13 @@ abstract class AbstractCrudController extends BaseAdminController protected $visibilityToggleEventIdentifier; protected $changePositionEventIdentifier; - /** * @param string $objectName the lower case object name. Example. "message" * - * @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual + * @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual * @param string $orderRequestParameterName Name of the request parameter that set the list order (null if list is not sortable) * - * @param string $viewPermissionIdentifier the 'view' permission identifier. Example: "admin.configuration.message.view" + * @param string $viewPermissionIdentifier the 'view' permission identifier. Example: "admin.configuration.message.view" * @param string $createPermissionIdentifier the 'create' permission identifier. Example: "admin.configuration.message.create" * @param string $updatePermissionIdentifier the 'update' permission identifier. Example: "admin.configuration.message.update" * @param string $deletePermissionIdentifier the 'delete' permission identifier. Example: "admin.configuration.message.delete" @@ -70,7 +68,7 @@ abstract class AbstractCrudController extends BaseAdminController * @param string $deleteEventIdentifier the dispatched delete TheliaEvent identifier. Example: TheliaEvents::MESSAGE_DELETE * * @param string $visibilityToggleEventIdentifier the dispatched visibility toggle TheliaEvent identifier, or null if the object has no visible options. Example: TheliaEvents::MESSAGE_TOGGLE_VISIBILITY - * @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION + * @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION */ public function __construct( $objectName, @@ -109,94 +107,93 @@ abstract class AbstractCrudController extends BaseAdminController /** * Return the creation form for this object */ - protected abstract function getCreationForm(); + abstract protected function getCreationForm(); /** * Return the update form for this object */ - protected abstract function getUpdateForm(); + abstract protected function getUpdateForm(); /** * Hydrate the update form for this object, before passing it to the update template * * @param unknown $object */ - protected abstract function hydrateObjectForm($object); + abstract protected function hydrateObjectForm($object); /** * Creates the creation event with the provided form data * * @param unknown $formData */ - protected abstract function getCreationEvent($formData); + abstract protected function getCreationEvent($formData); /** * Creates the update event with the provided form data * * @param unknown $formData */ - protected abstract function getUpdateEvent($formData); + abstract protected function getUpdateEvent($formData); /** * Creates the delete event with the provided form data */ - protected abstract function getDeleteEvent(); + abstract protected function getDeleteEvent(); /** * Return true if the event contains the object, e.g. the action has updated the object in the event. * * @param unknown $event */ - protected abstract function eventContainsObject($event); + abstract protected function eventContainsObject($event); /** * Get the created object from an event. * * @param unknown $createEvent */ - protected abstract function getObjectFromEvent($event); + abstract protected function getObjectFromEvent($event); /** * Load an existing object from the database */ - protected abstract function getExistingObject(); + abstract protected function getExistingObject(); /** * Returns the object label form the object event (name, title, etc.) * * @param unknown $object */ - protected abstract function getObjectLabel($object); + abstract protected function getObjectLabel($object); /** * Returns the object ID from the object * * @param unknown $object */ - protected abstract function getObjectId($object); + abstract protected function getObjectId($object); /** * Render the main list template * * @param unknown $currentOrder, if any, null otherwise. */ - protected abstract function renderListTemplate($currentOrder); + abstract protected function renderListTemplate($currentOrder); /** * Render the edition template */ - protected abstract function renderEditionTemplate(); + abstract protected function renderEditionTemplate(); /** * Redirect to the edition template */ - protected abstract function redirectToEditionTemplate(); + abstract protected function redirectToEditionTemplate(); /** * Redirect to the list template */ - protected abstract function redirectToListTemplate(); - + abstract protected function redirectToListTemplate(); protected function createUpdatePositionEvent($positionChangeMode, $positionValue) { @@ -211,7 +208,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Put in this method post object creation processing if required. * - * @param unknown $createEvent the create event + * @param unknown $createEvent the create event * @return Response a response, or null to continue normal processing */ protected function performAdditionalCreateAction($createEvent) @@ -222,7 +219,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Put in this method post object update processing if required. * - * @param unknown $updateEvent the update event + * @param unknown $updateEvent the update event * @return Response a response, or null to continue normal processing */ protected function performAdditionalUpdateAction($updateEvent) @@ -233,7 +230,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Put in this method post object delete processing if required. * - * @param unknown $deleteEvent the delete event + * @param unknown $deleteEvent the delete event * @return Response a response, or null to continue normal processing */ protected function performAdditionalDeleteAction($deleteEvent) @@ -244,7 +241,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Put in this method post object position change processing if required. * - * @param unknown $deleteEvent the delete event + * @param unknown $deleteEvent the delete event * @return Response a response, or null to continue normal processing */ protected function performAdditionalUpdatePositionAction($positionChangeEvent) @@ -282,7 +279,6 @@ abstract class AbstractCrudController extends BaseAdminController public function defaultAction() { if (null !== $response = $this->checkAuth($this->viewPermissionIdentifier)) return $response; - return $this->renderList(); } @@ -323,22 +319,19 @@ abstract class AbstractCrudController extends BaseAdminController $response = $this->performAdditionalCreateAction($createEvent); - if ($response == null) { + if ($response == null) { // Substitute _ID_ in the URL with the ID of the created object $successUrl = str_replace('_ID_', $this->getObjectId($createdObject), $creationForm->getSuccessUrl()); // Redirect to the success URL $this->redirect($successUrl); - } - else { + } else { return $response; } - } - catch (FormValidationException $ex) { + } catch (FormValidationException $ex) { // Form cannot be validated $error_msg = $this->createStandardFormValidationErrorMessage($ex); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any other error $error_msg = $ex->getMessage(); } @@ -423,16 +416,13 @@ abstract class AbstractCrudController extends BaseAdminController // Redirect to the success URL $this->redirect($changeForm->getSuccessUrl()); - } - else { + } else { return $response; } - } - catch (FormValidationException $ex) { + } catch (FormValidationException $ex) { // Form cannot be validated $error_msg = $this->createStandardFormValidationErrorMessage($ex); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any other error $error_msg = $ex->getMessage(); } @@ -469,8 +459,7 @@ abstract class AbstractCrudController extends BaseAdminController $event = $this->createUpdatePositionEvent($mode, $position); $this->dispatch($this->changePositionEventIdentifier, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -479,14 +468,13 @@ abstract class AbstractCrudController extends BaseAdminController if ($response == null) { $this->redirectToListTemplate(); - } - else { + } else { return $response; } } - protected function genericUpdatePositionAction($object, $eventName, $doFinalRedirect = true) { - + protected function genericUpdatePositionAction($object, $eventName, $doFinalRedirect = true) + { // Check current user authorization if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response; @@ -507,8 +495,7 @@ abstract class AbstractCrudController extends BaseAdminController $event = new UpdatePositionEvent($object->getId(), $mode, $position); $this->dispatch($eventName, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } diff --git a/core/lib/Thelia/Controller/Admin/AddressController.php b/core/lib/Thelia/Controller/Admin/AddressController.php new file mode 100644 index 000000000..38ec9cb6b --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/AddressController.php @@ -0,0 +1,306 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; +use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent; +use Thelia\Core\Event\Address\AddressEvent; +use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Form\AddressCreateForm; +use Thelia\Form\AddressUpdateForm; +use Thelia\Model\AddressQuery; +use Thelia\Model\CustomerQuery; + + +/** + * Class AddressController + * @package Thelia\Controller\Admin + * @author Manuel Raynaud + */ +class AddressController extends AbstractCrudController +{ + public function __construct() + { + parent::__construct( + 'address', + null, + null, + + 'admin.customer.update.view', + 'admin.address.create', + 'admin.address.update', + 'admin.address.delete', + + TheliaEvents::ADDRESS_CREATE, + TheliaEvents::ADDRESS_UPDATE, + TheliaEvents::ADDRESS_DELETE, + null, + null + + ); + } + + public function useAddressAction() + { + if (null !== $response = $this->checkAuth("admin.customer.update")) return $response; + + $address_id = $this->getRequest()->request->get('address_id'); + + try { + $address = AddressQuery::create()->findPk($address_id); + + if (null === $address) { + throw new \InvalidArgumentException(sprintf('%d address does not exists', $address_id)); + } + + $addressEvent = new AddressEvent($address); + + $this->dispatch(TheliaEvents::ADDRESS_DEFAULT, $addressEvent); + + $this->adminLogAppend(sprintf("address %d for customer %d removal", $address_id, $address->getCustomerId())); + } catch(\Exception $e) { + \Thelia\Log\Tlog::getInstance()->error(sprintf("error during address removal with message %s", $e->getMessage())); + } + + $this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId())); + } + + /** + * Return the creation form for this object + */ + protected function getCreationForm() + { + return new AddressCreateForm($this->getRequest()); + } + + /** + * Return the update form for this object + */ + protected function getUpdateForm() + { + return new AddressUpdateForm($this->getRequest()); + } + + /** + * Hydrate the update form for this object, before passing it to the update template + * + * @param \Thelia\Model\Address $object + */ + protected function hydrateObjectForm($object) + { + $data = array( + "label" => $object->getLabel(), + "title" => $object->getTitleId(), + "firstname" => $object->getFirstname(), + "lastname" => $object->getLastname(), + "address1" => $object->getAddress1(), + "address2" => $object->getAddress2(), + "address3" => $object->getAddress3(), + "zipcode" => $object->getZipcode(), + "city" => $object->getCity(), + "country" => $object->getCountryId(), + "cellphone" => $object->getCellphone(), + "phone" => $object->getPhone(), + "company" => $object->getCompany() + ); + + return new AddressUpdateForm($this->getRequest(), "form", $data); + } + + /** + * Creates the creation event with the provided form data + * + * @param unknown $formData + */ + protected function getCreationEvent($formData) + { + $event = $this->getCreateOrUpdateEvent($formData); + + $customer = CustomerQuery::create()->findPk($this->getRequest()->get("customer_id")); + + $event->setCustomer($customer); + + return $event; + } + + /** + * Creates the update event with the provided form data + * + * @param unknown $formData + */ + protected function getUpdateEvent($formData) + { + $event = $this->getCreateOrUpdateEvent($formData); + + $event->setAddress($this->getExistingObject()); + + return $event; + } + + protected function getCreateOrUpdateEvent($formData) + { + $event = new AddressCreateOrUpdateEvent( + $formData["label"], + $formData["title"], + $formData["firstname"], + $formData["lastname"], + $formData["address1"], + $formData["address2"], + $formData["address3"], + $formData["zipcode"], + $formData["city"], + $formData["country"], + $formData["cellphone"], + $formData["phone"], + $formData["company"], + $formData["is_default"] + ); + + + + return $event; + + } + + /** + * Creates the delete event with the provided form data + */ + protected function getDeleteEvent() + { + return new AddressEvent($this->getExistingObject()); + } + + /** + * Return true if the event contains the object, e.g. the action has updated the object in the event. + * + * @param unknown $event + */ + protected function eventContainsObject($event) + { + return null !== $event->getAddress(); + } + + /** + * Get the created object from an event. + * + * @param unknown $createEvent + */ + protected function getObjectFromEvent($event) + { + return null; + } + + /** + * Load an existing object from the database + */ + protected function getExistingObject() + { + return AddressQuery::create()->findPk($this->getRequest()->get('address_id')); + } + + /** + * Returns the object label form the object event (name, title, etc.) + * + * @param unknown $object + */ + protected function getObjectLabel($object) + { + return $object->getLabel(); + } + + /** + * Returns the object ID from the object + * + * @param unknown $object + */ + protected function getObjectId($object) + { + return $object->getId(); + } + + /** + * Render the main list template + * + * @param unknown $currentOrder, if any, null otherwise. + */ + protected function renderListTemplate($currentOrder) + { + // TODO: Implement renderListTemplate() method. + } + + /** + * Render the edition template + */ + protected function renderEditionTemplate() + { + return $this->render('ajax/address-update-modal', array( + "address_id" => $this->getRequest()->get('address_id'), + "customer_id" => $this->getExistingObject()->getCustomerId() + )); + } + + /** + * Redirect to the edition template + */ + protected function redirectToEditionTemplate() + { + $address = $this->getExistingObject(); + $this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId())); + } + + /** + * Redirect to the list template + */ + protected function redirectToListTemplate() + { + // TODO: Implement redirectToListTemplate() method. + } + + /** + * Put in this method post object delete processing if required. + * + * @param \Thelia\Core\Event\AddressEvent $deleteEvent the delete event + * @return Response a response, or null to continue normal processing + */ + protected function performAdditionalDeleteAction($deleteEvent) + { + $address = $deleteEvent->getAddress(); + $this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId())); + } + + /** + * Put in this method post object creation processing if required. + * + * @param AddressCreateOrUpdateEvent $createEvent the create event + * @return Response a response, or null to continue normal processing + */ + protected function performAdditionalCreateAction($createEvent) + { + $this->redirectToEditionTemplate(); + } + + protected function performAdditionalUpdateAction($event) + { + $this->redirectToEditionTemplate(); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/AdminController.php b/core/lib/Thelia/Controller/Admin/AdminController.php index 2d3d80df1..0b76c79ff 100755 --- a/core/lib/Thelia/Controller/Admin/AdminController.php +++ b/core/lib/Thelia/Controller/Admin/AdminController.php @@ -23,10 +23,6 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Security\Authentication\AdminTokenAuthenticator; -use Thelia\Model\ConfigQuery; -use Thelia\Core\Security\Exception\TokenAuthenticationException; - class AdminController extends BaseAdminController { public function indexAction() @@ -36,6 +32,6 @@ class AdminController extends BaseAdminController public function updateAction() { - return $this->render("profile-edit"); + return $this->render("profile-edit"); } } diff --git a/core/lib/Thelia/Controller/Admin/AttributeAvController.php b/core/lib/Thelia/Controller/Admin/AttributeAvController.php index 1ab12a081..bc6984e9e 100644 --- a/core/lib/Thelia/Controller/Admin/AttributeAvController.php +++ b/core/lib/Thelia/Controller/Admin/AttributeAvController.php @@ -23,10 +23,10 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Event\AttributeAvDeleteEvent; +use Thelia\Core\Event\Attribute\AttributeAvDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\AttributeAvUpdateEvent; -use Thelia\Core\Event\AttributeAvCreateEvent; +use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent; +use Thelia\Core\Event\Attribute\AttributeAvCreateEvent; use Thelia\Model\AttributeAvQuery; use Thelia\Form\AttributeAvModificationForm; use Thelia\Form\AttributeAvCreationForm; @@ -193,4 +193,4 @@ class AttributeAvController extends AbstractCrudController $this->getViewArguments() ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/AttributeController.php b/core/lib/Thelia/Controller/Admin/AttributeController.php index 48a65baa7..689b92a01 100644 --- a/core/lib/Thelia/Controller/Admin/AttributeController.php +++ b/core/lib/Thelia/Controller/Admin/AttributeController.php @@ -23,18 +23,18 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Event\AttributeDeleteEvent; +use Thelia\Core\Event\Attribute\AttributeDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\AttributeUpdateEvent; -use Thelia\Core\Event\AttributeCreateEvent; +use Thelia\Core\Event\Attribute\AttributeUpdateEvent; +use Thelia\Core\Event\Attribute\AttributeCreateEvent; use Thelia\Model\AttributeQuery; use Thelia\Form\AttributeModificationForm; use Thelia\Form\AttributeCreationForm; use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Model\AttributeAv; use Thelia\Model\AttributeAvQuery; -use Thelia\Core\Event\AttributeAvUpdateEvent; -use Thelia\Core\Event\AttributeEvent; +use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent; +use Thelia\Core\Event\Attribute\AttributeEvent; /** * Manages attributes @@ -113,7 +113,7 @@ class AttributeController extends AbstractCrudController if ($attr_values !== null) { - foreach($attr_values as $id => $value) { + foreach ($attr_values as $id => $value) { $event = new AttributeAvUpdateEvent($id); @@ -168,7 +168,7 @@ class AttributeController extends AbstractCrudController $attr_array = array(); - foreach($attr_av_list as $attr_av) { + foreach ($attr_av_list as $attr_av) { $attr_array[$attr_av->getId()] = $attr_av->getTitle(); } @@ -262,8 +262,7 @@ class AttributeController extends AbstractCrudController $this->dispatch($eventType, $event); } - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -286,4 +285,4 @@ class AttributeController extends AbstractCrudController { return $this->addRemoveFromAllTemplates(TheliaEvents::ATTRIBUTE_ADD_TO_ALL_TEMPLATES); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/BaseAdminController.php b/core/lib/Thelia/Controller/Admin/BaseAdminController.php index fa505b5c3..5d99a877b 100755 --- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php +++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php @@ -51,7 +51,7 @@ class BaseAdminController extends BaseController /** * Helper to append a message to the admin log. * - * @param unknown $message + * @param string $message */ public function adminLogAppend($message) { @@ -187,12 +187,12 @@ class BaseAdminController extends BaseController /** * @return a ParserInterface instance parser */ - protected function getParser() + protected function getParser($template = null) { $parser = $this->container->get("thelia.parser"); // Define the template thant shoud be used - $parser->setTemplate(ConfigQuery::read('base_admin_template', 'admin/default')); + $parser->setTemplate($template ?: ConfigQuery::read('base_admin_template', 'admin/default')); return $parser; } @@ -246,9 +246,9 @@ class BaseAdminController extends BaseController * @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml * @param unknown $urlParameters the URL parametrs, as a var/value pair array */ - public function redirectToRoute($routeId, $urlParameters = array()) + public function redirectToRoute($routeId, $urlParameters = array(), $routeParameters = array()) { - $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId), $urlParameters)); + $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId, $routeParameters), $urlParameters)); } /** @@ -293,20 +293,19 @@ class BaseAdminController extends BaseController return $this->getCurrentEditionLang()->getLocale(); } - /** * Return the current list order identifier for a given object name, * updating in using the current request. * - * @param unknown $objectName the object name (e.g. 'attribute', 'message') + * @param unknown $objectName the object name (e.g. 'attribute', 'message') * @param unknown $requestParameterName the name of the request parameter that defines the list order - * @param unknown $defaultListOrder the default order to use, if none is defined - * @param string $updateSession if true, the session will be updated with the current order. + * @param unknown $defaultListOrder the default order to use, if none is defined + * @param string $updateSession if true, the session will be updated with the current order. * * @return String the current liste order. */ - protected function getListOrderFromSession($objectName, $requestParameterName, $defaultListOrder, $updateSession = true) { - + protected function getListOrderFromSession($objectName, $requestParameterName, $defaultListOrder, $updateSession = true) + { $order = $defaultListOrder; $orderSessionIdentifier = sprintf("admin.%s.currentListOrder", $objectName); @@ -318,7 +317,6 @@ class BaseAdminController extends BaseController ); if ($updateSession) $this->getSession()->set($orderSessionIdentifier, $order); - return $order; } @@ -353,8 +351,8 @@ class BaseAdminController extends BaseController /** Clear the remember me cookie. * */ - protected function clearRememberMeCookie() { - + protected function clearRememberMeCookie() + { $ctp = new CookieTokenProvider(); $cookieName = ConfigQuery::read('admin_remember_me_cookie_name', 'armcn'); @@ -380,10 +378,12 @@ class BaseAdminController extends BaseController * Render the given template, and returns the result as a string. * * @param $templateName the complete template name, with extension - * @param array $args the template arguments + * @param array $args the template arguments + * @param null $templateDir + * * @return \Symfony\Component\HttpFoundation\Response */ - protected function renderRaw($templateName, $args = array()) + protected function renderRaw($templateName, $args = array(), $templateDir = null) { // Add the template standard extension @@ -419,7 +419,7 @@ class BaseAdminController extends BaseController // Render the template. try { - $data = $this->getParser()->render($templateName, $args); + $data = $this->getParser($templateDir)->render($templateName, $args); return $data; } catch (AuthenticationException $ex) { diff --git a/core/lib/Thelia/Controller/Admin/CategoryController.php b/core/lib/Thelia/Controller/Admin/CategoryController.php index 0b2b310ef..ff2dae1e4 100755 --- a/core/lib/Thelia/Controller/Admin/CategoryController.php +++ b/core/lib/Thelia/Controller/Admin/CategoryController.php @@ -24,19 +24,17 @@ namespace Thelia\Controller\Admin; use Symfony\Component\HttpFoundation\Response; -use Thelia\Core\Event\CategoryDeleteEvent; -use Thelia\Core\Event\ImageCreateOrUpdateEvent; +use Thelia\Core\Event\Category\CategoryDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\CategoryUpdateEvent; -use Thelia\Core\Event\CategoryCreateEvent; -use Thelia\Log\Tlog; +use Thelia\Core\Event\Category\CategoryUpdateEvent; +use Thelia\Core\Event\Category\CategoryCreateEvent; use Thelia\Model\CategoryQuery; use Thelia\Form\CategoryModificationForm; use Thelia\Form\CategoryCreationForm; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\CategoryToggleVisibilityEvent; -use Thelia\Core\Event\CategoryDeleteContentEvent; -use Thelia\Core\Event\CategoryAddContentEvent; +use Thelia\Core\Event\Category\CategoryToggleVisibilityEvent; +use Thelia\Core\Event\Category\CategoryDeleteContentEvent; +use Thelia\Core\Event\Category\CategoryAddContentEvent; use Thelia\Model\FolderQuery; use Thelia\Model\ContentQuery; use Propel\Runtime\ActiveQuery\Criteria; @@ -49,7 +47,8 @@ use Thelia\Model\CategoryAssociatedContentQuery; */ class CategoryController extends AbstractCrudController { - public function __construct() { + public function __construct() + { parent::__construct( 'category', 'manual', @@ -68,15 +67,18 @@ class CategoryController extends AbstractCrudController ); } - protected function getCreationForm() { + protected function getCreationForm() + { return new CategoryCreationForm($this->getRequest()); } - protected function getUpdateForm() { + protected function getUpdateForm() + { return new CategoryModificationForm($this->getRequest()); } - protected function getCreationEvent($formData) { + protected function getCreationEvent($formData) + { $createEvent = new CategoryCreateEvent(); $createEvent @@ -89,7 +91,8 @@ class CategoryController extends AbstractCrudController return $createEvent; } - protected function getUpdateEvent($formData) { + protected function getUpdateEvent($formData) + { $changeEvent = new CategoryUpdateEvent($formData['id']); // Create and dispatch the change event @@ -107,8 +110,8 @@ class CategoryController extends AbstractCrudController return $changeEvent; } - protected function createUpdatePositionEvent($positionChangeMode, $positionValue) { - + protected function createUpdatePositionEvent($positionChangeMode, $positionValue) + { return new UpdatePositionEvent( $this->getRequest()->get('category_id', null), $positionChangeMode, @@ -116,16 +119,18 @@ class CategoryController extends AbstractCrudController ); } - protected function getDeleteEvent() { + protected function getDeleteEvent() + { return new CategoryDeleteEvent($this->getRequest()->get('category_id', 0)); } - protected function eventContainsObject($event) { + protected function eventContainsObject($event) + { return $event->hasCategory(); } - protected function hydrateObjectForm($object) { - + protected function hydrateObjectForm($object) + { // Prepare the data that will hydrate the form $data = array( 'id' => $object->getId(), @@ -143,21 +148,25 @@ class CategoryController extends AbstractCrudController return new CategoryModificationForm($this->getRequest(), "form", $data); } - protected function getObjectFromEvent($event) { + protected function getObjectFromEvent($event) + { return $event->hasCategory() ? $event->getCategory() : null; } - protected function getExistingObject() { + protected function getExistingObject() + { return CategoryQuery::create() ->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('category_id', 0)); } - protected function getObjectLabel($object) { + protected function getObjectLabel($object) + { return $object->getTitle(); } - protected function getObjectId($object) { + protected function getObjectId($object) + { return $object->getId(); } @@ -170,8 +179,8 @@ class CategoryController extends AbstractCrudController ); } - protected function renderListTemplate($currentOrder) { - + protected function renderListTemplate($currentOrder) + { // Get product order $product_order = $this->getListOrderFromSession('product', 'product_order', 'manual'); @@ -183,19 +192,21 @@ class CategoryController extends AbstractCrudController )); } - protected function redirectToListTemplate() { + protected function redirectToListTemplate() + { $this->redirectToRoute( 'admin.categories.default', array('category_id' => $this->getRequest()->get('category_id', 0)) ); } - protected function renderEditionTemplate() { - + protected function renderEditionTemplate() + { return $this->render('category-edit', $this->getEditionArguments()); } - protected function redirectToEditionTemplate() { + protected function redirectToEditionTemplate() + { $this->redirectToRoute("admin.categories.update", $this->getEditionArguments()); } @@ -257,8 +268,8 @@ class CategoryController extends AbstractCrudController return null; } - public function getAvailableRelatedContentAction($categoryId, $folderId) { - + public function getAvailableRelatedContentAction($categoryId, $folderId) + { $result = array(); $folders = FolderQuery::create()->filterById($folderId)->find(); @@ -273,7 +284,7 @@ class CategoryController extends AbstractCrudController ; if ($list !== null) { - foreach($list as $item) { + foreach ($list as $item) { $result[] = array('id' => $item->getId(), 'title' => $item->getTitle()); } } @@ -282,8 +293,8 @@ class CategoryController extends AbstractCrudController return $this->jsonResponse(json_encode($result)); } - public function addRelatedContentAction() { - + public function addRelatedContentAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.categories.update")) return $response; @@ -298,8 +309,7 @@ class CategoryController extends AbstractCrudController try { $this->dispatch(TheliaEvents::CATEGORY_ADD_CONTENT, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -341,8 +351,8 @@ class CategoryController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function deleteRelatedContentAction() { - + public function deleteRelatedContentAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.categories.update")) return $response; @@ -357,8 +367,7 @@ class CategoryController extends AbstractCrudController try { $this->dispatch(TheliaEvents::CATEGORY_REMOVE_CONTENT, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } diff --git a/core/lib/Thelia/Controller/Admin/ConfigController.php b/core/lib/Thelia/Controller/Admin/ConfigController.php index 8701710b0..dc19107d8 100644 --- a/core/lib/Thelia/Controller/Admin/ConfigController.php +++ b/core/lib/Thelia/Controller/Admin/ConfigController.php @@ -23,14 +23,13 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Event\ConfigDeleteEvent; +use Thelia\Core\Event\Config\ConfigDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\ConfigUpdateEvent; -use Thelia\Core\Event\ConfigCreateEvent; +use Thelia\Core\Event\Config\ConfigUpdateEvent; +use Thelia\Core\Event\Config\ConfigCreateEvent; use Thelia\Model\ConfigQuery; use Thelia\Form\ConfigModificationForm; use Thelia\Form\ConfigCreationForm; -use Thelia\Core\Event\UpdatePositionEvent; /** * Manages variables @@ -39,7 +38,8 @@ use Thelia\Core\Event\UpdatePositionEvent; */ class ConfigController extends AbstractCrudController { - public function __construct() { + public function __construct() + { parent::__construct( 'variable', 'name', @@ -58,15 +58,18 @@ class ConfigController extends AbstractCrudController ); } - protected function getCreationForm() { + protected function getCreationForm() + { return new ConfigCreationForm($this->getRequest()); } - protected function getUpdateForm() { + protected function getUpdateForm() + { return new ConfigModificationForm($this->getRequest()); } - protected function getCreationEvent($data) { + protected function getCreationEvent($data) + { $createEvent = new ConfigCreateEvent(); $createEvent @@ -78,11 +81,11 @@ class ConfigController extends AbstractCrudController ->setSecured($data['secured']) ; - return $createEvent; } - protected function getUpdateEvent($data) { + protected function getUpdateEvent($data) + { $changeEvent = new ConfigUpdateEvent($data['id']); // Create and dispatch the change event @@ -101,16 +104,18 @@ class ConfigController extends AbstractCrudController return $changeEvent; } - protected function getDeleteEvent() { + protected function getDeleteEvent() + { return new ConfigDeleteEvent($this->getRequest()->get('variable_id')); } - protected function eventContainsObject($event) { + protected function eventContainsObject($event) + { return $event->hasConfig(); } - protected function hydrateObjectForm($object) { - + protected function hydrateObjectForm($object) + { // Prepare the data that will hydrate the form $data = array( 'id' => $object->getId(), @@ -129,40 +134,48 @@ class ConfigController extends AbstractCrudController return new ConfigModificationForm($this->getRequest(), "form", $data); } - protected function getObjectFromEvent($event) { + protected function getObjectFromEvent($event) + { return $event->hasConfig() ? $event->getConfig() : null; } - protected function getExistingObject() { + protected function getExistingObject() + { return ConfigQuery::create() ->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('variable_id')); } - protected function getObjectLabel($object) { + protected function getObjectLabel($object) + { return $object->getName(); } - protected function getObjectId($object) { + protected function getObjectId($object) + { return $object->getId(); } - protected function renderListTemplate($currentOrder) { + protected function renderListTemplate($currentOrder) + { return $this->render('variables', array('order' => $currentOrder)); } - protected function renderEditionTemplate() { + protected function renderEditionTemplate() + { return $this->render('variable-edit', array('variable_id' => $this->getRequest()->get('variable_id'))); } - protected function redirectToEditionTemplate() { + protected function redirectToEditionTemplate() + { $this->redirectToRoute( "admin.configuration.variables.update", array('variable_id' => $this->getRequest()->get('variable_id')) ); } - protected function redirectToListTemplate() { + protected function redirectToListTemplate() + { $this->redirectToRoute('admin.configuration.variables.default'); } @@ -188,4 +201,4 @@ class ConfigController extends AbstractCrudController $this->redirectToRoute('admin.configuration.variables.default'); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/ContentController.php b/core/lib/Thelia/Controller/Admin/ContentController.php index 10bfe07e0..c3811695f 100644 --- a/core/lib/Thelia/Controller/Admin/ContentController.php +++ b/core/lib/Thelia/Controller/Admin/ContentController.php @@ -22,8 +22,10 @@ /*************************************************************************************/ namespace Thelia\Controller\Admin; +use Thelia\Core\Event\Content\ContentAddFolderEvent; use Thelia\Core\Event\Content\ContentCreateEvent; use Thelia\Core\Event\Content\ContentDeleteEvent; +use Thelia\Core\Event\Content\ContentRemoveFolderEvent; use Thelia\Core\Event\Content\ContentToggleVisibilityEvent; use Thelia\Core\Event\Content\ContentUpdateEvent; use Thelia\Core\Event\TheliaEvents; @@ -32,7 +34,6 @@ use Thelia\Form\ContentCreationForm; use Thelia\Form\ContentModificationForm; use Thelia\Model\ContentQuery; - /** * Class ContentController * @package Thelia\Controller\Admin @@ -61,6 +62,62 @@ class ContentController extends AbstractCrudController ); } + /** + * controller adding content to additional folder + * + * @return mixed|\Symfony\Component\HttpFoundation\Response + */ + public function addAdditionalFolderAction() + { + // Check current user authorization + if (null !== $response = $this->checkAuth('admin.content.update')) return $response; + + $folder_id = intval($this->getRequest()->request->get('additional_folder_id')); + + if ($folder_id > 0) { + $event = new ContentAddFolderEvent( + $this->getExistingObject(), + $folder_id + ); + + try { + $this->dispatch(TheliaEvents::CONTENT_ADD_FOLDER, $event); + } catch (\Exception $e) { + return $this->errorPage($e); + } + } + + $this->redirectToEditionTemplate(); + } + + /** + * controller removing additional folder to a content + * + * @return mixed|\Symfony\Component\HttpFoundation\Response + */ + public function removeAdditionalFolderAction() + { + // Check current user authorization + if (null !== $response = $this->checkAuth('admin.content.update')) return $response; + + $folder_id = intval($this->getRequest()->request->get('additional_folder_id')); + + if ($folder_id > 0) { + $event = new ContentRemoveFolderEvent( + $this->getExistingObject(), + $folder_id + ); + + try { + $this->dispatch(TheliaEvents::CONTENT_REMOVE_FOLDER, $event); + } catch (\Exception $e) { + return $this->errorPage($e); + } + } + + $this->redirectToEditionTemplate(); + } + /** * Return the creation form for this object */ @@ -212,10 +269,10 @@ class ContentController extends AbstractCrudController { $folderId = $this->getRequest()->get('folder_id', null); - if(null === $folderId) { + if (null === $folderId) { $content = $this->getExistingObject(); - if($content) { + if ($content) { $folderId = $content->getDefaultFolderId(); } } @@ -243,7 +300,8 @@ class ContentController extends AbstractCrudController { return array( 'content_id' => $this->getRequest()->get('content_id', 0), - 'current_tab' => $this->getRequest()->get('current_tab', 'general') + 'current_tab' => $this->getRequest()->get('current_tab', 'general'), + 'folder_id' => $this->getFolderId(), ); } @@ -275,7 +333,7 @@ class ContentController extends AbstractCrudController } /** - * @param \Thelia\Core\Event\Content\ContentUpdateEvent $updateEvent + * @param \Thelia\Core\Event\Content\ContentUpdateEvent $updateEvent * @return Response|void */ protected function performAdditionalUpdateAction($updateEvent) @@ -293,8 +351,8 @@ class ContentController extends AbstractCrudController /** * Put in this method post object delete processing if required. * - * @param \Thelia\Core\Event\Content\ContentDeleteEvent $deleteEvent the delete event - * @return Response a response, or null to continue normal processing + * @param \Thelia\Core\Event\Content\ContentDeleteEvent $deleteEvent the delete event + * @return Response a response, or null to continue normal processing */ protected function performAdditionalDeleteAction($deleteEvent) { @@ -344,4 +402,4 @@ class ContentController extends AbstractCrudController { return new ContentToggleVisibilityEvent($this->getExistingObject()); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/CountryController.php b/core/lib/Thelia/Controller/Admin/CountryController.php index fadca1e92..a272f7364 100644 --- a/core/lib/Thelia/Controller/Admin/CountryController.php +++ b/core/lib/Thelia/Controller/Admin/CountryController.php @@ -22,31 +22,249 @@ /*************************************************************************************/ namespace Thelia\Controller\Admin; +use Thelia\Core\Event\Country\CountryCreateEvent; +use Thelia\Core\Event\Country\CountryDeleteEvent; +use Thelia\Core\Event\Country\CountryToggleDefaultEvent; +use Thelia\Core\Event\Country\CountryUpdateEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Form\CountryCreationForm; +use Thelia\Form\CountryModificationForm; +use Thelia\Model\CountryQuery; /** * Class CustomerController * @package Thelia\Controller\Admin * @author Manuel Raynaud */ -class CountryController extends BaseAdminController +class CountryController extends AbstractCrudController { - public function indexAction() + + /** + * @param string $objectName the lower case object name. Example. "message" + * + * @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual + * @param string $orderRequestParameterName Name of the request parameter that set the list order (null if list is not sortable) + * + * @param string $viewPermissionIdentifier the 'view' permission identifier. Example: "admin.configuration.message.view" + * @param string $createPermissionIdentifier the 'create' permission identifier. Example: "admin.configuration.message.create" + * @param string $updatePermissionIdentifier the 'update' permission identifier. Example: "admin.configuration.message.update" + * @param string $deletePermissionIdentifier the 'delete' permission identifier. Example: "admin.configuration.message.delete" + * + * @param string $createEventIdentifier the dispatched create TheliaEvent identifier. Example: TheliaEvents::MESSAGE_CREATE + * @param string $updateEventIdentifier the dispatched update TheliaEvent identifier. Example: TheliaEvents::MESSAGE_UPDATE + * @param string $deleteEventIdentifier the dispatched delete TheliaEvent identifier. Example: TheliaEvents::MESSAGE_DELETE + * + * @param string $visibilityToggleEventIdentifier the dispatched visibility toggle TheliaEvent identifier, or null if the object has no visible options. Example: TheliaEvents::MESSAGE_TOGGLE_VISIBILITY + * @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION + */ + public function __construct() + { + parent::__construct( + 'country', + 'manual', + 'country_order', + + 'admin.country.default', + 'admin.country.create', + 'admin.country.update', + 'admin.country.delete', + + TheliaEvents::COUNTRY_CREATE, + TheliaEvents::COUNTRY_UPDATE, + TheliaEvents::COUNTRY_DELETE + ); + } + + /** + * Return the creation form for this object + */ + protected function getCreationForm() + { + return new CountryCreationForm($this->getRequest()); + } + + /** + * Return the update form for this object + */ + protected function getUpdateForm() + { + return new CountryModificationForm($this->getRequest()); + } + + /** + * Hydrate the update form for this object, before passing it to the update template + * + * @param \Thelia\Model\Country $object + */ + protected function hydrateObjectForm($object) + { + $data = array( + 'id' => $object->getId(), + 'locale' => $object->getLocale(), + 'title' => $object->getTitle(), + 'isocode' => $object->getIsocode(), + 'isoalpha2' => $object->getIsoalpha2(), + 'isoalpha3' => $object->getIsoalpha3(), + ); + + return new CountryModificationForm($this->getRequest(), 'form', $data); + } + + /** + * Creates the creation event with the provided form data + * + * @param unknown $formData + */ + protected function getCreationEvent($formData) + { + $event = new CountryCreateEvent(); + + return $this->hydrateEvent($event, $formData); + } + + /** + * Creates the update event with the provided form data + * + * @param unknown $formData + */ + protected function getUpdateEvent($formData) + { + $event = new CountryUpdateEvent(); + + return $this->hydrateEvent($event, $formData); + } + + protected function hydrateEvent($event, $formData) + { + $event + ->setLocale($formData['locale']) + ->setTitle($formData['title']) + ->setIsocode($formData['isocode']) + ->setIsoAlpha2($formData['isoalpha2']) + ->setIsoAlpha3($formData['isoalpha3']) + ->setArea($formData['area']) + ; + + return $event; + } + + /** + * Creates the delete event with the provided form data + */ + protected function getDeleteEvent() + { + return new CountryDeleteEvent($this->getRequest()->get('country_id')); + } + + /** + * Return true if the event contains the object, e.g. the action has updated the object in the event. + * + * @param unknown $event + */ + protected function eventContainsObject($event) + { + return $event->hasCountry(); + } + + /** + * Get the created object from an event. + * + * @param unknown $createEvent + */ + protected function getObjectFromEvent($event) + { + return $event->getCountry(); + } + + /** + * Load an existing object from the database + */ + protected function getExistingObject() + { + return CountryQuery::create() + ->joinWithI18n($this->getCurrentEditionLocale()) + ->findPk($this->getRequest()->get('country_id', 0)); + } + + /** + * Returns the object label form the object event (name, title, etc.) + * + * @param \Thelia\Model\Country $object + */ + protected function getObjectLabel($object) + { + return $object->getTitle(); + } + + /** + * Returns the object ID from the object + * + * @param \Thelia\Model\Country $object + */ + protected function getObjectId($object) + { + return $object->getId(); + } + + /** + * Render the main list template + * + * @param unknown $currentOrder, if any, null otherwise. + */ + protected function renderListTemplate($currentOrder) { - if (null !== $response = $this->checkAuth("admin.country.view")) return $response; return $this->render("countries", array("display_country" => 20)); } /** - * update country action - * - * @param $country_id - * @return mixed|\Symfony\Component\HttpFoundation\Response + * Render the edition template */ - public function updateAction($country_id) - { - return $this->render("country-edit", array( - "country_id" => $country_id - )); + protected function renderEditionTemplate() + { + return $this->render('country-edit', $this->getEditionArgument()); } -} \ No newline at end of file + protected function getEditionArgument() + { + return array( + 'country_id' => $this->getRequest()->get('country_id', 0) + ); + } + + /** + * Redirect to the edition template + */ + protected function redirectToEditionTemplate() + { + $this->redirectToRoute('admin.configuration.countries.update', array(), $this->getRequest()->get('country_id', 0)); + } + + /** + * Redirect to the list template + */ + protected function redirectToListTemplate() + { + $this->redirectToRoute('admin.configuration.countries.default'); + } + + public function toggleDefaultAction() + { + if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response; + $content = null; + if (null !== $country_id = $this->getRequest()->get('country_id')) { + $toogleDefaultEvent = new CountryToggleDefaultEvent($country_id); + try { + $this->dispatch(TheliaEvents::COUNTRY_TOGGLE_DEFAULT, $toogleDefaultEvent); + + if($toogleDefaultEvent->hasCountry()) { + return $this->nullResponse(); + } + } catch (\Exception $ex) { + $content = $ex->getMessage(); + } + + } + + return $this->nullResponse($content, 500); + } +} diff --git a/core/lib/Thelia/Controller/Admin/CouponController.php b/core/lib/Thelia/Controller/Admin/CouponController.php index 029af5a1b..43e564cf7 100755 --- a/core/lib/Thelia/Controller/Admin/CouponController.php +++ b/core/lib/Thelia/Controller/Admin/CouponController.php @@ -30,7 +30,6 @@ use Thelia\Condition\ConditionManagerInterface; use Thelia\Core\Event\Coupon\CouponConsumeEvent; use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Translation\Translator; use Thelia\Coupon\CouponManager; use Thelia\Coupon\ConditionCollection; use Thelia\Coupon\Type\CouponInterface; @@ -295,7 +294,6 @@ class CouponController extends BaseAdminController ); } - /** * Manage Coupons read display * @@ -622,6 +620,4 @@ class CouponController extends BaseAdminController // } // } - - } diff --git a/core/lib/Thelia/Controller/Admin/CurrencyController.php b/core/lib/Thelia/Controller/Admin/CurrencyController.php index f0081d698..6fd98983b 100644 --- a/core/lib/Thelia/Controller/Admin/CurrencyController.php +++ b/core/lib/Thelia/Controller/Admin/CurrencyController.php @@ -23,10 +23,10 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Event\CurrencyDeleteEvent; +use Thelia\Core\Event\Currency\CurrencyDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\CurrencyUpdateEvent; -use Thelia\Core\Event\CurrencyCreateEvent; +use Thelia\Core\Event\Currency\CurrencyUpdateEvent; +use Thelia\Core\Event\Currency\CurrencyCreateEvent; use Thelia\Model\CurrencyQuery; use Thelia\Form\CurrencyModificationForm; use Thelia\Form\CurrencyCreationForm; @@ -39,7 +39,8 @@ use Thelia\Core\Event\UpdatePositionEvent; */ class CurrencyController extends AbstractCrudController { - public function __construct() { + public function __construct() + { parent::__construct( 'currency', 'manual', @@ -58,15 +59,18 @@ class CurrencyController extends AbstractCrudController ); } - protected function getCreationForm() { + protected function getCreationForm() + { return new CurrencyCreationForm($this->getRequest()); } - protected function getUpdateForm() { + protected function getUpdateForm() + { return new CurrencyModificationForm($this->getRequest()); } - protected function getCreationEvent($formData) { + protected function getCreationEvent($formData) + { $createEvent = new CurrencyCreateEvent(); $createEvent @@ -80,7 +84,8 @@ class CurrencyController extends AbstractCrudController return $createEvent; } - protected function getUpdateEvent($formData) { + protected function getUpdateEvent($formData) + { $changeEvent = new CurrencyUpdateEvent($formData['id']); // Create and dispatch the change event @@ -95,8 +100,8 @@ class CurrencyController extends AbstractCrudController return $changeEvent; } - protected function createUpdatePositionEvent($positionChangeMode, $positionValue) { - + protected function createUpdatePositionEvent($positionChangeMode, $positionValue) + { return new UpdatePositionEvent( $this->getRequest()->get('currency_id', null), $positionChangeMode, @@ -104,16 +109,18 @@ class CurrencyController extends AbstractCrudController ); } - protected function getDeleteEvent() { + protected function getDeleteEvent() + { return new CurrencyDeleteEvent($this->getRequest()->get('currency_id')); } - protected function eventContainsObject($event) { + protected function eventContainsObject($event) + { return $event->hasCurrency(); } - protected function hydrateObjectForm($object) { - + protected function hydrateObjectForm($object) + { // Prepare the data that will hydrate the form $data = array( 'id' => $object->getId(), @@ -128,44 +135,51 @@ class CurrencyController extends AbstractCrudController return new CurrencyModificationForm($this->getRequest(), "form", $data); } - protected function getObjectFromEvent($event) { + protected function getObjectFromEvent($event) + { return $event->hasCurrency() ? $event->getCurrency() : null; } - protected function getExistingObject() { + protected function getExistingObject() + { return CurrencyQuery::create() ->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('currency_id')); } - protected function getObjectLabel($object) { + protected function getObjectLabel($object) + { return $object->getName(); } - protected function getObjectId($object) { + protected function getObjectId($object) + { return $object->getId(); } - protected function renderListTemplate($currentOrder) { + protected function renderListTemplate($currentOrder) + { return $this->render('currencies', array('order' => $currentOrder)); } - protected function renderEditionTemplate() { + protected function renderEditionTemplate() + { return $this->render('currency-edit', array('currency_id' => $this->getRequest()->get('currency_id'))); } - protected function redirectToEditionTemplate() { + protected function redirectToEditionTemplate() + { $this->redirectToRoute( "admin.configuration.currencies.update", array('currency_id' => $this->getRequest()->get('currency_id')) ); } - protected function redirectToListTemplate() { + protected function redirectToListTemplate() + { $this->redirectToRoute('admin.configuration.currencies.default'); } - /** * Update currencies rates */ diff --git a/core/lib/Thelia/Controller/Admin/CustomerController.php b/core/lib/Thelia/Controller/Admin/CustomerController.php index 9209cb361..e4d24e9ad 100644 --- a/core/lib/Thelia/Controller/Admin/CustomerController.php +++ b/core/lib/Thelia/Controller/Admin/CustomerController.php @@ -22,13 +22,17 @@ /*************************************************************************************/ namespace Thelia\Controller\Admin; + use Propel\Runtime\Exception\PropelException; use Symfony\Component\Form\Form; -use Thelia\Core\Event\CustomerCreateOrUpdateEvent; -use Thelia\Core\Event\CustomerEvent; +use Thelia\Core\Event\Address\AddressEvent; +use Thelia\Core\Event\Customer\CustomerAddressEvent; +use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent; +use Thelia\Core\Event\Customer\CustomerEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Form\CustomerModification; use Thelia\Form\Exception\FormValidationException; +use Thelia\Model\AddressQuery; use Thelia\Model\CustomerQuery; use Thelia\Core\Translation\Translator; @@ -48,12 +52,13 @@ class CustomerController extends BaseAdminController public function viewAction($customer_id) { if (null !== $response = $this->checkAuth("admin.customer.view")) return $response; - - return $this->render("customer-edit", array( - "customer_id" => $customer_id - )); + return $this->render("customer-edit", array( + "customer_id" => $customer_id + )); } + + /** * update customer action * @@ -71,8 +76,8 @@ class CustomerController extends BaseAdminController try { $customer = CustomerQuery::create()->findPk($customer_id); - if(null === $customer) { - throw new \InvalidArgumentException(sprintf("%d customer id does not exists", $customer_id)); + if (null === $customer) { + throw new \InvalidArgumentException(sprintf("%d customer id does not exist", $customer_id)); } $form = $this->validateForm($customerModification); @@ -86,7 +91,7 @@ class CustomerController extends BaseAdminController $this->adminLogAppend(sprintf("Customer with Ref %s (ID %d) modified", $customerUpdated->getRef() , $customerUpdated->getId())); - if($this->getRequest()->get("save_mode") == "close") { + if ($this->getRequest()->get("save_mode") == "close") { $this->redirectToRoute("admin.customers"); } else { $this->redirectSuccess($customerModification); @@ -126,14 +131,14 @@ class CustomerController extends BaseAdminController $customer_id = $this->getRequest()->get("customer_id"); $customer = CustomerQuery::create()->findPk($customer_id); - if(null === $customer) { - throw new \InvalidArgumentException(Translator::getInstance("The customer you want to delete does not exists")); + if (null === $customer) { + throw new \InvalidArgumentException(Translator::getInstance("The customer you want to delete does not exist")); } $event = new CustomerEvent($customer); $this->dispatch(TheliaEvents::CUSTOMER_DELETEACCOUNT, $event); - } catch(\Exception $e) { + } catch (\Exception $e) { $message = $e->getMessage(); } @@ -151,7 +156,7 @@ class CustomerController extends BaseAdminController /** * @param $data - * @return CustomerCreateOrUpdateEvent + * @return \Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent */ private function createEventInstance($data) { @@ -178,4 +183,4 @@ class CustomerController extends BaseAdminController return $customerCreateEvent; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/FeatureAvController.php b/core/lib/Thelia/Controller/Admin/FeatureAvController.php index fc6571ccc..e8684ef04 100644 --- a/core/lib/Thelia/Controller/Admin/FeatureAvController.php +++ b/core/lib/Thelia/Controller/Admin/FeatureAvController.php @@ -23,10 +23,10 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Event\FeatureAvDeleteEvent; +use Thelia\Core\Event\Feature\FeatureAvDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\FeatureAvUpdateEvent; -use Thelia\Core\Event\FeatureAvCreateEvent; +use Thelia\Core\Event\Feature\FeatureAvUpdateEvent; +use Thelia\Core\Event\Feature\FeatureAvCreateEvent; use Thelia\Model\FeatureAvQuery; use Thelia\Form\FeatureAvModificationForm; use Thelia\Form\FeatureAvCreationForm; @@ -193,4 +193,4 @@ class FeatureAvController extends AbstractCrudController $this->getViewArguments() ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/FeatureController.php b/core/lib/Thelia/Controller/Admin/FeatureController.php index f81f55919..a8fde8880 100644 --- a/core/lib/Thelia/Controller/Admin/FeatureController.php +++ b/core/lib/Thelia/Controller/Admin/FeatureController.php @@ -23,18 +23,18 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Event\FeatureDeleteEvent; +use Thelia\Core\Event\Feature\FeatureDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\FeatureUpdateEvent; -use Thelia\Core\Event\FeatureCreateEvent; +use Thelia\Core\Event\Feature\FeatureUpdateEvent; +use Thelia\Core\Event\Feature\FeatureCreateEvent; use Thelia\Model\FeatureQuery; use Thelia\Form\FeatureModificationForm; use Thelia\Form\FeatureCreationForm; use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Model\FeatureAv; use Thelia\Model\FeatureAvQuery; -use Thelia\Core\Event\FeatureAvUpdateEvent; -use Thelia\Core\Event\FeatureEvent; +use Thelia\Core\Event\Feature\FeatureAvUpdateEvent; +use Thelia\Core\Event\Feature\FeatureEvent; /** * Manages features @@ -113,7 +113,7 @@ class FeatureController extends AbstractCrudController if ($attr_values !== null) { - foreach($attr_values as $id => $value) { + foreach ($attr_values as $id => $value) { $event = new FeatureAvUpdateEvent($id); @@ -168,7 +168,7 @@ class FeatureController extends AbstractCrudController $attr_array = array(); - foreach($attr_av_list as $attr_av) { + foreach ($attr_av_list as $attr_av) { $attr_array[$attr_av->getId()] = $attr_av->getTitle(); } @@ -262,8 +262,7 @@ class FeatureController extends AbstractCrudController $this->dispatch($eventType, $event); } - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -286,4 +285,4 @@ class FeatureController extends AbstractCrudController { return $this->addRemoveFromAllTemplates(TheliaEvents::FEATURE_ADD_TO_ALL_TEMPLATES); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/FileController.php b/core/lib/Thelia/Controller/Admin/FileController.php index f43f30fe6..e99b857f7 100755 --- a/core/lib/Thelia/Controller/Admin/FileController.php +++ b/core/lib/Thelia/Controller/Admin/FileController.php @@ -25,15 +25,12 @@ namespace Thelia\Controller\Admin; use Propel\Runtime\Exception\PropelException; use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Router; -use Thelia\Core\Event\DocumentCreateOrUpdateEvent; -use Thelia\Core\Event\DocumentDeleteEvent; -use Thelia\Core\Event\ImageCreateOrUpdateEvent; -use Thelia\Core\Event\ImageDeleteEvent; +use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent; +use Thelia\Core\Event\Document\DocumentDeleteEvent; +use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent; +use Thelia\Core\Event\Image\ImageDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Translation\Translator; use Thelia\Form\Exception\FormValidationException; use Thelia\Log\Tlog; use Thelia\Model\CategoryDocument; @@ -62,7 +59,6 @@ use Thelia\Tools\Rest\ResponseRest; class FileController extends BaseAdminController { - /** * Manage how a image collection has to be saved * @@ -126,14 +122,12 @@ class FileController extends BaseAdminController $imageCreateOrUpdateEvent->setUploadedFile($fileBeingUploaded); $imageCreateOrUpdateEvent->setParentName($parentModel->getTitle()); - // Dispatch Event to the Action $this->dispatch( TheliaEvents::IMAGE_SAVE, $imageCreateOrUpdateEvent ); - return new ResponseRest(array('status' => true, 'message' => '')); } } @@ -192,14 +186,12 @@ class FileController extends BaseAdminController $documentCreateOrUpdateEvent->setUploadedFile($fileBeingUploaded); $documentCreateOrUpdateEvent->setParentName($parentModel->getTitle()); - // Dispatch Event to the Action $this->dispatch( TheliaEvents::DOCUMENT_SAVE, $documentCreateOrUpdateEvent ); - return new ResponseRest(array('status' => true, 'message' => '')); } } @@ -676,5 +668,4 @@ class FileController extends BaseAdminController return $documentCreateEvent; } - } diff --git a/core/lib/Thelia/Controller/Admin/FolderController.php b/core/lib/Thelia/Controller/Admin/FolderController.php index 9f2190442..24e2659d9 100644 --- a/core/lib/Thelia/Controller/Admin/FolderController.php +++ b/core/lib/Thelia/Controller/Admin/FolderController.php @@ -22,10 +22,10 @@ /*************************************************************************************/ namespace Thelia\Controller\Admin; -use Thelia\Core\Event\FolderCreateEvent; -use Thelia\Core\Event\FolderDeleteEvent; -use Thelia\Core\Event\FolderToggleVisibilityEvent; -use Thelia\Core\Event\FolderUpdateEvent; +use Thelia\Core\Event\Folder\FolderCreateEvent; +use Thelia\Core\Event\Folder\FolderDeleteEvent; +use Thelia\Core\Event\Folder\FolderToggleVisibilityEvent; +use Thelia\Core\Event\Folder\FolderUpdateEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Form\FolderCreationForm; @@ -81,8 +81,8 @@ class FolderController extends AbstractCrudController * * @param \Thelia\Model\Folder $object */ - protected function hydrateObjectForm($object) { - + protected function hydrateObjectForm($object) + { // Prepare the data that will hydrate the form $data = array( 'id' => $object->getId(), @@ -150,7 +150,7 @@ class FolderController extends AbstractCrudController } /** - * @return FolderToggleVisibilityEvent|void + * @return \Thelia\Core\Event\Folder\FolderToggleVisibilityEvent|void */ protected function createToggleVisibilityEvent() { @@ -162,8 +162,8 @@ class FolderController extends AbstractCrudController * @param $positionValue * @return UpdatePositionEvent|void */ - protected function createUpdatePositionEvent($positionChangeMode, $positionValue) { - + protected function createUpdatePositionEvent($positionChangeMode, $positionValue) + { return new UpdatePositionEvent( $this->getRequest()->get('folder_id', null), $positionChangeMode, @@ -174,7 +174,7 @@ class FolderController extends AbstractCrudController /** * Return true if the event contains the object, e.g. the action has updated the object in the event. * - * @param \Thelia\Core\Event\FolderEvent $event + * @param \Thelia\Core\Event\Folder\FolderEvent $event */ protected function eventContainsObject($event) { @@ -184,7 +184,7 @@ class FolderController extends AbstractCrudController /** * Get the created object from an event. * - * @param $event \Thelia\Core\Event\FolderEvent $event + * @param $event \Thelia\Core\Event\Folder\FolderEvent $event * * @return null|\Thelia\Model\Folder */ @@ -196,7 +196,8 @@ class FolderController extends AbstractCrudController /** * Load an existing object from the database */ - protected function getExistingObject() { + protected function getExistingObject() + { return FolderQuery::create() ->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('folder_id', 0)); @@ -207,7 +208,8 @@ class FolderController extends AbstractCrudController * * @param unknown $object */ - protected function getObjectLabel($object) { + protected function getObjectLabel($object) + { return $object->getTitle(); } @@ -226,8 +228,8 @@ class FolderController extends AbstractCrudController * * @param unknown $currentOrder, if any, null otherwise. */ - protected function renderListTemplate($currentOrder) { - + protected function renderListTemplate($currentOrder) + { // Get content order $content_order = $this->getListOrderFromSession('content', 'content_order', 'manual'); @@ -239,12 +241,11 @@ class FolderController extends AbstractCrudController )); } - /** * Render the edition template */ - protected function renderEditionTemplate() { - + protected function renderEditionTemplate() + { return $this->render('folder-edit', $this->getEditionArguments()); } @@ -257,7 +258,7 @@ class FolderController extends AbstractCrudController } /** - * @param \Thelia\Core\Event\FolderUpdateEvent $updateEvent + * @param \Thelia\Core\Event\Folder\FolderUpdateEvent $updateEvent * @return Response|void */ protected function performAdditionalUpdateAction($updateEvent) @@ -275,8 +276,8 @@ class FolderController extends AbstractCrudController /** * Put in this method post object delete processing if required. * - * @param \Thelia\Core\Event\FolderDeleteEvent $deleteEvent the delete event - * @return Response a response, or null to continue normal processing + * @param \Thelia\Core\Event\Folder\FolderDeleteEvent $deleteEvent the delete event + * @return Response a response, or null to continue normal processing */ protected function performAdditionalDeleteAction($deleteEvent) { @@ -325,4 +326,4 @@ class FolderController extends AbstractCrudController array('parent' => $this->getRequest()->get('parent', 0)) ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/MessageController.php b/core/lib/Thelia/Controller/Admin/MessageController.php index a55c9deca..176fa7de8 100644 --- a/core/lib/Thelia/Controller/Admin/MessageController.php +++ b/core/lib/Thelia/Controller/Admin/MessageController.php @@ -23,9 +23,9 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Event\MessageDeleteEvent; -use Thelia\Core\Event\TheliaEvents;use Thelia\Core\Event\MessageUpdateEvent; -use Thelia\Core\Event\MessageCreateEvent; +use Thelia\Core\Event\Message\MessageDeleteEvent; +use Thelia\Core\Event\TheliaEvents;use Thelia\Core\Event\Message\MessageUpdateEvent; +use Thelia\Core\Event\Message\MessageCreateEvent; use Thelia\Model\MessageQuery; use Thelia\Form\MessageModificationForm; use Thelia\Form\MessageCreationForm; diff --git a/core/lib/Thelia/Controller/Admin/ModuleController.php b/core/lib/Thelia/Controller/Admin/ModuleController.php index fe794abf9..03691c069 100644 --- a/core/lib/Thelia/Controller/Admin/ModuleController.php +++ b/core/lib/Thelia/Controller/Admin/ModuleController.php @@ -35,12 +35,11 @@ class ModuleController extends BaseAdminController if (null !== $response = $this->checkAuth("admin.module.view")) return $response; return $this->render("modules", array("display_module" => 20)); } - + public function updateAction($module_id) { - - return $this->render("module-edit", array( - "module_id" => $module_id - )); + return $this->render("module-edit", array( + "module_id" => $module_id + )); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/OrderController.php b/core/lib/Thelia/Controller/Admin/OrderController.php index b2047cc31..1df0679f0 100644 --- a/core/lib/Thelia/Controller/Admin/OrderController.php +++ b/core/lib/Thelia/Controller/Admin/OrderController.php @@ -23,6 +23,18 @@ namespace Thelia\Controller\Admin; +use Symfony\Component\HttpFoundation\Response; +use Thelia\Core\Event\Order\OrderAddressEvent; +use Thelia\Core\Event\Order\OrderEvent; +use Thelia\Core\Event\PdfEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Form\OrderUpdateAddress; +use Thelia\Model\ConfigQuery; +use Thelia\Model\Base\OrderAddressQuery; +use Thelia\Model\OrderQuery; +use Thelia\Model\OrderStatusQuery; +use Thelia\Tools\URL; + /** * Class OrderController * @package Thelia\Controller\Admin @@ -38,10 +50,198 @@ class OrderController extends BaseAdminController public function viewAction($order_id) { - - return $this->render("order-edit", array( - "order_id" => $order_id - )); + return $this->render("order-edit", array( + "order_id" => $order_id + )); } -} \ No newline at end of file + public function updateStatus($order_id = null) + { + if (null !== $response = $this->checkAuth("admin.order.update")) return $response; + + $message = null; + + try { + if ($order_id !== null) { + $order_id = $order_id; + } else { + $order_id = $this->getRequest()->get("order_id"); + } + + $order = OrderQuery::create()->findPk($order_id); + + $statusId = $this->getRequest()->request->get("status_id"); + $status = OrderStatusQuery::create()->findPk($statusId); + + if (null === $order) { + throw new \InvalidArgumentException("The order you want to update status does not exist"); + } + if (null === $status) { + throw new \InvalidArgumentException("The status you want to set to the order does not exist"); + } + + $event = new OrderEvent($order); + $event->setStatus($statusId); + + $this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event); + } catch (\Exception $e) { + $message = $e->getMessage(); + } + + $params = array(); + + if ($message) { + $params["update_status_error_message"] = $message; + } + + $browsedPage = $this->getRequest()->get("order_page"); + + if ($browsedPage) { + $params["order_page"] = $browsedPage; + $this->redirectToRoute("admin.order.list", $params); + } else { + $params["order_id"] = $order_id; + $params["tab"] = $this->getRequest()->get("tab", 'cart'); + $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", $params))); + } + } + + public function updateDeliveryRef($order_id) + { + if (null !== $response = $this->checkAuth("admin.order.update")) return $response; + + $message = null; + + try { + $order = OrderQuery::create()->findPk($order_id); + + $deliveryRef = $this->getRequest()->get("delivery_ref"); + + if (null === $order) { + throw new \InvalidArgumentException("The order you want to update status does not exist"); + } + + $event = new OrderEvent($order); + $event->setDeliveryRef($deliveryRef); + + $this->dispatch(TheliaEvents::ORDER_UPDATE_DELIVERY_REF, $event); + } catch (\Exception $e) { + $message = $e->getMessage(); + } + + $params = array(); + + if ($message) { + $params["update_status_error_message"] = $message; + } + + $params["order_id"] = $order_id; + $params["tab"] = $this->getRequest()->get("tab", 'bill'); + + $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", $params))); + } + + public function updateAddress($order_id) + { + if (null !== $response = $this->checkAuth("admin.order.update")) return $response; + + $message = null; + + $orderUpdateAddress = new OrderUpdateAddress($this->getRequest()); + + try { + $order = OrderQuery::create()->findPk($order_id); + + if (null === $order) { + throw new \InvalidArgumentException("The order you want to update does not exist"); + } + + $form = $this->validateForm($orderUpdateAddress, "post"); + + $orderAddress = OrderAddressQuery::create()->findPk($form->get("id")->getData()); + + if ($orderAddress->getId() !== $order->getInvoiceOrderAddressId() && $orderAddress->getId() !== $order->getDeliveryOrderAddressId()) { + throw new \InvalidArgumentException("The order address you want to update does not belong to the current order not exist"); + } + + $event = new OrderAddressEvent( + $form->get("title")->getData(), + $form->get("firstname")->getData(), + $form->get("lastname")->getData(), + $form->get("address1")->getData(), + $form->get("address2")->getData(), + $form->get("address3")->getData(), + $form->get("zipcode")->getData(), + $form->get("city")->getData(), + $form->get("country")->getData(), + $form->get("phone")->getData(), + $form->get("company")->getData() + ); + $event->setOrderAddress($orderAddress); + $event->setOrder($order); + + $this->dispatch(TheliaEvents::ORDER_UPDATE_ADDRESS, $event); + } catch (\Exception $e) { + $message = $e->getMessage(); + } + + $params = array(); + + if ($message) { + $params["update_status_error_message"] = $message; + } + + $params["order_id"] = $order_id; + $params["tab"] = $this->getRequest()->get("tab", 'bill'); + + $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", $params))); + } + + public function generateInvoicePdf($order_id) + { + return $this->generatePdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice')); + } + + public function generateDeliveryPdf($order_id) + { + return $this->generatePdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery')); + } + + protected function generatePdf($order_id, $fileName) + { + if (null !== $response = $this->checkAuth("admin.order.update")) return $response; + + + $html = $this->renderRaw( + $fileName, + array( + 'order_id' => $order_id + ), + ConfigQuery::read('pdf_template', 'pdf') + ); + + $order = OrderQuery::create()->findPk($order_id); + + try { + $pdfEvent = new PdfEvent($html); + + $this->dispatch(TheliaEvents::GENERATE_PDF, $pdfEvent); + + if($pdfEvent->hasPdf()) { + return Response::create($pdfEvent->getPdf(), 200, + array( + 'Content-type' => "application/pdf", + 'Content-Disposition' => sprintf('Attachment;filename=%s.pdf', $order->getRef()), + )); + } + + } catch (\Exception $e) { + \Thelia\Log\Tlog::getInstance()->error(sprintf('error during generating invoice pdf for order id : %d with message "%s"', $order_id, $e->getMessage())); + + } + + $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", array( + 'order_id' => $order_id + )))); + } +} diff --git a/core/lib/Thelia/Controller/Admin/ProductController.php b/core/lib/Thelia/Controller/Admin/ProductController.php index 342af6b14..4ff40abff 100644 --- a/core/lib/Thelia/Controller/Admin/ProductController.php +++ b/core/lib/Thelia/Controller/Admin/ProductController.php @@ -23,40 +23,29 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Event\ProductDeleteEvent; +use Thelia\Core\Event\Product\ProductAddCategoryEvent; +use Thelia\Core\Event\Product\ProductDeleteCategoryEvent; +use Thelia\Core\Event\Product\ProductDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\ProductUpdateEvent; -use Thelia\Core\Event\ProductCreateEvent; +use Thelia\Core\Event\Product\ProductUpdateEvent; +use Thelia\Core\Event\Product\ProductCreateEvent; use Thelia\Model\ProductQuery; use Thelia\Form\ProductModificationForm; use Thelia\Form\ProductCreationForm; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\ProductToggleVisibilityEvent; -use Thelia\Core\Event\ProductDeleteContentEvent; -use Thelia\Core\Event\ProductAddContentEvent; -use Thelia\Model\ProductAssociatedContent; +use Thelia\Core\Event\Product\ProductToggleVisibilityEvent; +use Thelia\Core\Event\Product\ProductDeleteContentEvent; +use Thelia\Core\Event\Product\ProductAddContentEvent; use Thelia\Model\FolderQuery; use Thelia\Model\ContentQuery; use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Model\ProductAssociatedContentQuery; use Thelia\Model\AccessoryQuery; use Thelia\Model\CategoryQuery; -use Thelia\Core\Event\ProductAddAccessoryEvent; -use Thelia\Core\Event\ProductDeleteAccessoryEvent; -use Thelia\Core\Event\FeatureProductUpdateEvent; -use Thelia\Model\FeatureQuery; -use Thelia\Core\Event\FeatureProductDeleteEvent; -use Thelia\Model\FeatureTemplateQuery; -use Thelia\Core\Event\ProductSetTemplateEvent; -use Thelia\Core\Event\ProductAddCategoryEvent; -use Thelia\Core\Event\ProductDeleteCategoryEvent; -use Thelia\Model\AttributeQuery; -use Thelia\Model\AttributeAvQuery; + +use Thelia\Core\Event\Product\ProductAddAccessoryEvent; +use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent; use Thelia\Model\ProductSaleElementsQuery; -use Thelia\Model\AttributeCombination; -use Thelia\Model\AttributeAv; -use Thelia\Core\Event\ProductCreateCombinationEvent; -use Thelia\Core\Event\ProductDeleteCombinationEvent; /** * Manages products @@ -89,8 +78,8 @@ class ProductController extends AbstractCrudController /** * Attributes ajax tab loading */ - public function loadAttributesAjaxTabAction() { - + public function loadAttributesAjaxTabAction() + { return $this->render( 'ajax/product-attributes-tab', array( @@ -102,8 +91,8 @@ class ProductController extends AbstractCrudController /** * Related information ajax tab loading */ - public function loadRelatedAjaxTabAction() { - + public function loadRelatedAjaxTabAction() + { return $this->render( 'ajax/product-related-tab', array( @@ -242,7 +231,8 @@ class ProductController extends AbstractCrudController ); } - protected function getCategoryId() { + protected function getCategoryId() + { // Trouver le category_id, soit depuis la reques, souit depuis le produit courant $category_id = $this->getRequest()->get('category_id', null); @@ -353,7 +343,7 @@ class ProductController extends AbstractCrudController ; if ($list !== null) { - foreach($list as $item) { + foreach ($list as $item) { $result[] = array('id' => $item->getId(), 'title' => $item->getTitle()); } } @@ -379,8 +369,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_ADD_CONTENT, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -406,8 +395,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_REMOVE_CONTENT, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -416,7 +404,6 @@ class ProductController extends AbstractCrudController $this->redirectToEditionTemplate(); } - // -- Accessories management ---------------------------------------------- public function getAvailableAccessoriesAction($productId, $categoryId) @@ -435,7 +422,7 @@ class ProductController extends AbstractCrudController ; if ($list !== null) { - foreach($list as $item) { + foreach ($list as $item) { $result[] = array('id' => $item->getId(), 'title' => $item->getTitle()); } } @@ -460,8 +447,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_ADD_ACCESSORY, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -486,8 +472,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_REMOVE_ACCESSORY, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -527,7 +512,8 @@ class ProductController extends AbstractCrudController * * @param unknown $productId */ - public function setProductTemplateAction($productId) { + public function setProductTemplateAction($productId) + { // Check current user authorization if (null !== $response = $this->checkAuth('admin.products.update')) return $response; @@ -549,8 +535,8 @@ class ProductController extends AbstractCrudController /** * Update product attributes and features */ - public function updateAttributesAndFeaturesAction($productId) { - + public function updateAttributesAndFeaturesAction($productId) + { $product = ProductQuery::create()->findPk($productId); if ($product != null) { @@ -569,7 +555,7 @@ class ProductController extends AbstractCrudController // Update all features values, starting with feature av. values $featureValues = $this->getRequest()->get('feature_value', array()); - foreach($featureValues as $featureId => $featureValueList) { + foreach ($featureValues as $featureId => $featureValueList) { // Delete all features av. for this feature. $event = new FeatureProductDeleteEvent($productId, $featureId); @@ -577,7 +563,7 @@ class ProductController extends AbstractCrudController $this->dispatch(TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE, $event); // Add then all selected values - foreach($featureValueList as $featureValue) { + foreach ($featureValueList as $featureValue) { $event = new FeatureProductUpdateEvent($productId, $featureId, $featureValue); $this->dispatch(TheliaEvents::PRODUCT_FEATURE_UPDATE_VALUE, $event); @@ -589,7 +575,7 @@ class ProductController extends AbstractCrudController // Update then features text values $featureTextValues = $this->getRequest()->get('feature_text_value', array()); - foreach($featureTextValues as $featureId => $featureValue) { + foreach ($featureTextValues as $featureId => $featureValue) { // considere empty text as empty feature value (e.g., we will delete it) if (empty($featureValue)) continue; @@ -602,7 +588,7 @@ class ProductController extends AbstractCrudController } // Delete features which don't have any values - foreach($allFeatures as $feature) { + foreach ($allFeatures as $feature) { if (! in_array($feature->getId(), $updatedFeatures)) { $event = new FeatureProductDeleteEvent($productId, $feature->getId()); @@ -623,12 +609,12 @@ class ProductController extends AbstractCrudController $this->redirectToListTemplate(); } - public function addAdditionalCategoryAction() { - + public function addAdditionalCategoryAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.products.update")) return $response; - $category_id = intval($this->getRequest()->get('additional_category_id')); + $category_id = intval($this->getRequest()->request->get('additional_category_id')); if ($category_id > 0) { @@ -639,8 +625,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_ADD_CATEGORY, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -649,8 +634,8 @@ class ProductController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function deleteAdditionalCategoryAction() { - + public function deleteAdditionalCategoryAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.products.update")) return $response; @@ -665,8 +650,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_REMOVE_CATEGORY, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -677,8 +661,8 @@ class ProductController extends AbstractCrudController // -- Product combination management --------------------------------------- - public function getAttributeValuesAction($productId, $attributeId) { - + public function getAttributeValuesAction($productId, $attributeId) + { $result = array(); // Get attribute for this product @@ -693,7 +677,7 @@ class ProductController extends AbstractCrudController ; if ($values !== null) { - foreach($values as $value) { + foreach ($values as $value) { $result[] = array('id' => $value->getId(), 'title' => $value->getTitle()); } } @@ -702,8 +686,8 @@ class ProductController extends AbstractCrudController return $this->jsonResponse(json_encode($result)); } - public function addAttributeValueToCombinationAction($productId, $attributeAvId, $combination) { - + public function addAttributeValueToCombinationAction($productId, $attributeAvId, $combination) + { $result = array(); // Get attribute for this product @@ -747,8 +731,8 @@ class ProductController extends AbstractCrudController /** * A a new combination to a product */ - public function addCombinationAction() { - + public function addCombinationAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.products.update")) return $response; @@ -760,8 +744,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_ADD_COMBINATION, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -773,8 +756,8 @@ class ProductController extends AbstractCrudController /** * A a new combination to a product */ - public function deleteCombinationAction() { - + public function deleteCombinationAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.products.update")) return $response; @@ -785,8 +768,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_DELETE_COMBINATION, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } diff --git a/core/lib/Thelia/Controller/Admin/SessionController.php b/core/lib/Thelia/Controller/Admin/SessionController.php index 120a28b26..6d8d14416 100755 --- a/core/lib/Thelia/Controller/Admin/SessionController.php +++ b/core/lib/Thelia/Controller/Admin/SessionController.php @@ -31,9 +31,7 @@ use Thelia\Tools\URL; use Thelia\Tools\Redirect; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Security\Authentication\AdminTokenAuthenticator; -use Thelia\Core\Security\UserProvider\TokenProvider; use Symfony\Component\HttpFoundation\Cookie; -use Thelia\Core\Security\UserProvider\CookieTokenProvider; use Thelia\Core\Security\Exception\TokenAuthenticationException; class SessionController extends BaseAdminController @@ -59,8 +57,7 @@ class SessionController extends BaseAdminController // Render the home page return $this->render("home"); - } - catch (TokenAuthenticationException $ex) { + } catch (TokenAuthenticationException $ex) { $this->adminLogAppend("Token based authentication failed."); // Clear the cookie diff --git a/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php b/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php index 71aa0ba2f..92b73a83e 100644 --- a/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php +++ b/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php @@ -35,12 +35,11 @@ class ShippingConfigurationController extends BaseAdminController if (null !== $response = $this->checkAuth("admin.shipping-configuration.view")) return $response; return $this->render("shipping-configuration", array("display_shipping_configuration" => 20)); } - + public function updateAction($shipping_configuration_id) { - return $this->render("shipping-configuration-edit", array( "shipping_configuration_id" => $shipping_configuration_id )); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/ShippingZoneController.php b/core/lib/Thelia/Controller/Admin/ShippingZoneController.php index ee34d11bd..0084c861b 100644 --- a/core/lib/Thelia/Controller/Admin/ShippingZoneController.php +++ b/core/lib/Thelia/Controller/Admin/ShippingZoneController.php @@ -35,12 +35,11 @@ class ShippingZoneController extends BaseAdminController if (null !== $response = $this->checkAuth("admin.shipping-zones.view")) return $response; return $this->render("shipping-zones", array("display_shipping_zone" => 20)); } - + public function updateAction($shipping_zones_id) { - - return $this->render("shipping-zones-edit", array( - "shipping_zones_id" => $shipping_zones_id - )); + return $this->render("shipping-zones-edit", array( + "shipping_zones_id" => $shipping_zones_id + )); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/TemplateController.php b/core/lib/Thelia/Controller/Admin/TemplateController.php index fb32e4231..bdeac9fd2 100644 --- a/core/lib/Thelia/Controller/Admin/TemplateController.php +++ b/core/lib/Thelia/Controller/Admin/TemplateController.php @@ -23,22 +23,17 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Event\TemplateDeleteEvent; +use Thelia\Core\Event\Template\TemplateDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\TemplateUpdateEvent; -use Thelia\Core\Event\TemplateCreateEvent; +use Thelia\Core\Event\Template\TemplateUpdateEvent; +use Thelia\Core\Event\Template\TemplateCreateEvent; use Thelia\Model\TemplateQuery; use Thelia\Form\TemplateModificationForm; use Thelia\Form\TemplateCreationForm; -use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Model\TemplateAv; -use Thelia\Model\TemplateAvQuery; -use Thelia\Core\Event\TemplateAvUpdateEvent; -use Thelia\Core\Event\TemplateEvent; -use Thelia\Core\Event\TemplateDeleteAttributeEvent; -use Thelia\Core\Event\TemplateAddAttributeEvent; -use Thelia\Core\Event\TemplateAddFeatureEvent; -use Thelia\Core\Event\TemplateDeleteFeatureEvent; +use Thelia\Core\Event\Template\TemplateDeleteAttributeEvent; +use Thelia\Core\Event\Template\TemplateAddAttributeEvent; +use Thelia\Core\Event\Template\TemplateAddFeatureEvent; +use Thelia\Core\Event\Template\TemplateDeleteFeatureEvent; use Thelia\Model\FeatureTemplateQuery; use Thelia\Model\AttributeTemplateQuery; @@ -102,7 +97,6 @@ class TemplateController extends AbstractCrudController ; // Add feature and attributes list - return $changeEvent; } @@ -199,22 +193,24 @@ class TemplateController extends AbstractCrudController return null; } - public function getAjaxFeaturesAction() { + public function getAjaxFeaturesAction() + { return $this->render( 'ajax/template-feature-list', array('template_id' => $this->getRequest()->get('template_id')) ); } - public function getAjaxAttributesAction() { + public function getAjaxAttributesAction() + { return $this->render( 'ajax/template-attribute-list', array('template_id' => $this->getRequest()->get('template_id')) ); } - public function addAttributeAction() { - + public function addAttributeAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.configuration.template.attribute.add")) return $response; @@ -237,8 +233,8 @@ class TemplateController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function deleteAttributeAction() { - + public function deleteAttributeAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.configuration.template.attribute.delete")) return $response; @@ -257,8 +253,8 @@ class TemplateController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function updateAttributePositionAction() { - + public function updateAttributePositionAction() + { // Find attribute_template $attributeTemplate = AttributeTemplateQuery::create() ->filterByTemplateId($this->getRequest()->get('template_id', null)) @@ -272,8 +268,8 @@ class TemplateController extends AbstractCrudController ); } - public function addFeatureAction() { - + public function addFeatureAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.configuration.template.feature.add")) return $response; @@ -296,8 +292,8 @@ class TemplateController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function deleteFeatureAction() { - + public function deleteFeatureAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.configuration.template.feature.delete")) return $response; @@ -316,8 +312,8 @@ class TemplateController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function updateFeaturePositionAction() { - + public function updateFeaturePositionAction() + { // Find feature_template $featureTemplate = FeatureTemplateQuery::create() ->filterByTemplateId($this->getRequest()->get('template_id', null)) @@ -330,4 +326,4 @@ class TemplateController extends AbstractCrudController TheliaEvents::TEMPLATE_CHANGE_FEATURE_POSITION ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index 8ba0cb038..8c819159b 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -58,9 +58,9 @@ class BaseController extends ContainerAware /** * Return an empty response (after an ajax request, for example) */ - protected function nullResponse() + protected function nullResponse($status = 200) { - return new Response(); + return new Response(null, $status); } /** @@ -286,7 +286,7 @@ class BaseController extends ContainerAware */ protected function checkXmlHttpRequest() { - if(false === $this->getRequest()->isXmlHttpRequest() && false === $this->isDebug()) { + if (false === $this->getRequest()->isXmlHttpRequest() && false === $this->isDebug()) { $this->accessDenied(); } } @@ -300,6 +300,7 @@ class BaseController extends ContainerAware public function getMailer() { $mailer = $this->container->get('mailer'); + return $mailer->getSwiftMailer(); } } diff --git a/core/lib/Thelia/Controller/Front/AddressController.php b/core/lib/Thelia/Controller/Front/AddressController.php index 05e3949fa..94d0f78d7 100644 --- a/core/lib/Thelia/Controller/Front/AddressController.php +++ b/core/lib/Thelia/Controller/Front/AddressController.php @@ -22,15 +22,14 @@ /*************************************************************************************/ namespace Thelia\Controller\Front; -use Thelia\Core\Event\AddressCreateOrUpdateEvent; -use Thelia\Core\Event\AddressEvent; +use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent; +use Thelia\Core\Event\Address\AddressEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Form\AddressCreateForm; use Thelia\Form\AddressUpdateForm; use Thelia\Form\Exception\FormValidationException; use Thelia\Model\AddressQuery; use Thelia\Model\Customer; -use Thelia\Tools\URL; /** * Class AddressController @@ -51,10 +50,8 @@ class AddressController extends BaseFrontController $this->checkAuth(); $this->checkXmlHttpRequest(); - } - /** * Create controller. * Check if customer is logged in @@ -103,7 +100,7 @@ class AddressController extends BaseFrontController $customer = $this->getSecurityContext()->getCustomerUser(); $address = AddressQuery::create()->findPk($address_id); - if(!$address || $customer->getId() != $address->getCustomerId()) { + if (!$address || $customer->getId() != $address->getCustomerId()) { $this->redirectToRoute("home"); } @@ -117,7 +114,6 @@ class AddressController extends BaseFrontController $addressUpdate = new AddressUpdateForm($request); - try { $customer = $this->getSecurityContext()->getCustomerUser(); @@ -164,7 +160,7 @@ class AddressController extends BaseFrontController $customer = $this->getSecurityContext()->getCustomerUser(); $address = AddressQuery::create()->findPk($address_id); - if(!$address || $customer->getId() != $address->getCustomerId()) { + if (!$address || $customer->getId() != $address->getCustomerId()) { $this->redirectToRoute("home"); } diff --git a/core/lib/Thelia/Controller/Front/BaseFrontController.php b/core/lib/Thelia/Controller/Front/BaseFrontController.php index 152c2c10e..fadf65795 100755 --- a/core/lib/Thelia/Controller/Front/BaseFrontController.php +++ b/core/lib/Thelia/Controller/Front/BaseFrontController.php @@ -55,7 +55,7 @@ class BaseFrontController extends BaseController public function checkAuth() { - if($this->getSecurityContext()->hasCustomerUser() === false) { + if ($this->getSecurityContext()->hasCustomerUser() === false) { $this->redirectToRoute("customer.login.view"); } } @@ -63,7 +63,7 @@ class BaseFrontController extends BaseController protected function checkCartNotEmpty() { $cart = $this->getSession()->getCart(); - if($cart===null || $cart->countCartItems() == 0) { + if ($cart===null || $cart->countCartItems() == 0) { $this->redirectToRoute("cart.view"); } } @@ -71,7 +71,7 @@ class BaseFrontController extends BaseController protected function checkValidDelivery() { $order = $this->getSession()->getOrder(); - if(null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId() || null === AddressQuery::create()->findPk($order->chosenDeliveryAddress) || null === ModuleQuery::create()->findPk($order->getDeliveryModuleId())) { + if (null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId() || null === AddressQuery::create()->findPk($order->chosenDeliveryAddress) || null === ModuleQuery::create()->findPk($order->getDeliveryModuleId())) { $this->redirectToRoute("order.delivery"); } } @@ -79,7 +79,7 @@ class BaseFrontController extends BaseController protected function checkValidInvoice() { $order = $this->getSession()->getOrder(); - if(null === $order || null === $order->chosenInvoiceAddress || null === $order->getPaymentModuleId() || null === AddressQuery::create()->findPk($order->chosenInvoiceAddress) || null === ModuleQuery::create()->findPk($order->getPaymentModuleId())) { + if (null === $order || null === $order->chosenInvoiceAddress || null === $order->getPaymentModuleId() || null === AddressQuery::create()->findPk($order->chosenInvoiceAddress) || null === ModuleQuery::create()->findPk($order->getPaymentModuleId())) { $this->redirectToRoute("order.invoice"); } } diff --git a/core/lib/Thelia/Controller/Front/CartController.php b/core/lib/Thelia/Controller/Front/CartController.php index e13ecd61b..ae116b40a 100755 --- a/core/lib/Thelia/Controller/Front/CartController.php +++ b/core/lib/Thelia/Controller/Front/CartController.php @@ -24,7 +24,7 @@ namespace Thelia\Controller\Front; use Propel\Runtime\Exception\PropelException; use Thelia\Form\Exception\FormValidationException; -use Thelia\Core\Event\CartEvent; +use Thelia\Core\Event\Cart\CartEvent; use Thelia\Core\Event\TheliaEvents; use Symfony\Component\HttpFoundation\Request; use Thelia\Form\CartAdd; @@ -102,7 +102,7 @@ class CartController extends BaseFrontController /** * use Thelia\Cart\CartTrait for searching current cart or create a new one * - * @return CartEvent + * @return \Thelia\Core\Event\Cart\CartEvent */ protected function getCartEvent() { diff --git a/core/lib/Thelia/Controller/Front/CustomerController.php b/core/lib/Thelia/Controller/Front/CustomerController.php index 3b8c2ccff..f322d3fe1 100755 --- a/core/lib/Thelia/Controller/Front/CustomerController.php +++ b/core/lib/Thelia/Controller/Front/CustomerController.php @@ -22,8 +22,8 @@ /*************************************************************************************/ namespace Thelia\Controller\Front; -use Thelia\Core\Event\CustomerCreateOrUpdateEvent; -use Thelia\Core\Event\CustomerLoginEvent; +use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent; +use Thelia\Core\Event\Customer\CustomerLoginEvent; use Thelia\Core\Event\LostPasswordEvent; use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator; use Thelia\Core\Security\Exception\AuthenticationException; @@ -104,7 +104,7 @@ class CustomerController extends BaseFrontController $this->processLogin($customerCreateEvent->getCustomer()); $cart = $this->getCart($this->getRequest()); - if($cart->getCartItems()->count() > 0) { + if ($cart->getCartItems()->count() > 0) { $this->redirectToRoute("cart.view"); } else { $this->redirectSuccess($customerCreation); @@ -257,7 +257,7 @@ class CustomerController extends BaseFrontController /** * @param $data - * @return CustomerCreateOrUpdateEvent + * @return \Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent */ private function createEventInstance($data) { diff --git a/core/lib/Thelia/Controller/Front/OrderController.php b/core/lib/Thelia/Controller/Front/OrderController.php index 1f2c716ae..968597b8a 100755 --- a/core/lib/Thelia/Controller/Front/OrderController.php +++ b/core/lib/Thelia/Controller/Front/OrderController.php @@ -25,7 +25,7 @@ namespace Thelia\Controller\Front; use Propel\Runtime\Exception\PropelException; use Thelia\Exception\TheliaProcessException; use Thelia\Form\Exception\FormValidationException; -use Thelia\Core\Event\OrderEvent; +use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\TheliaEvents; use Symfony\Component\HttpFoundation\Request; use Thelia\Form\OrderDelivery; @@ -34,7 +34,6 @@ use Thelia\Log\Tlog; use Thelia\Model\AddressQuery; use Thelia\Model\AreaDeliveryModuleQuery; use Thelia\Model\Base\OrderQuery; -use Thelia\Model\CountryQuery; use Thelia\Model\ModuleQuery; use Thelia\Model\Order; use Thelia\Tools\URL; @@ -69,7 +68,7 @@ class OrderController extends BaseFrontController /* check that the delivery address belongs to the current customer */ $deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId); - if($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) { + if ($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) { throw new \Exception("Delivery address does not belong to the current customer"); } @@ -139,7 +138,7 @@ class OrderController extends BaseFrontController /* check that the invoice address belongs to the current customer */ $invoiceAddress = AddressQuery::create()->findPk($invoiceAddressId); - if($invoiceAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) { + if ($invoiceAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) { throw new \Exception("Invoice address does not belong to the current customer"); } @@ -193,7 +192,7 @@ class OrderController extends BaseFrontController $placedOrder = $orderEvent->getPlacedOrder(); - if(null !== $placedOrder && null !== $placedOrder->getId()) { + if (null !== $placedOrder && null !== $placedOrder->getId()) { /* order has been placed */ $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute('order.placed', array('order_id' => $orderEvent->getPlacedOrder()->getId())))); } else { @@ -209,13 +208,13 @@ class OrderController extends BaseFrontController $this->getRequest()->attributes->get('order_id') ); - if(null === $placedOrder) { + if (null === $placedOrder) { throw new TheliaProcessException("No placed order", TheliaProcessException::NO_PLACED_ORDER, $placedOrder); } $customer = $this->getSecurityContext()->getCustomerUser(); - if(null === $customer || $placedOrder->getCustomerId() !== $customer->getId()) { + if (null === $customer || $placedOrder->getCustomerId() !== $customer->getId()) { throw new TheliaProcessException("Received placed order id does not belong to the current customer", TheliaProcessException::PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER, $placedOrder); } diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php index 505d7a3fa..7d7ab086f 100755 --- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php @@ -84,7 +84,7 @@ class RegisterRouterPass implements CompilerPassInterface $container->setDefinition("router.".$moduleCode, $definition); - $chainRouter->addMethodCall("add", array(new Reference("router.".$moduleCode), 1)); + $chainRouter->addMethodCall("add", array(new Reference("router.".$moduleCode), 150)); } } } diff --git a/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php rename to core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php index 01e615ff6..05fc909d2 100644 --- a/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Address; use Symfony\Component\EventDispatcher\Event; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Address; use Thelia\Model\Customer; @@ -243,8 +244,6 @@ class AddressCreateOrUpdateEvent extends ActionEvent return $this->isDefault; } - - /** * @param \Thelia\Model\Customer $customer */ diff --git a/core/lib/Thelia/Core/Event/AddressEvent.php b/core/lib/Thelia/Core/Event/Address/AddressEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/AddressEvent.php rename to core/lib/Thelia/Core/Event/Address/AddressEvent.php index 366801075..d36fd7cab 100644 --- a/core/lib/Thelia/Core/Event/AddressEvent.php +++ b/core/lib/Thelia/Core/Event/Address/AddressEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Address; use Symfony\Component\EventDispatcher\Event; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Address; /** diff --git a/core/lib/Thelia/Core/Event/AttributeAvCreateEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeAvCreateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/AttributeAvCreateEvent.php rename to core/lib/Thelia/Core/Event/Attribute/AttributeAvCreateEvent.php index 81d22cfb9..b0b0ee6a3 100644 --- a/core/lib/Thelia/Core/Event/AttributeAvCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Attribute/AttributeAvCreateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Attribute; + +use Thelia\Core\Event\Attribute\AttributeAvEvent; class AttributeAvCreateEvent extends AttributeAvEvent { diff --git a/core/lib/Thelia/Core/Event/AttributeAvDeleteEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeAvDeleteEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/AttributeAvDeleteEvent.php rename to core/lib/Thelia/Core/Event/Attribute/AttributeAvDeleteEvent.php index d710dc23f..515764e3d 100644 --- a/core/lib/Thelia/Core/Event/AttributeAvDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Attribute/AttributeAvDeleteEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Attribute; + +use Thelia\Core\Event\Attribute\AttributeAvEvent; class AttributeAvDeleteEvent extends AttributeAvEvent { diff --git a/core/lib/Thelia/Core/Event/AttributeAvEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeAvEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/AttributeAvEvent.php rename to core/lib/Thelia/Core/Event/Attribute/AttributeAvEvent.php index c6c1726bd..3dcf1e889 100644 --- a/core/lib/Thelia/Core/Event/AttributeAvEvent.php +++ b/core/lib/Thelia/Core/Event/Attribute/AttributeAvEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Attribute; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\AttributeAv; class AttributeAvEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/AttributeAvUpdateEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeAvUpdateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/AttributeAvUpdateEvent.php rename to core/lib/Thelia/Core/Event/Attribute/AttributeAvUpdateEvent.php index c76198954..318ec5817 100644 --- a/core/lib/Thelia/Core/Event/AttributeAvUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Attribute/AttributeAvUpdateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Attribute; + +use Thelia\Core\Event\Attribute\AttributeAvCreateEvent; class AttributeAvUpdateEvent extends AttributeAvCreateEvent { diff --git a/core/lib/Thelia/Core/Event/AttributeCreateEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeCreateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/AttributeCreateEvent.php rename to core/lib/Thelia/Core/Event/Attribute/AttributeCreateEvent.php index 0787b34e3..155560de0 100644 --- a/core/lib/Thelia/Core/Event/AttributeCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Attribute/AttributeCreateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Attribute; + +use Thelia\Core\Event\Attribute\AttributeEvent; class AttributeCreateEvent extends AttributeEvent { diff --git a/core/lib/Thelia/Core/Event/AttributeDeleteEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeDeleteEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/AttributeDeleteEvent.php rename to core/lib/Thelia/Core/Event/Attribute/AttributeDeleteEvent.php index d7f359f9a..d4ee6227b 100644 --- a/core/lib/Thelia/Core/Event/AttributeDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Attribute/AttributeDeleteEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Attribute; + +use Thelia\Core\Event\Attribute\AttributeEvent; class AttributeDeleteEvent extends AttributeEvent { diff --git a/core/lib/Thelia/Core/Event/AttributeEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/AttributeEvent.php rename to core/lib/Thelia/Core/Event/Attribute/AttributeEvent.php index 7ce78938c..471505270 100644 --- a/core/lib/Thelia/Core/Event/AttributeEvent.php +++ b/core/lib/Thelia/Core/Event/Attribute/AttributeEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Attribute; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Attribute; class AttributeEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/AttributeUpdateEvent.php b/core/lib/Thelia/Core/Event/Attribute/AttributeUpdateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/AttributeUpdateEvent.php rename to core/lib/Thelia/Core/Event/Attribute/AttributeUpdateEvent.php index a1bf124d9..d692586e4 100644 --- a/core/lib/Thelia/Core/Event/AttributeUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Attribute/AttributeUpdateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Attribute; + +use Thelia\Core\Event\Attribute\AttributeCreateEvent; class AttributeUpdateEvent extends AttributeCreateEvent { diff --git a/core/lib/Thelia/Core/Event/CartEvent.php b/core/lib/Thelia/Core/Event/Cart/CartEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/CartEvent.php rename to core/lib/Thelia/Core/Event/Cart/CartEvent.php index b24a5c403..4e1ed304d 100755 --- a/core/lib/Thelia/Core/Event/CartEvent.php +++ b/core/lib/Thelia/Core/Event/Cart/CartEvent.php @@ -21,9 +21,10 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Cart; use Symfony\Component\EventDispatcher\Event; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Cart; class CartEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/CartItemEvent.php b/core/lib/Thelia/Core/Event/Cart/CartItemEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/CartItemEvent.php rename to core/lib/Thelia/Core/Event/Cart/CartItemEvent.php index 6718b63ff..83cbd17c0 100755 --- a/core/lib/Thelia/Core/Event/CartItemEvent.php +++ b/core/lib/Thelia/Core/Event/Cart/CartItemEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Cart; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\CartItem; class CartItemEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/CategoryAddContentEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryAddContentEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/CategoryAddContentEvent.php rename to core/lib/Thelia/Core/Event/Category/CategoryAddContentEvent.php index 3ca5b2ae5..115eae724 100644 --- a/core/lib/Thelia/Core/Event/CategoryAddContentEvent.php +++ b/core/lib/Thelia/Core/Event/Category/CategoryAddContentEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Category; +use Thelia\Core\Event\Category\CategoryEvent; use Thelia\Model\Category; class CategoryAddContentEvent extends CategoryEvent diff --git a/core/lib/Thelia/Core/Event/CategoryAssociatedContentEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryAssociatedContentEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/CategoryAssociatedContentEvent.php rename to core/lib/Thelia/Core/Event/Category/CategoryAssociatedContentEvent.php index 1984a042c..6593419ef 100644 --- a/core/lib/Thelia/Core/Event/CategoryAssociatedContentEvent.php +++ b/core/lib/Thelia/Core/Event/Category/CategoryAssociatedContentEvent.php @@ -21,7 +21,7 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Category; use Thelia\Model\CategoryAssociatedContent; use Thelia\Core\Event\ActionEvent; diff --git a/core/lib/Thelia/Core/Event/CategoryCreateEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryCreateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/CategoryCreateEvent.php rename to core/lib/Thelia/Core/Event/Category/CategoryCreateEvent.php index 41529019c..870b0beb8 100644 --- a/core/lib/Thelia/Core/Event/CategoryCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Category/CategoryCreateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Category; + +use Thelia\Core\Event\Category\CategoryEvent; class CategoryCreateEvent extends CategoryEvent { diff --git a/core/lib/Thelia/Core/Event/CategoryDeleteContentEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryDeleteContentEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/CategoryDeleteContentEvent.php rename to core/lib/Thelia/Core/Event/Category/CategoryDeleteContentEvent.php index bb28beb21..01a92a1b8 100644 --- a/core/lib/Thelia/Core/Event/CategoryDeleteContentEvent.php +++ b/core/lib/Thelia/Core/Event/Category/CategoryDeleteContentEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Category; +use Thelia\Core\Event\Category\CategoryEvent; use Thelia\Model\Category; class CategoryDeleteContentEvent extends CategoryEvent diff --git a/core/lib/Thelia/Core/Event/CategoryDeleteEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryDeleteEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/CategoryDeleteEvent.php rename to core/lib/Thelia/Core/Event/Category/CategoryDeleteEvent.php index 9d77a7e87..a81d9c7ad 100644 --- a/core/lib/Thelia/Core/Event/CategoryDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Category/CategoryDeleteEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Category; + +use Thelia\Core\Event\Category\CategoryEvent; class CategoryDeleteEvent extends CategoryEvent { diff --git a/core/lib/Thelia/Core/Event/CategoryEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/CategoryEvent.php rename to core/lib/Thelia/Core/Event/Category/CategoryEvent.php index ab5b101e5..ae0cb3b4a 100644 --- a/core/lib/Thelia/Core/Event/CategoryEvent.php +++ b/core/lib/Thelia/Core/Event/Category/CategoryEvent.php @@ -21,7 +21,7 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Category; use Thelia\Model\Category; use Thelia\Core\Event\ActionEvent; diff --git a/core/lib/Thelia/Core/Event/CategoryToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryToggleVisibilityEvent.php similarity index 95% rename from core/lib/Thelia/Core/Event/CategoryToggleVisibilityEvent.php rename to core/lib/Thelia/Core/Event/Category/CategoryToggleVisibilityEvent.php index f90378e38..3d580701a 100644 --- a/core/lib/Thelia/Core/Event/CategoryToggleVisibilityEvent.php +++ b/core/lib/Thelia/Core/Event/Category/CategoryToggleVisibilityEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Category; + +use Thelia\Core\Event\Category\CategoryEvent; class CategoryToggleVisibilityEvent extends CategoryEvent { diff --git a/core/lib/Thelia/Core/Event/CategoryUpdateEvent.php b/core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/CategoryUpdateEvent.php rename to core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php index f5f775a22..d04e8da08 100644 --- a/core/lib/Thelia/Core/Event/CategoryUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Category/CategoryUpdateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Category; + +use Thelia\Core\Event\Category\CategoryCreateEvent; class CategoryUpdateEvent extends CategoryCreateEvent { diff --git a/core/lib/Thelia/Core/Event/ConfigCreateEvent.php b/core/lib/Thelia/Core/Event/Config/ConfigCreateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/ConfigCreateEvent.php rename to core/lib/Thelia/Core/Event/Config/ConfigCreateEvent.php index 986eb31b7..86cd5c84f 100644 --- a/core/lib/Thelia/Core/Event/ConfigCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Config/ConfigCreateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Config; + +use Thelia\Core\Event\Config\ConfigEvent; class ConfigCreateEvent extends ConfigEvent { diff --git a/core/lib/Thelia/Core/Event/ConfigDeleteEvent.php b/core/lib/Thelia/Core/Event/Config/ConfigDeleteEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/ConfigDeleteEvent.php rename to core/lib/Thelia/Core/Event/Config/ConfigDeleteEvent.php index 87ae50c38..f225e49b5 100644 --- a/core/lib/Thelia/Core/Event/ConfigDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Config/ConfigDeleteEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Config; + +use Thelia\Core\Event\Config\ConfigEvent; class ConfigDeleteEvent extends ConfigEvent { diff --git a/core/lib/Thelia/Core/Event/ConfigEvent.php b/core/lib/Thelia/Core/Event/Config/ConfigEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/ConfigEvent.php rename to core/lib/Thelia/Core/Event/Config/ConfigEvent.php index 646b43856..d2dab3f87 100644 --- a/core/lib/Thelia/Core/Event/ConfigEvent.php +++ b/core/lib/Thelia/Core/Event/Config/ConfigEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Config; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Config; class ConfigEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/ConfigUpdateEvent.php b/core/lib/Thelia/Core/Event/Config/ConfigUpdateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/ConfigUpdateEvent.php rename to core/lib/Thelia/Core/Event/Config/ConfigUpdateEvent.php index b3d5955c4..f37f6ab55 100644 --- a/core/lib/Thelia/Core/Event/ConfigUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Config/ConfigUpdateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Config; + +use Thelia\Core\Event\Config\ConfigCreateEvent; class ConfigUpdateEvent extends ConfigCreateEvent { diff --git a/core/lib/Thelia/Core/Event/Content/ContentAddFolderEvent.php b/core/lib/Thelia/Core/Event/Content/ContentAddFolderEvent.php new file mode 100644 index 000000000..a1d1d44e1 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Content/ContentAddFolderEvent.php @@ -0,0 +1,66 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Content; +use Thelia\Model\Content; + + +/** + * Class ContentAddFolderEvent + * @package Thelia\Core\Event\Content + * @author Manuel Raynaud + */ +class ContentAddFolderEvent extends ContentEvent +{ + + /** + * @var int folder id + */ + protected $folderId; + + public function __construct(Content $content, $folderId) + { + $this->folderId = $folderId; + + parent::__construct($content); + } + + /** + * @param int $folderId + */ + public function setFolderId($folderId) + { + $this->folderId = $folderId; + } + + /** + * @return int + */ + public function getFolderId() + { + return $this->folderId; + } + + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php b/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php index 5e2e7f0ea..7763fd359 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Content; - /** * Class ContentCreateEvent * @package Thelia\Core\Event\Content @@ -76,9 +75,6 @@ class ContentCreateEvent extends ContentEvent return $this->default_folder; } - - - /** * @param mixed $visible * @@ -119,6 +115,4 @@ class ContentCreateEvent extends ContentEvent return $this->title; } - - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php b/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php index 3b5e5423b..8ad5b1c6f 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Content; - /** * Class ContentDeleteEvent * @package Thelia\Core\Event\Content @@ -35,7 +34,7 @@ class ContentDeleteEvent extends ContentEvent protected $folder_id; - function __construct($content_id) + public function __construct($content_id) { $this->content_id = $content_id; } @@ -70,5 +69,4 @@ class ContentDeleteEvent extends ContentEvent return $this->folder_id; } - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Content/ContentEvent.php b/core/lib/Thelia/Core/Event/Content/ContentEvent.php index 0949348e3..aebda8d28 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentEvent.php @@ -25,7 +25,6 @@ namespace Thelia\Core\Event\Content; use Thelia\Core\Event\ActionEvent; use Thelia\Model\Content; - /** * Class ContentEvent * @package Thelia\Core\Event\Content @@ -38,7 +37,7 @@ class ContentEvent extends ActionEvent */ protected $content; - function __construct(Content $content = null) + public function __construct(Content $content = null) { $this->content = $content; } @@ -70,4 +69,4 @@ class ContentEvent extends ActionEvent { return null !== $this->content; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Content/ContentRemoveFolderEvent.php b/core/lib/Thelia/Core/Event/Content/ContentRemoveFolderEvent.php new file mode 100644 index 000000000..195f4f3b0 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Content/ContentRemoveFolderEvent.php @@ -0,0 +1,34 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Content; + + +/** + * Class ContentRemoveFolderEvent + * @package Thelia\Core\Event\Content + * @author Manuel Raynaud + */ +class ContentRemoveFolderEvent extends ContentAddFolderEvent +{ +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php index 55176635c..b2b7e46e9 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Content; - /** * Class ContentToggleVisibilityEvent * @package Thelia\Core\Event\Content @@ -32,4 +31,4 @@ namespace Thelia\Core\Event\Content; class ContentToggleVisibilityEvent extends ContentEvent { -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php b/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php index f7c75a01f..fb5bdfb5e 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Content; - /** * Class ContentUpdateEvent * @package Thelia\Core\Event\Content @@ -39,7 +38,7 @@ class ContentUpdateEvent extends ContentCreateEvent protected $url; - function __construct($content_id) + public function __construct($content_id) { $this->content_id = $content_id; } @@ -144,7 +143,4 @@ class ContentUpdateEvent extends ContentCreateEvent return $this->url; } - - - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Country/CountryCreateEvent.php b/core/lib/Thelia/Core/Event/Country/CountryCreateEvent.php new file mode 100644 index 000000000..48e8469a4 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Country/CountryCreateEvent.php @@ -0,0 +1,154 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Country; + + +/** + * Class CountryCreateEvent + * @package Thelia\Core\Event\Country + * @author Manuel Raynaud + */ +class CountryCreateEvent extends CountryEvent +{ + protected $locale; + protected $title; + protected $isocode; + protected $isoAlpha2; + protected $isoAlpha3; + + /** + * @var int area zone + */ + protected $area; + + /** + * @param mixed $isoAlpha2 + */ + public function setIsoAlpha2($isoAlpha2) + { + $this->isoAlpha2 = $isoAlpha2; + + return $this; + } + + /** + * @return mixed + */ + public function getIsoAlpha2() + { + return $this->isoAlpha2; + } + + /** + * @param mixed $isoAlpha3 + */ + public function setIsoAlpha3($isoAlpha3) + { + $this->isoAlpha3 = $isoAlpha3; + + return $this; + } + + /** + * @return mixed + */ + public function getIsoAlpha3() + { + return $this->isoAlpha3; + } + + /** + * @param mixed $isocode + */ + public function setIsocode($isocode) + { + $this->isocode = $isocode; + + return $this; + } + + /** + * @return mixed + */ + public function getIsocode() + { + return $this->isocode; + } + + /** + * @param mixed $locale + */ + public function setLocale($locale) + { + $this->locale = $locale; + + return $this; + } + + /** + * @return mixed + */ + public function getLocale() + { + return $this->locale; + } + + /** + * @param mixed $title + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * @return mixed + */ + public function getTitle() + { + return $this->title; + } + + /** + * @param int $area + */ + public function setArea($area) + { + $this->area = $area; + + return $this; + } + + /** + * @return int + */ + public function getArea() + { + return $this->area; + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Country/CountryDeleteEvent.php b/core/lib/Thelia/Core/Event/Country/CountryDeleteEvent.php new file mode 100644 index 000000000..4a7d9c400 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Country/CountryDeleteEvent.php @@ -0,0 +1,60 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Country; + + +/** + * Class CountryDeleteEvent + * @package Thelia\Core\Event\Country + * @author Manuel Raynaud + */ +class CountryDeleteEvent extends CountryEvent +{ + /** + * @var int country id + */ + protected $country_id; + + function __construct($country_id) + { + $this->country_id = $country_id; + } + + /** + * @param int $country_id + */ + public function setCountryId($country_id) + { + $this->country_id = $country_id; + } + + /** + * @return int + */ + public function getCountryId() + { + return $this->country_id; + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Country/CountryEvent.php b/core/lib/Thelia/Core/Event/Country/CountryEvent.php new file mode 100644 index 000000000..962d880fa --- /dev/null +++ b/core/lib/Thelia/Core/Event/Country/CountryEvent.php @@ -0,0 +1,73 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Country; +use Thelia\Core\Event\ActionEvent; +use Thelia\Model\Country; + + +/** + * Class CountryEvent + * @package Thelia\Core\Event\Country + * @author Manuel Raynaud + */ +class CountryEvent extends ActionEvent +{ + /* + * @var \Thelia\Model\Country + */ + protected $country; + + function __construct(Country $country = null) + { + $this->country = $country; + } + + /** + * @param mixed $country + */ + public function setCountry(Country $country) + { + $this->country = $country; + + return $this; + } + + /** + * @return null|\Thelia\Model\Country + */ + public function getCountry() + { + return $this->country; + } + + /** + * @return bool + */ + public function hasCountry() + { + return null !== $this->country; + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Country/CountryToggleDefaultEvent.php b/core/lib/Thelia/Core/Event/Country/CountryToggleDefaultEvent.php new file mode 100644 index 000000000..8f8142d0d --- /dev/null +++ b/core/lib/Thelia/Core/Event/Country/CountryToggleDefaultEvent.php @@ -0,0 +1,48 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Country; + + +/** + * Class CountryToggleDefaultEvent + * @package Thelia\Core\Event\Country + * @author manuel raynaud + */ +class CountryToggleDefaultEvent extends CountryEvent +{ + protected $country_id; + + function __construct($country_id) + { + $this->country_id = $country_id; + } + + /** + * @return mixed + */ + public function getCountryId() + { + return $this->country_id; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Country/CountryUpdateEvent.php b/core/lib/Thelia/Core/Event/Country/CountryUpdateEvent.php new file mode 100644 index 000000000..5c4ad1cf3 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Country/CountryUpdateEvent.php @@ -0,0 +1,35 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Country; + + +/** + * Class CountryUpdateEvent + * @package Thelia\Core\Event\Country + * @author Manuel Raynaud + */ +class CountryUpdateEvent extends CountryCreateEvent +{ + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CurrencyCreateEvent.php b/core/lib/Thelia/Core/Event/Currency/CurrencyCreateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/CurrencyCreateEvent.php rename to core/lib/Thelia/Core/Event/Currency/CurrencyCreateEvent.php index fe2cf078c..45f5a1bbe 100644 --- a/core/lib/Thelia/Core/Event/CurrencyCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Currency/CurrencyCreateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Currency; + +use Thelia\Core\Event\Currency\CurrencyEvent; class CurrencyCreateEvent extends CurrencyEvent { diff --git a/core/lib/Thelia/Core/Event/CurrencyDeleteEvent.php b/core/lib/Thelia/Core/Event/Currency/CurrencyDeleteEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/CurrencyDeleteEvent.php rename to core/lib/Thelia/Core/Event/Currency/CurrencyDeleteEvent.php index 706b77f9d..0845d4b9a 100644 --- a/core/lib/Thelia/Core/Event/CurrencyDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Currency/CurrencyDeleteEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Currency; + +use Thelia\Core\Event\Currency\CurrencyEvent; class CurrencyDeleteEvent extends CurrencyEvent { diff --git a/core/lib/Thelia/Core/Event/CurrencyEvent.php b/core/lib/Thelia/Core/Event/Currency/CurrencyEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/CurrencyEvent.php rename to core/lib/Thelia/Core/Event/Currency/CurrencyEvent.php index cdc0b854c..47f91b81d 100644 --- a/core/lib/Thelia/Core/Event/CurrencyEvent.php +++ b/core/lib/Thelia/Core/Event/Currency/CurrencyEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Currency; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Currency; class CurrencyEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/CurrencyUpdateEvent.php b/core/lib/Thelia/Core/Event/Currency/CurrencyUpdateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/CurrencyUpdateEvent.php rename to core/lib/Thelia/Core/Event/Currency/CurrencyUpdateEvent.php index 58f8b0af4..2d9e6e72b 100644 --- a/core/lib/Thelia/Core/Event/CurrencyUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Currency/CurrencyUpdateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Currency; + +use Thelia\Core\Event\Currency\CurrencyCreateEvent; class CurrencyUpdateEvent extends CurrencyCreateEvent { diff --git a/core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php similarity index 95% rename from core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php rename to core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php index d3ae6f62d..2c59c2899 100755 --- a/core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php @@ -20,9 +20,10 @@ /* along with this program. If not, see . */ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Customer; use Symfony\Component\EventDispatcher\Event; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Customer; /** @@ -58,7 +59,7 @@ class CustomerCreateOrUpdateEvent extends ActionEvent protected $customer; /** - * @param int $title the title customer id + * @param int $title the title customer id * @param string $firstname * @param string $lastname * @param string $address1 @@ -68,13 +69,13 @@ class CustomerCreateOrUpdateEvent extends ActionEvent * @param string $cellphone * @param string $zipcode * @param string $city - * @param int $country the country id + * @param int $country the country id * @param string $email * @param string $password plain password, don't put hash password, it will hashes again * @param $lang - * @param int $reseller if customer is a reseller - * @param int $sponsor customer's id sponsor - * @param float $discount + * @param int $reseller if customer is a reseller + * @param int $sponsor customer's id sponsor + * @param float $discount * @param string $company */ public function __construct($title, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $country, $email, $password, $lang, $reseller, $sponsor, $discount, $company) diff --git a/core/lib/Thelia/Core/Event/CustomerEvent.php b/core/lib/Thelia/Core/Event/Customer/CustomerEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/CustomerEvent.php rename to core/lib/Thelia/Core/Event/Customer/CustomerEvent.php index 191b67e78..f11bb7f2d 100755 --- a/core/lib/Thelia/Core/Event/CustomerEvent.php +++ b/core/lib/Thelia/Core/Event/Customer/CustomerEvent.php @@ -21,7 +21,7 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Customer; use Thelia\Model\Customer; use Thelia\Core\Event\ActionEvent; diff --git a/core/lib/Thelia/Core/Event/CustomerLoginEvent.php b/core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/CustomerLoginEvent.php rename to core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php index e43968845..56c29bf6c 100755 --- a/core/lib/Thelia/Core/Event/CustomerLoginEvent.php +++ b/core/lib/Thelia/Core/Event/Customer/CustomerLoginEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Customer; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Customer; class CustomerLoginEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/DocumentCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/DocumentCreateOrUpdateEvent.php rename to core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php index 81e52257e..74deeacc1 100755 --- a/core/lib/Thelia/Core/Event/DocumentCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Document; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\CategoryDocument; use Thelia\Model\ContentDocument; use Thelia\Model\FolderDocument; @@ -65,7 +66,7 @@ class DocumentCreateOrUpdateEvent extends ActionEvent * * @param string $documentType Document type * ex : FileManager::TYPE_CATEGORY - * @param int $parentId Document parent id + * @param int $parentId Document parent id */ public function __construct($documentType, $parentId) { @@ -213,5 +214,4 @@ class DocumentCreateOrUpdateEvent extends ActionEvent return $this->oldModelDocument; } - } diff --git a/core/lib/Thelia/Core/Event/DocumentDeleteEvent.php b/core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/DocumentDeleteEvent.php rename to core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php index d9e2b7161..28a51a208 100755 --- a/core/lib/Thelia/Core/Event/DocumentDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Document; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\CategoryDocument; use Thelia\Model\ContentDocument; use Thelia\Model\FolderDocument; @@ -108,5 +109,4 @@ class DocumentDeleteEvent extends ActionEvent return $this->documentToDelete; } - } diff --git a/core/lib/Thelia/Core/Event/DocumentEvent.php b/core/lib/Thelia/Core/Event/Document/DocumentEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/DocumentEvent.php rename to core/lib/Thelia/Core/Event/Document/DocumentEvent.php index 6248b8d9a..dd3fe86b1 100644 --- a/core/lib/Thelia/Core/Event/DocumentEvent.php +++ b/core/lib/Thelia/Core/Event/Document/DocumentEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Document; +use Thelia\Core\Event\CachedFileEvent; /** * Class DocumentEvent diff --git a/core/lib/Thelia/Core/Event/FeatureAvCreateEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureAvCreateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/FeatureAvCreateEvent.php rename to core/lib/Thelia/Core/Event/Feature/FeatureAvCreateEvent.php index 2c8fb228e..f465d92d3 100644 --- a/core/lib/Thelia/Core/Event/FeatureAvCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Feature/FeatureAvCreateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Feature; + +use Thelia\Core\Event\Feature\FeatureAvEvent; class FeatureAvCreateEvent extends FeatureAvEvent { diff --git a/core/lib/Thelia/Core/Event/FeatureAvDeleteEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureAvDeleteEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/FeatureAvDeleteEvent.php rename to core/lib/Thelia/Core/Event/Feature/FeatureAvDeleteEvent.php index aa0a3c729..85e97f890 100644 --- a/core/lib/Thelia/Core/Event/FeatureAvDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Feature/FeatureAvDeleteEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Feature; + +use Thelia\Core\Event\Feature\FeatureAvEvent; class FeatureAvDeleteEvent extends FeatureAvEvent { diff --git a/core/lib/Thelia/Core/Event/FeatureAvEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureAvEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/FeatureAvEvent.php rename to core/lib/Thelia/Core/Event/Feature/FeatureAvEvent.php index 225acaf11..42011bfe3 100644 --- a/core/lib/Thelia/Core/Event/FeatureAvEvent.php +++ b/core/lib/Thelia/Core/Event/Feature/FeatureAvEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Feature; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\FeatureAv; class FeatureAvEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/FeatureAvUpdateEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureAvUpdateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/FeatureAvUpdateEvent.php rename to core/lib/Thelia/Core/Event/Feature/FeatureAvUpdateEvent.php index 5db9604c2..cd9d375aa 100644 --- a/core/lib/Thelia/Core/Event/FeatureAvUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Feature/FeatureAvUpdateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Feature; + +use Thelia\Core\Event\Feature\FeatureAvCreateEvent; class FeatureAvUpdateEvent extends FeatureAvCreateEvent { diff --git a/core/lib/Thelia/Core/Event/FeatureCreateEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureCreateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/FeatureCreateEvent.php rename to core/lib/Thelia/Core/Event/Feature/FeatureCreateEvent.php index 574433084..34f49b541 100644 --- a/core/lib/Thelia/Core/Event/FeatureCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Feature/FeatureCreateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Feature; + +use Thelia\Core\Event\Feature\FeatureEvent; class FeatureCreateEvent extends FeatureEvent { diff --git a/core/lib/Thelia/Core/Event/FeatureDeleteEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureDeleteEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/FeatureDeleteEvent.php rename to core/lib/Thelia/Core/Event/Feature/FeatureDeleteEvent.php index 1eca57982..5d53bf4bd 100644 --- a/core/lib/Thelia/Core/Event/FeatureDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Feature/FeatureDeleteEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Feature; + +use Thelia\Core\Event\Feature\FeatureEvent; class FeatureDeleteEvent extends FeatureEvent { diff --git a/core/lib/Thelia/Core/Event/FeatureEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/FeatureEvent.php rename to core/lib/Thelia/Core/Event/Feature/FeatureEvent.php index f1510ac63..7b597acaf 100644 --- a/core/lib/Thelia/Core/Event/FeatureEvent.php +++ b/core/lib/Thelia/Core/Event/Feature/FeatureEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Feature; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Feature; class FeatureEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/FeatureUpdateEvent.php b/core/lib/Thelia/Core/Event/Feature/FeatureUpdateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/FeatureUpdateEvent.php rename to core/lib/Thelia/Core/Event/Feature/FeatureUpdateEvent.php index 6bee33ebb..55c6cd651 100644 --- a/core/lib/Thelia/Core/Event/FeatureUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Feature/FeatureUpdateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Feature; + +use Thelia\Core\Event\Feature\FeatureCreateEvent; class FeatureUpdateEvent extends FeatureCreateEvent { diff --git a/core/lib/Thelia/Core/Event/FeatureProductDeleteEvent.php b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductDeleteEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/FeatureProductDeleteEvent.php rename to core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductDeleteEvent.php index 5c74c6287..73cb88013 100644 --- a/core/lib/Thelia/Core/Event/FeatureProductDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductDeleteEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\FeatureProduct; +use Thelia\Core\Event\FeatureProduct\FeatureProductEvent; use Thelia\Model\FeatureProduct; class FeatureProductDeleteEvent extends FeatureProductEvent diff --git a/core/lib/Thelia/Core/Event/FeatureProductEvent.php b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/FeatureProductEvent.php rename to core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php index 0acf48569..aef4b25f5 100644 --- a/core/lib/Thelia/Core/Event/FeatureProductEvent.php +++ b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\FeatureProduct; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\FeatureProduct; class FeatureProductEvent extends ActionEvent @@ -49,4 +50,4 @@ class FeatureProductEvent extends ActionEvent return $this; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/FeatureProductUpdateEvent.php b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductUpdateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/FeatureProductUpdateEvent.php rename to core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductUpdateEvent.php index 5493c55a7..8cb90dfdd 100644 --- a/core/lib/Thelia/Core/Event/FeatureProductUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductUpdateEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\FeatureProduct; +use Thelia\Core\Event\FeatureProduct\FeatureProductEvent; use Thelia\Model\FeatureProduct; class FeatureProductUpdateEvent extends FeatureProductEvent diff --git a/core/lib/Thelia/Core/Event/FolderCreateEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/FolderCreateEvent.php rename to core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php index 609fea6f8..162d6c896 100644 --- a/core/lib/Thelia/Core/Event/FolderCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php @@ -21,15 +21,16 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; - +namespace Thelia\Core\Event\Folder; +use Thelia\Core\Event\Folder\FolderEvent; /** * Class FolderCreateEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class FolderCreateEvent extends FolderEvent { +class FolderCreateEvent extends FolderEvent +{ protected $title; protected $parent; protected $locale; @@ -116,5 +117,4 @@ class FolderCreateEvent extends FolderEvent { return $this->visible; } - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/FolderDeleteEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php similarity index 93% rename from core/lib/Thelia/Core/Event/FolderDeleteEvent.php rename to core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php index 1ef83ef51..4dd251179 100644 --- a/core/lib/Thelia/Core/Event/FolderDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php @@ -21,16 +21,16 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; - +namespace Thelia\Core\Event\Folder; +use Thelia\Core\Event\Folder\FolderEvent; /** * Class FolderDeleteEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class FolderDeleteEvent extends FolderEvent{ - +class FolderDeleteEvent extends FolderEvent +{ /** * @var int folder id */ @@ -39,7 +39,7 @@ class FolderDeleteEvent extends FolderEvent{ /** * @param int $folder_id */ - function __construct($folder_id) + public function __construct($folder_id) { $this->folder_id = $folder_id; } @@ -60,5 +60,4 @@ class FolderDeleteEvent extends FolderEvent{ return $this->folder_id; } - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/FolderEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderEvent.php similarity index 93% rename from core/lib/Thelia/Core/Event/FolderEvent.php rename to core/lib/Thelia/Core/Event/Folder/FolderEvent.php index 8ae8223b5..62eaddf39 100644 --- a/core/lib/Thelia/Core/Event/FolderEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderEvent.php @@ -21,23 +21,23 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Folder; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Folder; - /** * Class FolderEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class FolderEvent extends ActionEvent { - +class FolderEvent extends ActionEvent +{ /** * @var \Thelia\Model\Folder */ protected $folder; - function __construct(Folder $folder = null) + public function __construct(Folder $folder = null) { $this->folder = $folder; } @@ -70,4 +70,4 @@ class FolderEvent extends ActionEvent { return null !== $this->folder; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/FolderToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php similarity index 93% rename from core/lib/Thelia/Core/Event/FolderToggleVisibilityEvent.php rename to core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php index 9d7c53ab7..d6bf24297 100644 --- a/core/lib/Thelia/Core/Event/FolderToggleVisibilityEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php @@ -21,14 +21,14 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; - +namespace Thelia\Core\Event\Folder; +use Thelia\Core\Event\Folder\FolderEvent; /** * Class FolderToggleVisibilityEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class FolderToggleVisibilityEvent extends FolderEvent { - -} \ No newline at end of file +class FolderToggleVisibilityEvent extends FolderEvent +{ +} diff --git a/core/lib/Thelia/Core/Event/FolderUpdateEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php similarity index 95% rename from core/lib/Thelia/Core/Event/FolderUpdateEvent.php rename to core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php index 47c3b28cf..bb4234d6c 100644 --- a/core/lib/Thelia/Core/Event/FolderUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php @@ -21,15 +21,16 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; - +namespace Thelia\Core\Event\Folder; +use Thelia\Core\Event\Folder\FolderCreateEvent; /** * Class FolderUpdateEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class FolderUpdateEvent extends FolderCreateEvent { +class FolderUpdateEvent extends FolderCreateEvent +{ protected $folder_id; protected $chapo; @@ -38,7 +39,7 @@ class FolderUpdateEvent extends FolderCreateEvent { protected $url; - function __construct($folder_id) + public function __construct($folder_id) { $this->folder_id = $folder_id; } @@ -133,4 +134,4 @@ class FolderUpdateEvent extends FolderCreateEvent { return $this->url; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php b/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php index 7ee22cddd..95604ceb5 100644 --- a/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php +++ b/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php @@ -23,14 +23,13 @@ namespace Thelia\Core\Event; - /** * Class GenerateRewrittenUrlEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class GenerateRewrittenUrlEvent extends ActionEvent { - +class GenerateRewrittenUrlEvent extends ActionEvent +{ protected $object; protected $locale; @@ -57,4 +56,4 @@ class GenerateRewrittenUrlEvent extends ActionEvent { return $this->url; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/ImageCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/ImageCreateOrUpdateEvent.php rename to core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php index e7d5f3449..ea870dd14 100755 --- a/core/lib/Thelia/Core/Event/ImageCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Image; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Thelia\Core\Event\ActionEvent; /** * Created by JetBrains PhpStorm. @@ -59,9 +60,9 @@ class ImageCreateOrUpdateEvent extends ActionEvent /** * Constructor * - * @param string $imageType Image type + * @param string $imageType Image type * ex : FileManager::TYPE_CATEGORY - * @param int $parentId Image parent id + * @param int $parentId Image parent id */ public function __construct($imageType, $parentId) { @@ -209,5 +210,4 @@ class ImageCreateOrUpdateEvent extends ActionEvent return $this->oldModelImage; } - } diff --git a/core/lib/Thelia/Core/Event/ImageDeleteEvent.php b/core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/ImageDeleteEvent.php rename to core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php index 9e890e999..d3ba94374 100755 --- a/core/lib/Thelia/Core/Event/ImageDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Image; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\CategoryImage; use Thelia\Model\ContentImage; use Thelia\Model\FolderImage; @@ -51,7 +52,7 @@ class ImageDeleteEvent extends ActionEvent * Constructor * * @param CategoryImage|ProductImage|ContentImage|FolderImage $imageToDelete Image about to be deleted - * @param string $imageType Image type + * @param string $imageType Image type * ex : FileManager::TYPE_CATEGORY */ public function __construct($imageToDelete, $imageType) @@ -108,5 +109,4 @@ class ImageDeleteEvent extends ActionEvent return $this->imageToDelete; } - } diff --git a/core/lib/Thelia/Core/Event/ImageEvent.php b/core/lib/Thelia/Core/Event/Image/ImageEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ImageEvent.php rename to core/lib/Thelia/Core/Event/Image/ImageEvent.php index 462fa012d..2fce2466c 100755 --- a/core/lib/Thelia/Core/Event/ImageEvent.php +++ b/core/lib/Thelia/Core/Event/Image/ImageEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Image; + +use Thelia\Core\Event\CachedFileEvent; class ImageEvent extends CachedFileEvent { diff --git a/core/lib/Thelia/Core/Event/LostPasswordEvent.php b/core/lib/Thelia/Core/Event/LostPasswordEvent.php index fe1f9dc5f..78d786b2d 100644 --- a/core/lib/Thelia/Core/Event/LostPasswordEvent.php +++ b/core/lib/Thelia/Core/Event/LostPasswordEvent.php @@ -23,14 +23,13 @@ namespace Thelia\Core\Event; - /** * Class LostPasswordEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class LostPasswordEvent extends ActionEvent { - +class LostPasswordEvent extends ActionEvent +{ protected $email; public function __construct($email) @@ -46,6 +45,4 @@ class LostPasswordEvent extends ActionEvent { return $this->email; } - - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/MailTransporterEvent.php b/core/lib/Thelia/Core/Event/MailTransporterEvent.php index d47ac693f..5a133158e 100644 --- a/core/lib/Thelia/Core/Event/MailTransporterEvent.php +++ b/core/lib/Thelia/Core/Event/MailTransporterEvent.php @@ -23,13 +23,13 @@ namespace Thelia\Core\Event; - /** * Class MailTransporterEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class MailTransporterEvent extends ActionEvent { +class MailTransporterEvent extends ActionEvent +{ /** * @var \Swift_Transport */ @@ -49,4 +49,4 @@ class MailTransporterEvent extends ActionEvent { { return null !== $this->transporter; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/MessageCreateEvent.php b/core/lib/Thelia/Core/Event/Message/MessageCreateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/MessageCreateEvent.php rename to core/lib/Thelia/Core/Event/Message/MessageCreateEvent.php index 172af5f61..fc20c2c81 100644 --- a/core/lib/Thelia/Core/Event/MessageCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Message/MessageCreateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Message; + +use Thelia\Core\Event\Message\MessageEvent; class MessageCreateEvent extends MessageEvent { diff --git a/core/lib/Thelia/Core/Event/MessageDeleteEvent.php b/core/lib/Thelia/Core/Event/Message/MessageDeleteEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/MessageDeleteEvent.php rename to core/lib/Thelia/Core/Event/Message/MessageDeleteEvent.php index 241c68463..a40b19a27 100644 --- a/core/lib/Thelia/Core/Event/MessageDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Message/MessageDeleteEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Message; + +use Thelia\Core\Event\Message\MessageEvent; class MessageDeleteEvent extends MessageEvent { diff --git a/core/lib/Thelia/Core/Event/MessageEvent.php b/core/lib/Thelia/Core/Event/Message/MessageEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/MessageEvent.php rename to core/lib/Thelia/Core/Event/Message/MessageEvent.php index c0efcf39f..82086ed05 100644 --- a/core/lib/Thelia/Core/Event/MessageEvent.php +++ b/core/lib/Thelia/Core/Event/Message/MessageEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Message; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Message; class MessageEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/MessageUpdateEvent.php b/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/MessageUpdateEvent.php rename to core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php index 8c9e2e740..858a668b8 100644 --- a/core/lib/Thelia/Core/Event/MessageUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Message; + +use Thelia\Core\Event\Message\MessageCreateEvent; class MessageUpdateEvent extends MessageCreateEvent { diff --git a/core/lib/Thelia/Core/Event/Order/OrderAddressEvent.php b/core/lib/Thelia/Core/Event/Order/OrderAddressEvent.php new file mode 100755 index 000000000..92c101dd6 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Order/OrderAddressEvent.php @@ -0,0 +1,231 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Order; + +use Thelia\Core\Event\ActionEvent; +use Thelia\Model\Order; +use Thelia\Model\OrderAddress; + +class OrderAddressEvent extends ActionEvent +{ + /** + * @var int title id + */ + protected $title; + + /** + * @var string|null company name + */ + protected $company; + + /** + * @var string first name + */ + protected $firstname; + + /** + * @var string last name + */ + protected $lastname; + + /** + * @var string address + */ + protected $address1; + + /** + * @var string address line 2 + */ + protected $address2; + + /** + * @var string address line 3 + */ + protected $address3; + + /** + * @var string zipcode + */ + protected $zipcode; + + /** + * @var string city + */ + protected $city; + + /** + * @var int country id + */ + protected $country; + + /** + * @var string phone + */ + protected $phone; + + /** + * @var \Thelia\Model\OrderAddress + */ + protected $orderAddress; + + /** + * @var \Thelia\Model\Order + */ + protected $order; + + public function __construct($title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $phone, $company) + { + $this->address1 = $address1; + $this->address2 = $address2; + $this->address3 = $address3; + $this->city = $city; + $this->company = $company; + $this->country = $country; + $this->firstname = $firstname; + $this->lastname = $lastname; + $this->phone = $phone; + $this->title = $title; + $this->zipcode = $zipcode; + } + + /** + * @return string + */ + public function getAddress1() + { + return $this->address1; + } + + /** + * @return string + */ + public function getAddress2() + { + return $this->address2; + } + + /** + * @return string + */ + public function getAddress3() + { + return $this->address3; + } + + /** + * @return string + */ + public function getCity() + { + return $this->city; + } + + /** + * @return null|string + */ + public function getCompany() + { + return $this->company; + } + + /** + * @return int + */ + public function getCountry() + { + return $this->country; + } + + /** + * @return string + */ + public function getFirstname() + { + return $this->firstname; + } + + /** + * @return string + */ + public function getLastname() + { + return $this->lastname; + } + + /** + * @return string + */ + public function getPhone() + { + return $this->phone; + } + + /** + * @return int + */ + public function getTitle() + { + return $this->title; + } + + /** + * @return string + */ + public function getZipcode() + { + return $this->zipcode; + } + + /** + * @param \Thelia\Model\OrderAddress $orderAddress + */ + public function setOrderAddress(OrderAddress $orderAddress) + { + $this->orderAddress = $orderAddress; + } + + /** + * @param \Thelia\Model\Order $order + */ + public function setOrder(Order $order) + { + $this->order = $order; + } + + /** + * @return \Thelia\Model\OrderAddress + */ + public function getOrderAddress() + { + return $this->orderAddress; + } + + /** + * @return \Thelia\Model\Order + */ + public function getOrder() + { + return $this->order; + } +} diff --git a/core/lib/Thelia/Core/Event/OrderEvent.php b/core/lib/Thelia/Core/Event/Order/OrderEvent.php similarity index 87% rename from core/lib/Thelia/Core/Event/OrderEvent.php rename to core/lib/Thelia/Core/Event/Order/OrderEvent.php index 7089141bb..7463bd176 100755 --- a/core/lib/Thelia/Core/Event/OrderEvent.php +++ b/core/lib/Thelia/Core/Event/Order/OrderEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Order; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Order; class OrderEvent extends ActionEvent @@ -35,6 +36,8 @@ class OrderEvent extends ActionEvent protected $paymentModule = null; protected $postage = null; protected $ref = null; + protected $status = null; + protected $deliveryRef = null; /** * @param Order $order @@ -108,6 +111,22 @@ class OrderEvent extends ActionEvent $this->ref = $ref; } + /** + * @param $status + */ + public function setStatus($status) + { + $this->status = $status; + } + + /** + * @param $deliveryRef + */ + public function setDeliveryRef($deliveryRef) + { + $this->deliveryRef = $deliveryRef; + } + /** * @return null|Order */ @@ -171,4 +190,20 @@ class OrderEvent extends ActionEvent { return $this->ref; } + + /** + * @return null|int + */ + public function getStatus() + { + return $this->status; + } + + /** + * @return null|string + */ + public function getDeliveryRef() + { + return $this->deliveryRef; + } } diff --git a/core/lib/Thelia/Core/Event/PdfEvent.php b/core/lib/Thelia/Core/Event/PdfEvent.php new file mode 100644 index 000000000..e0f873e04 --- /dev/null +++ b/core/lib/Thelia/Core/Event/PdfEvent.php @@ -0,0 +1,193 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + + +/** + * Class PdfEvent + * @package Thelia\Core\Event + * @author Manuel Raynaud + */ +class PdfEvent extends ActionEvent +{ + protected $content; + + protected $pdf; + + protected $orientation; + protected $format; + protected $lang; + protected $unicode; + protected $encoding; + protected $marges; + + /** + * @param $content html content to transform into pdf + * @param string $orientation page orientation, same as TCPDF + * @param string $format The format used for pages, same as TCPDF + * @param string $lang Lang : fr, en, it... + * @param bool $unicode TRUE means that the input text is unicode (default = true) + * @param string $encoding charset encoding; default is UTF-8 + * @param array $marges Default marges (left, top, right, bottom) + */ + public function __construct($content, $orientation = 'P', $format = 'A4', $lang='fr', $unicode=true, $encoding='UTF-8',array $marges = array(0, 0, 0, 0)) + { + $this->content = $content; + $this->orientation = $orientation; + $this->format = $format; + $this->lang = $lang; + $this->unicode = $unicode; + $this->encoding = $encoding; + $this->marges = $marges; + } + + /** + * @param mixed $content + */ + public function setContent($content) + { + $this->content = $content; + } + + /** + * @return mixed + */ + public function getContent() + { + return $this->content; + } + + public function setPdf($pdf) + { + $this->pdf = $pdf; + } + + public function getPdf() + { + return $this->pdf; + } + + public function hasPdf() + { + return null !== $this->pdf; + } + + /** + * @param mixed $encoding + */ + public function setEncoding($encoding) + { + $this->encoding = $encoding; + } + + /** + * @return mixed + */ + public function getEncoding() + { + return $this->encoding; + } + + /** + * @param mixed $format + */ + public function setFormat($format) + { + $this->format = $format; + } + + /** + * @return mixed + */ + public function getFormat() + { + return $this->format; + } + + /** + * @param mixed $lang + */ + public function setLang($lang) + { + $this->lang = $lang; + } + + /** + * @return mixed + */ + public function getLang() + { + return $this->lang; + } + + /** + * @param mixed $marges + */ + public function setMarges($marges) + { + $this->marges = $marges; + } + + /** + * @return mixed + */ + public function getMarges() + { + return $this->marges; + } + + /** + * @param mixed $orientation + */ + public function setOrientation($orientation) + { + $this->orientation = $orientation; + } + + /** + * @return mixed + */ + public function getOrientation() + { + return $this->orientation; + } + + /** + * @param mixed $unicode + */ + public function setUnicode($unicode) + { + $this->unicode = $unicode; + } + + /** + * @return mixed + */ + public function getUnicode() + { + return $this->unicode; + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/ProductAddAccessoryEvent.php b/core/lib/Thelia/Core/Event/Product/ProductAddAccessoryEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductAddAccessoryEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductAddAccessoryEvent.php index d3f2ba19b..d32988b84 100644 --- a/core/lib/Thelia/Core/Event/ProductAddAccessoryEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductAddAccessoryEvent.php @@ -21,7 +21,7 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; use Thelia\Model\Product; diff --git a/core/lib/Thelia/Core/Event/ProductAddCategoryEvent.php b/core/lib/Thelia/Core/Event/Product/ProductAddCategoryEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductAddCategoryEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductAddCategoryEvent.php index 215b61f99..de11b34cb 100644 --- a/core/lib/Thelia/Core/Event/ProductAddCategoryEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductAddCategoryEvent.php @@ -21,7 +21,7 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; use Thelia\Model\Product; diff --git a/core/lib/Thelia/Core/Event/ProductAddContentEvent.php b/core/lib/Thelia/Core/Event/Product/ProductAddContentEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductAddContentEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductAddContentEvent.php index 8cd648753..960dbfdf6 100644 --- a/core/lib/Thelia/Core/Event/ProductAddContentEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductAddContentEvent.php @@ -21,7 +21,7 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; use Thelia\Model\Product; diff --git a/core/lib/Thelia/Core/Event/ProductAssociatedContentEvent.php b/core/lib/Thelia/Core/Event/Product/ProductAssociatedContentEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductAssociatedContentEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductAssociatedContentEvent.php index ba41b5ede..5cdb7c8e1 100644 --- a/core/lib/Thelia/Core/Event/ProductAssociatedContentEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductAssociatedContentEvent.php @@ -21,7 +21,7 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; use Thelia\Model\ProductAssociatedContent; use Thelia\Core\Event\ActionEvent; diff --git a/core/lib/Thelia/Core/Event/ProductCreateCombinationEvent.php b/core/lib/Thelia/Core/Event/Product/ProductCreateCombinationEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductCreateCombinationEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductCreateCombinationEvent.php index 322451199..1af473aeb 100644 --- a/core/lib/Thelia/Core/Event/ProductCreateCombinationEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductCreateCombinationEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; + use Thelia\Model\Product; class ProductCreateCombinationEvent extends ProductEvent diff --git a/core/lib/Thelia/Core/Event/ProductCreateEvent.php b/core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductCreateEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php index 012d29793..a9f6bbea1 100644 --- a/core/lib/Thelia/Core/Event/ProductCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; + class ProductCreateEvent extends ProductEvent { @@ -44,6 +45,7 @@ class ProductCreateEvent extends ProductEvent public function setRef($ref) { $this->ref = $ref; + return $this; } @@ -55,6 +57,7 @@ class ProductCreateEvent extends ProductEvent public function setTitle($title) { $this->title = $title; + return $this; } @@ -66,6 +69,7 @@ class ProductCreateEvent extends ProductEvent public function setLocale($locale) { $this->locale = $locale; + return $this; } @@ -77,6 +81,7 @@ class ProductCreateEvent extends ProductEvent public function setDefaultCategory($default_category) { $this->default_category = $default_category; + return $this; } @@ -88,6 +93,7 @@ class ProductCreateEvent extends ProductEvent public function setVisible($visible) { $this->visible = $visible; + return $this; } @@ -99,6 +105,7 @@ class ProductCreateEvent extends ProductEvent public function setBasePrice($basePrice) { $this->basePrice = $basePrice; + return $this; } @@ -110,6 +117,7 @@ class ProductCreateEvent extends ProductEvent public function setBaseWeight($baseWeight) { $this->baseWeight = $baseWeight; + return $this; } @@ -121,6 +129,7 @@ class ProductCreateEvent extends ProductEvent public function setTaxRuleId($taxRuleId) { $this->taxRuleId = $taxRuleId; + return $this; } @@ -132,6 +141,7 @@ class ProductCreateEvent extends ProductEvent public function setCurrencyId($currencyId) { $this->currencyId = $currencyId; + return $this; } } diff --git a/core/lib/Thelia/Core/Event/ProductDeleteAccessoryEvent.php b/core/lib/Thelia/Core/Event/Product/ProductDeleteAccessoryEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductDeleteAccessoryEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductDeleteAccessoryEvent.php index 9644cdacc..0cfd979c2 100644 --- a/core/lib/Thelia/Core/Event/ProductDeleteAccessoryEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductDeleteAccessoryEvent.php @@ -21,7 +21,7 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; use Thelia\Model\Product; diff --git a/core/lib/Thelia/Core/Event/ProductDeleteCategoryEvent.php b/core/lib/Thelia/Core/Event/Product/ProductDeleteCategoryEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductDeleteCategoryEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductDeleteCategoryEvent.php index 4fcfeee92..e83cd087b 100644 --- a/core/lib/Thelia/Core/Event/ProductDeleteCategoryEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductDeleteCategoryEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; + use Thelia\Model\Product; class ProductDeleteCategoryEvent extends ProductEvent diff --git a/core/lib/Thelia/Core/Event/ProductDeleteCombinationEvent.php b/core/lib/Thelia/Core/Event/Product/ProductDeleteCombinationEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductDeleteCombinationEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductDeleteCombinationEvent.php index 3cc9a25ce..a4e926ee6 100644 --- a/core/lib/Thelia/Core/Event/ProductDeleteCombinationEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductDeleteCombinationEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; + use Thelia\Model\Product; class ProductDeleteCombinationEvent extends ProductEvent diff --git a/core/lib/Thelia/Core/Event/ProductDeleteContentEvent.php b/core/lib/Thelia/Core/Event/Product/ProductDeleteContentEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductDeleteContentEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductDeleteContentEvent.php index f3cdbda1f..6f09411cb 100644 --- a/core/lib/Thelia/Core/Event/ProductDeleteContentEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductDeleteContentEvent.php @@ -21,7 +21,7 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; use Thelia\Model\Product; diff --git a/core/lib/Thelia/Core/Event/ProductDeleteEvent.php b/core/lib/Thelia/Core/Event/Product/ProductDeleteEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductDeleteEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductDeleteEvent.php index 43273887c..108ceb781 100644 --- a/core/lib/Thelia/Core/Event/ProductDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductDeleteEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; + class ProductDeleteEvent extends ProductEvent { diff --git a/core/lib/Thelia/Core/Event/ProductEvent.php b/core/lib/Thelia/Core/Event/Product/ProductEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/ProductEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductEvent.php index 6decd8101..11359c616 100644 --- a/core/lib/Thelia/Core/Event/ProductEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductEvent.php @@ -21,7 +21,7 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; use Thelia\Model\Product; use Thelia\Core\Event\ActionEvent; diff --git a/core/lib/Thelia/Core/Event/ProductSetTemplateEvent.php b/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/ProductSetTemplateEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php index c7c6dc760..1847ca48f 100644 --- a/core/lib/Thelia/Core/Event/ProductSetTemplateEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php @@ -21,9 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; + use Thelia\Model\Product; -use Thelia\Core\Event\ActionEvent; class ProductSetTemplateEvent extends ProductEvent { diff --git a/core/lib/Thelia/Core/Event/ProductToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/Product/ProductToggleVisibilityEvent.php similarity index 95% rename from core/lib/Thelia/Core/Event/ProductToggleVisibilityEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductToggleVisibilityEvent.php index 732cfac76..c6a35a660 100644 --- a/core/lib/Thelia/Core/Event/ProductToggleVisibilityEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductToggleVisibilityEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; + +use Thelia\Core\Event\Product\ProductEvent; class ProductToggleVisibilityEvent extends ProductEvent { diff --git a/core/lib/Thelia/Core/Event/ProductUpdateEvent.php b/core/lib/Thelia/Core/Event/Product/ProductUpdateEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/ProductUpdateEvent.php rename to core/lib/Thelia/Core/Event/Product/ProductUpdateEvent.php index 8ade33c74..535f04462 100644 --- a/core/lib/Thelia/Core/Event/ProductUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductUpdateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Product; + +use Thelia\Core\Event\Product\ProductCreateEvent; class ProductUpdateEvent extends ProductCreateEvent { diff --git a/core/lib/Thelia/Core/Event/TemplateAddAttributeEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateAddAttributeEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/TemplateAddAttributeEvent.php rename to core/lib/Thelia/Core/Event/Template/TemplateAddAttributeEvent.php index 6adebf080..f73aba820 100644 --- a/core/lib/Thelia/Core/Event/TemplateAddAttributeEvent.php +++ b/core/lib/Thelia/Core/Event/Template/TemplateAddAttributeEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Template; +use Thelia\Core\Event\Template\TemplateEvent; use Thelia\Model\Template; class TemplateAddAttributeEvent extends TemplateEvent { diff --git a/core/lib/Thelia/Core/Event/TemplateAddFeatureEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateAddFeatureEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/TemplateAddFeatureEvent.php rename to core/lib/Thelia/Core/Event/Template/TemplateAddFeatureEvent.php index ccfecb95a..c718ea78e 100644 --- a/core/lib/Thelia/Core/Event/TemplateAddFeatureEvent.php +++ b/core/lib/Thelia/Core/Event/Template/TemplateAddFeatureEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Template; +use Thelia\Core\Event\Template\TemplateEvent; use Thelia\Model\Template; class TemplateAddFeatureEvent extends TemplateEvent { diff --git a/core/lib/Thelia/Core/Event/TemplateCreateEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateCreateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/TemplateCreateEvent.php rename to core/lib/Thelia/Core/Event/Template/TemplateCreateEvent.php index b966ce09b..e8b1cfb1a 100644 --- a/core/lib/Thelia/Core/Event/TemplateCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Template/TemplateCreateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Template; + +use Thelia\Core\Event\Template\TemplateEvent; class TemplateCreateEvent extends TemplateEvent { diff --git a/core/lib/Thelia/Core/Event/TemplateDeleteAttributeEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateDeleteAttributeEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/TemplateDeleteAttributeEvent.php rename to core/lib/Thelia/Core/Event/Template/TemplateDeleteAttributeEvent.php index 3df83422d..f3381678a 100644 --- a/core/lib/Thelia/Core/Event/TemplateDeleteAttributeEvent.php +++ b/core/lib/Thelia/Core/Event/Template/TemplateDeleteAttributeEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Template; +use Thelia\Core\Event\Template\TemplateEvent; use Thelia\Model\Template; class TemplateDeleteAttributeEvent extends TemplateEvent diff --git a/core/lib/Thelia/Core/Event/TemplateDeleteEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateDeleteEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/TemplateDeleteEvent.php rename to core/lib/Thelia/Core/Event/Template/TemplateDeleteEvent.php index de504cc98..cda8c9eea 100644 --- a/core/lib/Thelia/Core/Event/TemplateDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Template/TemplateDeleteEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Template; + +use Thelia\Core\Event\Template\TemplateEvent; class TemplateDeleteEvent extends TemplateEvent { diff --git a/core/lib/Thelia/Core/Event/TemplateDeleteFeatureEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateDeleteFeatureEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/TemplateDeleteFeatureEvent.php rename to core/lib/Thelia/Core/Event/Template/TemplateDeleteFeatureEvent.php index 83f73d923..a2d795402 100644 --- a/core/lib/Thelia/Core/Event/TemplateDeleteFeatureEvent.php +++ b/core/lib/Thelia/Core/Event/Template/TemplateDeleteFeatureEvent.php @@ -21,8 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Template; +use Thelia\Core\Event\Template\TemplateEvent; use Thelia\Model\Template; class TemplateDeleteFeatureEvent extends TemplateEvent diff --git a/core/lib/Thelia/Core/Event/TemplateEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/TemplateEvent.php rename to core/lib/Thelia/Core/Event/Template/TemplateEvent.php index 96945189e..1010cfc31 100644 --- a/core/lib/Thelia/Core/Event/TemplateEvent.php +++ b/core/lib/Thelia/Core/Event/Template/TemplateEvent.php @@ -21,7 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Template; +use Thelia\Core\Event\ActionEvent; use Thelia\Model\Template; class TemplateEvent extends ActionEvent diff --git a/core/lib/Thelia/Core/Event/TemplateUpdateEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php similarity index 96% rename from core/lib/Thelia/Core/Event/TemplateUpdateEvent.php rename to core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php index bae8ec7da..aaf39708f 100644 --- a/core/lib/Thelia/Core/Event/TemplateUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php @@ -21,7 +21,9 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event; +namespace Thelia\Core\Event\Template; + +use Thelia\Core\Event\Template\TemplateCreateEvent; class TemplateUpdateEvent extends TemplateCreateEvent { @@ -55,6 +57,7 @@ class TemplateUpdateEvent extends TemplateCreateEvent public function setFeatureList($feature_list) { $this->feature_list = $feature_list; + return $this; } @@ -66,6 +69,7 @@ class TemplateUpdateEvent extends TemplateCreateEvent public function setAttributeList($attribute_list) { $this->attribute_list = $attribute_list; + return $this; } } diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 3af6f195c..4e4f55ba8 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -76,6 +76,11 @@ final class TheliaEvents */ const CUSTOMER_DELETEACCOUNT = "action.deleteCustomer"; + /** + * sent on customer address removal + */ + const CUSTOMER_ADDRESS_DELETE = "action.customer.deleteAddress"; + /** * sent when a customer need a new password */ @@ -134,6 +139,11 @@ final class TheliaEvents */ const ADDRESS_DELETE = "action.deleteAddress"; + /** + * sent when an address is tag as default + */ + const ADDRESS_DEFAULT = "action.defaultAddress"; + const BEFORE_CREATEADDRESS = "action.before_createAddress"; const AFTER_CREATEADDRESS = "action.after_createAddress"; @@ -173,8 +183,6 @@ final class TheliaEvents const FOLDER_TOGGLE_VISIBILITY = "action.toggleFolderVisibility"; const FOLDER_UPDATE_POSITION = "action.updateFolderPosition"; -// const FOLDER_ADD_CONTENT = "action.categoryAddContent"; -// const FOLDER_REMOVE_CONTENT = "action.categoryRemoveContent"; const BEFORE_CREATEFOLDER = "action.before_createFolder"; const AFTER_CREATEFOLDER = "action.after_createFolder"; @@ -193,8 +201,9 @@ final class TheliaEvents const CONTENT_TOGGLE_VISIBILITY = "action.toggleContentVisibility"; const CONTENT_UPDATE_POSITION = "action.updateContentPosition"; -// const FOLDER_ADD_CONTENT = "action.categoryAddContent"; -// const FOLDER_REMOVE_CONTENT = "action.categoryRemoveContent"; + const CONTENT_ADD_FOLDER = "action.contentAddFolder"; + const CONTENT_REMOVE_FOLDER = "action.contentRemoveFolder"; + const BEFORE_CREATECONTENT = "action.before_createContent"; const AFTER_CREATECONTENT = "action.after_createContent"; @@ -205,6 +214,24 @@ final class TheliaEvents const BEFORE_UPDATECONTENT = "action.before_updateContent"; const AFTER_UPDATECONTENT = "action.after_updateContent"; + // -- country management ----------------------------------------------- + + const COUNTRY_CREATE = "action.createCountry"; + const COUNTRY_UPDATE = "action.updateCountry"; + const COUNTRY_DELETE = "action.deleteCountry"; + const COUNTRY_TOGGLE_DEFAULT = "action.toggleCountryDefault"; + //const COUNTRY_UPDATE_POSITION = "action.updateFolderPosition"; + + + const BEFORE_CREATECOUNTRY = "action.before_createCountry"; + const AFTER_CREATECOUNTRY = "action.after_createCountry"; + + const BEFORE_DELETECOUNTRY = "action.before_deleteCountry"; + const AFTER_DELETECOUNTRY = "action.after_deleteCountry"; + + const BEFORE_UPDATECOUNTRY = "action.before_updateCountry"; + const AFTER_UPDATECOUNTRY = "action.after_updateCountry"; + // -- Categories Associated Content ---------------------------------------- const BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT = "action.before_createCategoryAssociatedContent"; @@ -324,6 +351,10 @@ final class TheliaEvents const ORDER_AFTER_CREATE = "action.order.afterCreate"; const ORDER_BEFORE_PAYMENT = "action.order.beforePayment"; + const ORDER_UPDATE_STATUS = "action.order.updateStatus"; + const ORDER_UPDATE_DELIVERY_REF = "action.order.updateDeliveryRef"; + const ORDER_UPDATE_ADDRESS = "action.order.updateAddress"; + const ORDER_PRODUCT_BEFORE_CREATE = "action.orderProduct.beforeCreate"; const ORDER_PRODUCT_AFTER_CREATE = "action.orderProduct.afterCreate"; @@ -566,7 +597,6 @@ final class TheliaEvents const BEFORE_DELETEATTRIBUTE_AV = "action.before_deleteAttributeAv"; const AFTER_DELETEATTRIBUTE_AV = "action.after_deleteAttributeAv"; - // -- Features values management ---------------------------------------- const FEATURE_AV_CREATE = "action.createFeatureAv"; @@ -593,4 +623,6 @@ final class TheliaEvents */ const GENERATE_REWRITTENURL = 'action.generate_rewritenurl'; + const GENERATE_PDF = 'thelia.generatePdf'; + } diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php index dac1f943d..aefc0cf90 100755 --- a/core/lib/Thelia/Core/EventListener/ViewListener.php +++ b/core/lib/Thelia/Core/EventListener/ViewListener.php @@ -100,7 +100,7 @@ class ViewListener implements EventSubscriberInterface // Redirect to the login template Redirect::exec($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate())); } catch (OrderException $e) { - switch($e->getCode()) { + switch ($e->getCode()) { case OrderException::CART_EMPTY: // Redirect to the cart template Redirect::exec($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL)); diff --git a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php index 798a9c7fd..09b932a98 100755 --- a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php +++ b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php @@ -51,10 +51,10 @@ class Session extends BaseSession public function getLang($forceDefault = true) { $lang = $this->get("thelia.current.lang"); - if(null === $lang && $forceDefault) - { + if (null === $lang && $forceDefault) { $lang = Lang::getDefaultLanguage(); } + return $lang; } @@ -74,10 +74,10 @@ class Session extends BaseSession { $currency = $this->get("thelia.current.currency"); - if(null === $currency && $forceDefault) - { + if (null === $currency && $forceDefault) { $currency = Currency::getDefaultCurrency(); } + return $currency; } @@ -108,6 +108,7 @@ class Session extends BaseSession if (null === $lang) { $lang = Lang::getDefaultLanguage(); } + return $lang; } @@ -187,7 +188,7 @@ class Session extends BaseSession $cart = null; if ($cart_id) { $cart = CartQuery::create()->findPk($cart_id); - if($cart) { + if ($cart) { try { $this->verifyValidCart($cart); } catch (InvalidCartException $e) { @@ -230,7 +231,6 @@ class Session extends BaseSession // -- Order ------------------------------------------------------------------ - public function setOrder(Order $order) { $this->set("thelia.order", $order); @@ -246,7 +246,6 @@ class Session extends BaseSession return $this->get("thelia.order"); } - /** * Set consumed coupons by the Customer * diff --git a/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php b/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php index a52f0eb86..41ca0bdc1 100644 --- a/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php +++ b/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php @@ -20,15 +20,15 @@ /* along with this program. If not, see . */ /* */ /*************************************************************************************/ -namespace Thelia\Core\HttpKernel\Exceptions; +namespace Thelia\Core\HttpKernel\Exception; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException as BaseNotFountHttpException; /** * Class NotFountHttpException * @author Manuel Raynaud */ -class NotFountHttpException extends BaseNotFountHttpException { - +class NotFountHttpException extends BaseNotFountHttpException +{ protected $adminContext = false; public function __construct($message = null, \Exception $previous = null, $code = 0, $adminContext = false) @@ -43,4 +43,4 @@ class NotFountHttpException extends BaseNotFountHttpException { return $this->adminContext === true; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php index 1c8c11c73..e00ae4375 100644 --- a/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php +++ b/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php @@ -24,7 +24,6 @@ namespace Thelia\Core\Security\Authentication; use Thelia\Core\Security\Authentication\AuthenticatorInterface; -use Thelia\Core\Security\UserProvider\UserProviderInterface; use Thelia\Core\Security\UserProvider\TokenUserProvider; use Thelia\Core\Security\Exception\TokenAuthenticationException; @@ -51,7 +50,6 @@ class TokenAuthenticator implements AuthenticatorInterface $user = $this->userProvider->getUser($keyData); if ($user === null) throw new TokenAuthenticationException("No user matches the provided token"); - return $user; } } diff --git a/core/lib/Thelia/Core/Security/Token/TokenProvider.php b/core/lib/Thelia/Core/Security/Token/TokenProvider.php index e50b60602..32c5b7d6c 100644 --- a/core/lib/Thelia/Core/Security/Token/TokenProvider.php +++ b/core/lib/Thelia/Core/Security/Token/TokenProvider.php @@ -6,8 +6,8 @@ use Thelia\Core\Security\User\UserInterface; class TokenProvider { - public function encodeKey(UserInterface $user) { - + public function encodeKey(UserInterface $user) + { // Always set a new token in the user environment $user->setToken(uniqid()); @@ -15,7 +15,8 @@ class TokenProvider array($user->getUsername(), $user->getToken(), $user->getSerial()))); } - public function decodeKey($key) { + public function decodeKey($key) + { $data = unserialize(base64_decode($key)); return array( diff --git a/core/lib/Thelia/Core/Security/User/UserInterface.php b/core/lib/Thelia/Core/Security/User/UserInterface.php index cdff4d44e..113909a41 100755 --- a/core/lib/Thelia/Core/Security/User/UserInterface.php +++ b/core/lib/Thelia/Core/Security/User/UserInterface.php @@ -68,4 +68,4 @@ interface UserInterface * Set a serial number int the user data (used by remember me authnetication system) */ public function setSerial($serial); -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Security/UserProvider/AdminTokenUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/AdminTokenUserProvider.php index 4567176e5..ca36fc29a 100644 --- a/core/lib/Thelia/Core/Security/UserProvider/AdminTokenUserProvider.php +++ b/core/lib/Thelia/Core/Security/UserProvider/AdminTokenUserProvider.php @@ -23,13 +23,12 @@ namespace Thelia\Core\Security\UserProvider; -use Thelia\Model\Admin; use Thelia\Model\AdminQuery; class AdminTokenUserProvider extends TokenUserProvider { - public function getUser($dataArray) { - + public function getUser($dataArray) + { return AdminQuery::create() ->filterByLogin($dataArray['username']) ->filterByRememberMeSerial($dataArray['serial']) diff --git a/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php index 421d48dd4..e0ea58b84 100644 --- a/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php +++ b/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php @@ -23,17 +23,16 @@ namespace Thelia\Core\Security\UserProvider; -use Thelia\Action\Customer; use Thelia\Model\CustomerQuery; class CustomerTokenUserProvider extends TokenUserProvider { - public function getUser($dataArray) { - + public function getUser($dataArray) + { return CustomerQuery::create() ->filterByEmail($dataArray['username']) ->filterByRememberMeSerial($dataArray['serial']) ->filterByRememberMeToken($dataArray['token']) ->findOne(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php index 21db28cab..ccc15c3c7 100755 --- a/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php +++ b/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php @@ -35,4 +35,4 @@ class CustomerUserProvider implements UserProviderInterface return $customer; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php index 6c46bcbbb..e58a2e123 100644 --- a/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php +++ b/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php @@ -23,10 +23,9 @@ namespace Thelia\Core\Security\UserProvider; -use Thelia\Core\Security\User\UserInterface; use Thelia\Core\Security\Token\TokenProvider; abstract class TokenUserProvider extends TokenProvider implements UserProviderInterface { - public abstract function getUser($key); + abstract public function getUser($key); } diff --git a/core/lib/Thelia/Core/Template/Assets/AsseticHelper.php b/core/lib/Thelia/Core/Template/Assets/AsseticHelper.php index 349fa178a..12ed85ad2 100755 --- a/core/lib/Thelia/Core/Template/Assets/AsseticHelper.php +++ b/core/lib/Thelia/Core/Template/Assets/AsseticHelper.php @@ -72,7 +72,7 @@ class AsseticHelper break; case 'sass' : - $fm->set('less', new Filter\Sass\SassFilter()); + $fm->set('sass', new Filter\Sass\SassFilter()); break; case 'cssembed' : @@ -87,6 +87,10 @@ class AsseticHelper $fm->set('cssimport', new Filter\CssImportFilter()); break; + case 'compass': + $fm->set('compass', new Filter\CompassFilter()); + break; + default : throw new \InvalidArgumentException("Unsupported Assetic filter: '$filter_name'"); break; diff --git a/core/lib/Thelia/Core/Template/Loop/Accessory.php b/core/lib/Thelia/Core/Template/Loop/Accessory.php index 34d674c10..6b15a6715 100755 --- a/core/lib/Thelia/Core/Template/Loop/Accessory.php +++ b/core/lib/Thelia/Core/Template/Loop/Accessory.php @@ -117,7 +117,7 @@ class Accessory extends Product $loopResult = parent::exec($pagination); - foreach($loopResult as $loopResultRow) { + foreach ($loopResult as $loopResultRow) { $accessoryProductId = $loopResultRow->get('ID'); diff --git a/core/lib/Thelia/Core/Template/Loop/Address.php b/core/lib/Thelia/Core/Template/Loop/Address.php index 9ca4352e9..5fe20b0e4 100755 --- a/core/lib/Thelia/Core/Template/Loop/Address.php +++ b/core/lib/Thelia/Core/Template/Loop/Address.php @@ -112,7 +112,7 @@ class Address extends BaseLoop if ($default === true) { $search->filterByIsDefault(1, Criteria::EQUAL); - } else if($default === false) { + } elseif ($default === false) { $search->filterByIsDefault(0, Criteria::EQUAL); } diff --git a/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php b/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php index 418a76220..a9efad7ae 100755 --- a/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php +++ b/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php @@ -60,10 +60,10 @@ class Argument { $x = $value === null; - if($value === null) { + if ($value === null) { $this->value = null; } else { - if(false === $value) { + if (false === $value) { /* (string) $value = "" */ $this->value = 0; } else { diff --git a/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php b/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php index 78794b715..6fc41fc9b 100755 --- a/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php +++ b/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php @@ -159,7 +159,7 @@ class AssociatedContent extends Content $loopResult = parent::exec($pagination); - foreach($loopResult as $loopResultRow) { + foreach ($loopResult as $loopResultRow) { $relatedContentId = $loopResultRow->get('ID'); diff --git a/core/lib/Thelia/Core/Template/Loop/Attribute.php b/core/lib/Thelia/Core/Template/Loop/Attribute.php index 9a9aa6ff3..daad80979 100755 --- a/core/lib/Thelia/Core/Template/Loop/Attribute.php +++ b/core/lib/Thelia/Core/Template/Loop/Attribute.php @@ -31,17 +31,12 @@ use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Model\Base\CategoryQuery; -use Thelia\Model\Base\ProductCategoryQuery; use Thelia\Model\Base\AttributeQuery; -use Thelia\Model\Map\ProductCategoryTableMap; use Thelia\Type\TypeCollection; use Thelia\Type; -use Thelia\Type\BooleanOrBothType; use Thelia\Model\ProductQuery; use Thelia\Model\TemplateQuery; use Thelia\Model\AttributeTemplateQuery; -use Thelia\Core\Translation\Translator; use Thelia\Model\Map\AttributeTemplateTableMap; /** * @@ -121,7 +116,7 @@ class Attribute extends BaseI18nLoop // Create template array if ($template == null) $template = array(); - foreach($products as $product) { + foreach ($products as $product) { $tpl_id = $product->getTemplateId(); if (! is_null($tpl_id)) $template[] = $tpl_id; @@ -138,8 +133,7 @@ class Attribute extends BaseI18nLoop ; $use_attribute_pos = false; - } - else if (null !== $exclude_template) { + } elseif (null !== $exclude_template) { // Join with attribute_template table to get position $exclude_attributes = AttributeTemplateQuery::create()->filterByTemplateId($exclude_template)->select('attribute_id')->find(); diff --git a/core/lib/Thelia/Core/Template/Loop/Country.php b/core/lib/Thelia/Core/Template/Loop/Country.php index 3a05b684a..c3271a6ac 100755 --- a/core/lib/Thelia/Core/Template/Loop/Country.php +++ b/core/lib/Thelia/Core/Template/Loop/Country.php @@ -115,8 +115,10 @@ class Country extends BaseI18nLoop ->set("POSTSCRIPTUM", $country->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("ISOCODE", $country->getIsocode()) ->set("ISOALPHA2", $country->getIsoalpha2()) - ->set("ISOALPHA3", $country->getIsoalpha3()); + ->set("ISOALPHA3", $country->getIsoalpha3()) + ->set('IS_DEFAULT', $country->getByDefault()) + ; $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Core/Template/Loop/Coupon.php b/core/lib/Thelia/Core/Template/Loop/Coupon.php index 6dd205d16..61e3b2762 100755 --- a/core/lib/Thelia/Core/Template/Loop/Coupon.php +++ b/core/lib/Thelia/Core/Template/Loop/Coupon.php @@ -37,7 +37,6 @@ use Thelia\Coupon\Type\CouponInterface; use Thelia\Model\Coupon as MCoupon; use Thelia\Model\CouponQuery; use Thelia\Type; -use Thelia\Type\BooleanOrBothType; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Core/Template/Loop/Customer.php b/core/lib/Thelia/Core/Template/Loop/Customer.php index e0ce92c76..e811606c0 100755 --- a/core/lib/Thelia/Core/Template/Loop/Customer.php +++ b/core/lib/Thelia/Core/Template/Loop/Customer.php @@ -63,7 +63,6 @@ class Customer extends BaseLoop ) ), Argument::createBooleanTypeArgument('reseller'), - Argument::createBooleanTypeArgument('last_order'), Argument::createIntTypeArgument('sponsor') ); } @@ -130,20 +129,6 @@ class Customer extends BaseLoop $loopResultRow->set("SPONSOR", $customer->getSponsor()); $loopResultRow->set("DISCOUNT", $customer->getDiscount()); - $lastOrderDate = ""; - $lastOrderAmount = ""; - - if ($this->getLastOrder()) { - $order = $customer->getOrders()->getFirst(); - if ($order) { - $lastOrderDate = $order->getCreatedAt(); - $lastOrderAmount = $order->getTotalAmount(); - } - } - - $loopResultRow->set("LASTORDER_DATE", $lastOrderDate); - $loopResultRow->set("LASTORDER_AMOUNT", $lastOrderAmount); - $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Core/Template/Loop/Delivery.php b/core/lib/Thelia/Core/Template/Loop/Delivery.php index 5d33d398d..3a0c5cb31 100644 --- a/core/lib/Thelia/Core/Template/Loop/Delivery.php +++ b/core/lib/Thelia/Core/Template/Loop/Delivery.php @@ -57,9 +57,9 @@ class Delivery extends BaseSpecificModule $search->filterByType(BaseModule::DELIVERY_MODULE_TYPE, Criteria::EQUAL); $countryId = $this->getCountry(); - if(null !== $countryId) { + if (null !== $countryId) { $country = CountryQuery::create()->findPk($countryId); - if(null === $country) { + if (null === $country) { throw new \InvalidArgumentException('Cannot found country id: `' . $countryId . '` in delivery loop'); } } else { diff --git a/core/lib/Thelia/Core/Template/Loop/Document.php b/core/lib/Thelia/Core/Template/Loop/Document.php index d60aaf7b2..9f99a6fa4 100644 --- a/core/lib/Thelia/Core/Template/Loop/Document.php +++ b/core/lib/Thelia/Core/Template/Loop/Document.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Core\Event\DocumentEvent; +use Thelia\Core\Event\Document\DocumentEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Type\TypeCollection; @@ -265,8 +265,7 @@ class Document extends BaseI18nLoop ; $loopResult->addRow($loopResultRow); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Ignore the result and log an error Tlog::getInstance()->addError("Failed to process document in document loop: ", $this->args); } diff --git a/core/lib/Thelia/Core/Template/Loop/Feature.php b/core/lib/Thelia/Core/Template/Loop/Feature.php index f542b2e8d..89b338b0f 100755 --- a/core/lib/Thelia/Core/Template/Loop/Feature.php +++ b/core/lib/Thelia/Core/Template/Loop/Feature.php @@ -31,11 +31,8 @@ use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Model\CategoryQuery; use Thelia\Model\FeatureI18nQuery; -use Thelia\Model\ProductCategoryQuery; use Thelia\Model\FeatureQuery; -use Thelia\Model\Map\ProductCategoryTableMap; use Thelia\Model\ProductQuery; use Thelia\Type\TypeCollection; use Thelia\Type; @@ -124,7 +121,7 @@ class Feature extends BaseI18nLoop // Create template array if ($template == null) $template = array(); - foreach($products as $product) { + foreach ($products as $product) { $tpl_id = $product->getTemplateId(); if (! is_null($tpl_id)) $template[] = $tpl_id; @@ -164,7 +161,7 @@ class Feature extends BaseI18nLoop ->select('id') ->find(); - if($features) { + if ($features) { $search->filterById( $features, Criteria::IN @@ -204,7 +201,6 @@ class Feature extends BaseI18nLoop } - /* perform search */ $features = $this->search($search, $pagination); diff --git a/core/lib/Thelia/Core/Template/Loop/Folder.php b/core/lib/Thelia/Core/Template/Loop/Folder.php index 5c56dff94..04ba737fa 100755 --- a/core/lib/Thelia/Core/Template/Loop/Folder.php +++ b/core/lib/Thelia/Core/Template/Loop/Folder.php @@ -31,6 +31,7 @@ use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Model\ContentQuery; use Thelia\Model\FolderQuery; use Thelia\Type\TypeCollection; use Thelia\Type; @@ -55,6 +56,7 @@ class Folder extends BaseI18nLoop return new ArgumentCollection( Argument::createIntListTypeArgument('id'), Argument::createIntTypeArgument('parent'), + Argument::createIntTypeArgument('content'), Argument::createBooleanTypeArgument('current'), Argument::createBooleanTypeArgument('not_empty', 0), Argument::createBooleanOrBothTypeArgument('visible', 1), @@ -107,6 +109,16 @@ class Folder extends BaseI18nLoop $search->filterById($exclude, Criteria::NOT_IN); } + $content = $this->getContent(); + + if (null !== $content) { + $obj = ContentQuery::create()->findPk($content); + + if($obj) { + $search->filterByContent($obj, Criteria::IN); + } + } + $visible = $this->getVisible(); if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0); diff --git a/core/lib/Thelia/Core/Template/Loop/FolderPath.php b/core/lib/Thelia/Core/Template/Loop/FolderPath.php new file mode 100644 index 000000000..272b9fbbb --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/FolderPath.php @@ -0,0 +1,160 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; +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\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Model\FolderQuery; +use Thelia\Type\BooleanOrBothType; + + +/** + * Class FolderPath + * @package Thelia\Core\Template\Loop + * @author Manuel Raynaud + */ +class FolderPath extends BaseI18nLoop +{ + + /** + * + * define all args used in your loop + * + * + * example : + * + * public function getArgDefinitions() + * { + * return new ArgumentCollection( + * Argument::createIntListTypeArgument('id'), + * new Argument( + * 'ref', + * new TypeCollection( + * new Type\AlphaNumStringListType() + * ) + * ), + * Argument::createIntListTypeArgument('category'), + * Argument::createBooleanTypeArgument('new'), + * Argument::createBooleanTypeArgument('promo'), + * Argument::createFloatTypeArgument('min_price'), + * Argument::createFloatTypeArgument('max_price'), + * Argument::createIntTypeArgument('min_stock'), + * Argument::createFloatTypeArgument('min_weight'), + * Argument::createFloatTypeArgument('max_weight'), + * Argument::createBooleanTypeArgument('current'), + * + * ); + * } + * + * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('folder', null, true), + Argument::createIntTypeArgument('depth'), + Argument::createIntTypeArgument('level'), + Argument::createBooleanOrBothTypeArgument('visible', true, false) + ); + } + + /** + * + * this function have to be implement in your own loop class. + * + * All loops parameters can be accessible via getter. + * + * for example, ref parameter is accessible through getRef method + * + * @param $pagination + * + * @return mixed + */ + public function exec(&$pagination) + { + $id = $this->getFolder(); + $visible = $this->getVisible(); + + $search = FolderQuery::create(); + + $locale = $this->configureI18nProcessing($search, array('TITLE')); + + $search->filterById($id); + if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible); + + $results = array(); + + $ids = array(); + + do { + $folder = $search->findOne(); + + if ($folder != null) { + + $loopResultRow = new LoopResultRow(); + + $loopResultRow + ->set("TITLE",$folder->getVirtualColumn('i18n_TITLE')) + ->set("URL", $folder->getUrl($locale)) + ->set("ID", $folder->getId()) + ->set("LOCALE",$locale) + ; + + $results[] = $loopResultRow; + + $parent = $folder->getParent(); + + if ($parent > 0) { + + // Prevent circular refererences + if (in_array($parent, $ids)) { + throw new \LogicException(sprintf("Circular reference detected in folder ID=%d hierarchy (folder ID=%d appears more than one times in path)", $id, $parent)); + } + + $ids[] = $parent; + + $search = FolderQuery::create(); + + $this->configureI18nProcessing($search, array('TITLE')); + + $search->filterById($parent); + if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible); + } + } + } while ($folder != null && $parent > 0); + + // Reverse list and build the final result + $results = array_reverse($results); + + $loopResult = new LoopResult(); + + foreach($results as $result) $loopResult->addRow($result); + + return $loopResult; + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Image.php b/core/lib/Thelia/Core/Template/Loop/Image.php index a62f23702..b20b161a3 100755 --- a/core/lib/Thelia/Core/Template/Loop/Image.php +++ b/core/lib/Thelia/Core/Template/Loop/Image.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Core\Event\ImageEvent; +use Thelia\Core\Event\Image\ImageEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Type\TypeCollection; @@ -318,8 +318,7 @@ class Image extends BaseI18nLoop ; $loopResult->addRow($loopResultRow); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Ignore the result and log an error Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args); } diff --git a/core/lib/Thelia/Core/Template/Loop/Module.php b/core/lib/Thelia/Core/Template/Loop/Module.php index 1c4f91b4d..d780658c0 100755 --- a/core/lib/Thelia/Core/Template/Loop/Module.php +++ b/core/lib/Thelia/Core/Template/Loop/Module.php @@ -103,7 +103,7 @@ class Module extends BaseI18nLoop $active = $this->getActive(); - if($active !== Type\BooleanOrBothType::ANY) { + if ($active !== Type\BooleanOrBothType::ANY) { $search->filterByActivate($active ? 1 : 0, Criteria::EQUAL); } diff --git a/core/lib/Thelia/Core/Template/Loop/Order.php b/core/lib/Thelia/Core/Template/Loop/Order.php index 41d49c4f8..5b1e97cc1 100755 --- a/core/lib/Thelia/Core/Template/Loop/Order.php +++ b/core/lib/Thelia/Core/Template/Loop/Order.php @@ -53,11 +53,24 @@ class Order extends BaseLoop 'customer', new TypeCollection( new Type\IntType(), - new Type\EnumType(array('current')) + new Type\EnumType(array('current', '*')) ), 'current' ), - Argument::createIntListTypeArgument('status') + new Argument( + 'status', + new TypeCollection( + new Type\IntListType(), + new Type\EnumType(array('*')) + ) + ), + new Argument( + 'order', + new TypeCollection( + new Type\EnumListType(array('create-date', 'create-date-reverse')) + ), + 'create-date-reverse' + ) ); } @@ -85,16 +98,29 @@ class Order extends BaseLoop } else { $search->filterByCustomerId($currentCustomer->getId(), Criteria::EQUAL); } - } else { + } elseif ($customer !== '*') { $search->filterByCustomerId($customer, Criteria::EQUAL); } $status = $this->getStatus(); - if (null !== $status) { + if (null !== $status && $status != '*') { $search->filterByStatusId($status, Criteria::IN); } + $orderers = $this->getOrder(); + + foreach ($orderers as $orderer) { + switch ($orderer) { + case "create-date": + $search->orderByCreatedAt(Criteria::ASC); + break; + case "create-date-reverse": + $search->orderByCreatedAt(Criteria::DESC); + break; + } + } + $orders = $this->search($search, $pagination); $loopResult = new LoopResult($orders); diff --git a/core/lib/Thelia/Core/Template/Loop/OrderAddress.php b/core/lib/Thelia/Core/Template/Loop/OrderAddress.php new file mode 100755 index 000000000..38dcb0239 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/OrderAddress.php @@ -0,0 +1,98 @@ +. */ +/* */ +/*************************************************************************************/ + +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; + +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Core\Template\Loop\Argument\Argument; + +use Thelia\Model\OrderAddressQuery; + +/** + * + * OrderAddress loop + * + * + * Class OrderAddress + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix + */ +class OrderAddress extends BaseLoop +{ + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('id', null, true) + ); + } + + /** + * @param $pagination + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $search = OrderAddressQuery::create(); + + $id = $this->getId(); + + $search->filterById($id, Criteria::IN); + + $orderAddresses = $this->search($search, $pagination); + + $loopResult = new LoopResult($orderAddresses); + + foreach ($orderAddresses as $orderAddress) { + $loopResultRow = new LoopResultRow($loopResult, $orderAddress, $this->versionable, $this->timestampable, $this->countable); + $loopResultRow + ->set("ID", $orderAddress->getId()) + ->set("TITLE", $orderAddress->getCustomerTitleId()) + ->set("COMPANY", $orderAddress->getCompany()) + ->set("FIRSTNAME", $orderAddress->getFirstname()) + ->set("LASTNAME", $orderAddress->getLastname()) + ->set("ADDRESS1", $orderAddress->getAddress1()) + ->set("ADDRESS2", $orderAddress->getAddress2()) + ->set("ADDRESS3", $orderAddress->getAddress3()) + ->set("ZIPCODE", $orderAddress->getZipcode()) + ->set("CITY", $orderAddress->getCity()) + ->set("COUNTRY", $orderAddress->getCountryId()) + ->set("PHONE", $orderAddress->getPhone()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/core/lib/Thelia/Core/Template/Loop/OrderProduct.php b/core/lib/Thelia/Core/Template/Loop/OrderProduct.php new file mode 100755 index 000000000..ab1fa2ab1 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/OrderProduct.php @@ -0,0 +1,118 @@ +. */ +/* */ +/*************************************************************************************/ + +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; + +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Core\Template\Loop\Argument\Argument; + +use Thelia\Model\Base\OrderProductQuery; + +/** + * + * OrderProduct loop + * + * Class OrderProduct + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix + */ +class OrderProduct extends BaseLoop +{ + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('order', null, true) + ); + } + + /** + * @param $pagination + * + * @return \Thelia\Core\Template\Element\LoopResult + * @throws \InvalidArgumentException + */ + public function exec(&$pagination) + { + $search = OrderProductQuery::create(); + + $search->joinOrderProductTax('opt', Criteria::LEFT_JOIN) + ->withColumn('SUM(`opt`.AMOUNT)', 'TOTAL_TAX') + ->withColumn('SUM(`opt`.PROMO_AMOUNT)', 'TOTAL_PROMO_TAX') + ->groupById(); + + $order = $this->getOrder(); + + $search->filterByOrderId($order, Criteria::EQUAL); + + $search->orderById(Criteria::ASC); + + $products = $this->search($search, $pagination); + + $loopResult = new LoopResult($products); + + foreach ($products as $product) { + $loopResultRow = new LoopResultRow($loopResult, $product, $this->versionable, $this->timestampable, $this->countable); + + $price = $product->getPrice(); + $taxedPrice = $price + round($product->getVirtualColumn('TOTAL_TAX'), 2); + $promoPrice = $product->getPromoPrice(); + $taxedPromoPrice = $promoPrice + round($product->getVirtualColumn('TOTAL_PROMO_TAX'), 2); + + $loopResultRow->set("ID", $product->getId()) + ->set("REF", $product->getProductRef()) + ->set("PRODUCT_SALE_ELEMENTS_REF", $product->getProductSaleElementsRef()) + ->set("WAS_NEW", $product->getWasNew() === 1 ? 1 : 0) + ->set("WAS_IN_PROMO", $product->getWasInPromo() === 1 ? 1 : 0) + ->set("WEIGHT", $product->getWeight()) + ->set("TITLE", $product->getTitle()) + ->set("CHAPO", $product->getChapo()) + ->set("DESCRIPTION", $product->getDescription()) + ->set("POSTSCRIPTUM", $product->getPostscriptum()) + ->set("QUANTITY", $product->getQuantity()) + ->set("PRICE", $price) + ->set("PRICE_TAX", $taxedPrice - $price) + ->set("TAXED_PRICE", $taxedPrice) + ->set("PROMO_PRICE", $promoPrice) + ->set("PROMO_PRICE_TAX", $taxedPromoPrice - $promoPrice) + ->set("TAXED_PROMO_PRICE", $taxedPromoPrice) + ->set("TAX_RULE_TITLE", $product->getTaxRuleTitle()) + ->set("TAX_RULE_DESCRIPTION", $product->getTaxRuledescription()) + ->set("PARENT", $product->getParent()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php b/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php new file mode 100755 index 000000000..623d0bae5 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php @@ -0,0 +1,117 @@ +. */ +/* */ +/*************************************************************************************/ + +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\ArgumentCollection; +use Thelia\Core\Template\Loop\Argument\Argument; + +use Thelia\Model\Base\OrderProductAttributeCombinationQuery; +use Thelia\Type\TypeCollection; +use Thelia\Type; + +/** + * + * OrderProductOrderProductAttributeCombination loop + * + * Class OrderProductAttributeCombination + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix + */ +class OrderProductAttributeCombination extends BaseI18nLoop +{ + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('order_product', null, true), + new Argument( + 'order', + new TypeCollection( + new Type\EnumListType(array('alpha', 'alpha_reverse')) + ), + 'alpha' + ) + ); + } + + /** + * @param $pagination + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $search = OrderProductAttributeCombinationQuery::create(); + + $orderProduct = $this->getOrder_product(); + + $search->filterByOrderProductId($orderProduct, Criteria::EQUAL); + + $orders = $this->getOrder(); + + foreach ($orders as $order) { + switch ($order) { + case "alpha": + $search->orderByAttributeTitle(Criteria::ASC); + break; + case "alpha_reverse": + $search->orderByAttributeTitle(Criteria::DESC); + break; + } + } + + $attributeCombinations = $this->search($search, $pagination); + + $loopResult = new LoopResult($attributeCombinations); + + foreach ($attributeCombinations as $attributeCombination) { + $loopResultRow = new LoopResultRow($loopResult, $attributeCombination, $this->versionable, $this->timestampable, $this->countable); + + $loopResultRow + ->set("LOCALE",$locale) + ->set("ATTRIBUTE_TITLE", $attributeCombination->getAttributeTitle()) + ->set("ATTRIBUTE_CHAPO", $attributeCombination->getAttributeChapo()) + ->set("ATTRIBUTE_DESCRIPTION", $attributeCombination->getAttributeDescription()) + ->set("ATTRIBUTE_POSTSCRIPTUM", $attributeCombination->getAttributePostscriptum()) + ->set("ATTRIBUTE_AVAILABILITY_TITLE", $attributeCombination->getAttributeAvTitle()) + ->set("ATTRIBUTE_AVAILABILITY_CHAPO", $attributeCombination->getAttributeAvChapo()) + ->set("ATTRIBUTE_AVAILABILITY_DESCRIPTION", $attributeCombination->getAttributeAvDescription()) + ->set("ATTRIBUTE_AVAILABILITY_POSTSCRIPTUM", $attributeCombination->getAttributeAvPostscriptum()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/core/lib/Thelia/Core/Template/Loop/OrderStatus.php b/core/lib/Thelia/Core/Template/Loop/OrderStatus.php index 7f0e97c4f..0f0d144c4 100755 --- a/core/lib/Thelia/Core/Template/Loop/OrderStatus.php +++ b/core/lib/Thelia/Core/Template/Loop/OrderStatus.php @@ -4,7 +4,7 @@ /* Thelia */ /* */ /* Copyright (c) OpenStudio */ -/* email : info@thelia.net */ +/* email : info@thelia.net */ /* web : http://www.thelia.net */ /* */ /* This program is free software; you can redistribute it and/or modify */ @@ -23,33 +23,77 @@ namespace Thelia\Core\Template\Loop; -use Thelia\Core\Template\Element\BaseLoop; +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\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Model\OrderStatusQuery; + /** * - * @package Thelia\Core\Template\Loop + * OrderStatus loop * - * @author Franck Allimant + * + * Class OrderStatus + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix */ -class OrderStatus extends BaseLoop +class OrderStatus extends BaseI18nLoop { - public function getArgDefinitions() + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() { - return new ArgumentCollection(); + return new ArgumentCollection( + Argument::createIntListTypeArgument('id') + ); } /** - * + * @param $pagination * * @return \Thelia\Core\Template\Element\LoopResult */ public function exec(&$pagination) { - // TODO : a coder ! - return new LoopResult(); + $search = OrderStatusQuery::create(); + + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + + $id = $this->getId(); + + if (null !== $id) { + $search->filterById($id, Criteria::IN); + } + + /* perform search */ + $orderStatusList = $this->search($search, $pagination); + + $loopResult = new LoopResult($orderStatusList); + + foreach ($orderStatusList as $orderStatus) { + $loopResultRow = new LoopResultRow($loopResult, $orderStatus, $this->versionable, $this->timestampable, $this->countable); + $loopResultRow->set("ID", $orderStatus->getId()) + ->set("IS_TRANSLATED",$orderStatus->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("CODE", $orderStatus->getCode()) + ->set("TITLE", $orderStatus->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $orderStatus->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $orderStatus->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $orderStatus->getVirtualColumn('i18n_POSTSCRIPTUM')) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; } } diff --git a/core/lib/Thelia/Core/Template/Loop/Payment.php b/core/lib/Thelia/Core/Template/Loop/Payment.php index 542ffb590..ca0aaa18f 100644 --- a/core/lib/Thelia/Core/Template/Loop/Payment.php +++ b/core/lib/Thelia/Core/Template/Loop/Payment.php @@ -25,7 +25,6 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; -use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Module\BaseModule; /** diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php index 7c812d81f..f0bb95249 100755 --- a/core/lib/Thelia/Core/Template/Loop/Product.php +++ b/core/lib/Thelia/Core/Template/Loop/Product.php @@ -138,9 +138,9 @@ class Product extends BaseI18nLoop public function exec(&$pagination) { $currencyId = $this->getCurrency(); - if(null !== $currencyId) { + if (null !== $currencyId) { $currency = CurrencyQuery::create()->findOneById($currencyId); - if(null === $currency) { + if (null === $currency) { throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop'); } } else { @@ -610,7 +610,7 @@ class Product extends BaseI18nLoop $taxedPrice = $product->getTaxedPrice( $taxCountry ); - } catch(TaxEngineException $e) { + } catch (TaxEngineException $e) { $taxedPrice = null; } diff --git a/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php b/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php index e25164456..aa71d2b3c 100755 --- a/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php +++ b/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php @@ -158,7 +158,7 @@ class ProductSaleElements extends BaseLoop $taxedPrice = $PSEValue->getTaxedPrice( $taxCountry ); - } catch(TaxEngineException $e) { + } catch (TaxEngineException $e) { $taxedPrice = null; } $promoPrice = $PSEValue->getPromoPrice(); @@ -166,7 +166,7 @@ class ProductSaleElements extends BaseLoop $taxedPromoPrice = $PSEValue->getTaxedPromoPrice( $taxCountry ); - } catch(TaxEngineException $e) { + } catch (TaxEngineException $e) { $taxedPromoPrice = null; } diff --git a/core/lib/Thelia/Core/Template/Loop/TaxRule.php b/core/lib/Thelia/Core/Template/Loop/TaxRule.php index 5851f631d..e1c30d177 100644 --- a/core/lib/Thelia/Core/Template/Loop/TaxRule.php +++ b/core/lib/Thelia/Core/Template/Loop/TaxRule.php @@ -132,4 +132,4 @@ class TaxRule extends BaseI18nLoop return $loopResult; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Template/Loop/Template.php b/core/lib/Thelia/Core/Template/Loop/Template.php index db8bca7ee..9eaa3ea4f 100644 --- a/core/lib/Thelia/Core/Template/Loop/Template.php +++ b/core/lib/Thelia/Core/Template/Loop/Template.php @@ -31,13 +31,8 @@ use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Model\Base\CategoryQuery; -use Thelia\Model\Base\ProductCategoryQuery; use Thelia\Model\Base\TemplateQuery; -use Thelia\Model\Map\ProductCategoryTableMap; -use Thelia\Type\TypeCollection; use Thelia\Type; -use Thelia\Type\BooleanOrBothType; /** * @@ -111,4 +106,4 @@ class Template extends BaseI18nLoop return $loopResult; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php index f39c2a768..17d9e37a3 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php @@ -30,6 +30,7 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; use Thelia\Core\Security\SecurityContext; use Thelia\Core\Template\ParserContext; use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; +use Thelia\Model\ConfigQuery; use Thelia\Model\CategoryQuery; use Thelia\Model\ContentQuery; use Thelia\Model\CountryQuery; @@ -162,14 +163,14 @@ class DataAccessFunctions extends AbstractSmartyPlugin public function countryDataAccess($params, $smarty) { - if(array_key_exists('defaultCountry', self::$dataAccessCache)) { + if (array_key_exists('defaultCountry', self::$dataAccessCache)) { $defaultCountry = self::$dataAccessCache['defaultCountry']; } else { $defaultCountry = CountryQuery::create()->findOneByByDefault(1); self::$dataAccessCache['defaultCountry'] = $defaultCountry; } - switch($params["attr"]) { + switch ($params["attr"]) { case "default": return $defaultCountry->getId(); } @@ -177,7 +178,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin public function cartDataAccess($params, $smarty) { - if(array_key_exists('currentCountry', self::$dataAccessCache)) { + if (array_key_exists('currentCountry', self::$dataAccessCache)) { $currentCountry = self::$dataAccessCache['currentCountry']; } else { $currentCountry = CountryQuery::create()->findOneById(64); // @TODO : make it magic @@ -186,7 +187,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin $cart = $this->getCart($this->request); $result = ""; - switch($params["attr"]) { + switch ($params["attr"]) { case "count_item": $result = $cart->getCartItems()->count(); break; @@ -205,7 +206,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin { $order = $this->request->getSession()->getOrder(); $attribute = $this->getNormalizedParam($params, array('attribute', 'attrib', 'attr')); - switch($attribute) { + switch ($attribute) { case 'postage': return $order->getPostage(); case 'delivery_address': @@ -234,6 +235,17 @@ class DataAccessFunctions extends AbstractSmartyPlugin return $this->dataAccess("Lang", $params, $this->request->getSession()->getLang()); } + public function ConfigDataAccess($params, $smarty) + { + if(false === array_key_exists("key", $params)) { + return null; + } + + $key = $params['key']; + + return ConfigQuery::read($key); + } + /** * @param $objectLabel * @param $params @@ -246,7 +258,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin */ protected function dataAccessWithI18n($objectLabel, $params, ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID') { - if(array_key_exists('data_' . $objectLabel, self::$dataAccessCache)) { + if (array_key_exists('data_' . $objectLabel, self::$dataAccessCache)) { $data = self::$dataAccessCache['data_' . $objectLabel]; } else { $lang = $this->getNormalizedParam($params, array('lang')); @@ -332,7 +344,6 @@ class DataAccessFunctions extends AbstractSmartyPlugin */ public function getPluginDescriptors() { - return array( new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'), new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess'), @@ -345,6 +356,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin new SmartyPluginDescriptor('function', 'lang', $this, 'langDataAccess'), new SmartyPluginDescriptor('function', 'cart', $this, 'cartDataAccess'), new SmartyPluginDescriptor('function', 'order', $this, 'orderDataAccess'), + new SmartyPluginDescriptor('function', 'config', $this, 'ConfigDataAccess'), ); } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php index 569aedb84..61a68fdc7 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php @@ -22,13 +22,9 @@ /*************************************************************************************/ namespace Thelia\Core\Template\Smarty\Plugins; -use Symfony\Component\Form\FormView; -use Thelia\Form\BaseForm; -use Thelia\Core\Template\Element\Exception\ElementNotFoundException; use Symfony\Component\HttpFoundation\Request; use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; -use Thelia\Core\Template\ParserContext; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php index 4c953be3c..e7613bbac 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php @@ -168,8 +168,7 @@ $val = $value[$key]; $this->assignFieldValues($template, $name, $val, $formFieldView->vars); } } -} -else { +} else { $this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVars["value"], $formFieldView->vars); } */ @@ -204,7 +203,7 @@ $this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVar { $instance = $this->getInstanceFromParams($params); - $formView = $instance->getForm(); + $formView = $instance->getView(); if ($formView->vars["multipart"]) { return sprintf('%s="%s"',"enctype", "multipart/form-data"); diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php index 1492f45cd..b6e31aef0 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php @@ -46,9 +46,9 @@ class Security extends AbstractSmartyPlugin /** * Process security check function * - * @param array $params - * @param unknown $smarty - * @return string no text is returned. + * @param array $params + * @param unknown $smarty + * @return string no text is returned. * @throws \Thelia\Core\Security\Exception\AuthenticationException */ public function checkAuthFunction($params, &$smarty) @@ -79,7 +79,7 @@ class Security extends AbstractSmartyPlugin public function checkCartNotEmptyFunction($params, &$smarty) { $cart = $this->request->getSession()->getCart(); - if($cart===null || $cart->countCartItems() == 0) { + if ($cart===null || $cart->countCartItems() == 0) { throw new OrderException('Cart must not be empty', OrderException::CART_EMPTY, array('empty' => 1)); } @@ -90,11 +90,11 @@ class Security extends AbstractSmartyPlugin { $order = $this->request->getSession()->getOrder(); /* Does address and module still exists ? We assume address owner can't change neither module type */ - if($order !== null) { + if ($order !== null) { $checkAddress = AddressQuery::create()->findPk($order->chosenDeliveryAddress); $checkModule = ModuleQuery::create()->findPk($order->getDeliveryModuleId()); } - if(null === $order || null == $checkAddress || null === $checkModule) { + if (null === $order || null == $checkAddress || null === $checkModule) { throw new OrderException('Delivery must be defined', OrderException::UNDEFINED_DELIVERY, array('missing' => 1)); } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php index bd2c10513..a076c808a 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php @@ -247,6 +247,7 @@ class TheliaLoop extends AbstractSmartyPlugin // Find pagination $pagination = self::getPagination($loopName); if ($pagination === null) { // loop gas no result + return ''; } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php new file mode 100755 index 000000000..cc42a6b21 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php @@ -0,0 +1,57 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Smarty\Plugins; + +use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; +use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; + +class Type extends AbstractSmartyPlugin +{ + public function assertTypeModifier($value, $option) + { + $typeClass = "\\Thelia\\Type\\$option"; + if (!class_exists($typeClass)) { + throw new \InvalidArgumentException(sprintf("Invalid type name `%s` in `assertType` modifier", $option)); + } + + $typeInstance = new $typeClass(); + if (!$typeInstance->isValid($value)) { + return ''; + } + + return $value; + } + + /** + * Define the various smarty plugins handled by this class + * + * @return an array of smarty plugin descriptors + */ + public function getPluginDescriptors() + { + return array( + new SmartyPluginDescriptor('modifier', 'assertType', $this, 'assertTypeModifier'), + ); + } +} diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php index c74d1d2b3..d8227092f 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php @@ -55,11 +55,9 @@ class UrlGenerator extends AbstractSmartyPlugin if ($file !== null) { $path = $file; $mode = URL::PATH_TO_FILE; - } - else if ($path !== null) { + } elseif ($path !== null) { $mode = URL::WITH_INDEX_PAGE; - } - else { + } else { throw \InvalidArgumentException(Translator::getInstance()->trans("Please specify either 'path' or 'file' parameter in {url} function.")); } @@ -74,7 +72,6 @@ class UrlGenerator extends AbstractSmartyPlugin if ($noamp == null) $url = str_replace('&', '&', $url); if ($target != null) $url .= '#'.$target; - return $url; } diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php index f0cb6d8d4..868f1570c 100755 --- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php +++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php @@ -99,6 +99,10 @@ class SmartyParser extends Smarty implements ParserInterface $this->template = $template_path_from_template_base; $this->setTemplateDir(THELIA_TEMPLATE_DIR.$this->template); + + $config_dir = THELIA_TEMPLATE_DIR.$this->template.'/configs'; + + $this->setConfigDir($config_dir); } public function getTemplate() diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index dbfe48e17..199a0bb0b 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -87,7 +87,6 @@ class Thelia extends Kernel $con->useDebug(true); } - } /** diff --git a/core/lib/Thelia/Core/TheliaHttpKernel.php b/core/lib/Thelia/Core/TheliaHttpKernel.php index c3ed552c0..07dc15eed 100755 --- a/core/lib/Thelia/Core/TheliaHttpKernel.php +++ b/core/lib/Thelia/Core/TheliaHttpKernel.php @@ -32,7 +32,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Session; -use Thelia\Core\Event\CurrencyEvent; +use Thelia\Core\Event\Currency\CurrencyEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Model; @@ -148,7 +148,7 @@ class TheliaHttpKernel extends HttpKernel $currency = null; if ($request->query->has("currency")) { $currency = Model\CurrencyQuery::create()->findOneByCode($request->query->get("currency")); - if($currency) { + if ($currency) { $this->container->get("event_dispatcher")->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyEvent($currency)); } } else { diff --git a/core/lib/Thelia/Exception/OrderException.php b/core/lib/Thelia/Exception/OrderException.php index 70fd21c01..676447858 100755 --- a/core/lib/Thelia/Exception/OrderException.php +++ b/core/lib/Thelia/Exception/OrderException.php @@ -41,7 +41,7 @@ class OrderException extends \RuntimeException public function __construct($message, $code = null, $arguments = array(), $previous = null) { - if(is_array($arguments)) { + if (is_array($arguments)) { $this->arguments = $arguments; } if ($code === null) { diff --git a/core/lib/Thelia/Form/AddressCreateForm.php b/core/lib/Thelia/Form/AddressCreateForm.php index 483366a1f..0774f253d 100644 --- a/core/lib/Thelia/Form/AddressCreateForm.php +++ b/core/lib/Thelia/Form/AddressCreateForm.php @@ -102,7 +102,7 @@ class AddressCreateForm extends BaseForm "for" => "address1_create" ) )) - ->add("address2", "text", array( + ->add("address2", "text", array( "label" => Translator::getInstance()->trans("Additional address"), "label_attr" => array( "for" => "address2_create" diff --git a/core/lib/Thelia/Form/AddressUpdateForm.php b/core/lib/Thelia/Form/AddressUpdateForm.php index 4fcf6e29c..055b233c9 100644 --- a/core/lib/Thelia/Form/AddressUpdateForm.php +++ b/core/lib/Thelia/Form/AddressUpdateForm.php @@ -103,7 +103,7 @@ class AddressUpdateForm extends AddressCreateForm "for" => "address1_update" ) )) - ->add("address2", "text", array( + ->add("address2", "text", array( "label" => Translator::getInstance()->trans("Additional address"), "label_attr" => array( "for" => "address2_update" diff --git a/core/lib/Thelia/Form/AdminLogin.php b/core/lib/Thelia/Form/AdminLogin.php index 00236161d..ff26bdc8d 100755 --- a/core/lib/Thelia/Form/AdminLogin.php +++ b/core/lib/Thelia/Form/AdminLogin.php @@ -51,7 +51,7 @@ class AdminLogin extends BaseForm ) )) ->add("remember_me", "checkbox", array( - 'value' => 'yes', + 'value' => 'yes', "label" => Translator::getInstance()->trans("Remember me ?"), "label_attr" => array( "for" => "remember_me" diff --git a/core/lib/Thelia/Form/AttributeAvCreationForm.php b/core/lib/Thelia/Form/AttributeAvCreationForm.php index 2ad202e1d..513fc0c6b 100644 --- a/core/lib/Thelia/Form/AttributeAvCreationForm.php +++ b/core/lib/Thelia/Form/AttributeAvCreationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; @@ -59,4 +57,4 @@ class AttributeAvCreationForm extends BaseForm { return "thelia_attributeav_creation"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/AttributeCreationForm.php b/core/lib/Thelia/Form/AttributeCreationForm.php index a4c6d402f..dc65cc16c 100644 --- a/core/lib/Thelia/Form/AttributeCreationForm.php +++ b/core/lib/Thelia/Form/AttributeCreationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Form/AttributeModificationForm.php b/core/lib/Thelia/Form/AttributeModificationForm.php index 45dab7b28..51d4f6c3a 100644 --- a/core/lib/Thelia/Form/AttributeModificationForm.php +++ b/core/lib/Thelia/Form/AttributeModificationForm.php @@ -23,10 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; -use Symfony\Component\Validator\Constraints\NotBlank; -use Thelia\Core\Translation\Translator; use Symfony\Component\Validator\Constraints\GreaterThan; class AttributeModificationForm extends AttributeCreationForm diff --git a/core/lib/Thelia/Form/CategoryDocumentModification.php b/core/lib/Thelia/Form/CategoryDocumentModification.php index 47c637df0..9ad7ba890 100644 --- a/core/lib/Thelia/Form/CategoryDocumentModification.php +++ b/core/lib/Thelia/Form/CategoryDocumentModification.php @@ -22,10 +22,7 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\DocumentModification; -use Thelia\Form\Image\ImageModification; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Form/CategoryImageModification.php b/core/lib/Thelia/Form/CategoryImageModification.php index 06674d9ef..6f24263eb 100644 --- a/core/lib/Thelia/Form/CategoryImageModification.php +++ b/core/lib/Thelia/Form/CategoryImageModification.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\ImageModification; /** diff --git a/core/lib/Thelia/Form/ContentDocumentModification.php b/core/lib/Thelia/Form/ContentDocumentModification.php index 748eec0ec..d9d7c0571 100644 --- a/core/lib/Thelia/Form/ContentDocumentModification.php +++ b/core/lib/Thelia/Form/ContentDocumentModification.php @@ -22,10 +22,7 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\DocumentModification; -use Thelia\Form\Image\ImageModification; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Form/ContentImageModification.php b/core/lib/Thelia/Form/ContentImageModification.php index f40fc5497..d80e47224 100644 --- a/core/lib/Thelia/Form/ContentImageModification.php +++ b/core/lib/Thelia/Form/ContentImageModification.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\ImageModification; /** diff --git a/core/lib/Thelia/Form/ContentModificationForm.php b/core/lib/Thelia/Form/ContentModificationForm.php index 38ad4e2cf..14789ab84 100644 --- a/core/lib/Thelia/Form/ContentModificationForm.php +++ b/core/lib/Thelia/Form/ContentModificationForm.php @@ -33,7 +33,8 @@ use Thelia\Form\StandardDescriptionFieldsTrait; * @package Thelia\Form * @author manuel raynaud */ -class ContentModificationForm extends ContentCreationForm { +class ContentModificationForm extends ContentCreationForm +{ use StandardDescriptionFieldsTrait; protected function buildForm() @@ -58,4 +59,4 @@ class ContentModificationForm extends ContentCreationForm { { return "thelia_content_modification"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/CountryCreationForm.php b/core/lib/Thelia/Form/CountryCreationForm.php index ad6701a64..fe7486852 100644 --- a/core/lib/Thelia/Form/CountryCreationForm.php +++ b/core/lib/Thelia/Form/CountryCreationForm.php @@ -38,16 +38,19 @@ class CountryCreationForm extends BaseForm "label_attr" => array( "for" => "title" ) - )) - ->add("area", "text", array( + )) + ->add("locale", "text", array( "constraints" => array( new NotBlank() ), - "label" => Translator::getInstance()->trans("Country area *"), + "label_attr" => array("for" => "locale_create") + )) + ->add("area", "text", array( + "label" => Translator::getInstance()->trans("Country area"), "label_attr" => array( "for" => "area" ) - )) + )) ->add("isocode", "text", array( "constraints" => array( new NotBlank() @@ -56,7 +59,7 @@ class CountryCreationForm extends BaseForm "label_attr" => array( "for" => "isocode" ) - )) + )) ->add("isoalpha2", "text", array( "constraints" => array( new NotBlank() @@ -65,7 +68,7 @@ class CountryCreationForm extends BaseForm "label_attr" => array( "for" => "isoalpha2" ) - )) + )) ->add("isoalpha3", "text", array( "constraints" => array( new NotBlank() @@ -74,7 +77,7 @@ class CountryCreationForm extends BaseForm "label_attr" => array( "for" => "isoalpha3" ) - )) + )) ; } diff --git a/core/lib/Thelia/Form/CountryModificationForm.php b/core/lib/Thelia/Form/CountryModificationForm.php index 4c1581664..68570425b 100644 --- a/core/lib/Thelia/Form/CountryModificationForm.php +++ b/core/lib/Thelia/Form/CountryModificationForm.php @@ -26,78 +26,20 @@ use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; -class CountryModificationForm extends CurrencyCreationForm +class CountryModificationForm extends CountryCreationForm { + use StandardDescriptionFieldsTrait; + protected function buildForm() { parent::buildForm(true); $this->formBuilder ->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) - ->add("title", "text", array( - "constraints" => array( - new NotBlank() - ), - "label" => Translator::getInstance()->trans("Country title *"), - "label_attr" => array( - "for" => "title" - ) - )) - ->add("short-description", "text", array( - "constraints" => array( - new NotBlank() - ), - "label" => Translator::getInstance()->trans("Country short description *"), - "label_attr" => array( - "for" => "short-description" - ) - )) - ->add("description", "text", array( - "constraints" => array( - new NotBlank() - ), - "label" => Translator::getInstance()->trans("Country description *"), - "label_attr" => array( - "for" => "description" - ) - )) - ->add("area", "text", array( - "constraints" => array( - new NotBlank() - ), - "label" => Translator::getInstance()->trans("Country area *"), - "label_attr" => array( - "for" => "area" - ) - )) - ->add("isocode", "text", array( - "constraints" => array( - new NotBlank() - ), - "label" => Translator::getInstance()->trans("ISO Code *"), - "label_attr" => array( - "for" => "isocode" - ) - )) - ->add("isoalpha2", "text", array( - "constraints" => array( - new NotBlank() - ), - "label" => Translator::getInstance()->trans("Alpha code 2 *"), - "label_attr" => array( - "for" => "isoalpha2" - ) - )) - ->add("isoalpha3", "text", array( - "constraints" => array( - new NotBlank() - ), - "label" => Translator::getInstance()->trans("Alpha code 3 *"), - "label_attr" => array( - "for" => "isoalpha3" - ) - )) ; + + // Add standard description fields, excluding title and locale, which a re defined in parent class + $this->addStandardDescFields(array('title', 'locale')); } public function getName() diff --git a/core/lib/Thelia/Form/CouponCreationForm.php b/core/lib/Thelia/Form/CouponCreationForm.php index fcb2e793c..448f65e38 100755 --- a/core/lib/Thelia/Form/CouponCreationForm.php +++ b/core/lib/Thelia/Form/CouponCreationForm.php @@ -24,7 +24,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\Date; -use Symfony\Component\Validator\Constraints\DateTime; use Symfony\Component\Validator\Constraints\GreaterThanOrEqual; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotEqualTo; diff --git a/core/lib/Thelia/Form/CustomerCreation.php b/core/lib/Thelia/Form/CustomerCreation.php index 24e64faff..cc74585e7 100755 --- a/core/lib/Thelia/Form/CustomerCreation.php +++ b/core/lib/Thelia/Form/CustomerCreation.php @@ -220,4 +220,4 @@ class CustomerCreation extends BaseForm { return "thelia_customer_creation"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/CustomerLostPasswordForm.php b/core/lib/Thelia/Form/CustomerLostPasswordForm.php index d950bf614..83ff1f3d6 100644 --- a/core/lib/Thelia/Form/CustomerLostPasswordForm.php +++ b/core/lib/Thelia/Form/CustomerLostPasswordForm.php @@ -35,8 +35,8 @@ use Thelia\Model\CustomerQuery; * @package Thelia\Form * @author Manuel Raynaud */ -class CustomerLostPasswordForm extends BaseForm { - +class CustomerLostPasswordForm extends BaseForm +{ /** * * in this function you add all the fields you need for your Form. @@ -93,4 +93,4 @@ class CustomerLostPasswordForm extends BaseForm { { return "thelia_customer_creation"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/FeatureAvCreationForm.php b/core/lib/Thelia/Form/FeatureAvCreationForm.php index 504cc9338..9245bf28d 100644 --- a/core/lib/Thelia/Form/FeatureAvCreationForm.php +++ b/core/lib/Thelia/Form/FeatureAvCreationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; @@ -59,4 +57,4 @@ class FeatureAvCreationForm extends BaseForm { return "thelia_featureav_creation"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/FeatureCreationForm.php b/core/lib/Thelia/Form/FeatureCreationForm.php index 1977bd78b..cbbc7692f 100644 --- a/core/lib/Thelia/Form/FeatureCreationForm.php +++ b/core/lib/Thelia/Form/FeatureCreationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Form/FeatureModificationForm.php b/core/lib/Thelia/Form/FeatureModificationForm.php index 1702f299e..576db4bfc 100644 --- a/core/lib/Thelia/Form/FeatureModificationForm.php +++ b/core/lib/Thelia/Form/FeatureModificationForm.php @@ -23,10 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; -use Symfony\Component\Validator\Constraints\NotBlank; -use Thelia\Core\Translation\Translator; use Symfony\Component\Validator\Constraints\GreaterThan; class FeatureModificationForm extends FeatureCreationForm diff --git a/core/lib/Thelia/Form/FolderDocumentModification.php b/core/lib/Thelia/Form/FolderDocumentModification.php index bbf57ab9d..47bcd7c7f 100644 --- a/core/lib/Thelia/Form/FolderDocumentModification.php +++ b/core/lib/Thelia/Form/FolderDocumentModification.php @@ -22,10 +22,7 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\DocumentModification; -use Thelia\Form\Image\ImageModification; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Form/FolderImageModification.php b/core/lib/Thelia/Form/FolderImageModification.php index a9305433b..004c4676b 100644 --- a/core/lib/Thelia/Form/FolderImageModification.php +++ b/core/lib/Thelia/Form/FolderImageModification.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\ImageModification; /** diff --git a/core/lib/Thelia/Form/Image/DocumentModification.php b/core/lib/Thelia/Form/Image/DocumentModification.php index 39ba559be..31de5af98 100644 --- a/core/lib/Thelia/Form/Image/DocumentModification.php +++ b/core/lib/Thelia/Form/Image/DocumentModification.php @@ -22,7 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form\Image; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Validator\Constraints\Image; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Form/Image/ImageModification.php b/core/lib/Thelia/Form/Image/ImageModification.php index c4d26378b..e95a39c37 100644 --- a/core/lib/Thelia/Form/Image/ImageModification.php +++ b/core/lib/Thelia/Form/Image/ImageModification.php @@ -22,7 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form\Image; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Validator\Constraints\Image; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Form/OrderDelivery.php b/core/lib/Thelia/Form/OrderDelivery.php index 8cddb5bd9..b7eb4696d 100755 --- a/core/lib/Thelia/Form/OrderDelivery.php +++ b/core/lib/Thelia/Form/OrderDelivery.php @@ -25,8 +25,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Model\AddressQuery; -use Thelia\Model\ConfigQuery; -use Thelia\Core\Translation\Translator; use Thelia\Model\ModuleQuery; use Thelia\Module\BaseModule; @@ -69,7 +67,7 @@ class OrderDelivery extends BaseForm $address = AddressQuery::create() ->findPk($value); - if(null === $address) { + if (null === $address) { $context->addViolation("Address ID not found"); } } @@ -82,7 +80,7 @@ class OrderDelivery extends BaseForm ->filterById($value) ->findOne(); - if(null === $module) { + if (null === $module) { $context->addViolation("Delivery module ID not found"); } @@ -98,4 +96,4 @@ class OrderDelivery extends BaseForm { return "thelia_order_delivery"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/OrderPayment.php b/core/lib/Thelia/Form/OrderPayment.php index 6a6305971..6a0d6ec61 100755 --- a/core/lib/Thelia/Form/OrderPayment.php +++ b/core/lib/Thelia/Form/OrderPayment.php @@ -25,8 +25,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Model\AddressQuery; -use Thelia\Model\ConfigQuery; -use Thelia\Core\Translation\Translator; use Thelia\Model\ModuleQuery; use Thelia\Module\BaseModule; @@ -69,7 +67,7 @@ class OrderPayment extends BaseForm $address = AddressQuery::create() ->findPk($value); - if(null === $address) { + if (null === $address) { $context->addViolation("Address ID not found"); } } @@ -82,7 +80,7 @@ class OrderPayment extends BaseForm ->filterById($value) ->findOne(); - if(null === $module) { + if (null === $module) { $context->addViolation("Payment module ID not found"); } @@ -98,4 +96,4 @@ class OrderPayment extends BaseForm { return "thelia_order_payment"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/OrderUpdateAddress.php b/core/lib/Thelia/Form/OrderUpdateAddress.php new file mode 100644 index 000000000..f8aabf628 --- /dev/null +++ b/core/lib/Thelia/Form/OrderUpdateAddress.php @@ -0,0 +1,192 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Form; +use Symfony\Component\Validator\Constraints\Callback; +use Symfony\Component\Validator\Constraints\NotBlank; +use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; +use Thelia\Model\CountryQuery; +use Thelia\Model\CustomerTitleQuery; +use Thelia\Model\OrderAddressQuery; + +/** + * Class AddressUpdateForm + * @package Thelia\Form + * @author Etienne Roudeix + */ +class OrderUpdateAddress extends BaseForm +{ + protected function buildForm() + { + $this->formBuilder + ->add("id", "integer", array( + "constraints" => array( + new NotBlank(), + new Callback(array( + "methods" => array( + array($this, "verifyId") + ) + )) + ), + "required" => true + )) + ->add("title", "text", array( + "constraints" => array( + new NotBlank(), + new Callback(array( + "methods" => array( + array($this, "verifyTitle") + ) + )) + ), + "label" => Translator::getInstance()->trans("Title"), + "label_attr" => array( + "for" => "title_update" + ) + )) + ->add("firstname", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Firstname"), + "label_attr" => array( + "for" => "firstname_update" + ) + )) + ->add("lastname", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Lastname"), + "label_attr" => array( + "for" => "lastname_update" + ) + )) + ->add("address1", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Street Address"), + "label_attr" => array( + "for" => "address1_update" + ) + )) + ->add("address2", "text", array( + "label" => Translator::getInstance()->trans("Additional address"), + "label_attr" => array( + "for" => "address2_update" + ) + )) + ->add("address3", "text", array( + "label" => Translator::getInstance()->trans("Additional address"), + "label_attr" => array( + "for" => "address3_update" + ) + )) + ->add("zipcode", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Zip code"), + "label_attr" => array( + "for" => "zipcode_update" + ) + )) + ->add("city", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("City"), + "label_attr" => array( + "for" => "city_update" + ) + )) + ->add("country", "text", array( + "constraints" => array( + new NotBlank(), + new Callback(array( + "methods" => array( + array($this, "verifyCountry") + ) + )) + ), + "label" => Translator::getInstance()->trans("Country"), + "label_attr" => array( + "for" => "country_update" + ) + )) + ->add("phone", "text", array( + "label" => Translator::getInstance()->trans("Phone"), + "label_attr" => array( + "for" => "phone_update" + ) + )) + ->add("company", "text", array( + "label" => Translator::getInstance()->trans("Compagny"), + "label_attr" => array( + "for" => "company_update" + ) + )) + ; + + } + + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return "thelia_order_address_update"; + } + + public function verifyId($value, ExecutionContextInterface $context) + { + $address = OrderAddressQuery::create() + ->findPk($value); + + if (null === $address) { + $context->addViolation("Order address ID not found"); + } + } + + public function verifyTitle($value, ExecutionContextInterface $context) + { + $address = CustomerTitleQuery::create() + ->findPk($value); + + if (null === $address) { + $context->addViolation("Title ID not found"); + } + } + + public function verifyCountry($value, ExecutionContextInterface $context) + { + $address = CountryQuery::create() + ->findPk($value); + + if (null === $address) { + $context->addViolation("Country ID not found"); + } + } +} diff --git a/core/lib/Thelia/Form/ProductDetailsModificationForm.php b/core/lib/Thelia/Form/ProductDetailsModificationForm.php index 7ded6ff69..dbc6bb238 100644 --- a/core/lib/Thelia/Form/ProductDetailsModificationForm.php +++ b/core/lib/Thelia/Form/ProductDetailsModificationForm.php @@ -87,4 +87,4 @@ class ProductDetailsModificationForm extends BaseForm { return "thelia_product_details_modification"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/ProductDocumentModification.php b/core/lib/Thelia/Form/ProductDocumentModification.php index 1a9bc5467..a9d7617e4 100644 --- a/core/lib/Thelia/Form/ProductDocumentModification.php +++ b/core/lib/Thelia/Form/ProductDocumentModification.php @@ -22,10 +22,7 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\DocumentModification; -use Thelia\Form\Image\ImageModification; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Form/ProductImageModification.php b/core/lib/Thelia/Form/ProductImageModification.php index 2d35e176f..9c81ca839 100644 --- a/core/lib/Thelia/Form/ProductImageModification.php +++ b/core/lib/Thelia/Form/ProductImageModification.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\ImageModification; /** diff --git a/core/lib/Thelia/Form/ProductModificationForm.php b/core/lib/Thelia/Form/ProductModificationForm.php index dbda15eaa..34785cf45 100644 --- a/core/lib/Thelia/Form/ProductModificationForm.php +++ b/core/lib/Thelia/Form/ProductModificationForm.php @@ -61,4 +61,4 @@ class ProductModificationForm extends ProductCreationForm { return "thelia_product_modification"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/ProfileModificationForm.php b/core/lib/Thelia/Form/ProfileModificationForm.php index e3119cfee..618fbdfb4 100644 --- a/core/lib/Thelia/Form/ProfileModificationForm.php +++ b/core/lib/Thelia/Form/ProfileModificationForm.php @@ -35,7 +35,6 @@ use Thelia\Model\ConfigQuery; class ProfileModificationForm extends BaseForm { - protected function buildForm() { diff --git a/core/lib/Thelia/Form/TemplateCreationForm.php b/core/lib/Thelia/Form/TemplateCreationForm.php index 42e6db5a4..82d3560eb 100644 --- a/core/lib/Thelia/Form/TemplateCreationForm.php +++ b/core/lib/Thelia/Form/TemplateCreationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Form/TemplateModificationForm.php b/core/lib/Thelia/Form/TemplateModificationForm.php index b2b50a3ca..7d4248143 100644 --- a/core/lib/Thelia/Form/TemplateModificationForm.php +++ b/core/lib/Thelia/Form/TemplateModificationForm.php @@ -23,10 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; -use Symfony\Component\Validator\Constraints\NotBlank; -use Thelia\Core\Translation\Translator; use Symfony\Component\Validator\Constraints\GreaterThan; class TemplateModificationForm extends TemplateCreationForm diff --git a/core/lib/Thelia/Install/CheckPermission.php b/core/lib/Thelia/Install/CheckPermission.php index 15317211b..b8c4e9888 100644 --- a/core/lib/Thelia/Install/CheckPermission.php +++ b/core/lib/Thelia/Install/CheckPermission.php @@ -45,6 +45,7 @@ class CheckPermission extends BaseInstall const DIR_LOG = 'log'; const DIR_CACHE = 'cache'; const DIR_WEB = 'web'; + const DIR_SESSION = 'local/session'; /** @var array Directory needed to be writable */ protected $directoriesToBeWritable = array( @@ -52,11 +53,12 @@ class CheckPermission extends BaseInstall self::DIR_LOG, self::DIR_CACHE, self::DIR_WEB, + self::DIR_SESSION, ); /** @var array Minimum server configuration necessary */ protected $minServerConfigurationNecessary = array( - 'memory_limit' => 134217728, + 'memory_limit' => 157286400, 'post_max_size' => 20971520, 'upload_max_filesize' => 2097152 ); @@ -187,9 +189,9 @@ class CheckPermission extends BaseInstall { if ($this->translator !== null) { if ($isValid) { - $sentence = 'Your directory %directory% is writable'; + $sentence = 'Your directory %directory% is writable'; } else { - $sentence = 'Your directory %directory% is not writable'; + $sentence = 'Your directory %directory% is not writable'; } $translatedText = $this->translator->trans( @@ -216,7 +218,7 @@ class CheckPermission extends BaseInstall protected function getI18nDirectoryHint($directory) { if ($this->translator !== null) { - $sentence = 'chmod 777 %directory% on your server with admin rights could help'; + $sentence = 'chmod 777 %directory% on your server with admin rights could help'; $translatedText = $this->translator->trans( $sentence, array( @@ -246,9 +248,9 @@ class CheckPermission extends BaseInstall protected function getI18nConfigText($key, $expectedValue, $currentValue, $isValid) { if ($isValid) { - $sentence = 'Your %key% server configuration (currently %currentValue%) is well enough to run Thelia2 (%expectedValue% needed)'; + $sentence = 'Your %key% server configuration (currently %currentValue%) is well enough to run Thelia2 (%expectedValue% needed)'; } else { - $sentence = 'Your %key% server configuration (currently %currentValue%) is not sufficient enough in order to run Thelia2 (%expectedValue% needed)'; + $sentence = 'Your %key% server configuration (currently %currentValue%) is not sufficient enough in order to run Thelia2 (%expectedValue% needed)'; } $translatedText = $this->translator->trans( @@ -271,7 +273,7 @@ class CheckPermission extends BaseInstall */ protected function getI18nConfigHint() { - $sentence = 'Modifying this value on your server php.ini file with admin rights could help'; + $sentence = 'Modifying this value on your server php.ini file with admin rights could help'; $translatedText = $this->translator->trans( $sentence, array(), @@ -294,9 +296,9 @@ class CheckPermission extends BaseInstall { if ($this->translator !== null) { if ($isValid) { - $sentence = 'Your PHP version %currentValue% is well enough to run Thelia2 (%expectedValue% needed)'; + $sentence = 'Your PHP version %currentValue% is well enough to run Thelia2 (%expectedValue% needed)'; } else { - $sentence = 'Your PHP version %currentValue% is not sufficient enough to run Thelia2 (%expectedValue% needed)'; + $sentence = 'Your PHP version %currentValue% is not sufficient enough to run Thelia2 (%expectedValue% needed)'; } $translatedText = $this->translator->trans( @@ -343,6 +345,10 @@ class CheckPermission extends BaseInstall { $serverValueInBytes = $this->returnBytes(ini_get($key)); + if($serverValueInBytes == -1) { + return true; + } + return ($serverValueInBytes >= $necessaryValueInBytes); } diff --git a/core/lib/Thelia/Install/Database.php b/core/lib/Thelia/Install/Database.php index 648a6431a..d17bd7c3d 100644 --- a/core/lib/Thelia/Install/Database.php +++ b/core/lib/Thelia/Install/Database.php @@ -40,21 +40,33 @@ class Database /** * Insert all sql needed in database + * Default insert /install/thelia.sql and /install/insert.sql * - * @param $dbName + * @param string $dbName Database name + * @param array $extraSqlFiles SQL Files uri to insert */ - public function insertSql($dbName = null) + public function insertSql($dbName = null, array $extraSqlFiles = null) { - if($dbName) { + if ($dbName) { $this->connection->query(sprintf("use %s", $dbName)); } $sql = array(); - $sql = array_merge( - $sql, - $this->prepareSql(file_get_contents(THELIA_ROOT . "/install/thelia.sql")), - $this->prepareSql(file_get_contents(THELIA_ROOT . "/install/insert.sql")) - ); + + if (null === $extraSqlFiles) { + $sql = array_merge( + $sql, + $this->prepareSql(file_get_contents(THELIA_ROOT . '/install/thelia.sql')), + $this->prepareSql(file_get_contents(THELIA_ROOT . '/install/insert.sql')) + ); + } else { + foreach ($extraSqlFiles as $fileToInsert) { + $sql = array_merge( + $sql, + $this->prepareSql(file_get_contents($fileToInsert)) + ); + } + } for ($i = 0; $i < count($sql); $i ++) { if (!empty($sql[$i])) { @@ -75,7 +87,7 @@ class Database $sql = trim($sql); $query = array(); - $tab = explode(";", $sql); + $tab = explode(";\n", $sql); for ($i=0; $idispatchEvent(TheliaEvents::BEFORE_CREATEATTRIBUTE, new AttributeEvent($this)); // Set the current position for the new object - $this->setPosition($this->getNextPosition()); + //$this->setPosition($this->getNextPosition()); return true; } diff --git a/core/lib/Thelia/Model/AttributeAv.php b/core/lib/Thelia/Model/AttributeAv.php index d45b16192..8059b217e 100755 --- a/core/lib/Thelia/Model/AttributeAv.php +++ b/core/lib/Thelia/Model/AttributeAv.php @@ -3,7 +3,7 @@ namespace Thelia\Model; use Thelia\Model\Base\AttributeAv as BaseAttributeAv; -use Thelia\Core\Event\AttributeAvEvent; +use Thelia\Core\Event\Attribute\AttributeAvEvent; use Propel\Runtime\Connection\ConnectionInterface; use Thelia\Core\Event\TheliaEvents; use Propel\Runtime\ActiveQuery\Criteria; diff --git a/core/lib/Thelia/Model/Base/Accessory.php b/core/lib/Thelia/Model/Base/Accessory.php index 183f59947..df3de2bc3 100644 --- a/core/lib/Thelia/Model/Base/Accessory.php +++ b/core/lib/Thelia/Model/Base/Accessory.php @@ -152,7 +152,7 @@ abstract class Accessory implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -210,8 +210,8 @@ abstract class Accessory implements ActiveRecordInterface * obj is an instance of Accessory, delegates to * equals(Accessory). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -250,8 +250,6 @@ abstract class Accessory implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -262,6 +260,7 @@ abstract class Accessory implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -272,7 +271,10 @@ abstract class Accessory implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -329,7 +331,9 @@ abstract class Accessory implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -424,7 +428,7 @@ abstract class Accessory implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -444,7 +448,7 @@ abstract class Accessory implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1061,8 +1065,7 @@ abstract class Accessory implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Address.php b/core/lib/Thelia/Model/Base/Address.php index 2dc666a08..47bcd35a3 100644 --- a/core/lib/Thelia/Model/Base/Address.php +++ b/core/lib/Thelia/Model/Base/Address.php @@ -274,7 +274,7 @@ abstract class Address implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -332,8 +332,8 @@ abstract class Address implements ActiveRecordInterface * obj is an instance of Address, delegates to * equals(Address). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -372,8 +372,6 @@ abstract class Address implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -384,6 +382,7 @@ abstract class Address implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -394,7 +393,10 @@ abstract class Address implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -451,7 +453,9 @@ abstract class Address implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -678,7 +682,7 @@ abstract class Address implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -698,7 +702,7 @@ abstract class Address implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1782,8 +1786,7 @@ abstract class Address implements ActiveRecordInterface $keys[17] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Admin.php b/core/lib/Thelia/Model/Base/Admin.php index edcdb27e8..bb26ed270 100644 --- a/core/lib/Thelia/Model/Base/Admin.php +++ b/core/lib/Thelia/Model/Base/Admin.php @@ -198,7 +198,7 @@ abstract class Admin implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -256,8 +256,8 @@ abstract class Admin implements ActiveRecordInterface * obj is an instance of Admin, delegates to * equals(Admin). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -296,8 +296,6 @@ abstract class Admin implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -308,6 +306,7 @@ abstract class Admin implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -318,7 +317,10 @@ abstract class Admin implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -375,7 +377,9 @@ abstract class Admin implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -525,7 +529,7 @@ abstract class Admin implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -545,7 +549,7 @@ abstract class Admin implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1344,8 +1348,7 @@ abstract class Admin implements ActiveRecordInterface $keys[10] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/AdminGroup.php b/core/lib/Thelia/Model/Base/AdminGroup.php index 9eadbb107..663e437a4 100644 --- a/core/lib/Thelia/Model/Base/AdminGroup.php +++ b/core/lib/Thelia/Model/Base/AdminGroup.php @@ -148,7 +148,7 @@ abstract class AdminGroup implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -206,8 +206,8 @@ abstract class AdminGroup implements ActiveRecordInterface * obj is an instance of AdminGroup, delegates to * equals(AdminGroup). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -246,8 +246,6 @@ abstract class AdminGroup implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -258,6 +256,7 @@ abstract class AdminGroup implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -268,7 +267,10 @@ abstract class AdminGroup implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -325,7 +327,9 @@ abstract class AdminGroup implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -409,7 +413,7 @@ abstract class AdminGroup implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -429,7 +433,7 @@ abstract class AdminGroup implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1012,8 +1016,7 @@ abstract class AdminGroup implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/AdminLog.php b/core/lib/Thelia/Model/Base/AdminLog.php index ae828e4bb..dfce950eb 100644 --- a/core/lib/Thelia/Model/Base/AdminLog.php +++ b/core/lib/Thelia/Model/Base/AdminLog.php @@ -152,7 +152,7 @@ abstract class AdminLog implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -210,8 +210,8 @@ abstract class AdminLog implements ActiveRecordInterface * obj is an instance of AdminLog, delegates to * equals(AdminLog). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -250,8 +250,6 @@ abstract class AdminLog implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -262,6 +260,7 @@ abstract class AdminLog implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -272,7 +271,10 @@ abstract class AdminLog implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -329,7 +331,9 @@ abstract class AdminLog implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -446,7 +450,7 @@ abstract class AdminLog implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -466,7 +470,7 @@ abstract class AdminLog implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1115,8 +1119,7 @@ abstract class AdminLog implements ActiveRecordInterface $keys[7] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Area.php b/core/lib/Thelia/Model/Base/Area.php index f561ba330..14d834929 100644 --- a/core/lib/Thelia/Model/Base/Area.php +++ b/core/lib/Thelia/Model/Base/Area.php @@ -163,7 +163,7 @@ abstract class Area implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -221,8 +221,8 @@ abstract class Area implements ActiveRecordInterface * obj is an instance of Area, delegates to * equals(Area). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -261,8 +261,6 @@ abstract class Area implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -273,6 +271,7 @@ abstract class Area implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -283,7 +282,10 @@ abstract class Area implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -340,7 +342,9 @@ abstract class Area implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -424,7 +428,7 @@ abstract class Area implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -444,7 +448,7 @@ abstract class Area implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1031,8 +1035,7 @@ abstract class Area implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/AreaDeliveryModule.php b/core/lib/Thelia/Model/Base/AreaDeliveryModule.php index 38a16dd5a..1e2996fb4 100644 --- a/core/lib/Thelia/Model/Base/AreaDeliveryModule.php +++ b/core/lib/Thelia/Model/Base/AreaDeliveryModule.php @@ -148,7 +148,7 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -206,8 +206,8 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface * obj is an instance of AreaDeliveryModule, delegates to * equals(AreaDeliveryModule). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -246,8 +246,6 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -258,6 +256,7 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -268,7 +267,10 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -325,7 +327,9 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -409,7 +413,7 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -429,7 +433,7 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1012,8 +1016,7 @@ abstract class AreaDeliveryModule implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Attribute.php b/core/lib/Thelia/Model/Base/Attribute.php index 64e765fdd..f9cee31c7 100644 --- a/core/lib/Thelia/Model/Base/Attribute.php +++ b/core/lib/Thelia/Model/Base/Attribute.php @@ -212,7 +212,7 @@ abstract class Attribute implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -270,8 +270,8 @@ abstract class Attribute implements ActiveRecordInterface * obj is an instance of Attribute, delegates to * equals(Attribute). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -310,8 +310,6 @@ abstract class Attribute implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -322,6 +320,7 @@ abstract class Attribute implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -332,7 +331,10 @@ abstract class Attribute implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -389,7 +391,9 @@ abstract class Attribute implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -462,7 +466,7 @@ abstract class Attribute implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -482,7 +486,7 @@ abstract class Attribute implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1100,8 +1104,7 @@ abstract class Attribute implements ActiveRecordInterface $keys[3] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/AttributeAv.php b/core/lib/Thelia/Model/Base/AttributeAv.php index b94288753..83b55fab8 100644 --- a/core/lib/Thelia/Model/Base/AttributeAv.php +++ b/core/lib/Thelia/Model/Base/AttributeAv.php @@ -184,7 +184,7 @@ abstract class AttributeAv implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -242,8 +242,8 @@ abstract class AttributeAv implements ActiveRecordInterface * obj is an instance of AttributeAv, delegates to * equals(AttributeAv). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -282,8 +282,6 @@ abstract class AttributeAv implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -294,6 +292,7 @@ abstract class AttributeAv implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -304,7 +303,10 @@ abstract class AttributeAv implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -361,7 +363,9 @@ abstract class AttributeAv implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -445,7 +449,7 @@ abstract class AttributeAv implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -465,7 +469,7 @@ abstract class AttributeAv implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1071,8 +1075,7 @@ abstract class AttributeAv implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/AttributeAvI18n.php b/core/lib/Thelia/Model/Base/AttributeAvI18n.php index ec6f8811f..dd2a973b7 100644 --- a/core/lib/Thelia/Model/Base/AttributeAvI18n.php +++ b/core/lib/Thelia/Model/Base/AttributeAvI18n.php @@ -158,7 +158,7 @@ abstract class AttributeAvI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class AttributeAvI18n implements ActiveRecordInterface * obj is an instance of AttributeAvI18n, delegates to * equals(AttributeAvI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class AttributeAvI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class AttributeAvI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class AttributeAvI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class AttributeAvI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class AttributeAvI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/AttributeCombination.php b/core/lib/Thelia/Model/Base/AttributeCombination.php index ef840a5a1..543e86476 100644 --- a/core/lib/Thelia/Model/Base/AttributeCombination.php +++ b/core/lib/Thelia/Model/Base/AttributeCombination.php @@ -155,7 +155,7 @@ abstract class AttributeCombination implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -213,8 +213,8 @@ abstract class AttributeCombination implements ActiveRecordInterface * obj is an instance of AttributeCombination, delegates to * equals(AttributeCombination). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -253,8 +253,6 @@ abstract class AttributeCombination implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -265,6 +263,7 @@ abstract class AttributeCombination implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -275,7 +274,10 @@ abstract class AttributeCombination implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -332,7 +334,9 @@ abstract class AttributeCombination implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -416,7 +420,7 @@ abstract class AttributeCombination implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -436,7 +440,7 @@ abstract class AttributeCombination implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1023,8 +1027,7 @@ abstract class AttributeCombination implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/AttributeI18n.php b/core/lib/Thelia/Model/Base/AttributeI18n.php index d75c24412..30bd331a3 100644 --- a/core/lib/Thelia/Model/Base/AttributeI18n.php +++ b/core/lib/Thelia/Model/Base/AttributeI18n.php @@ -158,7 +158,7 @@ abstract class AttributeI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class AttributeI18n implements ActiveRecordInterface * obj is an instance of AttributeI18n, delegates to * equals(AttributeI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class AttributeI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class AttributeI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class AttributeI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class AttributeI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class AttributeI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/AttributeTemplate.php b/core/lib/Thelia/Model/Base/AttributeTemplate.php index 85d432a62..ae45495ee 100644 --- a/core/lib/Thelia/Model/Base/AttributeTemplate.php +++ b/core/lib/Thelia/Model/Base/AttributeTemplate.php @@ -154,7 +154,7 @@ abstract class AttributeTemplate implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -212,8 +212,8 @@ abstract class AttributeTemplate implements ActiveRecordInterface * obj is an instance of AttributeTemplate, delegates to * equals(AttributeTemplate). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -252,8 +252,6 @@ abstract class AttributeTemplate implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -264,6 +262,7 @@ abstract class AttributeTemplate implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -274,7 +273,10 @@ abstract class AttributeTemplate implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -331,7 +333,9 @@ abstract class AttributeTemplate implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -426,7 +430,7 @@ abstract class AttributeTemplate implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -446,7 +450,7 @@ abstract class AttributeTemplate implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1063,8 +1067,7 @@ abstract class AttributeTemplate implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Cart.php b/core/lib/Thelia/Model/Base/Cart.php index 2ef18297c..96880be66 100644 --- a/core/lib/Thelia/Model/Base/Cart.php +++ b/core/lib/Thelia/Model/Base/Cart.php @@ -213,7 +213,7 @@ abstract class Cart implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -271,8 +271,8 @@ abstract class Cart implements ActiveRecordInterface * obj is an instance of Cart, delegates to * equals(Cart). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -311,8 +311,6 @@ abstract class Cart implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -323,6 +321,7 @@ abstract class Cart implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -333,7 +332,10 @@ abstract class Cart implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -390,7 +392,9 @@ abstract class Cart implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -518,7 +522,7 @@ abstract class Cart implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -538,7 +542,7 @@ abstract class Cart implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1310,8 +1314,7 @@ abstract class Cart implements ActiveRecordInterface $keys[8] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CartItem.php b/core/lib/Thelia/Model/Base/CartItem.php index e785ae0a5..53b3ef411 100644 --- a/core/lib/Thelia/Model/Base/CartItem.php +++ b/core/lib/Thelia/Model/Base/CartItem.php @@ -213,7 +213,7 @@ abstract class CartItem implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -271,8 +271,8 @@ abstract class CartItem implements ActiveRecordInterface * obj is an instance of CartItem, delegates to * equals(CartItem). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -311,8 +311,6 @@ abstract class CartItem implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -323,6 +321,7 @@ abstract class CartItem implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -333,7 +332,10 @@ abstract class CartItem implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -390,7 +392,9 @@ abstract class CartItem implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -518,7 +522,7 @@ abstract class CartItem implements ActiveRecordInterface if ($format === null) { return $this->price_end_of_life; } else { - return $this->price_end_of_life !== null ? $this->price_end_of_life->format($format) : null; + return $this->price_end_of_life instanceof \DateTime ? $this->price_end_of_life->format($format) : null; } } @@ -560,7 +564,7 @@ abstract class CartItem implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -580,7 +584,7 @@ abstract class CartItem implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1427,8 +1431,7 @@ abstract class CartItem implements ActiveRecordInterface $keys[11] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Category.php b/core/lib/Thelia/Model/Base/Category.php index 6dc9b727a..d5272d1e4 100644 --- a/core/lib/Thelia/Model/Base/Category.php +++ b/core/lib/Thelia/Model/Base/Category.php @@ -293,7 +293,7 @@ abstract class Category implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -351,8 +351,8 @@ abstract class Category implements ActiveRecordInterface * obj is an instance of Category, delegates to * equals(Category). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -391,8 +391,6 @@ abstract class Category implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -403,6 +401,7 @@ abstract class Category implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -413,7 +412,10 @@ abstract class Category implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -470,7 +472,9 @@ abstract class Category implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -565,7 +569,7 @@ abstract class Category implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -585,7 +589,7 @@ abstract class Category implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -616,7 +620,7 @@ abstract class Category implements ActiveRecordInterface if ($format === null) { return $this->version_created_at; } else { - return $this->version_created_at !== null ? $this->version_created_at->format($format) : null; + return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null; } } @@ -1472,8 +1476,7 @@ abstract class Category implements ActiveRecordInterface $keys[8] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CategoryAssociatedContent.php b/core/lib/Thelia/Model/Base/CategoryAssociatedContent.php index 142ab543f..8079eb563 100644 --- a/core/lib/Thelia/Model/Base/CategoryAssociatedContent.php +++ b/core/lib/Thelia/Model/Base/CategoryAssociatedContent.php @@ -154,7 +154,7 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -212,8 +212,8 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface * obj is an instance of CategoryAssociatedContent, delegates to * equals(CategoryAssociatedContent). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -252,8 +252,6 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -264,6 +262,7 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -274,7 +273,10 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -331,7 +333,9 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -426,7 +430,7 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -446,7 +450,7 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1063,8 +1067,7 @@ abstract class CategoryAssociatedContent implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CategoryDocument.php b/core/lib/Thelia/Model/Base/CategoryDocument.php index 7539312cc..83660e717 100644 --- a/core/lib/Thelia/Model/Base/CategoryDocument.php +++ b/core/lib/Thelia/Model/Base/CategoryDocument.php @@ -176,7 +176,7 @@ abstract class CategoryDocument implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -234,8 +234,8 @@ abstract class CategoryDocument implements ActiveRecordInterface * obj is an instance of CategoryDocument, delegates to * equals(CategoryDocument). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -274,8 +274,6 @@ abstract class CategoryDocument implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -286,6 +284,7 @@ abstract class CategoryDocument implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -296,7 +295,10 @@ abstract class CategoryDocument implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -353,7 +355,9 @@ abstract class CategoryDocument implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -448,7 +452,7 @@ abstract class CategoryDocument implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -468,7 +472,7 @@ abstract class CategoryDocument implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1089,8 +1093,7 @@ abstract class CategoryDocument implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php b/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php index 4d284b57e..c4348da52 100644 --- a/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php @@ -158,7 +158,7 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface * obj is an instance of CategoryDocumentI18n, delegates to * equals(CategoryDocumentI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CategoryI18n.php b/core/lib/Thelia/Model/Base/CategoryI18n.php index 9ae8c8cf3..bd9bf2608 100644 --- a/core/lib/Thelia/Model/Base/CategoryI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryI18n.php @@ -158,7 +158,7 @@ abstract class CategoryI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class CategoryI18n implements ActiveRecordInterface * obj is an instance of CategoryI18n, delegates to * equals(CategoryI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class CategoryI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class CategoryI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class CategoryI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class CategoryI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class CategoryI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CategoryImage.php b/core/lib/Thelia/Model/Base/CategoryImage.php index 353c79c4f..2a7e826c7 100644 --- a/core/lib/Thelia/Model/Base/CategoryImage.php +++ b/core/lib/Thelia/Model/Base/CategoryImage.php @@ -176,7 +176,7 @@ abstract class CategoryImage implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -234,8 +234,8 @@ abstract class CategoryImage implements ActiveRecordInterface * obj is an instance of CategoryImage, delegates to * equals(CategoryImage). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -274,8 +274,6 @@ abstract class CategoryImage implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -286,6 +284,7 @@ abstract class CategoryImage implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -296,7 +295,10 @@ abstract class CategoryImage implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -353,7 +355,9 @@ abstract class CategoryImage implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -448,7 +452,7 @@ abstract class CategoryImage implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -468,7 +472,7 @@ abstract class CategoryImage implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1089,8 +1093,7 @@ abstract class CategoryImage implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CategoryImageI18n.php b/core/lib/Thelia/Model/Base/CategoryImageI18n.php index 61b4fc413..1197930c8 100644 --- a/core/lib/Thelia/Model/Base/CategoryImageI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryImageI18n.php @@ -158,7 +158,7 @@ abstract class CategoryImageI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class CategoryImageI18n implements ActiveRecordInterface * obj is an instance of CategoryImageI18n, delegates to * equals(CategoryImageI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class CategoryImageI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class CategoryImageI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class CategoryImageI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class CategoryImageI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class CategoryImageI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CategoryVersion.php b/core/lib/Thelia/Model/Base/CategoryVersion.php index 416ad95d5..7abd40b21 100644 --- a/core/lib/Thelia/Model/Base/CategoryVersion.php +++ b/core/lib/Thelia/Model/Base/CategoryVersion.php @@ -178,7 +178,7 @@ abstract class CategoryVersion implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -236,8 +236,8 @@ abstract class CategoryVersion implements ActiveRecordInterface * obj is an instance of CategoryVersion, delegates to * equals(CategoryVersion). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -276,8 +276,6 @@ abstract class CategoryVersion implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -288,6 +286,7 @@ abstract class CategoryVersion implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -298,7 +297,10 @@ abstract class CategoryVersion implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -355,7 +357,9 @@ abstract class CategoryVersion implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -450,7 +454,7 @@ abstract class CategoryVersion implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -470,7 +474,7 @@ abstract class CategoryVersion implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -501,7 +505,7 @@ abstract class CategoryVersion implements ActiveRecordInterface if ($format === null) { return $this->version_created_at; } else { - return $this->version_created_at !== null ? $this->version_created_at->format($format) : null; + return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null; } } @@ -1201,8 +1205,7 @@ abstract class CategoryVersion implements ActiveRecordInterface $keys[8] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Config.php b/core/lib/Thelia/Model/Base/Config.php index 9f2080d1f..72837ec39 100644 --- a/core/lib/Thelia/Model/Base/Config.php +++ b/core/lib/Thelia/Model/Base/Config.php @@ -191,7 +191,7 @@ abstract class Config implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -249,8 +249,8 @@ abstract class Config implements ActiveRecordInterface * obj is an instance of Config, delegates to * equals(Config). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -289,8 +289,6 @@ abstract class Config implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -301,6 +299,7 @@ abstract class Config implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -311,7 +310,10 @@ abstract class Config implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -368,7 +370,9 @@ abstract class Config implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -474,7 +478,7 @@ abstract class Config implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -494,7 +498,7 @@ abstract class Config implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1137,8 +1141,7 @@ abstract class Config implements ActiveRecordInterface $keys[6] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ConfigI18n.php b/core/lib/Thelia/Model/Base/ConfigI18n.php index 71f1d5287..370860b61 100644 --- a/core/lib/Thelia/Model/Base/ConfigI18n.php +++ b/core/lib/Thelia/Model/Base/ConfigI18n.php @@ -158,7 +158,7 @@ abstract class ConfigI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class ConfigI18n implements ActiveRecordInterface * obj is an instance of ConfigI18n, delegates to * equals(ConfigI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class ConfigI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class ConfigI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class ConfigI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class ConfigI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class ConfigI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Content.php b/core/lib/Thelia/Model/Base/Content.php index aa53fb9b5..bb7299f17 100644 --- a/core/lib/Thelia/Model/Base/Content.php +++ b/core/lib/Thelia/Model/Base/Content.php @@ -301,7 +301,7 @@ abstract class Content implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -359,8 +359,8 @@ abstract class Content implements ActiveRecordInterface * obj is an instance of Content, delegates to * equals(Content). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -399,8 +399,6 @@ abstract class Content implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -411,6 +409,7 @@ abstract class Content implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -421,7 +420,10 @@ abstract class Content implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -478,7 +480,9 @@ abstract class Content implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -562,7 +566,7 @@ abstract class Content implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -582,7 +586,7 @@ abstract class Content implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -613,7 +617,7 @@ abstract class Content implements ActiveRecordInterface if ($format === null) { return $this->version_created_at; } else { - return $this->version_created_at !== null ? $this->version_created_at->format($format) : null; + return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null; } } @@ -1454,8 +1458,7 @@ abstract class Content implements ActiveRecordInterface $keys[7] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ContentDocument.php b/core/lib/Thelia/Model/Base/ContentDocument.php index a8207bb14..f59b52af0 100644 --- a/core/lib/Thelia/Model/Base/ContentDocument.php +++ b/core/lib/Thelia/Model/Base/ContentDocument.php @@ -176,7 +176,7 @@ abstract class ContentDocument implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -234,8 +234,8 @@ abstract class ContentDocument implements ActiveRecordInterface * obj is an instance of ContentDocument, delegates to * equals(ContentDocument). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -274,8 +274,6 @@ abstract class ContentDocument implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -286,6 +284,7 @@ abstract class ContentDocument implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -296,7 +295,10 @@ abstract class ContentDocument implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -353,7 +355,9 @@ abstract class ContentDocument implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -448,7 +452,7 @@ abstract class ContentDocument implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -468,7 +472,7 @@ abstract class ContentDocument implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1089,8 +1093,7 @@ abstract class ContentDocument implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ContentDocumentI18n.php b/core/lib/Thelia/Model/Base/ContentDocumentI18n.php index 1e1f1bd52..e51c76524 100644 --- a/core/lib/Thelia/Model/Base/ContentDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/ContentDocumentI18n.php @@ -158,7 +158,7 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface * obj is an instance of ContentDocumentI18n, delegates to * equals(ContentDocumentI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ContentFolder.php b/core/lib/Thelia/Model/Base/ContentFolder.php index 809825d51..8200b942c 100644 --- a/core/lib/Thelia/Model/Base/ContentFolder.php +++ b/core/lib/Thelia/Model/Base/ContentFolder.php @@ -148,7 +148,7 @@ abstract class ContentFolder implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -206,8 +206,8 @@ abstract class ContentFolder implements ActiveRecordInterface * obj is an instance of ContentFolder, delegates to * equals(ContentFolder). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -246,8 +246,6 @@ abstract class ContentFolder implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -258,6 +256,7 @@ abstract class ContentFolder implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -268,7 +267,10 @@ abstract class ContentFolder implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -325,7 +327,9 @@ abstract class ContentFolder implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -409,7 +413,7 @@ abstract class ContentFolder implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -429,7 +433,7 @@ abstract class ContentFolder implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1009,8 +1013,7 @@ abstract class ContentFolder implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ContentI18n.php b/core/lib/Thelia/Model/Base/ContentI18n.php index 6ffc1d4bf..e5de214c8 100644 --- a/core/lib/Thelia/Model/Base/ContentI18n.php +++ b/core/lib/Thelia/Model/Base/ContentI18n.php @@ -158,7 +158,7 @@ abstract class ContentI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class ContentI18n implements ActiveRecordInterface * obj is an instance of ContentI18n, delegates to * equals(ContentI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class ContentI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class ContentI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class ContentI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class ContentI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class ContentI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ContentImage.php b/core/lib/Thelia/Model/Base/ContentImage.php index 8a0a5a77c..17fa9d1f8 100644 --- a/core/lib/Thelia/Model/Base/ContentImage.php +++ b/core/lib/Thelia/Model/Base/ContentImage.php @@ -176,7 +176,7 @@ abstract class ContentImage implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -234,8 +234,8 @@ abstract class ContentImage implements ActiveRecordInterface * obj is an instance of ContentImage, delegates to * equals(ContentImage). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -274,8 +274,6 @@ abstract class ContentImage implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -286,6 +284,7 @@ abstract class ContentImage implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -296,7 +295,10 @@ abstract class ContentImage implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -353,7 +355,9 @@ abstract class ContentImage implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -448,7 +452,7 @@ abstract class ContentImage implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -468,7 +472,7 @@ abstract class ContentImage implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1089,8 +1093,7 @@ abstract class ContentImage implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ContentImageI18n.php b/core/lib/Thelia/Model/Base/ContentImageI18n.php index 54016f0df..dcee14315 100644 --- a/core/lib/Thelia/Model/Base/ContentImageI18n.php +++ b/core/lib/Thelia/Model/Base/ContentImageI18n.php @@ -158,7 +158,7 @@ abstract class ContentImageI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class ContentImageI18n implements ActiveRecordInterface * obj is an instance of ContentImageI18n, delegates to * equals(ContentImageI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class ContentImageI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class ContentImageI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class ContentImageI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class ContentImageI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class ContentImageI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ContentVersion.php b/core/lib/Thelia/Model/Base/ContentVersion.php index ef2897030..beb02456e 100644 --- a/core/lib/Thelia/Model/Base/ContentVersion.php +++ b/core/lib/Thelia/Model/Base/ContentVersion.php @@ -172,7 +172,7 @@ abstract class ContentVersion implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -230,8 +230,8 @@ abstract class ContentVersion implements ActiveRecordInterface * obj is an instance of ContentVersion, delegates to * equals(ContentVersion). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -270,8 +270,6 @@ abstract class ContentVersion implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -282,6 +280,7 @@ abstract class ContentVersion implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -292,7 +291,10 @@ abstract class ContentVersion implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -349,7 +351,9 @@ abstract class ContentVersion implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -433,7 +437,7 @@ abstract class ContentVersion implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -453,7 +457,7 @@ abstract class ContentVersion implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -484,7 +488,7 @@ abstract class ContentVersion implements ActiveRecordInterface if ($format === null) { return $this->version_created_at; } else { - return $this->version_created_at !== null ? $this->version_created_at->format($format) : null; + return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null; } } @@ -1150,8 +1154,7 @@ abstract class ContentVersion implements ActiveRecordInterface $keys[7] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Country.php b/core/lib/Thelia/Model/Base/Country.php index 86cc8220b..eb8312369 100644 --- a/core/lib/Thelia/Model/Base/Country.php +++ b/core/lib/Thelia/Model/Base/Country.php @@ -216,7 +216,7 @@ abstract class Country implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -274,8 +274,8 @@ abstract class Country implements ActiveRecordInterface * obj is an instance of Country, delegates to * equals(Country). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -314,8 +314,6 @@ abstract class Country implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -326,6 +324,7 @@ abstract class Country implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -336,7 +335,10 @@ abstract class Country implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -393,7 +395,9 @@ abstract class Country implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -510,7 +514,7 @@ abstract class Country implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -530,7 +534,7 @@ abstract class Country implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1067,6 +1071,10 @@ abstract class Country implements ActiveRecordInterface $modifiedColumns = array(); $index = 0; + $this->modifiedColumns[] = CountryTableMap::ID; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . CountryTableMap::ID . ')'); + } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(CountryTableMap::ID)) { @@ -1136,6 +1144,13 @@ abstract class Country implements ActiveRecordInterface throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); } + try { + $pk = $con->lastInsertId(); + } catch (Exception $e) { + throw new PropelException('Unable to get autoincrement id.', 0, $e); + } + $this->setId($pk); + $this->setNew(false); } @@ -1246,8 +1261,7 @@ abstract class Country implements ActiveRecordInterface $keys[7] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } @@ -1436,7 +1450,6 @@ abstract class Country implements ActiveRecordInterface */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setId($this->getId()); $copyObj->setAreaId($this->getAreaId()); $copyObj->setIsocode($this->getIsocode()); $copyObj->setIsoalpha2($this->getIsoalpha2()); @@ -1472,6 +1485,7 @@ abstract class Country implements ActiveRecordInterface if ($makeNew) { $copyObj->setNew(true); + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } diff --git a/core/lib/Thelia/Model/Base/CountryI18n.php b/core/lib/Thelia/Model/Base/CountryI18n.php index 3e3e314cb..2c660e200 100644 --- a/core/lib/Thelia/Model/Base/CountryI18n.php +++ b/core/lib/Thelia/Model/Base/CountryI18n.php @@ -158,7 +158,7 @@ abstract class CountryI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class CountryI18n implements ActiveRecordInterface * obj is an instance of CountryI18n, delegates to * equals(CountryI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class CountryI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class CountryI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class CountryI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class CountryI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class CountryI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Coupon.php b/core/lib/Thelia/Model/Base/Coupon.php index 81bc23d07..012b97313 100644 --- a/core/lib/Thelia/Model/Base/Coupon.php +++ b/core/lib/Thelia/Model/Base/Coupon.php @@ -260,7 +260,7 @@ abstract class Coupon implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -318,8 +318,8 @@ abstract class Coupon implements ActiveRecordInterface * obj is an instance of Coupon, delegates to * equals(Coupon). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -358,8 +358,6 @@ abstract class Coupon implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -370,6 +368,7 @@ abstract class Coupon implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -380,7 +379,10 @@ abstract class Coupon implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -437,7 +439,9 @@ abstract class Coupon implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -543,7 +547,7 @@ abstract class Coupon implements ActiveRecordInterface if ($format === null) { return $this->expiration_date; } else { - return $this->expiration_date !== null ? $this->expiration_date->format($format) : null; + return $this->expiration_date instanceof \DateTime ? $this->expiration_date->format($format) : null; } } @@ -629,7 +633,7 @@ abstract class Coupon implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -649,7 +653,7 @@ abstract class Coupon implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1642,8 +1646,7 @@ abstract class Coupon implements ActiveRecordInterface $keys[14] => $this->getVersion(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CouponI18n.php b/core/lib/Thelia/Model/Base/CouponI18n.php index 0ea9027b6..7bb7d8314 100644 --- a/core/lib/Thelia/Model/Base/CouponI18n.php +++ b/core/lib/Thelia/Model/Base/CouponI18n.php @@ -152,7 +152,7 @@ abstract class CouponI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -210,8 +210,8 @@ abstract class CouponI18n implements ActiveRecordInterface * obj is an instance of CouponI18n, delegates to * equals(CouponI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -250,8 +250,6 @@ abstract class CouponI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -262,6 +260,7 @@ abstract class CouponI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -272,7 +271,10 @@ abstract class CouponI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -329,7 +331,9 @@ abstract class CouponI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -959,8 +963,7 @@ abstract class CouponI18n implements ActiveRecordInterface $keys[4] => $this->getDescription(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CouponOrder.php b/core/lib/Thelia/Model/Base/CouponOrder.php index b2685ea74..4488e8ec6 100644 --- a/core/lib/Thelia/Model/Base/CouponOrder.php +++ b/core/lib/Thelia/Model/Base/CouponOrder.php @@ -141,7 +141,7 @@ abstract class CouponOrder implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -199,8 +199,8 @@ abstract class CouponOrder implements ActiveRecordInterface * obj is an instance of CouponOrder, delegates to * equals(CouponOrder). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -239,8 +239,6 @@ abstract class CouponOrder implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -251,6 +249,7 @@ abstract class CouponOrder implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -261,7 +260,10 @@ abstract class CouponOrder implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -318,7 +320,9 @@ abstract class CouponOrder implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -402,7 +406,7 @@ abstract class CouponOrder implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -422,7 +426,7 @@ abstract class CouponOrder implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -990,8 +994,7 @@ abstract class CouponOrder implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CouponVersion.php b/core/lib/Thelia/Model/Base/CouponVersion.php index 83e5bf6dc..67c077cfa 100644 --- a/core/lib/Thelia/Model/Base/CouponVersion.php +++ b/core/lib/Thelia/Model/Base/CouponVersion.php @@ -214,7 +214,7 @@ abstract class CouponVersion implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -272,8 +272,8 @@ abstract class CouponVersion implements ActiveRecordInterface * obj is an instance of CouponVersion, delegates to * equals(CouponVersion). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -312,8 +312,6 @@ abstract class CouponVersion implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -324,6 +322,7 @@ abstract class CouponVersion implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -334,7 +333,10 @@ abstract class CouponVersion implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -391,7 +393,9 @@ abstract class CouponVersion implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -497,7 +501,7 @@ abstract class CouponVersion implements ActiveRecordInterface if ($format === null) { return $this->expiration_date; } else { - return $this->expiration_date !== null ? $this->expiration_date->format($format) : null; + return $this->expiration_date instanceof \DateTime ? $this->expiration_date->format($format) : null; } } @@ -583,7 +587,7 @@ abstract class CouponVersion implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -603,7 +607,7 @@ abstract class CouponVersion implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1547,8 +1551,7 @@ abstract class CouponVersion implements ActiveRecordInterface $keys[14] => $this->getVersion(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Currency.php b/core/lib/Thelia/Model/Base/Currency.php index e46176739..fea63f546 100644 --- a/core/lib/Thelia/Model/Base/Currency.php +++ b/core/lib/Thelia/Model/Base/Currency.php @@ -223,7 +223,7 @@ abstract class Currency implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -281,8 +281,8 @@ abstract class Currency implements ActiveRecordInterface * obj is an instance of Currency, delegates to * equals(Currency). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -321,8 +321,6 @@ abstract class Currency implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -333,6 +331,7 @@ abstract class Currency implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -343,7 +342,10 @@ abstract class Currency implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -400,7 +402,9 @@ abstract class Currency implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -517,7 +521,7 @@ abstract class Currency implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -537,7 +541,7 @@ abstract class Currency implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1264,8 +1268,7 @@ abstract class Currency implements ActiveRecordInterface $keys[7] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CurrencyI18n.php b/core/lib/Thelia/Model/Base/CurrencyI18n.php index df5ff7240..c3e6af289 100644 --- a/core/lib/Thelia/Model/Base/CurrencyI18n.php +++ b/core/lib/Thelia/Model/Base/CurrencyI18n.php @@ -140,7 +140,7 @@ abstract class CurrencyI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -198,8 +198,8 @@ abstract class CurrencyI18n implements ActiveRecordInterface * obj is an instance of CurrencyI18n, delegates to * equals(CurrencyI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -238,8 +238,6 @@ abstract class CurrencyI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -250,6 +248,7 @@ abstract class CurrencyI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -260,7 +259,10 @@ abstract class CurrencyI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -317,7 +319,9 @@ abstract class CurrencyI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -857,8 +861,7 @@ abstract class CurrencyI18n implements ActiveRecordInterface $keys[2] => $this->getName(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Customer.php b/core/lib/Thelia/Model/Base/Customer.php index e7bd688af..8ec119627 100644 --- a/core/lib/Thelia/Model/Base/Customer.php +++ b/core/lib/Thelia/Model/Base/Customer.php @@ -250,7 +250,7 @@ abstract class Customer implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -308,8 +308,8 @@ abstract class Customer implements ActiveRecordInterface * obj is an instance of Customer, delegates to * equals(Customer). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -348,8 +348,6 @@ abstract class Customer implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -360,6 +358,7 @@ abstract class Customer implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -370,7 +369,10 @@ abstract class Customer implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -427,7 +429,9 @@ abstract class Customer implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -632,7 +636,7 @@ abstract class Customer implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -652,7 +656,7 @@ abstract class Customer implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1652,8 +1656,7 @@ abstract class Customer implements ActiveRecordInterface $keys[15] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CustomerTitle.php b/core/lib/Thelia/Model/Base/CustomerTitle.php index 6b1295d2b..978b779b1 100644 --- a/core/lib/Thelia/Model/Base/CustomerTitle.php +++ b/core/lib/Thelia/Model/Base/CustomerTitle.php @@ -205,7 +205,7 @@ abstract class CustomerTitle implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -263,8 +263,8 @@ abstract class CustomerTitle implements ActiveRecordInterface * obj is an instance of CustomerTitle, delegates to * equals(CustomerTitle). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -303,8 +303,6 @@ abstract class CustomerTitle implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -315,6 +313,7 @@ abstract class CustomerTitle implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -325,7 +324,10 @@ abstract class CustomerTitle implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -382,7 +384,9 @@ abstract class CustomerTitle implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -466,7 +470,7 @@ abstract class CustomerTitle implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -486,7 +490,7 @@ abstract class CustomerTitle implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1095,8 +1099,7 @@ abstract class CustomerTitle implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/CustomerTitleI18n.php b/core/lib/Thelia/Model/Base/CustomerTitleI18n.php index b384210b1..5c173543b 100644 --- a/core/lib/Thelia/Model/Base/CustomerTitleI18n.php +++ b/core/lib/Thelia/Model/Base/CustomerTitleI18n.php @@ -146,7 +146,7 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -204,8 +204,8 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface * obj is an instance of CustomerTitleI18n, delegates to * equals(CustomerTitleI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -244,8 +244,6 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -256,6 +254,7 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -266,7 +265,10 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -323,7 +325,9 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -908,8 +912,7 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface $keys[3] => $this->getLong(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Feature.php b/core/lib/Thelia/Model/Base/Feature.php index c9b6c5ed4..7d3a0e7f3 100644 --- a/core/lib/Thelia/Model/Base/Feature.php +++ b/core/lib/Thelia/Model/Base/Feature.php @@ -232,7 +232,7 @@ abstract class Feature implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -290,8 +290,8 @@ abstract class Feature implements ActiveRecordInterface * obj is an instance of Feature, delegates to * equals(Feature). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -330,8 +330,6 @@ abstract class Feature implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -342,6 +340,7 @@ abstract class Feature implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -352,7 +351,10 @@ abstract class Feature implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -409,7 +411,9 @@ abstract class Feature implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -493,7 +497,7 @@ abstract class Feature implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -513,7 +517,7 @@ abstract class Feature implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1169,8 +1173,7 @@ abstract class Feature implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FeatureAv.php b/core/lib/Thelia/Model/Base/FeatureAv.php index bf1bfc41e..7f5191418 100644 --- a/core/lib/Thelia/Model/Base/FeatureAv.php +++ b/core/lib/Thelia/Model/Base/FeatureAv.php @@ -184,7 +184,7 @@ abstract class FeatureAv implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -242,8 +242,8 @@ abstract class FeatureAv implements ActiveRecordInterface * obj is an instance of FeatureAv, delegates to * equals(FeatureAv). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -282,8 +282,6 @@ abstract class FeatureAv implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -294,6 +292,7 @@ abstract class FeatureAv implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -304,7 +303,10 @@ abstract class FeatureAv implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -361,7 +363,9 @@ abstract class FeatureAv implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -445,7 +449,7 @@ abstract class FeatureAv implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -465,7 +469,7 @@ abstract class FeatureAv implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1071,8 +1075,7 @@ abstract class FeatureAv implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FeatureAvI18n.php b/core/lib/Thelia/Model/Base/FeatureAvI18n.php index 44e7893a2..e88356a16 100644 --- a/core/lib/Thelia/Model/Base/FeatureAvI18n.php +++ b/core/lib/Thelia/Model/Base/FeatureAvI18n.php @@ -158,7 +158,7 @@ abstract class FeatureAvI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class FeatureAvI18n implements ActiveRecordInterface * obj is an instance of FeatureAvI18n, delegates to * equals(FeatureAvI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class FeatureAvI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class FeatureAvI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class FeatureAvI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class FeatureAvI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class FeatureAvI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FeatureI18n.php b/core/lib/Thelia/Model/Base/FeatureI18n.php index 57c7a0b30..ed475e87f 100644 --- a/core/lib/Thelia/Model/Base/FeatureI18n.php +++ b/core/lib/Thelia/Model/Base/FeatureI18n.php @@ -158,7 +158,7 @@ abstract class FeatureI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class FeatureI18n implements ActiveRecordInterface * obj is an instance of FeatureI18n, delegates to * equals(FeatureI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class FeatureI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class FeatureI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class FeatureI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class FeatureI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class FeatureI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FeatureProduct.php b/core/lib/Thelia/Model/Base/FeatureProduct.php index 039967cee..f8ddbd9b7 100644 --- a/core/lib/Thelia/Model/Base/FeatureProduct.php +++ b/core/lib/Thelia/Model/Base/FeatureProduct.php @@ -173,7 +173,7 @@ abstract class FeatureProduct implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -231,8 +231,8 @@ abstract class FeatureProduct implements ActiveRecordInterface * obj is an instance of FeatureProduct, delegates to * equals(FeatureProduct). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -271,8 +271,6 @@ abstract class FeatureProduct implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -283,6 +281,7 @@ abstract class FeatureProduct implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -293,7 +292,10 @@ abstract class FeatureProduct implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -350,7 +352,9 @@ abstract class FeatureProduct implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -467,7 +471,7 @@ abstract class FeatureProduct implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -487,7 +491,7 @@ abstract class FeatureProduct implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1187,8 +1191,7 @@ abstract class FeatureProduct implements ActiveRecordInterface $keys[7] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FeatureTemplate.php b/core/lib/Thelia/Model/Base/FeatureTemplate.php index b8ba55629..bc7b4f921 100644 --- a/core/lib/Thelia/Model/Base/FeatureTemplate.php +++ b/core/lib/Thelia/Model/Base/FeatureTemplate.php @@ -154,7 +154,7 @@ abstract class FeatureTemplate implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -212,8 +212,8 @@ abstract class FeatureTemplate implements ActiveRecordInterface * obj is an instance of FeatureTemplate, delegates to * equals(FeatureTemplate). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -252,8 +252,6 @@ abstract class FeatureTemplate implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -264,6 +262,7 @@ abstract class FeatureTemplate implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -274,7 +273,10 @@ abstract class FeatureTemplate implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -331,7 +333,9 @@ abstract class FeatureTemplate implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -426,7 +430,7 @@ abstract class FeatureTemplate implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -446,7 +450,7 @@ abstract class FeatureTemplate implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1063,8 +1067,7 @@ abstract class FeatureTemplate implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Folder.php b/core/lib/Thelia/Model/Base/Folder.php index 4457c5042..e62e9b71e 100644 --- a/core/lib/Thelia/Model/Base/Folder.php +++ b/core/lib/Thelia/Model/Base/Folder.php @@ -279,7 +279,7 @@ abstract class Folder implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -337,8 +337,8 @@ abstract class Folder implements ActiveRecordInterface * obj is an instance of Folder, delegates to * equals(Folder). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -377,8 +377,6 @@ abstract class Folder implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -389,6 +387,7 @@ abstract class Folder implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -399,7 +398,10 @@ abstract class Folder implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -456,7 +458,9 @@ abstract class Folder implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -551,7 +555,7 @@ abstract class Folder implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -571,7 +575,7 @@ abstract class Folder implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -602,7 +606,7 @@ abstract class Folder implements ActiveRecordInterface if ($format === null) { return $this->version_created_at; } else { - return $this->version_created_at !== null ? $this->version_created_at->format($format) : null; + return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null; } } @@ -1439,8 +1443,7 @@ abstract class Folder implements ActiveRecordInterface $keys[8] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FolderDocument.php b/core/lib/Thelia/Model/Base/FolderDocument.php index 8e24ee9d4..ea1a35d74 100644 --- a/core/lib/Thelia/Model/Base/FolderDocument.php +++ b/core/lib/Thelia/Model/Base/FolderDocument.php @@ -176,7 +176,7 @@ abstract class FolderDocument implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -234,8 +234,8 @@ abstract class FolderDocument implements ActiveRecordInterface * obj is an instance of FolderDocument, delegates to * equals(FolderDocument). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -274,8 +274,6 @@ abstract class FolderDocument implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -286,6 +284,7 @@ abstract class FolderDocument implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -296,7 +295,10 @@ abstract class FolderDocument implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -353,7 +355,9 @@ abstract class FolderDocument implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -448,7 +452,7 @@ abstract class FolderDocument implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -468,7 +472,7 @@ abstract class FolderDocument implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1089,8 +1093,7 @@ abstract class FolderDocument implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FolderDocumentI18n.php b/core/lib/Thelia/Model/Base/FolderDocumentI18n.php index b68c8ce9d..600890a03 100644 --- a/core/lib/Thelia/Model/Base/FolderDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/FolderDocumentI18n.php @@ -158,7 +158,7 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface * obj is an instance of FolderDocumentI18n, delegates to * equals(FolderDocumentI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FolderI18n.php b/core/lib/Thelia/Model/Base/FolderI18n.php index 976c6b041..8e972b307 100644 --- a/core/lib/Thelia/Model/Base/FolderI18n.php +++ b/core/lib/Thelia/Model/Base/FolderI18n.php @@ -158,7 +158,7 @@ abstract class FolderI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class FolderI18n implements ActiveRecordInterface * obj is an instance of FolderI18n, delegates to * equals(FolderI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class FolderI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class FolderI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class FolderI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class FolderI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class FolderI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FolderImage.php b/core/lib/Thelia/Model/Base/FolderImage.php index 525dc9d48..2440c7232 100644 --- a/core/lib/Thelia/Model/Base/FolderImage.php +++ b/core/lib/Thelia/Model/Base/FolderImage.php @@ -176,7 +176,7 @@ abstract class FolderImage implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -234,8 +234,8 @@ abstract class FolderImage implements ActiveRecordInterface * obj is an instance of FolderImage, delegates to * equals(FolderImage). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -274,8 +274,6 @@ abstract class FolderImage implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -286,6 +284,7 @@ abstract class FolderImage implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -296,7 +295,10 @@ abstract class FolderImage implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -353,7 +355,9 @@ abstract class FolderImage implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -448,7 +452,7 @@ abstract class FolderImage implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -468,7 +472,7 @@ abstract class FolderImage implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1089,8 +1093,7 @@ abstract class FolderImage implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FolderImageI18n.php b/core/lib/Thelia/Model/Base/FolderImageI18n.php index 6ac9575e1..e080b4b5c 100644 --- a/core/lib/Thelia/Model/Base/FolderImageI18n.php +++ b/core/lib/Thelia/Model/Base/FolderImageI18n.php @@ -158,7 +158,7 @@ abstract class FolderImageI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class FolderImageI18n implements ActiveRecordInterface * obj is an instance of FolderImageI18n, delegates to * equals(FolderImageI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class FolderImageI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class FolderImageI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class FolderImageI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class FolderImageI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class FolderImageI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/FolderVersion.php b/core/lib/Thelia/Model/Base/FolderVersion.php index ec588dcbd..657bdeb44 100644 --- a/core/lib/Thelia/Model/Base/FolderVersion.php +++ b/core/lib/Thelia/Model/Base/FolderVersion.php @@ -178,7 +178,7 @@ abstract class FolderVersion implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -236,8 +236,8 @@ abstract class FolderVersion implements ActiveRecordInterface * obj is an instance of FolderVersion, delegates to * equals(FolderVersion). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -276,8 +276,6 @@ abstract class FolderVersion implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -288,6 +286,7 @@ abstract class FolderVersion implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -298,7 +297,10 @@ abstract class FolderVersion implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -355,7 +357,9 @@ abstract class FolderVersion implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -450,7 +454,7 @@ abstract class FolderVersion implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -470,7 +474,7 @@ abstract class FolderVersion implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -501,7 +505,7 @@ abstract class FolderVersion implements ActiveRecordInterface if ($format === null) { return $this->version_created_at; } else { - return $this->version_created_at !== null ? $this->version_created_at->format($format) : null; + return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null; } } @@ -1201,8 +1205,7 @@ abstract class FolderVersion implements ActiveRecordInterface $keys[8] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Group.php b/core/lib/Thelia/Model/Base/Group.php index 19d41e38c..751111952 100644 --- a/core/lib/Thelia/Model/Base/Group.php +++ b/core/lib/Thelia/Model/Base/Group.php @@ -225,7 +225,7 @@ abstract class Group implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -283,8 +283,8 @@ abstract class Group implements ActiveRecordInterface * obj is an instance of Group, delegates to * equals(Group). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -323,8 +323,6 @@ abstract class Group implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -335,6 +333,7 @@ abstract class Group implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -345,7 +344,10 @@ abstract class Group implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -402,7 +404,9 @@ abstract class Group implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -475,7 +479,7 @@ abstract class Group implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -495,7 +499,7 @@ abstract class Group implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1141,8 +1145,7 @@ abstract class Group implements ActiveRecordInterface $keys[3] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/GroupI18n.php b/core/lib/Thelia/Model/Base/GroupI18n.php index df8f3f81a..07274e969 100644 --- a/core/lib/Thelia/Model/Base/GroupI18n.php +++ b/core/lib/Thelia/Model/Base/GroupI18n.php @@ -158,7 +158,7 @@ abstract class GroupI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class GroupI18n implements ActiveRecordInterface * obj is an instance of GroupI18n, delegates to * equals(GroupI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class GroupI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class GroupI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class GroupI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class GroupI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class GroupI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/GroupModule.php b/core/lib/Thelia/Model/Base/GroupModule.php index 82d6056f2..e3f9d9e15 100644 --- a/core/lib/Thelia/Model/Base/GroupModule.php +++ b/core/lib/Thelia/Model/Base/GroupModule.php @@ -168,7 +168,7 @@ abstract class GroupModule implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -226,8 +226,8 @@ abstract class GroupModule implements ActiveRecordInterface * obj is an instance of GroupModule, delegates to * equals(GroupModule). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -266,8 +266,6 @@ abstract class GroupModule implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -278,6 +276,7 @@ abstract class GroupModule implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -288,7 +287,10 @@ abstract class GroupModule implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -345,7 +347,9 @@ abstract class GroupModule implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -440,7 +444,7 @@ abstract class GroupModule implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -460,7 +464,7 @@ abstract class GroupModule implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1081,8 +1085,7 @@ abstract class GroupModule implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/GroupResource.php b/core/lib/Thelia/Model/Base/GroupResource.php index ea6c0ff47..8bfcd442f 100644 --- a/core/lib/Thelia/Model/Base/GroupResource.php +++ b/core/lib/Thelia/Model/Base/GroupResource.php @@ -176,7 +176,7 @@ abstract class GroupResource implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -234,8 +234,8 @@ abstract class GroupResource implements ActiveRecordInterface * obj is an instance of GroupResource, delegates to * equals(GroupResource). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -274,8 +274,6 @@ abstract class GroupResource implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -286,6 +284,7 @@ abstract class GroupResource implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -296,7 +295,10 @@ abstract class GroupResource implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -353,7 +355,9 @@ abstract class GroupResource implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -459,7 +463,7 @@ abstract class GroupResource implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -479,7 +483,7 @@ abstract class GroupResource implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1138,8 +1142,7 @@ abstract class GroupResource implements ActiveRecordInterface $keys[6] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Lang.php b/core/lib/Thelia/Model/Base/Lang.php index 59836e27d..ac6f1f63c 100644 --- a/core/lib/Thelia/Model/Base/Lang.php +++ b/core/lib/Thelia/Model/Base/Lang.php @@ -209,7 +209,7 @@ abstract class Lang implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -267,8 +267,8 @@ abstract class Lang implements ActiveRecordInterface * obj is an instance of Lang, delegates to * equals(Lang). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -307,8 +307,6 @@ abstract class Lang implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -319,6 +317,7 @@ abstract class Lang implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -329,7 +328,10 @@ abstract class Lang implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -386,7 +388,9 @@ abstract class Lang implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -580,7 +584,7 @@ abstract class Lang implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -600,7 +604,7 @@ abstract class Lang implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1507,8 +1511,7 @@ abstract class Lang implements ActiveRecordInterface $keys[14] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Message.php b/core/lib/Thelia/Model/Base/Message.php index 4ee6b4cab..fbea5b241 100644 --- a/core/lib/Thelia/Model/Base/Message.php +++ b/core/lib/Thelia/Model/Base/Message.php @@ -218,7 +218,7 @@ abstract class Message implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -276,8 +276,8 @@ abstract class Message implements ActiveRecordInterface * obj is an instance of Message, delegates to * equals(Message). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -316,8 +316,6 @@ abstract class Message implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -328,6 +326,7 @@ abstract class Message implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -338,7 +337,10 @@ abstract class Message implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -395,7 +397,9 @@ abstract class Message implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -479,7 +483,7 @@ abstract class Message implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -499,7 +503,7 @@ abstract class Message implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -530,7 +534,7 @@ abstract class Message implements ActiveRecordInterface if ($format === null) { return $this->version_created_at; } else { - return $this->version_created_at !== null ? $this->version_created_at->format($format) : null; + return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null; } } @@ -1248,8 +1252,7 @@ abstract class Message implements ActiveRecordInterface $keys[7] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/MessageI18n.php b/core/lib/Thelia/Model/Base/MessageI18n.php index d37682f97..42923cb69 100644 --- a/core/lib/Thelia/Model/Base/MessageI18n.php +++ b/core/lib/Thelia/Model/Base/MessageI18n.php @@ -158,7 +158,7 @@ abstract class MessageI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class MessageI18n implements ActiveRecordInterface * obj is an instance of MessageI18n, delegates to * equals(MessageI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class MessageI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class MessageI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class MessageI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class MessageI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class MessageI18n implements ActiveRecordInterface $keys[5] => $this->getHtmlMessage(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/MessageVersion.php b/core/lib/Thelia/Model/Base/MessageVersion.php index 60e12da8d..0c58a5bb2 100644 --- a/core/lib/Thelia/Model/Base/MessageVersion.php +++ b/core/lib/Thelia/Model/Base/MessageVersion.php @@ -172,7 +172,7 @@ abstract class MessageVersion implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -230,8 +230,8 @@ abstract class MessageVersion implements ActiveRecordInterface * obj is an instance of MessageVersion, delegates to * equals(MessageVersion). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -270,8 +270,6 @@ abstract class MessageVersion implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -282,6 +280,7 @@ abstract class MessageVersion implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -292,7 +291,10 @@ abstract class MessageVersion implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -349,7 +351,9 @@ abstract class MessageVersion implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -433,7 +437,7 @@ abstract class MessageVersion implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -453,7 +457,7 @@ abstract class MessageVersion implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -484,7 +488,7 @@ abstract class MessageVersion implements ActiveRecordInterface if ($format === null) { return $this->version_created_at; } else { - return $this->version_created_at !== null ? $this->version_created_at->format($format) : null; + return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null; } } @@ -1150,8 +1154,7 @@ abstract class MessageVersion implements ActiveRecordInterface $keys[7] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Module.php b/core/lib/Thelia/Model/Base/Module.php index 88080dbe2..09858a877 100644 --- a/core/lib/Thelia/Model/Base/Module.php +++ b/core/lib/Thelia/Model/Base/Module.php @@ -249,7 +249,7 @@ abstract class Module implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -307,8 +307,8 @@ abstract class Module implements ActiveRecordInterface * obj is an instance of Module, delegates to * equals(Module). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -347,8 +347,6 @@ abstract class Module implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -359,6 +357,7 @@ abstract class Module implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -369,7 +368,10 @@ abstract class Module implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -426,7 +428,9 @@ abstract class Module implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -543,7 +547,7 @@ abstract class Module implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -563,7 +567,7 @@ abstract class Module implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1327,8 +1331,7 @@ abstract class Module implements ActiveRecordInterface $keys[7] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ModuleI18n.php b/core/lib/Thelia/Model/Base/ModuleI18n.php index 9c7d603d1..359fb530e 100644 --- a/core/lib/Thelia/Model/Base/ModuleI18n.php +++ b/core/lib/Thelia/Model/Base/ModuleI18n.php @@ -158,7 +158,7 @@ abstract class ModuleI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class ModuleI18n implements ActiveRecordInterface * obj is an instance of ModuleI18n, delegates to * equals(ModuleI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class ModuleI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class ModuleI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class ModuleI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class ModuleI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class ModuleI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ModuleImage.php b/core/lib/Thelia/Model/Base/ModuleImage.php index f488e289c..4185d26c9 100644 --- a/core/lib/Thelia/Model/Base/ModuleImage.php +++ b/core/lib/Thelia/Model/Base/ModuleImage.php @@ -176,7 +176,7 @@ abstract class ModuleImage implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -234,8 +234,8 @@ abstract class ModuleImage implements ActiveRecordInterface * obj is an instance of ModuleImage, delegates to * equals(ModuleImage). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -274,8 +274,6 @@ abstract class ModuleImage implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -286,6 +284,7 @@ abstract class ModuleImage implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -296,7 +295,10 @@ abstract class ModuleImage implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -353,7 +355,9 @@ abstract class ModuleImage implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -448,7 +452,7 @@ abstract class ModuleImage implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -468,7 +472,7 @@ abstract class ModuleImage implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1089,8 +1093,7 @@ abstract class ModuleImage implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ModuleImageI18n.php b/core/lib/Thelia/Model/Base/ModuleImageI18n.php index 2425b4e65..92a19a601 100644 --- a/core/lib/Thelia/Model/Base/ModuleImageI18n.php +++ b/core/lib/Thelia/Model/Base/ModuleImageI18n.php @@ -158,7 +158,7 @@ abstract class ModuleImageI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class ModuleImageI18n implements ActiveRecordInterface * obj is an instance of ModuleImageI18n, delegates to * equals(ModuleImageI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class ModuleImageI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class ModuleImageI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class ModuleImageI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class ModuleImageI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class ModuleImageI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Order.php b/core/lib/Thelia/Model/Base/Order.php index a2cd3f829..befa2abfe 100644 --- a/core/lib/Thelia/Model/Base/Order.php +++ b/core/lib/Thelia/Model/Base/Order.php @@ -293,7 +293,7 @@ abstract class Order implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -351,8 +351,8 @@ abstract class Order implements ActiveRecordInterface * obj is an instance of Order, delegates to * equals(Order). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -391,8 +391,6 @@ abstract class Order implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -403,6 +401,7 @@ abstract class Order implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -413,7 +412,10 @@ abstract class Order implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -470,7 +472,9 @@ abstract class Order implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -576,7 +580,7 @@ abstract class Order implements ActiveRecordInterface if ($format === null) { return $this->invoice_date; } else { - return $this->invoice_date !== null ? $this->invoice_date->format($format) : null; + return $this->invoice_date instanceof \DateTime ? $this->invoice_date->format($format) : null; } } @@ -706,7 +710,7 @@ abstract class Order implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -726,7 +730,7 @@ abstract class Order implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1882,8 +1886,7 @@ abstract class Order implements ActiveRecordInterface $keys[17] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/OrderAddress.php b/core/lib/Thelia/Model/Base/OrderAddress.php index c5502321a..d52fd9de3 100644 --- a/core/lib/Thelia/Model/Base/OrderAddress.php +++ b/core/lib/Thelia/Model/Base/OrderAddress.php @@ -215,7 +215,7 @@ abstract class OrderAddress implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -273,8 +273,8 @@ abstract class OrderAddress implements ActiveRecordInterface * obj is an instance of OrderAddress, delegates to * equals(OrderAddress). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -313,8 +313,6 @@ abstract class OrderAddress implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -325,6 +323,7 @@ abstract class OrderAddress implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -335,7 +334,10 @@ abstract class OrderAddress implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -392,7 +394,9 @@ abstract class OrderAddress implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -575,7 +579,7 @@ abstract class OrderAddress implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -595,7 +599,7 @@ abstract class OrderAddress implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1487,8 +1491,7 @@ abstract class OrderAddress implements ActiveRecordInterface $keys[13] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/OrderProduct.php b/core/lib/Thelia/Model/Base/OrderProduct.php index 6ff03d427..69e927214 100644 --- a/core/lib/Thelia/Model/Base/OrderProduct.php +++ b/core/lib/Thelia/Model/Base/OrderProduct.php @@ -254,7 +254,7 @@ abstract class OrderProduct implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -312,8 +312,8 @@ abstract class OrderProduct implements ActiveRecordInterface * obj is an instance of OrderProduct, delegates to * equals(OrderProduct). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -352,8 +352,6 @@ abstract class OrderProduct implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -364,6 +362,7 @@ abstract class OrderProduct implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -374,7 +373,10 @@ abstract class OrderProduct implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -431,7 +433,9 @@ abstract class OrderProduct implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -669,7 +673,7 @@ abstract class OrderProduct implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -689,7 +693,7 @@ abstract class OrderProduct implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1771,8 +1775,7 @@ abstract class OrderProduct implements ActiveRecordInterface $keys[18] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/OrderProductAttributeCombination.php b/core/lib/Thelia/Model/Base/OrderProductAttributeCombination.php index 971f127b6..bcdcada7a 100644 --- a/core/lib/Thelia/Model/Base/OrderProductAttributeCombination.php +++ b/core/lib/Thelia/Model/Base/OrderProductAttributeCombination.php @@ -183,7 +183,7 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -241,8 +241,8 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface * obj is an instance of OrderProductAttributeCombination, delegates to * equals(OrderProductAttributeCombination). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -281,8 +281,6 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -293,6 +291,7 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -303,7 +302,10 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -360,7 +362,9 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -521,7 +525,7 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -541,7 +545,7 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1347,8 +1351,7 @@ abstract class OrderProductAttributeCombination implements ActiveRecordInterface $keys[11] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/OrderProductTax.php b/core/lib/Thelia/Model/Base/OrderProductTax.php index 6d0807ccf..91d3492e1 100644 --- a/core/lib/Thelia/Model/Base/OrderProductTax.php +++ b/core/lib/Thelia/Model/Base/OrderProductTax.php @@ -159,7 +159,7 @@ abstract class OrderProductTax implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -217,8 +217,8 @@ abstract class OrderProductTax implements ActiveRecordInterface * obj is an instance of OrderProductTax, delegates to * equals(OrderProductTax). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -257,8 +257,6 @@ abstract class OrderProductTax implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -269,6 +267,7 @@ abstract class OrderProductTax implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -279,7 +278,10 @@ abstract class OrderProductTax implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -336,7 +338,9 @@ abstract class OrderProductTax implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -453,7 +457,7 @@ abstract class OrderProductTax implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -473,7 +477,7 @@ abstract class OrderProductTax implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1143,8 +1147,7 @@ abstract class OrderProductTax implements ActiveRecordInterface $keys[7] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/OrderStatus.php b/core/lib/Thelia/Model/Base/OrderStatus.php index 5771072f2..4a5e49436 100644 --- a/core/lib/Thelia/Model/Base/OrderStatus.php +++ b/core/lib/Thelia/Model/Base/OrderStatus.php @@ -171,7 +171,7 @@ abstract class OrderStatus implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -229,8 +229,8 @@ abstract class OrderStatus implements ActiveRecordInterface * obj is an instance of OrderStatus, delegates to * equals(OrderStatus). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -269,8 +269,6 @@ abstract class OrderStatus implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -281,6 +279,7 @@ abstract class OrderStatus implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -291,7 +290,10 @@ abstract class OrderStatus implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -348,7 +350,9 @@ abstract class OrderStatus implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -421,7 +425,7 @@ abstract class OrderStatus implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -441,7 +445,7 @@ abstract class OrderStatus implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -993,8 +997,7 @@ abstract class OrderStatus implements ActiveRecordInterface $keys[3] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/OrderStatusI18n.php b/core/lib/Thelia/Model/Base/OrderStatusI18n.php index 2946cc55b..d9f7f3b52 100644 --- a/core/lib/Thelia/Model/Base/OrderStatusI18n.php +++ b/core/lib/Thelia/Model/Base/OrderStatusI18n.php @@ -158,7 +158,7 @@ abstract class OrderStatusI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class OrderStatusI18n implements ActiveRecordInterface * obj is an instance of OrderStatusI18n, delegates to * equals(OrderStatusI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class OrderStatusI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class OrderStatusI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class OrderStatusI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class OrderStatusI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class OrderStatusI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Product.php b/core/lib/Thelia/Model/Base/Product.php index 9ec203fec..77824575c 100644 --- a/core/lib/Thelia/Model/Base/Product.php +++ b/core/lib/Thelia/Model/Base/Product.php @@ -411,7 +411,7 @@ abstract class Product implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -469,8 +469,8 @@ abstract class Product implements ActiveRecordInterface * obj is an instance of Product, delegates to * equals(Product). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -509,8 +509,6 @@ abstract class Product implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -521,6 +519,7 @@ abstract class Product implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -531,7 +530,10 @@ abstract class Product implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -588,7 +590,9 @@ abstract class Product implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -705,7 +709,7 @@ abstract class Product implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -725,7 +729,7 @@ abstract class Product implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -756,7 +760,7 @@ abstract class Product implements ActiveRecordInterface if ($format === null) { return $this->version_created_at; } else { - return $this->version_created_at !== null ? $this->version_created_at->format($format) : null; + return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null; } } @@ -1870,8 +1874,7 @@ abstract class Product implements ActiveRecordInterface $keys[10] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ProductAssociatedContent.php b/core/lib/Thelia/Model/Base/ProductAssociatedContent.php index bbc97d5d1..764a7370c 100644 --- a/core/lib/Thelia/Model/Base/ProductAssociatedContent.php +++ b/core/lib/Thelia/Model/Base/ProductAssociatedContent.php @@ -154,7 +154,7 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -212,8 +212,8 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface * obj is an instance of ProductAssociatedContent, delegates to * equals(ProductAssociatedContent). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -252,8 +252,6 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -264,6 +262,7 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -274,7 +273,10 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -331,7 +333,9 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -426,7 +430,7 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -446,7 +450,7 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1063,8 +1067,7 @@ abstract class ProductAssociatedContent implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ProductCategory.php b/core/lib/Thelia/Model/Base/ProductCategory.php index 2c6db3184..2e00db24a 100644 --- a/core/lib/Thelia/Model/Base/ProductCategory.php +++ b/core/lib/Thelia/Model/Base/ProductCategory.php @@ -148,7 +148,7 @@ abstract class ProductCategory implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -206,8 +206,8 @@ abstract class ProductCategory implements ActiveRecordInterface * obj is an instance of ProductCategory, delegates to * equals(ProductCategory). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -246,8 +246,6 @@ abstract class ProductCategory implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -258,6 +256,7 @@ abstract class ProductCategory implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -268,7 +267,10 @@ abstract class ProductCategory implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -325,7 +327,9 @@ abstract class ProductCategory implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -409,7 +413,7 @@ abstract class ProductCategory implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -429,7 +433,7 @@ abstract class ProductCategory implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1009,8 +1013,7 @@ abstract class ProductCategory implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ProductDocument.php b/core/lib/Thelia/Model/Base/ProductDocument.php index 4223679c1..507539f45 100644 --- a/core/lib/Thelia/Model/Base/ProductDocument.php +++ b/core/lib/Thelia/Model/Base/ProductDocument.php @@ -176,7 +176,7 @@ abstract class ProductDocument implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -234,8 +234,8 @@ abstract class ProductDocument implements ActiveRecordInterface * obj is an instance of ProductDocument, delegates to * equals(ProductDocument). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -274,8 +274,6 @@ abstract class ProductDocument implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -286,6 +284,7 @@ abstract class ProductDocument implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -296,7 +295,10 @@ abstract class ProductDocument implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -353,7 +355,9 @@ abstract class ProductDocument implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -448,7 +452,7 @@ abstract class ProductDocument implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -468,7 +472,7 @@ abstract class ProductDocument implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1089,8 +1093,7 @@ abstract class ProductDocument implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ProductDocumentI18n.php b/core/lib/Thelia/Model/Base/ProductDocumentI18n.php index 1a6017966..2dff23586 100644 --- a/core/lib/Thelia/Model/Base/ProductDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/ProductDocumentI18n.php @@ -158,7 +158,7 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface * obj is an instance of ProductDocumentI18n, delegates to * equals(ProductDocumentI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ProductI18n.php b/core/lib/Thelia/Model/Base/ProductI18n.php index 3ef14e787..cdab7349d 100644 --- a/core/lib/Thelia/Model/Base/ProductI18n.php +++ b/core/lib/Thelia/Model/Base/ProductI18n.php @@ -158,7 +158,7 @@ abstract class ProductI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class ProductI18n implements ActiveRecordInterface * obj is an instance of ProductI18n, delegates to * equals(ProductI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class ProductI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class ProductI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class ProductI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class ProductI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class ProductI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ProductImage.php b/core/lib/Thelia/Model/Base/ProductImage.php index a54d22cd0..873aa0ec7 100644 --- a/core/lib/Thelia/Model/Base/ProductImage.php +++ b/core/lib/Thelia/Model/Base/ProductImage.php @@ -176,7 +176,7 @@ abstract class ProductImage implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -234,8 +234,8 @@ abstract class ProductImage implements ActiveRecordInterface * obj is an instance of ProductImage, delegates to * equals(ProductImage). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -274,8 +274,6 @@ abstract class ProductImage implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -286,6 +284,7 @@ abstract class ProductImage implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -296,7 +295,10 @@ abstract class ProductImage implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -353,7 +355,9 @@ abstract class ProductImage implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -448,7 +452,7 @@ abstract class ProductImage implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -468,7 +472,7 @@ abstract class ProductImage implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1089,8 +1093,7 @@ abstract class ProductImage implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ProductImageI18n.php b/core/lib/Thelia/Model/Base/ProductImageI18n.php index 679ded79c..76f9b38a9 100644 --- a/core/lib/Thelia/Model/Base/ProductImageI18n.php +++ b/core/lib/Thelia/Model/Base/ProductImageI18n.php @@ -158,7 +158,7 @@ abstract class ProductImageI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class ProductImageI18n implements ActiveRecordInterface * obj is an instance of ProductImageI18n, delegates to * equals(ProductImageI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class ProductImageI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class ProductImageI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class ProductImageI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class ProductImageI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class ProductImageI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ProductPrice.php b/core/lib/Thelia/Model/Base/ProductPrice.php index e92ca2cfa..dc177ad1b 100644 --- a/core/lib/Thelia/Model/Base/ProductPrice.php +++ b/core/lib/Thelia/Model/Base/ProductPrice.php @@ -154,7 +154,7 @@ abstract class ProductPrice implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -212,8 +212,8 @@ abstract class ProductPrice implements ActiveRecordInterface * obj is an instance of ProductPrice, delegates to * equals(ProductPrice). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -252,8 +252,6 @@ abstract class ProductPrice implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -264,6 +262,7 @@ abstract class ProductPrice implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -274,7 +273,10 @@ abstract class ProductPrice implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -331,7 +333,9 @@ abstract class ProductPrice implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -426,7 +430,7 @@ abstract class ProductPrice implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -446,7 +450,7 @@ abstract class ProductPrice implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1052,8 +1056,7 @@ abstract class ProductPrice implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ProductSaleElements.php b/core/lib/Thelia/Model/Base/ProductSaleElements.php index eb6aa2b1a..e54b13155 100644 --- a/core/lib/Thelia/Model/Base/ProductSaleElements.php +++ b/core/lib/Thelia/Model/Base/ProductSaleElements.php @@ -234,7 +234,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -292,8 +292,8 @@ abstract class ProductSaleElements implements ActiveRecordInterface * obj is an instance of ProductSaleElements, delegates to * equals(ProductSaleElements). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -332,8 +332,6 @@ abstract class ProductSaleElements implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -344,6 +342,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -354,7 +353,10 @@ abstract class ProductSaleElements implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -411,7 +413,9 @@ abstract class ProductSaleElements implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -550,7 +554,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -570,7 +574,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1389,8 +1393,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface $keys[9] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ProductVersion.php b/core/lib/Thelia/Model/Base/ProductVersion.php index a5d22e498..f4327e4f1 100644 --- a/core/lib/Thelia/Model/Base/ProductVersion.php +++ b/core/lib/Thelia/Model/Base/ProductVersion.php @@ -192,7 +192,7 @@ abstract class ProductVersion implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -250,8 +250,8 @@ abstract class ProductVersion implements ActiveRecordInterface * obj is an instance of ProductVersion, delegates to * equals(ProductVersion). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -290,8 +290,6 @@ abstract class ProductVersion implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -302,6 +300,7 @@ abstract class ProductVersion implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -312,7 +311,10 @@ abstract class ProductVersion implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -369,7 +371,9 @@ abstract class ProductVersion implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -486,7 +490,7 @@ abstract class ProductVersion implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -506,7 +510,7 @@ abstract class ProductVersion implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -537,7 +541,7 @@ abstract class ProductVersion implements ActiveRecordInterface if ($format === null) { return $this->version_created_at; } else { - return $this->version_created_at !== null ? $this->version_created_at->format($format) : null; + return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null; } } @@ -1309,8 +1313,7 @@ abstract class ProductVersion implements ActiveRecordInterface $keys[10] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Resource.php b/core/lib/Thelia/Model/Base/Resource.php index 5a51bdc29..59bb2766a 100644 --- a/core/lib/Thelia/Model/Base/Resource.php +++ b/core/lib/Thelia/Model/Base/Resource.php @@ -184,7 +184,7 @@ abstract class Resource implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -242,8 +242,8 @@ abstract class Resource implements ActiveRecordInterface * obj is an instance of Resource, delegates to * equals(Resource). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -282,8 +282,6 @@ abstract class Resource implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -294,6 +292,7 @@ abstract class Resource implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -304,7 +303,10 @@ abstract class Resource implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -361,7 +363,9 @@ abstract class Resource implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -434,7 +438,7 @@ abstract class Resource implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -454,7 +458,7 @@ abstract class Resource implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1034,8 +1038,7 @@ abstract class Resource implements ActiveRecordInterface $keys[3] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/ResourceI18n.php b/core/lib/Thelia/Model/Base/ResourceI18n.php index ac9ca106f..bd1104a90 100644 --- a/core/lib/Thelia/Model/Base/ResourceI18n.php +++ b/core/lib/Thelia/Model/Base/ResourceI18n.php @@ -158,7 +158,7 @@ abstract class ResourceI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -216,8 +216,8 @@ abstract class ResourceI18n implements ActiveRecordInterface * obj is an instance of ResourceI18n, delegates to * equals(ResourceI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -256,8 +256,6 @@ abstract class ResourceI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -268,6 +266,7 @@ abstract class ResourceI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -278,7 +277,10 @@ abstract class ResourceI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -335,7 +337,9 @@ abstract class ResourceI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -1010,8 +1014,7 @@ abstract class ResourceI18n implements ActiveRecordInterface $keys[5] => $this->getPostscriptum(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/RewritingArgument.php b/core/lib/Thelia/Model/Base/RewritingArgument.php index 45f26c24f..e34778574 100644 --- a/core/lib/Thelia/Model/Base/RewritingArgument.php +++ b/core/lib/Thelia/Model/Base/RewritingArgument.php @@ -141,7 +141,7 @@ abstract class RewritingArgument implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -199,8 +199,8 @@ abstract class RewritingArgument implements ActiveRecordInterface * obj is an instance of RewritingArgument, delegates to * equals(RewritingArgument). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -239,8 +239,6 @@ abstract class RewritingArgument implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -251,6 +249,7 @@ abstract class RewritingArgument implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -261,7 +260,10 @@ abstract class RewritingArgument implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -318,7 +320,9 @@ abstract class RewritingArgument implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -402,7 +406,7 @@ abstract class RewritingArgument implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -422,7 +426,7 @@ abstract class RewritingArgument implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -979,8 +983,7 @@ abstract class RewritingArgument implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/RewritingUrl.php b/core/lib/Thelia/Model/Base/RewritingUrl.php index 75ee97e79..06fa093b2 100644 --- a/core/lib/Thelia/Model/Base/RewritingUrl.php +++ b/core/lib/Thelia/Model/Base/RewritingUrl.php @@ -184,7 +184,7 @@ abstract class RewritingUrl implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -242,8 +242,8 @@ abstract class RewritingUrl implements ActiveRecordInterface * obj is an instance of RewritingUrl, delegates to * equals(RewritingUrl). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -282,8 +282,6 @@ abstract class RewritingUrl implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -294,6 +292,7 @@ abstract class RewritingUrl implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -304,7 +303,10 @@ abstract class RewritingUrl implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -361,7 +363,9 @@ abstract class RewritingUrl implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -478,7 +482,7 @@ abstract class RewritingUrl implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -498,7 +502,7 @@ abstract class RewritingUrl implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1207,8 +1211,7 @@ abstract class RewritingUrl implements ActiveRecordInterface $keys[7] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Tax.php b/core/lib/Thelia/Model/Base/Tax.php index da674b5cf..2ca5a8735 100644 --- a/core/lib/Thelia/Model/Base/Tax.php +++ b/core/lib/Thelia/Model/Base/Tax.php @@ -177,7 +177,7 @@ abstract class Tax implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -235,8 +235,8 @@ abstract class Tax implements ActiveRecordInterface * obj is an instance of Tax, delegates to * equals(Tax). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -275,8 +275,6 @@ abstract class Tax implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -287,6 +285,7 @@ abstract class Tax implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -297,7 +296,10 @@ abstract class Tax implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -354,7 +356,9 @@ abstract class Tax implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -438,7 +442,7 @@ abstract class Tax implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -458,7 +462,7 @@ abstract class Tax implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1044,8 +1048,7 @@ abstract class Tax implements ActiveRecordInterface $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/TaxI18n.php b/core/lib/Thelia/Model/Base/TaxI18n.php index abb659135..cedf8b348 100644 --- a/core/lib/Thelia/Model/Base/TaxI18n.php +++ b/core/lib/Thelia/Model/Base/TaxI18n.php @@ -146,7 +146,7 @@ abstract class TaxI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -204,8 +204,8 @@ abstract class TaxI18n implements ActiveRecordInterface * obj is an instance of TaxI18n, delegates to * equals(TaxI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -244,8 +244,6 @@ abstract class TaxI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -256,6 +254,7 @@ abstract class TaxI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -266,7 +265,10 @@ abstract class TaxI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -323,7 +325,9 @@ abstract class TaxI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -908,8 +912,7 @@ abstract class TaxI18n implements ActiveRecordInterface $keys[3] => $this->getDescription(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/TaxRule.php b/core/lib/Thelia/Model/Base/TaxRule.php index b361567d8..7accb0df8 100644 --- a/core/lib/Thelia/Model/Base/TaxRule.php +++ b/core/lib/Thelia/Model/Base/TaxRule.php @@ -199,7 +199,7 @@ abstract class TaxRule implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -257,8 +257,8 @@ abstract class TaxRule implements ActiveRecordInterface * obj is an instance of TaxRule, delegates to * equals(TaxRule). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -297,8 +297,6 @@ abstract class TaxRule implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -309,6 +307,7 @@ abstract class TaxRule implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -319,7 +318,10 @@ abstract class TaxRule implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -376,7 +378,9 @@ abstract class TaxRule implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -449,7 +453,7 @@ abstract class TaxRule implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -469,7 +473,7 @@ abstract class TaxRule implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1053,8 +1057,7 @@ abstract class TaxRule implements ActiveRecordInterface $keys[3] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/TaxRuleCountry.php b/core/lib/Thelia/Model/Base/TaxRuleCountry.php index 0cc3e74eb..de527540c 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleCountry.php +++ b/core/lib/Thelia/Model/Base/TaxRuleCountry.php @@ -161,7 +161,7 @@ abstract class TaxRuleCountry implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -219,8 +219,8 @@ abstract class TaxRuleCountry implements ActiveRecordInterface * obj is an instance of TaxRuleCountry, delegates to * equals(TaxRuleCountry). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -259,8 +259,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -271,6 +269,7 @@ abstract class TaxRuleCountry implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -281,7 +280,10 @@ abstract class TaxRuleCountry implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -338,7 +340,9 @@ abstract class TaxRuleCountry implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -433,7 +437,7 @@ abstract class TaxRuleCountry implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -453,7 +457,7 @@ abstract class TaxRuleCountry implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1074,8 +1078,7 @@ abstract class TaxRuleCountry implements ActiveRecordInterface $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/TaxRuleI18n.php b/core/lib/Thelia/Model/Base/TaxRuleI18n.php index 711dba307..535195fb7 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleI18n.php +++ b/core/lib/Thelia/Model/Base/TaxRuleI18n.php @@ -146,7 +146,7 @@ abstract class TaxRuleI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -204,8 +204,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface * obj is an instance of TaxRuleI18n, delegates to * equals(TaxRuleI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -244,8 +244,6 @@ abstract class TaxRuleI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -256,6 +254,7 @@ abstract class TaxRuleI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -266,7 +265,10 @@ abstract class TaxRuleI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -323,7 +325,9 @@ abstract class TaxRuleI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -908,8 +912,7 @@ abstract class TaxRuleI18n implements ActiveRecordInterface $keys[3] => $this->getDescription(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/Template.php b/core/lib/Thelia/Model/Base/Template.php index 08bb0f3a0..fdb767c96 100644 --- a/core/lib/Thelia/Model/Base/Template.php +++ b/core/lib/Thelia/Model/Base/Template.php @@ -219,7 +219,7 @@ abstract class Template implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -277,8 +277,8 @@ abstract class Template implements ActiveRecordInterface * obj is an instance of Template, delegates to * equals(Template). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -317,8 +317,6 @@ abstract class Template implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -329,6 +327,7 @@ abstract class Template implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -339,7 +338,10 @@ abstract class Template implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -396,7 +398,9 @@ abstract class Template implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -458,7 +462,7 @@ abstract class Template implements ActiveRecordInterface if ($format === null) { return $this->created_at; } else { - return $this->created_at !== null ? $this->created_at->format($format) : null; + return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null; } } @@ -478,7 +482,7 @@ abstract class Template implements ActiveRecordInterface if ($format === null) { return $this->updated_at; } else { - return $this->updated_at !== null ? $this->updated_at->format($format) : null; + return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null; } } @@ -1091,8 +1095,7 @@ abstract class Template implements ActiveRecordInterface $keys[2] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/Base/TemplateI18n.php b/core/lib/Thelia/Model/Base/TemplateI18n.php index 7c61c6983..67ec21bc5 100644 --- a/core/lib/Thelia/Model/Base/TemplateI18n.php +++ b/core/lib/Thelia/Model/Base/TemplateI18n.php @@ -140,7 +140,7 @@ abstract class TemplateI18n implements ActiveRecordInterface * be false, if the object was retrieved from storage or was created * and then saved. * - * @return true, if the object has never been persisted. + * @return boolean true, if the object has never been persisted. */ public function isNew() { @@ -198,8 +198,8 @@ abstract class TemplateI18n implements ActiveRecordInterface * obj is an instance of TemplateI18n, delegates to * equals(TemplateI18n). Otherwise, returns false. * - * @param obj The object to compare to. - * @return Whether equal to the object specified. + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. */ public function equals($obj) { @@ -238,8 +238,6 @@ abstract class TemplateI18n implements ActiveRecordInterface /** * Get the associative array of the virtual columns in this object * - * @param string $name The virtual column name - * * @return array */ public function getVirtualColumns() @@ -250,6 +248,7 @@ abstract class TemplateI18n implements ActiveRecordInterface /** * Checks the existence of a virtual column in this object * + * @param string $name The virtual column name * @return boolean */ public function hasVirtualColumn($name) @@ -260,7 +259,10 @@ abstract class TemplateI18n implements ActiveRecordInterface /** * Get the value of a virtual column in this object * + * @param string $name The virtual column name * @return mixed + * + * @throws PropelException */ public function getVirtualColumn($name) { @@ -317,7 +319,9 @@ abstract class TemplateI18n implements ActiveRecordInterface $parser = AbstractParser::getParser($parser); } - return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; } /** @@ -857,8 +861,7 @@ abstract class TemplateI18n implements ActiveRecordInterface $keys[2] => $this->getName(), ); $virtualColumns = $this->virtualColumns; - foreach($virtualColumns as $key => $virtualColumn) - { + foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } diff --git a/core/lib/Thelia/Model/CartItem.php b/core/lib/Thelia/Model/CartItem.php index a1fb3601a..25a4f44aa 100755 --- a/core/lib/Thelia/Model/CartItem.php +++ b/core/lib/Thelia/Model/CartItem.php @@ -7,7 +7,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Base\CartItem as BaseCartItem; use Thelia\Model\ConfigQuery; -use Thelia\Core\Event\CartEvent; +use Thelia\Core\Event\Cart\CartEvent; use Thelia\TaxEngine\Calculator; class CartItem extends BaseCartItem diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php index 347a0f7f7..067c54fc1 100755 --- a/core/lib/Thelia/Model/Category.php +++ b/core/lib/Thelia/Model/Category.php @@ -2,7 +2,7 @@ namespace Thelia\Model; -use Thelia\Core\Event\CategoryEvent; +use Thelia\Core\Event\Category\CategoryEvent; use Thelia\Model\Base\Category as BaseCategory; use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Tools\URL; @@ -106,7 +106,7 @@ class Category extends BaseCategory public function preDelete(ConnectionInterface $con = null) { $this->dispatchEvent(TheliaEvents::BEFORE_DELETECATEGORY, new CategoryEvent($this)); - + $this->reorderBeforeDelete(); return true; } diff --git a/core/lib/Thelia/Model/CategoryAssociatedContent.php b/core/lib/Thelia/Model/CategoryAssociatedContent.php index 9154767bc..e5fcddc41 100644 --- a/core/lib/Thelia/Model/CategoryAssociatedContent.php +++ b/core/lib/Thelia/Model/CategoryAssociatedContent.php @@ -3,7 +3,7 @@ namespace Thelia\Model; use Thelia\Model\Base\CategoryAssociatedContent as BaseCategoryAssociatedContent; -use Thelia\Core\Event\CategoryAssociatedContentEvent; +use Thelia\Core\Event\Category\CategoryAssociatedContentEvent; use Thelia\Core\Event\TheliaEvents; use Propel\Runtime\Connection\ConnectionInterface; diff --git a/core/lib/Thelia/Model/Config.php b/core/lib/Thelia/Model/Config.php index cc44e5053..9b44f1981 100755 --- a/core/lib/Thelia/Model/Config.php +++ b/core/lib/Thelia/Model/Config.php @@ -26,7 +26,7 @@ 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; +use Thelia\Core\Event\Config\ConfigEvent; class Config extends BaseConfig { diff --git a/core/lib/Thelia/Model/Content.php b/core/lib/Thelia/Model/Content.php index 69ef7d6d7..6417c8b56 100755 --- a/core/lib/Thelia/Model/Content.php +++ b/core/lib/Thelia/Model/Content.php @@ -55,6 +55,47 @@ class Content extends BaseContent return $this; } + + public function updateDefaultFolder($defaultFolderId) + { + // Allow uncategorized content (NULL instead of 0, to bypass delete cascade constraint) + if ($defaultFolderId <= 0) { + $defaultFolderId = NULL; + } + + if ($defaultFolderId == $this->getDefaultFolderId()) { + return; + } + + ContentFolderQuery::create() + ->filterByContentId($this->getId()) + ->update(array('DefaultFolder' => 0)); + + $contentFolder = ContentFolderQuery::create() + ->filterByContentId($this->getId()) + ->filterByFolderId($defaultFolderId) + ->findOne(); + + if (null === $contentFolder) { + $contentFolder = new ContentFolder(); + + $contentFolder->setContentId($this->getId()) + ->setFolderId($defaultFolderId); + } + + $contentFolder->setDefaultFolder(true) + ->save(); + + } + + /** + * Create a new content. + * + * Here pre and post insert event are fired + * + * @param $defaultFolderId + * @throws \Exception + */ public function create($defaultFolderId) { $con = Propel::getWriteConnection(ContentTableMap::DATABASE_NAME); diff --git a/core/lib/Thelia/Model/Country.php b/core/lib/Thelia/Model/Country.php index a7a6c23b9..e254d4a5e 100755 --- a/core/lib/Thelia/Model/Country.php +++ b/core/lib/Thelia/Model/Country.php @@ -2,8 +2,59 @@ namespace Thelia\Model; +use Propel\Runtime\Connection\ConnectionInterface; +use Thelia\Core\Event\Country\CountryEvent; +use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Base\Country as BaseCountry; -class Country extends BaseCountry { +class Country extends BaseCountry +{ + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + + public function toggleDefault() + { + CountryQuery::create() + ->filterByByDefault(1) + ->update(array('ByDefault' => 0)); + + $this + ->setByDefault(1) + ->save(); + } + + public function preInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CREATECOUNTRY, new CountryEvent($this)); + return true; + } + + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATECOUNTRY, new CountryEvent($this)); + } + + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECOUNTRY, new CountryEvent($this)); + + return true; + } + + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_UPDATECOUNTRY, new CountryEvent($this)); + } + + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETECOUNTRY, new CountryEvent($this)); + + return true; + } + + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETECOUNTRY, new CountryEvent($this)); + } } diff --git a/core/lib/Thelia/Model/Currency.php b/core/lib/Thelia/Model/Currency.php index 6ec452456..c5b77fc08 100755 --- a/core/lib/Thelia/Model/Currency.php +++ b/core/lib/Thelia/Model/Currency.php @@ -6,7 +6,7 @@ use Propel\Runtime\Exception\PropelException; use Thelia\Model\Base\Currency as BaseCurrency; use Thelia\Core\Event\TheliaEvents; use Propel\Runtime\Connection\ConnectionInterface; -use Thelia\Core\Event\CurrencyEvent; +use Thelia\Core\Event\Currency\CurrencyEvent; class Currency extends BaseCurrency { diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php index 820928224..230023410 100755 --- a/core/lib/Thelia/Model/Customer.php +++ b/core/lib/Thelia/Model/Customer.php @@ -17,7 +17,7 @@ use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Propel; use Thelia\Model\Map\CustomerTableMap; use Thelia\Core\Security\Role\Role; -use Thelia\Core\Event\CustomerEvent; +use Thelia\Core\Event\Customer\CustomerEvent; /** * Skeleton subclass for representing a row from the 'customer' table. diff --git a/core/lib/Thelia/Model/Feature.php b/core/lib/Thelia/Model/Feature.php index cf0284d2b..800ff832a 100755 --- a/core/lib/Thelia/Model/Feature.php +++ b/core/lib/Thelia/Model/Feature.php @@ -5,7 +5,7 @@ namespace Thelia\Model; use Thelia\Model\Base\Feature as BaseFeature; use Propel\Runtime\Connection\ConnectionInterface; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\FeatureEvent; +use Thelia\Core\Event\Feature\FeatureEvent; class Feature extends BaseFeature { @@ -20,7 +20,7 @@ class Feature extends BaseFeature { $this->dispatchEvent(TheliaEvents::BEFORE_CREATEFEATURE, new FeatureEvent($this)); // Set the current position for the new object - $this->setPosition($this->getNextPosition()); + //$this->setPosition($this->getNextPosition()); return true; } diff --git a/core/lib/Thelia/Model/FeatureAv.php b/core/lib/Thelia/Model/FeatureAv.php index ae6e35087..8d21b4cb1 100755 --- a/core/lib/Thelia/Model/FeatureAv.php +++ b/core/lib/Thelia/Model/FeatureAv.php @@ -5,7 +5,7 @@ namespace Thelia\Model; use Thelia\Model\Base\FeatureAv as BaseFeatureAv; use Thelia\Core\Event\TheliaEvents; use Propel\Runtime\Connection\ConnectionInterface; -use Thelia\Core\Event\FeatureAvEvent; +use Thelia\Core\Event\Feature\FeatureAvEvent; class FeatureAv extends BaseFeatureAv { diff --git a/core/lib/Thelia/Model/FeatureProduct.php b/core/lib/Thelia/Model/FeatureProduct.php index fe6c5d8c1..bc4440a26 100755 --- a/core/lib/Thelia/Model/FeatureProduct.php +++ b/core/lib/Thelia/Model/FeatureProduct.php @@ -5,7 +5,7 @@ namespace Thelia\Model; use Thelia\Model\Base\FeatureProduct as BaseFeatureProduct; use Thelia\Core\Event\TheliaEvents; use Propel\Runtime\Connection\ConnectionInterface; -use Thelia\Core\Event\FeatureProductEvent; +use Thelia\Core\Event\FeatureProduct\FeatureProductEvent; class FeatureProduct extends BaseFeatureProduct { diff --git a/core/lib/Thelia/Model/Folder.php b/core/lib/Thelia/Model/Folder.php index ffd1c38ef..4b32e7591 100755 --- a/core/lib/Thelia/Model/Folder.php +++ b/core/lib/Thelia/Model/Folder.php @@ -2,7 +2,7 @@ namespace Thelia\Model; -use Thelia\Core\Event\FolderEvent; +use Thelia\Core\Event\Folder\FolderEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Base\Folder as BaseFolder; use Thelia\Tools\URL; @@ -94,7 +94,7 @@ class Folder extends BaseFolder public function preDelete(ConnectionInterface $con = null) { $this->dispatchEvent(TheliaEvents::BEFORE_DELETEFOLDER, new FolderEvent($this)); - + $this->reorderBeforeDelete(); return true; } diff --git a/core/lib/Thelia/Model/Map/CountryTableMap.php b/core/lib/Thelia/Model/Map/CountryTableMap.php index 519af7176..752f2b34a 100644 --- a/core/lib/Thelia/Model/Map/CountryTableMap.php +++ b/core/lib/Thelia/Model/Map/CountryTableMap.php @@ -167,7 +167,7 @@ class CountryTableMap extends TableMap $this->setPhpName('Country'); $this->setClassName('\\Thelia\\Model\\Country'); $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(false); + $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', false, null, null); @@ -466,6 +466,10 @@ class CountryTableMap extends TableMap $criteria = $criteria->buildCriteria(); // build Criteria from Country object } + if ($criteria->containsKey(CountryTableMap::ID) && $criteria->keyContainsValue(CountryTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CountryTableMap::ID.')'); + } + // Set the correct dbName $query = CountryQuery::create()->mergeWith($criteria); diff --git a/core/lib/Thelia/Model/Message.php b/core/lib/Thelia/Model/Message.php index aa6481ab8..4163e6d6b 100755 --- a/core/lib/Thelia/Model/Message.php +++ b/core/lib/Thelia/Model/Message.php @@ -5,7 +5,7 @@ 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; +use Thelia\Core\Event\Message\MessageEvent; class Message extends BaseMessage { diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php index fd5164513..4033e5bfb 100755 --- a/core/lib/Thelia/Model/Order.php +++ b/core/lib/Thelia/Model/Order.php @@ -5,7 +5,7 @@ namespace Thelia\Model; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Propel; -use Thelia\Core\Event\OrderEvent; +use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Base\Order as BaseOrder; use Thelia\Model\Base\OrderProductTaxQuery; @@ -62,9 +62,15 @@ class Order extends BaseOrder /* browse all products */ $orderProductIds = array(); foreach($this->getOrderProducts() as $orderProduct) { - $taxAmount = OrderProductTaxQuery::create() - ->withColumn('SUM(' . OrderProductTaxTableMap::AMOUNT . ')', 'total_tax') - ->filterByOrderProductId($orderProduct->getId(), Criteria::EQUAL) + $taxAmountQuery = OrderProductTaxQuery::create(); + + if($orderProduct->getWasInPromo() == 1) { + $taxAmountQuery->withColumn('SUM(' . OrderProductTaxTableMap::PROMO_AMOUNT . ')', 'total_tax'); + } else { + $taxAmountQuery->withColumn('SUM(' . OrderProductTaxTableMap::AMOUNT . ')', 'total_tax'); + } + + $taxAmount = $taxAmountQuery->filterByOrderProductId($orderProduct->getId(), Criteria::EQUAL) ->findOne(); $amount += ($orderProduct->getWasInPromo() == 1 ? $orderProduct->getPromoPrice() : $orderProduct->getPrice()) * $orderProduct->getQuantity(); $tax += round($taxAmount->getVirtualColumn('total_tax'), 2) * $orderProduct->getQuantity(); diff --git a/core/lib/Thelia/Model/OrderProduct.php b/core/lib/Thelia/Model/OrderProduct.php index 235eaf259..b73ef9852 100644 --- a/core/lib/Thelia/Model/OrderProduct.php +++ b/core/lib/Thelia/Model/OrderProduct.php @@ -3,7 +3,7 @@ namespace Thelia\Model; use Propel\Runtime\Connection\ConnectionInterface; -use Thelia\Core\Event\OrderEvent; +use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Base\OrderProduct as BaseOrderProduct; diff --git a/core/lib/Thelia/Model/Product.php b/core/lib/Thelia/Model/Product.php index 2348a9c0d..f48f9e75e 100755 --- a/core/lib/Thelia/Model/Product.php +++ b/core/lib/Thelia/Model/Product.php @@ -8,7 +8,7 @@ use Thelia\Tools\URL; use Thelia\TaxEngine\Calculator; use Propel\Runtime\Connection\ConnectionInterface; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Event\ProductEvent; +use Thelia\Core\Event\Product\ProductEvent; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\Propel; use Thelia\Model\Map\ProductTableMap; diff --git a/core/lib/Thelia/Model/ProductAssociatedContent.php b/core/lib/Thelia/Model/ProductAssociatedContent.php index 843d76ba1..12be080fc 100644 --- a/core/lib/Thelia/Model/ProductAssociatedContent.php +++ b/core/lib/Thelia/Model/ProductAssociatedContent.php @@ -4,7 +4,7 @@ namespace Thelia\Model; use Thelia\Model\Base\ProductAssociatedContent as BaseProductAssociatedContent; use Propel\Runtime\Connection\ConnectionInterface; -use Thelia\Core\Event\ProductAssociatedContentEvent; +use Thelia\Core\Event\Product\ProductAssociatedContentEvent; use Thelia\Core\Event\TheliaEvents; class ProductAssociatedContent extends BaseProductAssociatedContent { diff --git a/core/lib/Thelia/Model/TaxRule.php b/core/lib/Thelia/Model/TaxRule.php index 024fd8923..e66e013d0 100755 --- a/core/lib/Thelia/Model/TaxRule.php +++ b/core/lib/Thelia/Model/TaxRule.php @@ -11,16 +11,23 @@ class TaxRule extends BaseTaxRule /** * @param Country $country * @param $untaxedAmount + * @param $untaxedPromoAmount * @param null $askedLocale * * @return OrderProductTaxCollection */ - public function getTaxDetail(Country $country, $untaxedAmount, $askedLocale = null) + public function getTaxDetail(Country $country, $untaxedAmount, $untaxedPromoAmount, $askedLocale = null) { $taxCalculator = new Calculator(); $taxCollection = new OrderProductTaxCollection(); $taxCalculator->loadTaxRule($this, $country)->getTaxedPrice($untaxedAmount, $taxCollection, $askedLocale); + $promoTaxCollection = new OrderProductTaxCollection(); + $taxCalculator->loadTaxRule($this, $country)->getTaxedPrice($untaxedPromoAmount, $promoTaxCollection, $askedLocale); + + foreach($taxCollection as $index => $tax) { + $tax->setPromoAmount($promoTaxCollection->getKey($index)->getAmount()); + } return $taxCollection; } diff --git a/core/lib/Thelia/Model/Template.php b/core/lib/Thelia/Model/Template.php index 881187573..1772421bb 100644 --- a/core/lib/Thelia/Model/Template.php +++ b/core/lib/Thelia/Model/Template.php @@ -4,7 +4,7 @@ namespace Thelia\Model; use Thelia\Model\Base\Template as BaseTemplate; use Propel\Runtime\Connection\ConnectionInterface; -use Thelia\Core\Event\TemplateEvent; +use Thelia\Core\Event\Template\TemplateEvent; use Thelia\Core\Event\TheliaEvents; class Template extends BaseTemplate diff --git a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php index 642d07402..edbbad62b 100644 --- a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php +++ b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php @@ -198,4 +198,20 @@ trait PositionManagementTrait { } } } + + protected function reorderBeforeDelete() + { + // Find DATABASE_NAME constant + $mapClassName = self::TABLE_MAP; + + $sql = sprintf("UPDATE `%s` SET position=(position-1) WHERE parent=:parent AND position>:position", $mapClassName::TABLE_NAME); + + $con = Propel::getConnection($mapClassName::DATABASE_NAME); + $statement = $con->prepare($sql); + + $statement->execute(array( + ':parent' => $this->getParent(), + ':position' => $this->getPosition() + )); + } } \ No newline at end of file diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php index 8efc76e6e..37c40c953 100755 --- a/core/lib/Thelia/Module/BaseModule.php +++ b/core/lib/Thelia/Module/BaseModule.php @@ -51,12 +51,12 @@ abstract class BaseModule extends ContainerAware public function activate() { $moduleModel = $this->getModuleModel(); - if($moduleModel->getActivate() == self::IS_NOT_ACTIVATED) { + if ($moduleModel->getActivate() == self::IS_NOT_ACTIVATED) { $moduleModel->setActivate(self::IS_ACTIVATED); $moduleModel->save(); try { $this->afterActivation(); - } catch(\Exception $e) { + } catch (\Exception $e) { $moduleModel->setActivate(self::IS_NOT_ACTIVATED); $moduleModel->save(); throw $e; @@ -80,10 +80,10 @@ abstract class BaseModule extends ContainerAware public function setTitle(Module $module, $titles) { - if(is_array($titles)) { - foreach($titles as $locale => $title) { + if (is_array($titles)) { + foreach ($titles as $locale => $title) { $moduleI18n = ModuleI18nQuery::create()->filterById($module->getId())->filterByLocale($locale)->findOne(); - if(null === $moduleI18n) { + if (null === $moduleI18n) { $moduleI18n = new ModuleI18n(); $moduleI18n ->setId($module->getId()) @@ -103,7 +103,7 @@ abstract class BaseModule extends ContainerAware { try { $directoryBrowser = new \DirectoryIterator($folderPath); - } catch(\UnexpectedValueException $e) { + } catch (\UnexpectedValueException $e) { throw $e; } @@ -113,7 +113,7 @@ abstract class BaseModule extends ContainerAware /* browse the directory */ $imagePosition = 1; - foreach($directoryBrowser as $directoryContent) { + foreach ($directoryBrowser as $directoryContent) { /* is it a file ? */ if ($directoryContent->isFile()) { @@ -121,7 +121,7 @@ abstract class BaseModule extends ContainerAware $filePath = $directoryContent->getPathName(); /* is it a picture ? */ - if( Image::isImage($filePath) ) { + if ( Image::isImage($filePath) ) { $con->beginTransaction(); @@ -134,7 +134,7 @@ abstract class BaseModule extends ContainerAware $imageFileName = sprintf("%s-%d-%s", $module->getCode(), $image->getId(), $fileName); $increment = 0; - while(file_exists($imageDirectory . '/' . $imageFileName)) { + while (file_exists($imageDirectory . '/' . $imageFileName)) { $imageFileName = sprintf("%s-%d-%d-%s", $module->getCode(), $image->getId(), $increment, $fileName); $increment++; } @@ -142,13 +142,13 @@ abstract class BaseModule extends ContainerAware $imagePath = sprintf('%s/%s', $imageDirectory, $imageFileName); if (! is_dir($imageDirectory)) { - if(! @mkdir($imageDirectory, 0777, true)) { + if (! @mkdir($imageDirectory, 0777, true)) { $con->rollBack(); throw new ModuleException(sprintf("Cannot create directory : %s", $imageDirectory), ModuleException::CODE_NOT_FOUND); } } - if(! @copy($filePath, $imagePath)) { + if (! @copy($filePath, $imagePath)) { $con->rollBack(); throw new ModuleException(sprintf("Cannot copy file : %s to : %s", $filePath, $imagePath), ModuleException::CODE_NOT_FOUND); } @@ -171,7 +171,7 @@ abstract class BaseModule extends ContainerAware { $moduleModel = ModuleQuery::create()->findOneByCode($this->getCode()); - if(null === $moduleModel) { + if (null === $moduleModel) { throw new ModuleException(sprintf("Module Code `%s` not found", $this->getCode()), ModuleException::CODE_NOT_FOUND); } diff --git a/core/lib/Thelia/Module/PaymentModuleInterface.php b/core/lib/Thelia/Module/PaymentModuleInterface.php index d864ae50a..90f8ea0a9 100644 --- a/core/lib/Thelia/Module/PaymentModuleInterface.php +++ b/core/lib/Thelia/Module/PaymentModuleInterface.php @@ -23,8 +23,6 @@ namespace Thelia\Module; -use Thelia\Model\Country; - interface PaymentModuleInterface extends BaseModuleInterface { /** diff --git a/core/lib/Thelia/Tests/Action/AddressTest.php b/core/lib/Thelia/Tests/Action/AddressTest.php index 69f5b5329..9c4198c06 100644 --- a/core/lib/Thelia/Tests/Action/AddressTest.php +++ b/core/lib/Thelia/Tests/Action/AddressTest.php @@ -22,9 +22,11 @@ /*************************************************************************************/ namespace Thelia\Tests\Action; + use Thelia\Action\Address; -use Thelia\Core\Event\AddressCreateOrUpdateEvent; +use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent; use Thelia\Model\Base\CustomerQuery; +use Thelia\Tests\Action\BaseAction; /** * @@ -34,20 +36,9 @@ use Thelia\Model\Base\CustomerQuery; * @package Thelia\Tests\Action * @author Manuel Raynaud */ -class AddressTest extends \PHPUnit_Framework_TestCase +class AddressTest extends BaseAction { - public function getContainer() - { - $container = new \Symfony\Component\DependencyInjection\ContainerBuilder(); - - $dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"); - - $container->set("event_dispatcher", $dispatcher); - - return $container; - } - public function testCreatedAddress() { $customer = CustomerQuery::create()->findOne(); diff --git a/core/lib/Thelia/Tests/Action/BaseAction.php b/core/lib/Thelia/Tests/Action/BaseAction.php new file mode 100644 index 000000000..f0027fd21 --- /dev/null +++ b/core/lib/Thelia/Tests/Action/BaseAction.php @@ -0,0 +1,44 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Action; + + +/** + * Class BaseAction + * @package Thelia\Tests\Action\ImageTest + * @author Manuel Raynaud + */ +class BaseAction extends \PHPUnit_Framework_TestCase +{ + public function getContainer() + { + $container = new \Symfony\Component\DependencyInjection\ContainerBuilder(); + + $dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"); + + $container->set("event_dispatcher", $dispatcher); + + return $container; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Tests/Action/ContentTest.php b/core/lib/Thelia/Tests/Action/ContentTest.php new file mode 100644 index 000000000..7aa819346 --- /dev/null +++ b/core/lib/Thelia/Tests/Action/ContentTest.php @@ -0,0 +1,276 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Action; +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Action\Content; +use Thelia\Core\Event\Content\ContentAddFolderEvent; +use Thelia\Core\Event\Content\ContentCreateEvent; +use Thelia\Core\Event\Content\ContentDeleteEvent; +use Thelia\Core\Event\Content\ContentRemoveFolderEvent; +use Thelia\Core\Event\Content\ContentToggleVisibilityEvent; +use Thelia\Core\Event\Content\ContentUpdateEvent; +use Thelia\Core\Event\UpdatePositionEvent; +use Thelia\Model\ContentFolder; +use Thelia\Model\ContentFolderQuery; +use Thelia\Model\ContentQuery; +use Thelia\Model\FolderQuery; + + +/** + * Class ContentTest + * @package Thelia\Tests\Action + * @author Manuel Raynaud + */ +class ContentTest extends BaseAction +{ + public function testCreateContent() + { + $folder = $this->getRandomFolder(); + + $event = new ContentCreateEvent(); + $event + ->setVisible(1) + ->setLocale('en_US') + ->setTitle('test create content') + ->setDefaultFolder($folder->getId()) + ; + + $contentAction = new Content($this->getContainer()); + $contentAction->create($event); + + $createdContent = $event->getContent(); + + $this->assertInstanceOf('Thelia\Model\Content', $createdContent); + $this->assertEquals(1, $createdContent->getVisible()); + $this->assertEquals('test create content', $createdContent->getTitle()); + $this->assertEquals($folder->getId(), $createdContent->getDefaultFolderId()); + + } + + public function testUpdateContent() + { + $content = $this->getRandomContent(); + $folder = $this->getRandomFolder(); + + $event = new ContentUpdateEvent($content->getId()); + $event + ->setVisible(1) + ->setLocale('en_US') + ->setTitle('test update content title') + ->setChapo('test update content short description') + ->setDescription('test update content description') + ->setPostscriptum('test update content postscriptum') + ->setDefaultFolder($folder->getId()) + ; + + $contentAction = new Content($this->getContainer()); + $contentAction->update($event); + + $updatedContent = $event->getContent(); + + $this->assertInstanceOf('Thelia\Model\Content', $updatedContent); + $this->assertEquals(1, $updatedContent->getVisible()); + $this->assertEquals('test update content title', $updatedContent->getTitle()); + $this->assertEquals('test update content short description', $updatedContent->getChapo()); + $this->assertEquals('test update content description', $updatedContent->getDescription()); + $this->assertEquals('test update content postscriptum', $updatedContent->getPostscriptum()); + $this->assertEquals($folder->getId(), $updatedContent->getDefaultFolderId()); + } + + public function testDeleteContent() + { + $content = $this->getRandomContent(); + + $event = new ContentDeleteEvent($content->getId()); + + $contentAction = new Content($this->getContainer()); + $contentAction->delete($event); + + $deletedContent = $event->getContent(); + + $this->assertInstanceOf('Thelia\Model\Content', $deletedContent); + $this->assertTrue($deletedContent->isDeleted()); + + } + + public function testContentToggleVisibility() + { + $content = $this->getRandomContent(); + + $visibility = $content->getVisible(); + + $event = new ContentToggleVisibilityEvent($content); + + $contentAction = new Content($this->getContainer()); + $contentAction->toggleVisibility($event); + + $updatedContent = $event->getContent(); + + $this->assertInstanceOf('Thelia\Model\Content', $updatedContent); + $this->assertEquals(!$visibility, $updatedContent->getVisible()); + } + + public function testUpdatePositionUp() + { + $content = ContentQuery::create() + ->filterByPosition(1, Criteria::GREATER_THAN) + ->findOne(); + + if (null === $content) { + $this->fail('use fixtures before launching test, there is no content in database'); + } + + $newPosition = $content->getPosition()-1; + + $event = new UpdatePositionEvent($content->getId(), UpdatePositionEvent::POSITION_UP); + + $contentAction = new Content($this->getContainer()); + $contentAction->updatePosition($event); + + $updatedContent = ContentQuery::create()->findPk($content->getId()); + + $this->assertEquals($newPosition, $updatedContent->getPosition(),sprintf("new position is %d, new position expected is %d for content %d", $newPosition, $updatedContent->getPosition(), $updatedContent->getId())); + } + + public function testUpdatePositionDown() + { + $content = ContentQuery::create() + ->filterByPosition(1) + ->findOne(); + + if (null === $content) { + $this->fail('use fixtures before launching test, there is no content in database'); + } + + $newPosition = $content->getPosition()+1; + + $event = new UpdatePositionEvent($content->getId(), UpdatePositionEvent::POSITION_DOWN); + + $contentAction = new Content($this->getContainer()); + $contentAction->updatePosition($event); + + $updatedContent = ContentQuery::create()->findPk($content->getId()); + + $this->assertEquals($newPosition, $updatedContent->getPosition(),sprintf("new position is %d, new position expected is %d for content %d", $newPosition, $updatedContent->getPosition(), $updatedContent->getId())); + } + + public function testUpdatePositionWithSpecificPosition() + { + $content = ContentQuery::create() + ->filterByPosition(1, Criteria::GREATER_THAN) + ->findOne(); + + if (null === $content) { + $this->fail('use fixtures before launching test, there is no content in database'); + } + + $event = new UpdatePositionEvent($content->getId(), UpdatePositionEvent::POSITION_ABSOLUTE, 1); + + $contentAction = new Content($this->getContainer()); + $contentAction->updatePosition($event); + + $updatedContent = ContentQuery::create()->findPk($content->getId()); + + $this->assertEquals(1, $updatedContent->getPosition(),sprintf("new position is 1, new position expected is %d for content %d", $updatedContent->getPosition(), $updatedContent->getId())); + } + + public function testAddFolderToContent() + { + $content = $this->getRandomContent(); + + do { + $folder = $this->getRandomFolder(); + + $test = ContentFolderQuery::create() + ->filterByContent($content) + ->filterByFolder($folder); + } while($test->count() > 0); + + $event = new ContentAddFolderEvent($content, $folder->getId()); + + $contentAction = new Content($this->getContainer()); + $contentAction->addFolder($event); + + $testAddFolder = ContentFolderQuery::create() + ->filterByContent($content) + ->filterByFolder($folder) + ->findOne() + ; + + $this->assertNotNull($testAddFolder); + $this->assertEquals($content->getId(), $testAddFolder->getContentId(), 'check if content id are equals'); + $this->assertEquals($folder->getId(), $testAddFolder->getFolderId(), 'check if folder id are equals'); + + return $testAddFolder; + } + + /** + * @depends testAddFolderToContent + */ + public function testRemoveFolder(ContentFolder $association) + { + $event = new ContentRemoveFolderEvent($association->getContent(), $association->getFolder()->getId()); + + $contentAction = new Content($this->getContainer()); + $contentAction->removeFolder($event); + + $testAssociation = ContentFolderQuery::create() + ->filterByContent($association->getContent()) + ->filterByFolder($association->getFolder()) + ->findOne(); + + $this->assertNull($testAssociation); + } + /** + * @return \Thelia\Model\Content + */ + protected function getRandomContent() + { + $content = ContentQuery::create() + ->addAscendingOrderByColumn('RAND()') + ->findOne(); + + if (null === $content) { + $this->fail('use fixtures before launching test, there is no content in database'); + } + + return $content; + } + + /** + * @return \Thelia\Model\Folder + */ + protected function getRandomFolder() + { + $folder = FolderQuery::create() + ->addAscendingOrderByColumn('RAND()') + ->findOne(); + + if(null === $folder) { + $this->fail('use fixtures before launching test, there is no folder in database'); + } + + return $folder; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Tests/Action/CustomerTest.php b/core/lib/Thelia/Tests/Action/CustomerTest.php index 10ba01587..50ef4fde6 100644 --- a/core/lib/Thelia/Tests/Action/CustomerTest.php +++ b/core/lib/Thelia/Tests/Action/CustomerTest.php @@ -23,8 +23,7 @@ namespace Thelia\Tests\Action\ImageTest; use Thelia\Action\Customer; -use Thelia\Core\Event\CustomerCreateOrUpdateEvent; - +use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent; /** * Class CustomerTest @@ -101,4 +100,4 @@ class CustomerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($customerCreateEvent->getCellphone(), $addressCreated->getCellphone()); $this->assertEquals($customerCreateEvent->getCompany(), $addressCreated->getCompany()); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Action/DocumentTest.php b/core/lib/Thelia/Tests/Action/DocumentTest.php index 39aece1f4..17a841d94 100644 --- a/core/lib/Thelia/Tests/Action/DocumentTest.php +++ b/core/lib/Thelia/Tests/Action/DocumentTest.php @@ -21,14 +21,14 @@ /* */ /*************************************************************************************/ -namespace Thelia\Tests\Action\DocumentTest; +namespace Thelia\Tests\Action; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Session\Session; use Thelia\Action\Document; -use Thelia\Core\Event\DocumentEvent; +use Thelia\Core\Event\Document\DocumentEvent; use Thelia\Model\ConfigQuery; /** diff --git a/core/lib/Thelia/Tests/Action/FolderTest.php b/core/lib/Thelia/Tests/Action/FolderTest.php new file mode 100644 index 000000000..903e1b77b --- /dev/null +++ b/core/lib/Thelia/Tests/Action/FolderTest.php @@ -0,0 +1,224 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Action; +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Action\Folder; +use Thelia\Core\Event\Folder\FolderCreateEvent; +use Thelia\Core\Event\Folder\FolderDeleteEvent; +use Thelia\Core\Event\Folder\FolderToggleVisibilityEvent; +use Thelia\Core\Event\Folder\FolderUpdateEvent; +use Thelia\Core\Event\UpdatePositionEvent; +use Thelia\Model\FolderQuery; + + +/** + * Class FolderTest + * @package Thelia\Tests\Action\ImageTest + * @author Manuel Raynaud + */ +class FolderTest extends BaseAction +{ + /** + * test folder creation + * @covers Thelia\Action\Folder::create + */ + public function testCreateFolder() + { + + $event = new FolderCreateEvent(); + $event + ->setParent(0) + ->setVisible(1) + ->setLocale('en_US') + ->setTitle('folder creation test'); + + $folderAction = new Folder($this->getContainer()); + + $folderAction->create($event); + + $folder = $event->getFolder(); + + $this->assertInstanceOf('Thelia\Model\Folder', $folder); + $this->assertEquals('folder creation test', $folder->getTitle()); + $this->assertEquals(1, $folder->getVisible()); + $this->assertEquals(0, $folder->getParent()); + } + + /** + * test update creation + * @covers Thelia\Action\Folder::update + */ + public function testUpdateFolder() + { + $folder = $this->getRandomFolder(); + + + + $visible = !$folder->getVisible(); + $event = new FolderUpdateEvent($folder->getId()); + + $event + ->setLocale('en_US') + ->setTitle('test update folder') + ->setVisible($visible) + ->setChapo('test folder update chapo') + ->setDescription('update folder description') + ->setPostscriptum('update folder postscriptum') + ->setParent(0) + ; + + $folderAction = new Folder($this->getContainer()); + $folderAction->update($event); + + $updatedFolder = $event->getFolder(); + + $this->assertInstanceOf('Thelia\Model\Folder', $updatedFolder); + $this->assertEquals('test update folder', $updatedFolder->getTitle()); + $this->assertEquals('test folder update chapo', $updatedFolder->getChapo()); + $this->assertEquals('update folder description', $updatedFolder->getDescription()); + $this->assertEquals('update folder postscriptum', $updatedFolder->getPostscriptum()); + $this->assertEquals(0, $updatedFolder->getParent()); + $this->assertEquals($visible, $updatedFolder->getVisible()); + } + + /** + * test folder removal + * @covers Thelia\Action\Folder::delete + */ + public function testDeleteFolder() + { + $folder = $this->getRandomFolder(); + + $event = new FolderDeleteEvent($folder->getId()); + + $folderAction = new Folder($this->getContainer()); + $folderAction->delete($event); + + $deletedFolder = $event->getFolder(); + + $this->assertInstanceOf('Thelia\Model\Folder', $deletedFolder); + $this->assertTrue($deletedFolder->isDeleted()); + } + + /** + * test folder toggle visibility + * @covers Thelia\Action\Folder::toggleVisibility + */ + public function testToggleVisibility() + { + $folder = $this->getRandomFolder(); + $visible = $folder->getVisible(); + + $event = new FolderToggleVisibilityEvent($folder); + + $folderAction = new Folder($this->getContainer()); + $folderAction->toggleVisibility($event); + + $updatedFolder = $event->getFolder(); + + $this->assertInstanceOf('Thelia\Model\Folder', $updatedFolder); + $this->assertEquals(!$visible, $updatedFolder->getVisible()); + } + + public function testUpdatePositionUp() + { + $folder = FolderQuery::create() + ->filterByPosition(1, Criteria::GREATER_THAN) + ->findOne(); + + if(null === $folder) { + $this->fail('use fixtures before launching test, there is no folder in database'); + } + + $newPosition = $folder->getPosition()-1; + + $event = new UpdatePositionEvent($folder->getId(), UpdatePositionEvent::POSITION_UP); + + $folderAction = new Folder($this->getContainer()); + $folderAction->updatePosition($event); + + $updatedFolder = FolderQuery::create()->findPk($folder->getId()); + + $this->assertEquals($newPosition, $updatedFolder->getPosition(),sprintf("new position is %d, new position expected is %d for folder %d", $newPosition, $updatedFolder->getPosition(), $updatedFolder->getId())); + } + + public function testUpdatePositionDown() + { + $folder = FolderQuery::create() + ->filterByPosition(1) + ->findOne(); + + if(null === $folder) { + $this->fail('use fixtures before launching test, there is no folder in database'); + } + + $newPosition = $folder->getPosition()+1; + + $event = new UpdatePositionEvent($folder->getId(), UpdatePositionEvent::POSITION_DOWN); + + $folderAction = new Folder($this->getContainer()); + $folderAction->updatePosition($event); + + $updatedFolder = FolderQuery::create()->findPk($folder->getId()); + + $this->assertEquals($newPosition, $updatedFolder->getPosition(),sprintf("new position is %d, new position expected is %d for folder %d", $newPosition, $updatedFolder->getPosition(), $updatedFolder->getId())); + } + + public function testUpdatePositionWithSpecificPosition() + { + $folder = FolderQuery::create() + ->filterByPosition(1, Criteria::GREATER_THAN) + ->findOne(); + + if(null === $folder) { + $this->fail('use fixtures before launching test, there is no folder in database'); + } + + $event = new UpdatePositionEvent($folder->getId(), UpdatePositionEvent::POSITION_ABSOLUTE, 1); + + $folderAction = new Folder($this->getContainer()); + $folderAction->updatePosition($event); + + $updatedFolder = FolderQuery::create()->findPk($folder->getId()); + + $this->assertEquals(1, $updatedFolder->getPosition(),sprintf("new position is 1, new position expected is %d for folder %d", $updatedFolder->getPosition(), $updatedFolder->getId())); + + } + + /** + * @return \Thelia\Model\Folder + */ + protected function getRandomFolder() + { + $folder = FolderQuery::create() + ->addAscendingOrderByColumn('RAND()') + ->findOne(); + + if(null === $folder) { + $this->fail('use fixtures before launching test, there is no folder in database'); + } + + return $folder; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Tests/Action/ImageTest.php b/core/lib/Thelia/Tests/Action/ImageTest.php index f08da25b9..1b718f096 100755 --- a/core/lib/Thelia/Tests/Action/ImageTest.php +++ b/core/lib/Thelia/Tests/Action/ImageTest.php @@ -21,14 +21,14 @@ /* */ /*************************************************************************************/ -namespace Thelia\Tests\Action\ImageTest; +namespace Thelia\Tests\Action; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Session\Session; use Thelia\Action\Image; -use Thelia\Core\Event\ImageEvent; +use Thelia\Core\Event\Image\ImageEvent; use Thelia\Model\ConfigQuery; /** diff --git a/core/lib/Thelia/Tests/Action/OrderTest.php b/core/lib/Thelia/Tests/Action/OrderTest.php index 3802b362f..67628e718 100644 --- a/core/lib/Thelia/Tests/Action/OrderTest.php +++ b/core/lib/Thelia/Tests/Action/OrderTest.php @@ -25,12 +25,16 @@ namespace Thelia\Tests\Action; use Propel\Runtime\ActiveQuery\Criteria; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; -use Thelia\Core\Event\OrderEvent; +use Thelia\Core\Event\Order\OrderAddressEvent; +use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Session\Session; use Thelia\Core\Security\SecurityContext; use Thelia\Model\AddressQuery; +use Thelia\Model\Base\OrderAddressQuery; use Thelia\Model\Base\OrderProductQuery; +use Thelia\Model\Base\OrderQuery; +use Thelia\Model\OrderAddress; use Thelia\Model\OrderStatus; use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\Cart; @@ -62,7 +66,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase protected $orderAction; /** - * @var OrderEvent $orderEvent + * @var \Thelia\Core\Event\Order\OrderEvent $orderEvent */ protected $orderEvent; @@ -103,7 +107,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase /* load customer */ $this->customer = $this->loadCustomer(); - if(null === $this->customer) { + if (null === $this->customer) { return; } @@ -115,7 +119,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function loadCustomer() { $customer = CustomerQuery::create()->findOne(); - if(null === $customer) { + if (null === $customer) { return null; } @@ -137,7 +141,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase /* add 3 items */ $productList = array(); - for($i=0; $i<3; $i++) { + for ($i=0; $i<3; $i++) { $pse = ProductSaleElementsQuery::create() ->filterByProduct( ProductQuery::create() @@ -159,7 +163,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase ->setCart($cart) ->setProduct($pse->getProduct()) ->setProductSaleElements($pse) - ->setQuantity($i) + ->setQuantity($i+1) ->setPrice($pse->getPrice()) ->setPromoPrice($pse->getPromoPrice()) ->setPromo($pse->getPromo()) @@ -233,8 +237,8 @@ class OrderTest extends \PHPUnit_Framework_TestCase ->filterByActivate(1) ->findOne(); - if(null === $deliveryModule) { - return; + if (null === $deliveryModule) { + throw new \Exception('No Delivery Module fixture found'); } $paymentModule = ModuleQuery::create() @@ -242,8 +246,8 @@ class OrderTest extends \PHPUnit_Framework_TestCase ->filterByActivate(1) ->findOne(); - if(null === $paymentModule) { - return; + if (null === $paymentModule) { + throw new \Exception('No Payment Module fixture found'); } $this->orderEvent->getOrder()->chosenDeliveryAddress = $validDeliveryAddress->getId(); @@ -254,7 +258,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase /* memorize current stocks */ $itemsStock = array(); - foreach($this->cartItems as $index => $cartItem) { + foreach ($this->cartItems as $index => $cartItem) { $itemsStock[$index] = $cartItem->getProductSaleElements()->getQuantity(); } @@ -314,7 +318,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase $this->assertEquals($this->container->get('request')->getSession()->getLang()->getId(), $placedOrder->getLangId(), 'lang does not match'); /* check ordered product */ - foreach($this->cartItems as $index => $cartItem) { + foreach ($this->cartItems as $index => $cartItem) { $orderProduct = OrderProductQuery::create() ->filterByOrderId($placedOrder->getId()) ->filterByProductRef($cartItem->getProduct()->getRef()) @@ -343,11 +347,105 @@ class OrderTest extends \PHPUnit_Framework_TestCase /* check tax */ $orderProductTaxList = $orderProduct->getOrderProductTaxes(); - foreach($cartItem->getProduct()->getTaxRule()->getTaxDetail($validDeliveryAddress->getCountry(), $cartItem->getPromo() == 1 ? $cartItem->getPromoPrice() : $cartItem->getPrice()) as $index => $tax) { + foreach ($cartItem->getProduct()->getTaxRule()->getTaxDetail($validDeliveryAddress->getCountry(), $cartItem->getPrice(), $cartItem->getPromoPrice()) as $index => $tax) { $orderProductTax = $orderProductTaxList[$index]; $this->assertEquals($tax->getAmount(), $orderProductTax->getAmount()); + $this->assertEquals($tax->getPromoAmount(), $orderProductTax->getPromoAmount()); } } + return $placedOrder; } -} \ No newline at end of file + + /** + * @depends testCreate + * + * @param OrderModel $order + */ + public function testUpdateStatus(OrderModel $order) + { + $newStatus = $order->getStatusId() == 5 ? 1 : 5; + $this->orderEvent->setStatus($newStatus); + $this->orderEvent->setOrder($order); + + $this->orderAction->updateStatus($this->orderEvent); + + $this->assertEquals( + $newStatus, + $this->orderEvent->getOrder()->getStatusId() + ); + $this->assertEquals( + $newStatus, + OrderQuery::create()->findPk($order->getId())->getStatusId() + ); + } + + /** + * @depends testCreate + * + * @param OrderModel $order + */ + public function testUpdateDeliveryRef(OrderModel $order) + { + $deliveryRef = uniqid('DELREF'); + $this->orderEvent->setDeliveryRef($deliveryRef); + $this->orderEvent->setOrder($order); + + $this->orderAction->updateDeliveryRef($this->orderEvent); + + $this->assertEquals( + $deliveryRef, + $this->orderEvent->getOrder()->getDeliveryRef() + ); + $this->assertEquals( + $deliveryRef, + OrderQuery::create()->findPk($order->getId())->getDeliveryRef() + ); + } + + /** + * @depends testCreate + * + * @param OrderModel $order + */ + public function testUpdateAddress(OrderModel $order) + { + $deliveryRef = uniqid('DELREF'); + $orderAddress = OrderAddressQuery::create()->findPk($order->getDeliveryOrderAddressId()); + $title = $orderAddress->getCustomerTitleId() == 3 ? 1 : 3; + $country = $orderAddress->getCountryId() == 64 ? 1 : 64; + $orderAddressEvent = new OrderAddressEvent( + $title, 'B', 'C', 'D', 'E', 'F', 'G', 'H', $country, 'J', 'K' + ); + $orderAddressEvent->setOrderAddress($orderAddress); + $orderAddressEvent->setOrder($order); + + $this->orderAction->updateAddress($orderAddressEvent); + + $newOrderAddress = OrderAddressQuery::create()->findPk($orderAddress->getId()); + + $this->assertEquals($title, $orderAddressEvent->getOrderAddress()->getCustomerTitleId()); + $this->assertEquals('B', $orderAddressEvent->getOrderAddress()->getFirstname()); + $this->assertEquals('C', $orderAddressEvent->getOrderAddress()->getLastname()); + $this->assertEquals('D', $orderAddressEvent->getOrderAddress()->getAddress1()); + $this->assertEquals('E', $orderAddressEvent->getOrderAddress()->getAddress2()); + $this->assertEquals('F', $orderAddressEvent->getOrderAddress()->getAddress3()); + $this->assertEquals('G', $orderAddressEvent->getOrderAddress()->getZipcode()); + $this->assertEquals('H', $orderAddressEvent->getOrderAddress()->getCity()); + $this->assertEquals($country, $orderAddressEvent->getOrderAddress()->getCountryId()); + $this->assertEquals('J', $orderAddressEvent->getOrderAddress()->getPhone()); + $this->assertEquals('K', $orderAddressEvent->getOrderAddress()->getCompany()); + + $this->assertEquals($title, $newOrderAddress->getCustomerTitleId()); + $this->assertEquals('B', $newOrderAddress->getFirstname()); + $this->assertEquals('C', $newOrderAddress->getLastname()); + $this->assertEquals('D', $newOrderAddress->getAddress1()); + $this->assertEquals('E', $newOrderAddress->getAddress2()); + $this->assertEquals('F', $newOrderAddress->getAddress3()); + $this->assertEquals('G', $newOrderAddress->getZipcode()); + $this->assertEquals('H', $newOrderAddress->getCity()); + $this->assertEquals($country, $newOrderAddress->getCountryId()); + $this->assertEquals('J', $newOrderAddress->getPhone()); + $this->assertEquals('K', $newOrderAddress->getCompany()); + } +} diff --git a/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php b/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php index 1d6d08e92..680a487aa 100755 --- a/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php +++ b/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php @@ -40,7 +40,7 @@ class ModuleActivateCommandTest extends \PHPUnit_Framework_TestCase { $module = ModuleQuery::create()->findOne(); - if(null !== $module) { + if (null !== $module) { $application = new Application($this->getKernel()); $module->setActivate(BaseModule::IS_NOT_ACTIVATED); @@ -70,10 +70,9 @@ class ModuleActivateCommandTest extends \PHPUnit_Framework_TestCase { $testedModule = ModuleQuery::create()->findOneByCode('Letshopethismoduledoesnotexists'); - if(null == $testedModule) { + if (null == $testedModule) { $application = new Application($this->getKernel()); - $moduleActivate = new ModuleActivateCommand(); $moduleActivate->setContainer($this->getContainer()); diff --git a/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php b/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php index 7df8d6dfb..6e54417e3 100644 --- a/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php +++ b/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php @@ -23,7 +23,6 @@ namespace Thelia\Condition\Implementation; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Thelia\Condition\ConditionEvaluator; use Thelia\Condition\Operators; use Thelia\Coupon\AdapterInterface; diff --git a/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php b/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php index 97686e871..295d9a308 100644 --- a/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php +++ b/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php @@ -23,7 +23,6 @@ namespace Thelia\Condition\Implementation; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Thelia\Condition\ConditionEvaluator; use Thelia\Condition\ConditionFactory; use Thelia\Condition\Operators; @@ -95,7 +94,6 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ->method('getContainer') ->will($this->returnValue($stubContainer)); - $condition1 = new MatchForTotalAmountManager($stubAdapter); $operators = array( MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, @@ -302,7 +300,6 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ->method('getContainer') ->will($this->returnValue($stubContainer)); - $operators = array( MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT2 => Operators::EQUAL @@ -313,7 +310,6 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ); $condition1->setValidatorsFromForm($operators, $values); - $conditions = new ConditionCollection(); $conditions->add($condition1); @@ -369,7 +365,6 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ->method('getContainer') ->will($this->returnValue($stubContainer)); - $operators = array( MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT2 => Operators::EQUAL @@ -380,7 +375,6 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ); $condition1->setValidatorsFromForm($operators, $values); - $conditions = new ConditionCollection(); $conditions->add($condition1); diff --git a/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneManagerTest.php b/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneManagerTest.php index 85e357eca..726ed4988 100644 --- a/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneManagerTest.php +++ b/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneManagerTest.php @@ -26,7 +26,6 @@ namespace Thelia\Condition\Implementation; use Thelia\Condition\ConditionEvaluator; use Thelia\Condition\Operators; use Thelia\Coupon\AdapterInterface; -use Thelia\Exception\InvalidConditionValueException; use Thelia\Model\Currency; /** @@ -105,7 +104,6 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, $actual); } - /** * Check if condition is always matching * diff --git a/core/lib/Thelia/Tests/Condition/OperatorsTest.php b/core/lib/Thelia/Tests/Condition/OperatorsTest.php index 667714189..5d673e80b 100644 --- a/core/lib/Thelia/Tests/Condition/OperatorsTest.php +++ b/core/lib/Thelia/Tests/Condition/OperatorsTest.php @@ -103,12 +103,10 @@ class OperatorsTest extends \PHPUnit_Framework_TestCase { } - function callbackI18n() + public function callbackI18n() { $args = func_get_args(); return $args[0]; } } - - diff --git a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php index eb271d4c1..056a14927 100755 --- a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php +++ b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php @@ -103,7 +103,6 @@ abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase $stubRequestContext )); - $this->container->set('request', $request); $this->container->set('event_dispatcher', new EventDispatcher()); $this->container->set('thelia.securityContext', new SecurityContext($request)); diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php index 2b7019879..cd3a47df0 100644 --- a/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php @@ -23,7 +23,6 @@ namespace Thelia\Tests\Core\Template\Loop; -use Thelia\Model\DocumentQuery; use Thelia\Tests\Core\Template\Element\BaseLoopTestor; use Thelia\Core\Template\Loop\Document; diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php index ba4bfadc5..8c4906293 100644 --- a/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php @@ -23,7 +23,6 @@ namespace Thelia\Tests\Core\Template\Loop; -use Thelia\Model\ImageQuery; use Thelia\Tests\Core\Template\Element\BaseLoopTestor; use Thelia\Core\Template\Loop\Image; diff --git a/core/lib/Thelia/Tests/Module/BaseModuleTestor.php b/core/lib/Thelia/Tests/Module/BaseModuleTestor.php index ce70cd4ad..1a8de083a 100644 --- a/core/lib/Thelia/Tests/Module/BaseModuleTestor.php +++ b/core/lib/Thelia/Tests/Module/BaseModuleTestor.php @@ -23,7 +23,6 @@ namespace Thelia\Tests\Module; - /** * * @author Etienne Roudeix @@ -50,4 +49,3 @@ abstract class BaseModuleTestor extends \PHPUnit_Framework_TestCase $this->instance = $this->getTestedInstance(); } } - diff --git a/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php b/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php index 449a9162d..16b8e2f28 100644 --- a/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php +++ b/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php @@ -23,7 +23,6 @@ namespace Thelia\Tests\Rewriting; - /** * Class BaseRewritingObject * @package Thelia\Tests\Rewriting @@ -35,7 +34,7 @@ abstract class BaseRewritingObject extends \PHPUnit_Framework_TestCase /** * @return mixed an instance of Product, Folder, Content or Category Model */ - abstract function getObject(); + abstract public function getObject(); /** * @covers Thelia\Model\Tools\UrlRewritingTrait::generateRewrittenUrl @@ -105,4 +104,4 @@ abstract class BaseRewritingObject extends \PHPUnit_Framework_TestCase $object->generateRewrittenUrl('fr_FR'); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php b/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php index 247fdc8a9..f5ff56685 100644 --- a/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php +++ b/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php @@ -24,7 +24,6 @@ namespace Thelia\Tests\Rewriting; use Thelia\Model\Category; - /** * Class CategoryRewritingTest * @package Thelia\Tests\Rewriting @@ -36,8 +35,8 @@ class CategoryRewritingTest extends BaseRewritingObject /** * @return \Thelia\Model\Category */ - function getObject() + public function getObject() { return new Category(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php b/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php index e06ff62b2..97dd10bee 100644 --- a/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php +++ b/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php @@ -24,7 +24,6 @@ namespace Thelia\Tests\Rewriting; use Thelia\Model\Content; - /** * Class ContentRewritingTest * @package Thelia\Tests\Rewriting @@ -36,8 +35,8 @@ class ContentRewritingTest extends BaseRewritingObject /** * @return \Thelia\Model\Content */ - function getObject() + public function getObject() { return new Content(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php b/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php index db0dbc897..81e4154a2 100644 --- a/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php +++ b/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php @@ -24,7 +24,6 @@ namespace Thelia\Tests\Rewriting; use Thelia\Model\Folder; - /** * Class FolderRewritingTest * @package Thelia\Tests\Rewriting @@ -36,8 +35,8 @@ class FolderRewritingTest extends BaseRewritingObject /** * @return mixed an instance of Product, Folder, Content or Category Model */ - function getObject() + public function getObject() { return new Folder(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php b/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php index 2bff1bf5c..0a74587d5 100644 --- a/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php +++ b/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php @@ -23,8 +23,6 @@ namespace Thelia\Tests\Rewriting; use Thelia\Model\Product; -use Thelia\Model\ProductQuery; - /** * Class ProductRewriteTest @@ -37,8 +35,8 @@ class ProductRewriteTest extends BaseRewritingObject /** * @return mixed an instance of Product, Folder, Content or Category Model */ - function getObject() + public function getObject() { return new Product(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Tools/FileManagerTest.php b/core/lib/Thelia/Tests/Tools/FileManagerTest.php index 8c1c9fe99..1228867a7 100644 --- a/core/lib/Thelia/Tests/Tools/FileManagerTest.php +++ b/core/lib/Thelia/Tests/Tools/FileManagerTest.php @@ -3,15 +3,14 @@ * Created by JetBrains PhpStorm. * Date: 9/18/13 * Time: 8:47 PM - * + * * @author Guillaume MOREL */ -namespace Thelia\Tests\Type; +namespace Thelia\Tests\Tools; - -use Thelia\Core\Event\DocumentCreateOrUpdateEvent; -use Thelia\Core\Event\ImageCreateOrUpdateEvent; +use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent; +use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent; use Thelia\Core\Translation\Translator; use Thelia\Exception\ImageException; use Thelia\Model\Admin; @@ -20,11 +19,10 @@ use Thelia\Tools\FileManager; /** * Class FileManagerTest * - * @package Thelia\Tests\Type + * @package Thelia\Tests\Tools */ -class FileManagerTest extends \PHPUnit_Framework_TestCase { - - +class FileManagerTest extends \PHPUnit_Framework_TestCase +{ /** * @covers Thelia\Tools\FileManager::copyUploadedFile */ @@ -52,8 +50,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { ->method('getAdminUser') ->will($this->returnValue(new Admin())); - - // Create a map of arguments to return values. $map = array( array('thelia.translator', $stubTranslator), @@ -105,7 +101,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $this->assertCount(1, $actual); } - /** * @covers Thelia\Tools\FileManager::copyUploadedFile * @expectedException \Thelia\Exception\ImageException @@ -134,8 +129,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { ->method('getAdminUser') ->will($this->returnValue(new Admin())); - - // Create a map of arguments to return values. $map = array( array('thelia.translator', $stubTranslator), @@ -745,7 +738,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(false, $actual); } - /** * @covers Thelia\Tools\FileManager::getFormId */ @@ -799,7 +791,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { ->method('getClientOriginalName') ->will($this->returnValue('or1-g_n?al*/&é"filen@me#')); - $fileManager = new FileManager($stubContainer); $expected = 'or1-g_nalfilenme-1.yml'; @@ -827,7 +818,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { ->method('getClientOriginalName') ->will($this->returnValue('or1-g_n?al*/&é"filen@me#')); - $fileManager = new FileManager($stubContainer); $expected = 'or1-g_nalfilenme-1'; @@ -865,7 +855,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { } - /** * @covers Thelia\Tools\FileManager::getAvailableTypes */ diff --git a/core/lib/Thelia/Tools/FileManager.php b/core/lib/Thelia/Tools/FileManager.php index ba5e1d24a..a795bcd5e 100644 --- a/core/lib/Thelia/Tools/FileManager.php +++ b/core/lib/Thelia/Tools/FileManager.php @@ -24,8 +24,8 @@ namespace Thelia\Tools; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\File\UploadedFile; -use Thelia\Core\Event\DocumentCreateOrUpdateEvent; -use Thelia\Core\Event\ImageCreateOrUpdateEvent; +use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent; +use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent; use Thelia\Core\HttpFoundation\Request; use Thelia\Core\Translation\Translator; use Thelia\Exception\ImageException; @@ -156,7 +156,7 @@ class FileManager * @param ImageCreateOrUpdateEvent $event Image event * @param FolderImage|ContentImage|CategoryImage|ProductImage $modelImage Image to save * - * @return int Nb lines modified + * @return int Nb lines modified * @throws \Thelia\Exception\ImageException * @todo refactor make all pictures using propel inheritance and factorise image behaviour into one single clean action */ @@ -215,7 +215,7 @@ class FileManager * @param FolderDocument|ContentDocument|CategoryDocument|ProductDocument $modelDocument Document to save * * @throws \Thelia\Model\Exception\InvalidArgumentException - * @return int Nb lines modified + * @return int Nb lines modified * @todo refactor make all documents using propel inheritance and factorise image behaviour into one single clean action */ public function saveDocument(DocumentCreateOrUpdateEvent $event, $modelDocument) @@ -296,7 +296,6 @@ class FileManager ); } - /** * Delete image from file storage and database * @@ -313,7 +312,6 @@ class FileManager $model->delete(); } - /** * Get image model from type * @@ -723,4 +721,4 @@ class FileManager self::TYPE_MODULE, ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tools/I18n.php b/core/lib/Thelia/Tools/I18n.php index aeb79ca84..9931f4087 100644 --- a/core/lib/Thelia/Tools/I18n.php +++ b/core/lib/Thelia/Tools/I18n.php @@ -23,8 +23,6 @@ namespace Thelia\Tools; -use Propel\Runtime\ActiveQuery\ModelCriteria; -use Propel\Runtime\ActiveRecord\ActiveRecordInterface; use Thelia\Model\Lang; /** @@ -69,19 +67,19 @@ class I18n $askedLocale )->findOne(); /* or default translation */ - if(null === $i18n) { + if (null === $i18n) { $i18n = $i18nQueryClass::create() ->filterById($id) ->filterByLocale( Lang::getDefaultLanguage()->getLocale() )->findOne(); } - if(null === $i18n) { // @todo something else ? + if (null === $i18n) { // @todo something else ? $i18n = new $i18nClass();; $i18n->setId($id); - foreach($needed as $need) { + foreach ($needed as $need) { $method = sprintf('set%s', $need); - if(method_exists($i18n, $method)) { + if (method_exists($i18n, $method)) { $i18n->$method('DEFAULT ' . strtoupper($need)); } else { // @todo throw sg ? diff --git a/core/lib/Thelia/Tools/Image.php b/core/lib/Thelia/Tools/Image.php index 5fa4d3c6c..2558c9bd4 100755 --- a/core/lib/Thelia/Tools/Image.php +++ b/core/lib/Thelia/Tools/Image.php @@ -25,17 +25,16 @@ namespace Thelia\Tools; class Image { - static public function isImage($filePath, $allowedImageTypes = null) + public static function isImage($filePath, $allowedImageTypes = null) { $imageFile = getimagesize($filePath); $imageType = $imageFile[2]; - if(!is_array($allowedImageTypes) && $imageType != IMAGETYPE_UNKNOWN) { + if (!is_array($allowedImageTypes) && $imageType != IMAGETYPE_UNKNOWN) { return true; } - if(in_array($imageType , $allowedImageTypes)) - { + if (in_array($imageType , $allowedImageTypes)) { return true; } diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php index 363860064..83469f602 100755 --- a/core/lib/Thelia/Tools/URL.php +++ b/core/lib/Thelia/Tools/URL.php @@ -91,6 +91,7 @@ class URL $schemeAuthority = "$scheme://$host"."$port"; } + return $schemeAuthority.$this->requestContext->getBaseUrl(); } @@ -240,7 +241,7 @@ class URL } else { $allParametersWithoutView = $request->query->all(); $view = $request->attributes->get('_view'); - if(isset($allOtherParameters['view'])) { + if (isset($allOtherParameters['view'])) { unset($allOtherParameters['view']); } $this->retriever->rewrittenUrl = null; diff --git a/core/lib/Thelia/Type/FloatToFloatArrayType.php b/core/lib/Thelia/Type/FloatToFloatArrayType.php index 5a70dba91..682ddebdd 100755 --- a/core/lib/Thelia/Type/FloatToFloatArrayType.php +++ b/core/lib/Thelia/Type/FloatToFloatArrayType.php @@ -38,10 +38,11 @@ class FloatToFloatArrayType implements TypeInterface public function isValid($value) { if(!is_array($value)) + return false; - foreach($value as $key => $value) { - if( filter_var($key, FILTER_VALIDATE_FLOAT) === false || filter_var($value, FILTER_VALIDATE_FLOAT) === false ) { + foreach ($value as $key => $value) { + if ( filter_var($key, FILTER_VALIDATE_FLOAT) === false || filter_var($value, FILTER_VALIDATE_FLOAT) === false ) { return false; } } diff --git a/core/lib/Thelia/Type/ModelType.php b/core/lib/Thelia/Type/ModelType.php index 38df857e4..9eacef094 100755 --- a/core/lib/Thelia/Type/ModelType.php +++ b/core/lib/Thelia/Type/ModelType.php @@ -42,7 +42,7 @@ class ModelType implements TypeInterface { $class = '\\Thelia\\Model\\' . $expectedModelActiveRecord; - if(!(class_exists($class) && new $class instanceof ActiveRecordInterface)) { + if (!(class_exists($class) && new $class instanceof ActiveRecordInterface)) { throw new TypeException('MODEL NOT FOUND', TypeException::MODEL_NOT_FOUND); } diff --git a/install/faker.php b/install/faker.php index 268cd3abf..86b401aee 100755 --- a/install/faker.php +++ b/install/faker.php @@ -144,7 +144,7 @@ try { $stmt->execute(); - echo "Creating customer\n"; + echo "Creating customers\n"; //customer $customer = new Thelia\Model\Customer(); @@ -294,7 +294,7 @@ try { ->save(); } - echo "Creating folders and content\n"; + echo "Creating folders and contents\n"; //folders and contents $contentIdList = array(); diff --git a/install/import.php b/install/import.php index d0910eede..ab1cba486 100644 --- a/install/import.php +++ b/install/import.php @@ -41,14 +41,14 @@ $con->beginTransaction(); try { $stmt = $con->prepare("SET foreign_key_checks = 0"); $stmt->execute(); - clearTables(); + clearTables($con); $stmt = $con->prepare("SET foreign_key_checks = 1"); $stmt->execute(); - $categories = createCategories(); - $color = createColors(); - $brand = createBrand(); + $categories = createCategories($con); + $color = createColors($con); + $brand = createBrand($con); echo "creating templates\n"; $template = new \Thelia\Model\Template(); @@ -57,24 +57,24 @@ try { ->setName('template de démo') ->setLocale('en_US') ->setName('demo template') - ->save(); + ->save($con); $at = new Thelia\Model\AttributeTemplate(); $at ->setTemplate($template) ->setAttribute($color) - ->save(); + ->save($con); $ft = new Thelia\Model\FeatureTemplate(); $ft ->setTemplate($template) ->setFeature($brand) - ->save(); + ->save($con); echo "end creating templates\n"; - createProduct($faker, $categories, $template, $color, $brand); + createProduct($faker, $categories, $template, $color, $brand, $con); @@ -84,7 +84,7 @@ try { $con->rollBack(); } -function createProduct($faker, $categories, $template, $attribute, $feature) +function createProduct($faker, $categories, $template, $attribute, $feature, $con) { echo "start creating products\n"; $fileSystem = new \Symfony\Component\Filesystem\Filesystem(); @@ -121,11 +121,11 @@ function createProduct($faker, $categories, $template, $attribute, $feature) ->setChapo($data[3]) ->setDescription($data[5]) ->setPostscriptum($data[7]) - ->save(); + ->save($con); $productCategories = $product->getProductCategories()->getFirst(); $productCategories->setDefaultCategory(true) - ->save(); + ->save($con); // Set the position $product->setPosition($product->getNextPosition())->save(); @@ -139,7 +139,7 @@ function createProduct($faker, $categories, $template, $attribute, $feature) $productImage ->setProduct($product) ->setFile($image) - ->save(); + ->save($con); $fileSystem->copy(THELIA_ROOT . 'install/import/images/'.$image, THELIA_ROOT . 'local/media/images/product/'.$image, true); } @@ -160,39 +160,42 @@ function createProduct($faker, $categories, $template, $attribute, $feature) $stock->setNewness($faker->randomNumber(0,1)); $stock->setWeight($faker->randomFloat(2, 100,10000)); - $stock->save(); + $stock->save($con); $productPrice = new \Thelia\Model\ProductPrice(); $productPrice->setProductSaleElements($stock); $productPrice->setCurrencyId(1); $productPrice->setPrice($data[8]); $productPrice->setPromoPrice($data[9]); - $productPrice->save(); + $productPrice->save($con); $attributeAv = \Thelia\Model\AttributeAvI18nQuery::create() ->filterByLocale('en_US') ->filterByTitle($pse) - ->findOne(); + ->findOne($con); $attributeCombination = new \Thelia\Model\AttributeCombination(); $attributeCombination ->setAttributeId($attribute->getId()) ->setAttributeAvId($attributeAv->getId()) ->setProductSaleElements($stock) - ->save(); + ->save($con); } + $productSaleElements = $product->getProductSaleElementss()->getFirst(); + $productSaleElements->setIsDefault(1)->save($con); + $brand = $data[11]; $featurAv = \Thelia\Model\FeatureAvI18nQuery::create() ->filterByLocale('en_US') ->filterByTitle($brand) - ->findOne(); + ->findOne($con); $featureProduct = new Thelia\Model\FeatureProduct(); $featureProduct->setProduct($product) ->setFeatureId($feature->getId()) ->setFeatureAvId($featurAv->getId()) - ->save() + ->save($con) ; @@ -202,7 +205,7 @@ function createProduct($faker, $categories, $template, $attribute, $feature) echo "end creating products\n"; } -function createBrand() +function createBrand($con) { echo "start creating brands feature\n"; if (($handle = fopen(THELIA_ROOT . '/install/import/brand.csv', "r")) !== FALSE) { @@ -226,7 +229,7 @@ function createBrand() $feature->addFeatureAv($featureAv); } - $feature->save(); + $feature->save($con); fclose($handle); } echo "brands feature created successfully\n"; @@ -234,7 +237,7 @@ function createBrand() return $feature; } -function createCategories() +function createCategories($con) { echo "start creating categories\n"; $categories = array(); @@ -252,7 +255,7 @@ function createCategories() ->setTitle(trim($data[0])) ->setLocale('en_US') ->setTitle(trim($data[1])) - ->save(); + ->save($con); $categories[trim($data[1])] = $category; } fclose($handle); @@ -261,7 +264,7 @@ function createCategories() return $categories; } -function createColors() +function createColors($con) { echo "start creating colors attributes\n"; if (($handle = fopen(THELIA_ROOT . '/install/import/colors.csv', "r")) !== FALSE) { @@ -286,91 +289,91 @@ function createColors() $attribute->addAttributeAv($attributeAv); } - $attribute->save(); + $attribute->save($con); fclose($handle); } echo "colors attributes created with success\n"; return $attribute; } -function clearTables() +function clearTables($con) { $productAssociatedContent = Thelia\Model\ProductAssociatedContentQuery::create() - ->find(); - $productAssociatedContent->delete(); + ->find($con); + $productAssociatedContent->delete($con); $categoryAssociatedContent = Thelia\Model\CategoryAssociatedContentQuery::create() - ->find(); - $categoryAssociatedContent->delete(); + ->find($con); + $categoryAssociatedContent->delete($con); $featureProduct = Thelia\Model\FeatureProductQuery::create() - ->find(); - $featureProduct->delete(); + ->find($con); + $featureProduct->delete($con); $attributeCombination = Thelia\Model\AttributeCombinationQuery::create() - ->find(); - $attributeCombination->delete(); + ->find($con); + $attributeCombination->delete($con); $feature = Thelia\Model\FeatureQuery::create() - ->find(); - $feature->delete(); + ->find($con); + $feature->delete($con); $feature = Thelia\Model\FeatureI18nQuery::create() - ->find(); - $feature->delete(); + ->find($con); + $feature->delete($con); $featureAv = Thelia\Model\FeatureAvQuery::create() - ->find(); - $featureAv->delete(); + ->find($con); + $featureAv->delete($con); $featureAv = Thelia\Model\FeatureAvI18nQuery::create() - ->find(); - $featureAv->delete(); + ->find($con); + $featureAv->delete($con); $attribute = Thelia\Model\AttributeQuery::create() - ->find(); - $attribute->delete(); + ->find($con); + $attribute->delete($con); $attribute = Thelia\Model\AttributeI18nQuery::create() - ->find(); - $attribute->delete(); + ->find($con); + $attribute->delete($con); $attributeAv = Thelia\Model\AttributeAvQuery::create() - ->find(); - $attributeAv->delete(); + ->find($con); + $attributeAv->delete($con); $attributeAv = Thelia\Model\AttributeAvI18nQuery::create() - ->find(); - $attributeAv->delete(); + ->find($con); + $attributeAv->delete($con); $category = Thelia\Model\CategoryQuery::create() - ->find(); - $category->delete(); + ->find($con); + $category->delete($con); $category = Thelia\Model\CategoryI18nQuery::create() - ->find(); - $category->delete(); + ->find($con); + $category->delete($con); $product = Thelia\Model\ProductQuery::create() - ->find(); - $product->delete(); + ->find($con); + $product->delete($con); $product = Thelia\Model\ProductI18nQuery::create() - ->find(); - $product->delete(); + ->find($con); + $product->delete($con); $accessory = Thelia\Model\AccessoryQuery::create() - ->find(); - $accessory->delete(); + ->find($con); + $accessory->delete($con); $stock = \Thelia\Model\ProductSaleElementsQuery::create() - ->find(); - $stock->delete(); + ->find($con); + $stock->delete($con); $productPrice = \Thelia\Model\ProductPriceQuery::create() - ->find(); - $productPrice->delete(); + ->find($con); + $productPrice->delete($con); - \Thelia\Model\ProductImageQuery::create()->find()->delete(); + \Thelia\Model\ProductImageQuery::create()->find($con)->delete($con); } \ No newline at end of file diff --git a/install/insert.sql b/install/insert.sql index ec4e1b02b..d91c511dc 100755 --- a/install/insert.sql +++ b/install/insert.sql @@ -27,7 +27,8 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat ('thelia_admin_remember_me_cookie_expiration', 2592000, 0, 0, NOW(), NOW()), ('thelia_customer_remember_me_cookie_name', 'tcrmcn', 0, 0, NOW(), NOW()), ('thelia_customer_remember_me_cookie_expiration', 31536000, 0, 0, NOW(), NOW()), -('session_config.handlers', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler', 0, 0, NOW(), NOW()) +('session_config.handlers', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler', 0, 0, NOW(), NOW()), +('company_name','', 0, 0, NOW(), NOW()) ; diff --git a/install/thelia.sql b/install/thelia.sql index 9b4ea4880..4371aa4f5 100755 --- a/install/thelia.sql +++ b/install/thelia.sql @@ -93,7 +93,7 @@ DROP TABLE IF EXISTS `country`; CREATE TABLE `country` ( - `id` INTEGER NOT NULL, + `id` INTEGER NOT NULL AUTO_INCREMENT, `area_id` INTEGER, `isocode` VARCHAR(4) NOT NULL, `isoalpha2` VARCHAR(2), diff --git a/local/config/schema.xml b/local/config/schema.xml index 718ac3a7b..65928176e 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -1,1258 +1,1258 @@ - + - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
diff --git a/local/modules/TheliaDebugBar/DataCollector/PropelCollector.php b/local/modules/TheliaDebugBar/DataCollector/PropelCollector.php index 2605e07dd..00d99f9d2 100755 --- a/local/modules/TheliaDebugBar/DataCollector/PropelCollector.php +++ b/local/modules/TheliaDebugBar/DataCollector/PropelCollector.php @@ -47,10 +47,9 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa public function __construct(LoggerInterface $alternativeLogger = null) { - $serviceContainer = Propel::getServiceContainer(); - $serviceContainer->setLogger('defaultLogger', $this); + $con = Propel::getServiceContainer()->getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME); + $con->setLogger($this); - $con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME); $con->setLogMethods(array( 'exec', 'query', diff --git a/reset_install.sh b/reset_install.sh index 8280173d9..a91a2dc1c 100755 --- a/reset_install.sh +++ b/reset_install.sh @@ -9,6 +9,9 @@ read test echo -e "\n\033[01;34m[INFO] Clearing caches\033[00m\n" php Thelia cache:clear +echo -e "\n\033[01;34m[INFO] Self-updating Composer\033[00m\n" +composer self-update + echo -e "\n\033[01;34m[INFO] Downloading vendors\033[00m\n" composer install --prefer-dist --optimize-autoloader diff --git a/templates/admin/default/admin-layout.tpl b/templates/admin/default/admin-layout.tpl index 03765e97f..592e47d28 100644 --- a/templates/admin/default/admin-layout.tpl +++ b/templates/admin/default/admin-layout.tpl @@ -4,6 +4,9 @@ {check_auth roles="ADMIN" permissions="{block name="check-permissions"}{/block}" login_tpl="/admin/login"} {/block} +{* -- Define some stuff for Smarty ----------------------------------------- *} +{config_load file='variables.conf'} + @@ -111,26 +114,30 @@ {/loop} {loop name="menu-auth-order" type="auth" roles="ADMIN" permissions="admin.orders.view"} - {/loop} {loop name="menu-auth-catalog" type="auth" roles="ADMIN" permissions="admin.catalog.view"} diff --git a/templates/admin/default/ajax/address-update-modal.html b/templates/admin/default/ajax/address-update-modal.html new file mode 100644 index 000000000..39bafccea --- /dev/null +++ b/templates/admin/default/ajax/address-update-modal.html @@ -0,0 +1,111 @@ +{* Update an Address *} + +{form name="thelia.address.update"} + +{* Capture the dialog body, to pass it to the generic dialog *} +{capture "edit_address_dialog"} + + {form_hidden_fields form=$form} + + {form_field form=$form field='label'} +
+ + +
+ {/form_field} + + {form_field form=$form field='company'} +
+ + +
+ {/form_field} + + {form_field form=$form field='title'} +
+ + + +
+ {/form_field} + + {form_field form=$form field='firstname'} +
+ + +
+ {/form_field} + + {form_field form=$form field='lastname'} +
+ + +
+ {/form_field} + + {form_field form=$form field='address1'} +
+ + +
+ +
+ {form_field form=$form field='address2'} + + {/form_field} +
+ +
+ {form_field form=$form field='address3'} + + {/form_field} +
+ {/form_field} + + {form_field form=$form field='zipcode'} +
+ + +
+ {/form_field} + + {form_field form=$form field='city'} +
+ + +
+ {/form_field} + + {form_field form=$form field='country'} +
+ + +
+ {/form_field} + +{/capture} + + {include + file = "includes/generic-create-dialog.html" + + dialog_id = "edit_address_dialog" + dialog_title = {intl l="Edit an address"} + dialog_body = {$smarty.capture.edit_address_dialog nofilter} + +dialog_ok_label = {intl l="Edit this address"} +dialog_cancel_label = {intl l="Cancel"} + +form_action = {url path="/admin/address/save/{$address_id}"} +form_enctype = {form_enctype form=$form} +form_error_message = $form_error_message +} + +{/form} \ No newline at end of file diff --git a/templates/admin/default/assets/less/thelia/navbar.less b/templates/admin/default/assets/less/thelia/navbar.less index a0080e775..41725c5d8 100755 --- a/templates/admin/default/assets/less/thelia/navbar.less +++ b/templates/admin/default/assets/less/thelia/navbar.less @@ -9,6 +9,14 @@ // Base class and wrapper .navbar { margin-bottom: 0; + .dropdown-menu { + > li { + > a > .label { + font-size: 15px; + } + } + + } } // Inner for background effects diff --git a/templates/admin/default/assets/less/thelia/tables.less b/templates/admin/default/assets/less/thelia/tables.less index e542786ec..1f6212447 100755 --- a/templates/admin/default/assets/less/thelia/tables.less +++ b/templates/admin/default/assets/less/thelia/tables.less @@ -13,6 +13,19 @@ } } } + + tbody { + tr.active, tr { + td.td-unstyled { + background-color: white; + border-top: none; + border-right: 1px solid @table-border-color; + } + td.last { + border-bottom: 1px solid @table-border-color; + } + } + } } @@ -55,10 +68,6 @@ tfoot{ } } - // td, th { - // text-align: center; - // } - td.object-title, th.object-title { text-align: left; } diff --git a/templates/admin/default/assets/less/thelia/thelia.less b/templates/admin/default/assets/less/thelia/thelia.less index 1b898052b..11dc5bd74 100644 --- a/templates/admin/default/assets/less/thelia/thelia.less +++ b/templates/admin/default/assets/less/thelia/thelia.less @@ -193,6 +193,11 @@ padding: 1em; margin-bottom: 20px; + .select-fixed-width { + width: 120px; + } + + // The block title .title { color: #5A6876; @@ -290,6 +295,13 @@ width: auto; } +.modal-backdrop .loading { + left: 50%; + top: 50%; + right: auto; + position: absolute; +} + .existing-image .col-sm-6{ position: relative; diff --git a/templates/admin/default/configs/variables.conf b/templates/admin/default/configs/variables.conf new file mode 100644 index 000000000..d80dba5f7 --- /dev/null +++ b/templates/admin/default/configs/variables.conf @@ -0,0 +1,9 @@ +#order +max_displayed_orders = 20 + +#order status +order_not_paid = 'warning' +order_paid = 'success' +order_processing = 'primary' +order_sent = 'info' +order_canceled = 'danger' \ No newline at end of file diff --git a/templates/admin/default/content-edit.html b/templates/admin/default/content-edit.html index 40b0d5600..a4a80acf8 100644 --- a/templates/admin/default/content-edit.html +++ b/templates/admin/default/content-edit.html @@ -8,7 +8,7 @@
- {* include file="includes/folder-breadcrumb.html" editing_category="true" *} + {include file="includes/folder-breadcrumb.html" editing_category="false" editing_content="true"}
{loop name="content_edit" type="content" visible="*" id="{$content_id}" backend_context="1" lang="$edit_language_id"} @@ -42,7 +42,7 @@
-
-
-
- - - {include - file="includes/inner-form-toolbar.html" - hide_submit_buttons=true - close_url="{url path='/admin/folders' folder_id=$folder_id}" - } - - - - - {ifloop rel="folders"} -
- -
-
- -
- {intl l='Select a folder to get its content'} -
- -
-
-
- - - - -
- - {intl l='Select a content and click (+) to add it to this category'} -
-
- -
- {/ifloop} - - {elseloop rel="folders"} -
{intl l="No folders found"}
- {/elseloop} - - -
- - - - - - - - - {module_include location='folder_contents_table_header'} - - - - - - - {*loop name="assigned_contents" type="associated_content" folder="$folder_id" backend_context="1" lang="$edit_language_id"} - - - - - - {module_include location='folder_contents_table_row'} - - - - {/loop} - - {elseloop rel="assigned_contents"} - - - - {/elseloop*} - -
{intl l='ID'}{intl l='Attribute title'}{intl l="Actions"}
{$ID} - {$TITLE} - -
- {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.folder.content.delete"} - - - - {/loop} -
-
-
- {intl l="This folder contains no contents"} -
-
-
+
+ {include file="includes/content-folder-management.html"}
@@ -265,28 +165,29 @@
-{* Delete related content confirmation dialog *} +{* Delete category confirmation dialog *} - {capture "delete_content_dialog"} - - - + {capture "delete_folder_dialog"} + + - + {/capture} {include file = "includes/generic-confirm-dialog.html" - dialog_id = "delete_content_dialog" - dialog_title = {intl l="Remove related content"} - dialog_message = {intl l="Do you really want to remove this related content ?"} + dialog_id = "delete_folder_dialog" + dialog_title = {intl l="Remove associated folder"} + dialog_message = {intl l="Do you really want to remove the content from this folder ?"} -form_action = {url path='/admin/folders/related-content/delete'} -form_content = {$smarty.capture.delete_content_dialog nofilter} +form_action = {url path='/admin/content/folder/delete'} +form_content = {$smarty.capture.delete_folder_dialog nofilter} } {/block} + + {block name="javascript-initialization"} {javascripts file='assets/js/dropzone.js'} @@ -314,6 +215,9 @@ form_content = {$smarty.capture.delete_content_dialog nofilter} $('#tabbed-menu a[href="#{$current_tab}"]').tab('show') {/if} + $('a.delete-folder').click(function(e) { + $('#additional_folder_delete_id').val($(this).data('id')); + }); // Set proper content ID in delete content from $('a.delete-content').click(function(ev) { diff --git a/templates/admin/default/countries.html b/templates/admin/default/countries.html index fe1b614a1..6de45aa38 100644 --- a/templates/admin/default/countries.html +++ b/templates/admin/default/countries.html @@ -35,12 +35,12 @@ - ID - Name - Default - Shop - N° ISO - ISO Code + {intl l="ID"} + {intl l="Name"} + {intl l="Default"} + {intl l="Shop"} + {intl l="N° ISO"} + {intl l="ISO Code"} {module_include location='countries_table_header'} @@ -54,8 +54,8 @@ {$ID} {$TITLE} -
- +
+
@@ -71,7 +71,7 @@
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.countries.change"} - + {/loop} @@ -121,7 +121,7 @@ {form_field form=$form field='success_url'} {* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} - + {/form_field} {form_field form=$form field='title'} @@ -160,6 +160,12 @@
{/form_field} + {loop type="lang" name="default-lang" default_only="1"} + + {form_field form=$form field='locale'} + + {/form_field} + {/loop} {module_include location='country_create_form'} @@ -202,6 +208,23 @@ form_content = {$smarty.capture.delete_dialog nofilter} } + + {/block} {block name="javascript-initialization"} @@ -210,10 +233,30 @@ {/javascripts} diff --git a/templates/admin/default/country-edit.html b/templates/admin/default/country-edit.html index fe1a0f240..b5d68e46b 100644 --- a/templates/admin/default/country-edit.html +++ b/templates/admin/default/country-edit.html @@ -92,13 +92,13 @@ {form_field form=$form field='title'}
- +
{/form_field} - {form_field form=$form field='short-description'} + {form_field form=$form field='chapo'}
- +
{/form_field} {form_field form=$form field='description'} diff --git a/templates/admin/default/customer-edit.html b/templates/admin/default/customer-edit.html index 9bcba75b9..69e1815f3 100644 --- a/templates/admin/default/customer-edit.html +++ b/templates/admin/default/customer-edit.html @@ -44,7 +44,7 @@ {/form_field} {if $form_error}
{$form_error_message}
{/if} - + {loop name="address" type="address" customer="$customer_id" backend_context="1" default="true"}

{intl l="Customer informations"}

@@ -74,7 +74,7 @@
{/form_field} - {loop name="address" type="address" customer="$customer_id" backend_context="1" default="true"} +

{intl l="Default address"}

@@ -171,15 +171,15 @@
- + - + - + @@ -218,7 +218,7 @@
- +
{* Add an Address *} {form name="thelia.address.create"} @@ -227,7 +227,10 @@ {capture "address_creation_dialog"} {form_hidden_fields form=$form} - + + {form_field form=$form field='success_url'} + + {/form_field} {form_field form=$form field='label'}
@@ -246,7 +249,7 @@
- {loop type="title" name="title1"} {/loop} @@ -257,21 +260,21 @@ {form_field form=$form field='firstname'}
- +
{/form_field} {form_field form=$form field='lastname'}
- +
{/form_field} {form_field form=$form field='address1'}
- +
@@ -290,21 +293,21 @@ {form_field form=$form field='zipcode'}
- +
{/form_field} {form_field form=$form field='city'}
- +
{/form_field} {form_field form=$form field='country'}
- {loop type="country" name="country1"} {/loop} @@ -331,117 +334,7 @@ {/form} - {* Update an Address *} - {form name="thelia.address.update"} - - {* Capture the dialog body, to pass it to the generic dialog *} - {capture "edit_address_dialog"} - - {form_hidden_fields form=$form} - - {form_field form=$form field='label'} -
- - -
- {/form_field} - - {form_field form=$form field='company'} -
- - -
- {/form_field} - - {form_field form=$form field='title'} -
- - - -
- {/form_field} - - {form_field form=$form field='firstname'} -
- - -
- {/form_field} - - {form_field form=$form field='lastname'} -
- - -
- {/form_field} - - {form_field form=$form field='address1'} -
- - -
- -
- {form_field form=$form field='address2'} - - {/form_field} -
- -
- {form_field form=$form field='address3'} - - {/form_field} -
- {/form_field} - - {form_field form=$form field='zipcode'} -
- - -
- {/form_field} - - {form_field form=$form field='city'} -
- - -
- {/form_field} - - {form_field form=$form field='country'} -
- - -
- {/form_field} - - {/capture} - - {include - file = "includes/generic-create-dialog.html" - - dialog_id = "edit_address_dialog" - dialog_title = {intl l="Edit an address"} - dialog_body = {$smarty.capture.edit_address_dialog nofilter} - - dialog_ok_label = {intl l="Edit this address"} - dialog_cancel_label = {intl l="Cancel"} - - form_action = {url path='/admin/address/update'} - form_enctype = {form_enctype form=$form} - form_error_message = $form_error_message - } - - {/form} {* Default confirmation dialog *} @@ -475,7 +368,7 @@ dialog_message = {intl l="Do you really want to delete this address ?"} form_action = {url path='/admin/address/delete'} - form_content = {$smarty.capture.delete_dialog nofilter} + form_content = {$smarty.capture.delete_address_dialog nofilter} } {/block} @@ -483,4 +376,35 @@ {javascripts file='assets/js/main.js'} {/javascripts} + + {/block} \ No newline at end of file diff --git a/templates/admin/default/customers.html b/templates/admin/default/customers.html index 9d74835d7..cfa332ae4 100644 --- a/templates/admin/default/customers.html +++ b/templates/admin/default/customers.html @@ -64,9 +64,21 @@ - {loop name="customer_list" type="customer" current="false" visible="*" last_order="1" backend_context="1" page={$customer_page} limit={$display_customer}} + {loop name="customer_list" type="customer" current="false" visible="*" backend_context="1" page={$customer_page} limit={$display_customer}} + {assign "lastOrderDate" ''} + {assign "lastOrderAmount" ''} + {assign "lastOrderCurrency" ''} + + {loop type="order" name="last-order" customer=$ID order="create-date-reverse" limit="1"} + {assign "lastOrderDate" "{format_date date=$CREATE_DATE}"} + {assign "lastOrderAmount" "{format_number number=$TOTAL_TAXED_AMOUNT}"} + {loop type="currency" name="order-currency" id=$CURRENCY} + {assign "lastOrderCurrency" $SYMBOL} + {/loop} + {/loop} + - {$REF} + {$REF} {$COMPANY} @@ -79,11 +91,11 @@ {module_include location='customer_list_row'} - {format_date date=$LASTORDER_DATE} + {$lastOrderDate} - {format_number number=$LASTORDER_AMOUNT} + {$lastOrderCurrency} {$lastOrderAmount}
diff --git a/templates/admin/default/folder-edit.html b/templates/admin/default/folder-edit.html index bac087096..6a0b962e4 100644 --- a/templates/admin/default/folder-edit.html +++ b/templates/admin/default/folder-edit.html @@ -8,7 +8,7 @@
- {* include file="includes/folder-breadcrumb.html" editing_category="true" *} + {include file="includes/folder-breadcrumb.html" editing_category="true" }
{loop name="folder_edit" type="folder" visible="*" id="{$folder_id}" backend_context="1" lang="$edit_language_id"} diff --git a/templates/admin/default/folders.html b/templates/admin/default/folders.html index 99c811311..7a68d5bf0 100644 --- a/templates/admin/default/folders.html +++ b/templates/admin/default/folders.html @@ -5,332 +5,337 @@ {block name="check-permissions"}admin.folders.view{/block} {block name="main-content"} -
+
- {* include file="includes/folder-breadcrumb.html" *} + {include file="includes/folder-breadcrumb.html" folder_id=$parent } - {module_include location='folders_top'} + {module_include location='folders_top'} -
-
-
-
- -
- {* display parent folder name, and get current folder ID *} - {loop name="folder_title" type="folder" visible="*" id=$folder_id} - {intl l="Folders in %fold" fold=$TITLE} - {$fold_id = $ID} - {/loop} - {elseloop rel="folder_title"} - {intl l="Top level folders"} - {/elseloop} +
+
+
+
+ + *} + {module_include location='folder_list_caption'} - {module_include location='folder_list_caption'} + {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.folders.create"} + + + + {/loop} + - {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.folders.create"} - - - - {/loop} - + {ifloop rel="folder_list"} + + + - {ifloop rel="folder_list"} - - - + - + - + {module_include location='folder_list_header'} - {module_include location='folder_list_header'} + - + - + + + - - - + + {loop name="folder_list" type="folder" visible="*" parent=$parent order=$folder_order backend_context="1" lang=$lang_id} + + - - {loop name="folder_list" type="folder" visible="*" parent=$folder_id order=$folder_order backend_context="1" lang=$lang_id} - - + - + - + {module_include location='folder_list_row'} - {module_include location='folder_list_row'} + - {elseloop rel="can_change"} -
- -
- {/elseloop} - + - + + + {/loop} + + {/ifloop} - {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.folders.delete"} - - {/loop} - - - - {/loop} - - {/ifloop} + {elseloop rel="folder_list"} + + + - - - - - {/elseloop} -
+ {* display parent folder name, and get current folder ID *} + {loop name="folder_title" type="folder" visible="*" id=$parent} + {intl l="Folders in %fold" fold=$TITLE} + {$fold_id = $ID} + {/loop} + {elseloop rel="folder_title"} + {intl l="Top level folders"} + {/elseloop} +{* +
+ + {$TITLE} + +
+ {admin_sortable_header + current_order=$folder_order + order='id' + reverse_order='id_reverse' + path={url path='/admin/folders' parent=$parent} + request_parameter_name='folder_order' + label="{intl l='ID'}" + } +
- {admin_sortable_header - current_order=$folder_order - order='id' - reverse_order='id_reverse' - path={url path='/admin/folders' id_folder=$folder_id} - request_parameter_name='folder_order' - label="{intl l='ID'}" - } -    + {admin_sortable_header + current_order=$folder_order + order='alpha' + reverse_order='alpha_reverse' + path={url path='/admin/folders' parent=$parent} + request_parameter_name='folder_order' + label="{intl l='Folder title'}" + } + - {admin_sortable_header - current_order=$folder_order - order='alpha' - reverse_order='alpha_reverse' - path={url path='/admin/folders' id_folder=$folder_id} - request_parameter_name='folder_order' - label="{intl l='Folder title'}" - } - + {admin_sortable_header + current_order=$folder_order + order='visible' + reverse_order='visible_reverse' + path={url path='/admin/folders' parent=$parent} + request_parameter_name='folder_order' + label="{intl l='Online'}" + } + - {admin_sortable_header - current_order=$folder_order - order='visible' - reverse_order='visible_reverse' - path={url path='/admin/folders' id_folder=$folder_id} - request_parameter_name='folder_order' - label="{intl l='Online'}" - } - + {admin_sortable_header + current_order=$folder_order + order='manual' + reverse_order='manual_reverse' + path={url path='/admin/folders' parent=$parent} + request_parameter_name='folder_order' + label="{intl l='Position'}" + } + - {admin_sortable_header - current_order=$folder_order - order='manual' - reverse_order='manual_reverse' - path={url path='/admin/folders' id_folder=$folder_id} - request_parameter_name='folder_order' - label="{intl l='Position'}" - } - {intl l='Actions'}
{intl l='Actions'}
{$ID}
{$ID} + {loop type="image" name="folder_image" source="folder" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"} + {$TITLE} + {/loop} + - {loop type="image" name="folder_image" source="folder" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"} - {$TITLE} - {/loop} - + + {$TITLE} + + - - {$TITLE} - - + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.folders.edit"} +
+ +
+ {/loop} -
- {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.folders.edit"} -
- -
- {/loop} + {elseloop rel="can_change"} +
+ +
+ {/elseloop} +
+ {admin_position_block + permission="admin.folders.edit" + path={url path='admin/folders/update-position' folder_id=$ID} + url_parameter="folder_id" + in_place_edit_class="folderPositionChange" + position=$POSITION + id=$ID + } + - {admin_position_block - permission="admin.folders.edit" - path={url path='admin/folders/update-position' folder_id=$ID} - url_parameter="folder_id" - in_place_edit_class="folderPositionChange" - position=$POSITION - id=$ID - } - +
+ -
-
- + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.folders.edit"} + + {/loop} - {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.folders.edit"} - - {/loop} + {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.folders.delete"} + + {/loop} +
+
+
+ {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.folders.create"} + {intl l="This folder has no sub-folders. To create a new one, click the + button above."} + {/loop} - {elseloop rel="folder_list"} -
-
- {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.folders.create"} - {intl l="This folder has no sub-folders. To create a new one, click the + button above."} - {/loop} - - {elseloop rel="can_create"} + {elseloop rel="can_create"} {intl l="This folder has no sub-folders."} - {/elseloop} -
-
-
+ {/elseloop} +
+ + + + {/elseloop} +
+
-{* -- CONTENT MANAGEMENT ---------------------------------------------------- *} + {* -- CONTENT MANAGEMENT ---------------------------------------------------- *} -
-
-
+
+
+
- - + + + + + {/elseloop} +
- {* display parent folder name *} - {loop name="folder_title" type="folder" visible="*" id=$folder_id} - {intl l="Contents in %fold" fold=$TITLE} - {/loop} + + + + + + - {ifloop rel="content_list"} - - - + + + - + } + - + } + - - - + + + - - {loop name="content_list" type="content" visible="*" folder_default=$folder_id order=$content_order} - - + + {loop name="content_list" type="content" visible="*" folder_default=$parent order=$content_order} + + - + - {module_include location='content_list_row'} + {module_include location='content_list_row'} - + + + + + + {/loop} + + {/ifloop} - {elseloop rel="can_change"} -
- -
- {/elseloop} - - - - - - - {/loop} - - {/ifloop} - - {elseloop rel="content_list"} - - - - - - {/elseloop} -
+ {* display parent folder name *} + {loop name="folder_title" type="folder" visible="*" id=$parent} + {intl l="Contents in %fold" fold=$TITLE} + {/loop} - {elseloop rel="folder_title"} - {intl l="Top level Contents"} - {/elseloop} + {elseloop rel="folder_title"} + {intl l="Top level Contents"} + {/elseloop} - {module_include location='content_list_caption'} + {module_include location='content_list_caption'} - - - -
- {admin_sortable_header + {ifloop rel="content_list"} +
+ {admin_sortable_header current_order=$content_order order='id' reverse_order='id_reverse' - path={url path='/admin/folders' id_folder=$folder_id target='contents'} + path={url path='/admin/folders' parent=$parent target='contents'} label="{intl l='ID'}" - } + } -    - {admin_sortable_header + + {admin_sortable_header current_order=$content_order order='alpha' reverse_order='alpha_reverse' - path={url path='/admin/folders' id_folder=$folder_id target='contents'} + path={url path='/admin/folders' parent=$parent target='contents'} label="{intl l='Content title'}" - } + } - {module_include location='content_list_header'} + {module_include location='content_list_header'} - - {admin_sortable_header + + {admin_sortable_header current_order=$content_order order='visible' reverse_order='visible_reverse' - path={url path='/admin/folders' id_folder=$folder_id target='contents'} + path={url path='/admin/folders' parent=$parent target='contents'} label="{intl l='Online'}" - } - - {admin_sortable_header + + {admin_sortable_header current_order=$content_order order='manual' reverse_order='manual_reverse' - path={url path='/admin/folders' id_folder=$folder_id target='contents'} + path={url path='/admin/folders' parent=$parent target='contents'} label="{intl l='Position'}" - } -  
 
{$ID}
{$ID} - {loop type="image" name="folder_image" source="content" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"} - - {$TITLE} - - {/loop} + + {loop type="image" name="folder_image" source="content" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"} + + {$TITLE} + + {/loop} - {$TITLE}{$TITLE} - {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.contents.edit"} -
- +
+ {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.contents.edit"} +
+ +
+ {/loop} + + {elseloop rel="can_change"} +
+ +
+ {/elseloop} +
+ {admin_position_block + permission="admin.content.edit" + path={url path='/admin/content/update-position' content_id=$ID} + url_parameter="content_id" + in_place_edit_class="contentPositionChange" + position=$POSITION + id=$ID + } + +
+ {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.content.edit"} + + {/loop} + + {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.content.delete"} + + {/loop}
- {/loop} +
- {admin_position_block - permission="admin.content.edit" - path={url path='/admin/content/update-position' content_id=$ID} - url_parameter="content_id" - in_place_edit_class="contentPositionChange" - position=$POSITION - id=$ID - } - -
- {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.content.edit"} - - {/loop} - - {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.content.delete"} - - {/loop} -
-
{intl l="This folder doesn't contains any contents. To add a new content, click the + button above."}
+ {elseloop rel="content_list"} +
{intl l="This folder doesn't contains any contents. To add a new content, click the + button above."}
-
+
- {module_include location='folders_bottom'} + {module_include location='folders_bottom'}
-
+
{* -- Adding a new folder ------------------------------------------------- *} -{form name="thelia.admin.folder.creation"} + {form name="thelia.admin.folder.creation"} {* Capture the dialog body, to pass it to the generic dialog *} {capture "folder_creation_dialog"} @@ -338,12 +343,12 @@ {form_hidden_fields form=$form} {form_field form=$form field='success_url'} - {* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} - + {* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} + {/form_field} {form_field form=$form field='parent'} - + {/form_field} {form_field form=$form field='title'} @@ -357,12 +362,12 @@
{intl l='Enter here the folder name in the default language (%title)' title="$TITLE"}
- {* Switch edition to the current locale *} + {* Switch edition to the current locale *} - {form_field form=$form field='locale'} - - {/form_field} + {form_field form=$form field='locale'} + + {/form_field} {/loop}
{/form_field} @@ -382,55 +387,55 @@ {/capture} - {include + {include file = "includes/generic-create-dialog.html" dialog_id = "folder_creation_dialog" dialog_title = {intl l="Create a new folder"} dialog_body = {$smarty.capture.folder_creation_dialog nofilter} - dialog_ok_label = {intl l="Create this folder"} + dialog_ok_label = {intl l="Create this folder"} - form_action = {url path='/admin/folders/create'} - form_enctype = {form_enctype form=$form} - form_error_message = $form_error_message + form_action = {url path='/admin/folders/create'} + form_enctype = {form_enctype form=$form} + form_error_message = $form_error_message } -{/form} + {/form} {* -- Adding a new content -------------------------------------------------- *} -{form name="thelia.admin.content.creation"} + {form name="thelia.admin.content.creation"} {* Capture the dialog body, to pass it to the generic dialog *} - {capture "content_creation_dialog"} +{capture "content_creation_dialog"} - {form_hidden_fields form=$form} +{form_hidden_fields form=$form} - {* Be sure to get the folder_id, even if the form could not be validated *} - +{* Be sure to get the folder_id, even if the form could not be validated *} + - {form_field form=$form field='success_url'} - {* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} - - {/form_field} + {form_field form=$form field='success_url'} + {* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} + + {/form_field} - {form_field form=$form field='default_folder'} - - {/form_field} + {form_field form=$form field='default_folder'} + + {/form_field} - {form_field form=$form field='title'} -
- - {loop type="lang" name="default-lang" default_only="1"} -
- + {form_field form=$form field='title'} +
+ + {loop type="lang" name="default-lang" default_only="1"} +
+ $TITLE -
+
-
{intl l='Enter here the content name in the default language (%title)' title="$TITLE"}
+
{intl l='Enter here the content name in the default language (%title)' title="$TITLE"}
- {* Switch edition to the current locale *} - + {* Switch edition to the current locale *} + {form_field form=$form field='locale'} @@ -455,18 +460,18 @@ {/capture} {include - file = "includes/generic-create-dialog.html" + file = "includes/generic-create-dialog.html" - dialog_id = "content_creation_dialog" - dialog_title = {intl l="Create a new content"} - dialog_body = {$smarty.capture.content_creation_dialog nofilter} + dialog_id = "content_creation_dialog" + dialog_title = {intl l="Create a new content"} + dialog_body = {$smarty.capture.content_creation_dialog nofilter} - dialog_ok_label = {intl l="Create this content"} + dialog_ok_label = {intl l="Create this content"} - form_action = {url path='/admin/contents/create'} - form_enctype = {form_enctype form=$form} - form_error_message = $form_error_message - } + form_action = {url path='/admin/content/create'} + form_enctype = {form_enctype form=$form} + form_error_message = $form_error_message + } {/form} {* -- Delete folder confirmation dialog ----------------------------------- *} @@ -479,36 +484,36 @@ {/capture} {include - file = "includes/generic-confirm-dialog.html" + file = "includes/generic-confirm-dialog.html" - dialog_id = "folder_delete_dialog" - dialog_title = {intl l="Delete folder"} - dialog_message = {intl l="Do you really want to delete this folder and all its content ?"} + dialog_id = "folder_delete_dialog" + dialog_title = {intl l="Delete folder"} + dialog_message = {intl l="Do you really want to delete this folder and all its content ?"} - form_action = {url path='/admin/folders/delete'} - form_content = {$smarty.capture.folder_delete_dialog nofilter} -} + form_action = {url path='/admin/folders/delete'} + form_content = {$smarty.capture.folder_delete_dialog nofilter} + } {* -- Delete content confirmation dialog ------------------------------------ *} {capture "content_delete_dialog"} - + {module_include location='content_delete_form'} {/capture} {include - file = "includes/generic-confirm-dialog.html" + file = "includes/generic-confirm-dialog.html" - dialog_id = "content_delete_dialog" - dialog_title = {intl l="Delete content"} - dialog_message = {intl l="Do you really want to delete this content ?"} + dialog_id = "content_delete_dialog" + dialog_title = {intl l="Delete content"} + dialog_message = {intl l="Do you really want to delete this content ?"} - form_action = {url path='/admin/content/delete'} - form_content = {$smarty.capture.content_delete_dialog nofilter} -} + form_action = {url path='/admin/content/delete'} + form_content = {$smarty.capture.content_delete_dialog nofilter} + } {/block} {block name="javascript-initialization"} @@ -536,23 +541,23 @@ // JS stuff for creation form {include - file = "includes/generic-js-dialog.html" - dialog_id = "folder_creation_dialog" - form_name = "thelia.admin.folder.creation" - } + file = "includes/generic-js-dialog.html" + dialog_id = "folder_creation_dialog" + form_name = "thelia.admin.folder.creation" + } {include - file = "includes/generic-js-dialog.html" - dialog_id = "content_creation_dialog" - form_name = "thelia.admin.content.creation" - } + file = "includes/generic-js-dialog.html" + dialog_id = "content_creation_dialog" + form_name = "thelia.admin.content.creation" + } {* Toggle object visibility *} $(".folderVisibleToggle").on('switch-change', function(event, data) { $.ajax({ url : "{url path='admin/folders/toggle-online'}", - data : { + data : { folder_id : $(this).data('id'), action : 'visibilityToggle' } @@ -570,9 +575,9 @@ }); }); - {* Inline editing of object position using bootstrap-editable *} + {* Inline editing of object position using bootstrap-editable *} - $('.folderPositionChange').editable({ + $('.folderPositionChange').editable({ type : 'text', title : '{intl l="Enter new folder position"}', mode : 'popup', @@ -580,18 +585,18 @@ placement : 'left', success : function(response, newValue) { // The URL template - var url = "{url noamp='1' path='/admin/folders/update-position' folder_id='__ID__' position='__POS__'}"; + var url = "{url path='/admin/folders/update-position' folder_id='__ID__' position='__POS__'}"; - // Perform subtitutions - url = url.replace('__ID__', $(this).data('id')) - .replace('__POS__', newValue); + // Perform subtitutions + url = url.replace('__ID__', $(this).data('id')) + .replace('__POS__', newValue); - // Reload the page - location.href = url; - } - }); + // Reload the page + location.href = url; + } + }); - $('.contentPositionChange').editable({ + $('.contentPositionChange').editable({ type : 'text', title : '{intl l="Enter new content position"}', mode : 'popup', @@ -599,7 +604,7 @@ placement : 'left', success : function(response, newValue) { // The URL template - var url = "{url noamp='1' path='/admin/contents/update-position' content_id='__ID__' position='__POS__'}"; + var url = "{url path='/admin/contents/update-position' content_id='__ID__' position='__POS__'}"; // Perform subtitutions url = url.replace('__ID__', $(this).data('id')) diff --git a/templates/admin/default/image-edit.html b/templates/admin/default/image-edit.html index 034dea7f5..f95d2645f 100644 --- a/templates/admin/default/image-edit.html +++ b/templates/admin/default/image-edit.html @@ -28,7 +28,7 @@
{form name="$formId"} -
+
diff --git a/templates/admin/default/includes/catalog-breadcrumb.html b/templates/admin/default/includes/catalog-breadcrumb.html index 1233d17a3..d0223b8bd 100644 --- a/templates/admin/default/includes/catalog-breadcrumb.html +++ b/templates/admin/default/includes/catalog-breadcrumb.html @@ -1,8 +1,8 @@ {* Breadcrumb for categories browsing and editing *}