diff --git a/.gitignore b/.gitignore index cad92f7a8..8de5039ed 100755 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ web/cache/* web/.htaccess phpdoc*.log php-cs +xhprof +phpunit.phar +.DS_Store \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 1ed4aba4a..3ee2064b8 100755 --- a/.travis.yml +++ b/.travis.yml @@ -12,3 +12,4 @@ before_script: - 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 diff --git a/composer.json b/composer.json index 67fb90100..9d179a987 100755 --- a/composer.json +++ b/composer.json @@ -9,9 +9,8 @@ }, "require":{ "php": ">=5.4", - "ezyang/htmlpurifier": "dev-master", "ircmaxell/password-compat": "dev-master", - "propel/propel": "2.0.0-alpha1", + "propel/propel": "dev-master", "psr/log" : "1.0", "symfony/class-loader": "2.2.*", "symfony/config" : "2.2.*", @@ -27,7 +26,7 @@ "symfony-cmf/routing": "1.0.0", "symfony/form": "2.2.*", - "symfony/validator": "2.3.*@dev", + "symfony/validator": "2.3.*", "smarty/smarty": "v3.1.14", "kriswallsmith/assetic": "1.2.*@dev", @@ -36,11 +35,14 @@ "simplepie/simplepie": "dev-master", - "imagine/imagine": "dev-master" + "imagine/imagine": "dev-master", + "symfony/serializer": "dev-master", + "symfony/icu": "1.0" }, "require-dev" : { "phpunit/phpunit": "3.7.*", - "fzaninotto/faker": "dev-master" + "fzaninotto/faker": "dev-master", + "maximebf/debugbar": "1.*" }, "minimum-stability": "stable", "config" : { diff --git a/composer.lock b/composer.lock index d84eeb977..0215c3d0f 100755 --- a/composer.lock +++ b/composer.lock @@ -3,64 +3,21 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "458aeccc06b7394d7653a9063b6fd981", + "hash": "ba2f3e0943f00c7c3bf0c086bc611b0f", + "packages": [ - { - "name": "ezyang/htmlpurifier", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "19eee1489965d9bc6eded80f847ced2382127261" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/19eee1489965d9bc6eded80f847ced2382127261", - "reference": "19eee1489965d9bc6eded80f847ced2382127261", - "shasum": "" - }, - "require": { - "php": ">=5.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "HTMLPurifier": "library/" - }, - "files": [ - "library/HTMLPurifier.composer.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Edward Z. Yang", - "email": "admin@htmlpurifier.org", - "homepage": "http://ezyang.com" - } - ], - "description": "Standards compliant HTML filter written in PHP", - "homepage": "http://htmlpurifier.org/", - "keywords": [ - "html" - ], - "time": "2013-07-27 04:54:53" - }, { "name": "imagine/imagine", "version": "dev-master", "source": { "type": "git", "url": "https://github.com/avalanche123/Imagine.git", - "reference": "v0.5.0" + "reference": "f64ec666baaa800edcbf237db41121a569230709" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/avalanche123/Imagine/zipball/v0.5.0", - "reference": "v0.5.0", + "url": "https://api.github.com/repos/avalanche123/Imagine/zipball/f64ec666baaa800edcbf237db41121a569230709", + "reference": "f64ec666baaa800edcbf237db41121a569230709", "shasum": "" }, "require": { @@ -217,12 +174,12 @@ "source": { "type": "git", "url": "https://github.com/leafo/lessphp.git", - "reference": "v0.4.0" + "reference": "51f3f06f0fe78a722dabfd14578444bdd078d9de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/leafo/lessphp/zipball/v0.4.0", - "reference": "v0.4.0", + "url": "https://api.github.com/repos/leafo/lessphp/zipball/51f3f06f0fe78a722dabfd14578444bdd078d9de", + "reference": "51f3f06f0fe78a722dabfd14578444bdd078d9de", "shasum": "" }, "type": "library", @@ -254,30 +211,30 @@ }, { "name": "propel/propel", - "version": "2.0.0-alpha1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/propelorm/Propel2.git", - "reference": "2.0.0-alpha1" + "reference": "58a25ded43c3d04313cad2b738342d307988b1b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/propelorm/Propel2/zipball/2.0.0-alpha1", - "reference": "2.0.0-alpha1", + "url": "https://api.github.com/repos/propelorm/Propel2/zipball/58a25ded43c3d04313cad2b738342d307988b1b5", + "reference": "58a25ded43c3d04313cad2b738342d307988b1b5", "shasum": "" }, "require": { "php": ">=5.4", - "psr/log": ">=1.0,<2.0", - "symfony/console": ">=2.2,<3.0", - "symfony/filesystem": ">=2.2,<3.0", - "symfony/finder": ">=2.2,<3.0", - "symfony/validator": ">=2.2,<3.0", - "symfony/yaml": ">=2.2,<3.0" + "psr/log": "~1.0", + "symfony/console": "~2.2", + "symfony/filesystem": "~2.2", + "symfony/finder": "~2.2", + "symfony/validator": "~2.2", + "symfony/yaml": "~2.2" }, "require-dev": { - "behat/behat": ">=2.4,<3.0", - "monolog/monolog": ">=1.3,<2.0", + "behat/behat": "~2.4", + "monolog/monolog": "~1.3", "phpunit/phpunit": "3.7.*" }, "suggest": { @@ -310,7 +267,7 @@ "orm", "persistence" ], - "time": "2013-06-05 06:46:14" + "time": "2013-09-01 13:29:51" }, { "name": "psr/log", @@ -356,12 +313,12 @@ "source": { "type": "git", "url": "https://github.com/krichprollsch/phpCssEmbed.git", - "reference": "v1.0.2" + "reference": "406c6d5b846cafa9186f9944a6210d0e6fed154b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/krichprollsch/phpCssEmbed/zipball/v1.0.2", - "reference": "v1.0.2", + "url": "https://api.github.com/repos/krichprollsch/phpCssEmbed/zipball/406c6d5b846cafa9186f9944a6210d0e6fed154b", + "reference": "406c6d5b846cafa9186f9944a6210d0e6fed154b", "shasum": "" }, "require": { @@ -397,12 +354,12 @@ "source": { "type": "git", "url": "https://github.com/simplepie/simplepie.git", - "reference": "f5436d69a8efa9d4ab3a9abc65d17317eb24b7f4" + "reference": "f97c8ef9be655c35e6fecdb608bdf5af05a4374a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/simplepie/simplepie/zipball/f5436d69a8efa9d4ab3a9abc65d17317eb24b7f4", - "reference": "f5436d69a8efa9d4ab3a9abc65d17317eb24b7f4", + "url": "https://api.github.com/repos/simplepie/simplepie/zipball/f97c8ef9be655c35e6fecdb608bdf5af05a4374a", + "reference": "f97c8ef9be655c35e6fecdb608bdf5af05a4374a", "shasum": "" }, "require": { @@ -443,7 +400,7 @@ "feeds", "rss" ], - "time": "2013-04-29 06:13:26" + "time": "2013-08-31 01:38:46" }, { "name": "smarty/smarty", @@ -540,17 +497,17 @@ }, { "name": "symfony/class-loader", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/ClassLoader", "source": { "type": "git", "url": "https://github.com/symfony/ClassLoader.git", - "reference": "v2.2.5" + "reference": "827c54ee9827f6de5afe53324cdbe47f017c0cba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/827c54ee9827f6de5afe53324cdbe47f017c0cba", + "reference": "827c54ee9827f6de5afe53324cdbe47f017c0cba", "shasum": "" }, "require": { @@ -586,21 +543,21 @@ ], "description": "Symfony ClassLoader Component", "homepage": "http://symfony.com", - "time": "2013-05-06 20:02:13" + "time": "2013-08-09 07:16:43" }, { "name": "symfony/config", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/Config", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "v2.2.5" + "reference": "4ab8ad0c0f4bb52b0e7fb12d63b81892fb7f697a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/Config/zipball/4ab8ad0c0f4bb52b0e7fb12d63b81892fb7f697a", + "reference": "4ab8ad0c0f4bb52b0e7fb12d63b81892fb7f697a", "shasum": "" }, "require": { @@ -637,17 +594,17 @@ }, { "name": "symfony/console", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "v2.2.5" + "reference": "b9ed9d61ff84296c9ace5ac333c15e6f35062eeb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/Console/zipball/b9ed9d61ff84296c9ace5ac333c15e6f35062eeb", + "reference": "b9ed9d61ff84296c9ace5ac333c15e6f35062eeb", "shasum": "" }, "require": { @@ -680,21 +637,21 @@ ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2013-07-08 14:34:53" + "time": "2013-08-17 16:29:09" }, { "name": "symfony/dependency-injection", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/DependencyInjection", "source": { "type": "git", "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "v2.2.5" + "reference": "434b31fe8548e0354d5f93b455d8927481ddfc6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/434b31fe8548e0354d5f93b455d8927481ddfc6f", + "reference": "434b31fe8548e0354d5f93b455d8927481ddfc6f", "shasum": "" }, "require": { @@ -739,17 +696,17 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "v2.2.5" + "reference": "45c43ffa186a0473c71a947981e43e025cd93c87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/45c43ffa186a0473c71a947981e43e025cd93c87", + "reference": "45c43ffa186a0473c71a947981e43e025cd93c87", "shasum": "" }, "require": { @@ -793,17 +750,17 @@ }, { "name": "symfony/filesystem", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "v2.2.5" + "reference": "fa16b9ab446b84371a63ab391133ff58134edff1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/fa16b9ab446b84371a63ab391133ff58134edff1", + "reference": "fa16b9ab446b84371a63ab391133ff58134edff1", "shasum": "" }, "require": { @@ -840,17 +797,17 @@ }, { "name": "symfony/finder", - "version": "v2.3.3", + "version": "v2.3.4", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "v2.3.3" + "reference": "4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.3.3", - "reference": "v2.3.3", + "url": "https://api.github.com/repos/symfony/Finder/zipball/4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1", + "reference": "4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1", "shasum": "" }, "require": { @@ -883,21 +840,21 @@ ], "description": "Symfony Finder Component", "homepage": "http://symfony.com", - "time": "2013-07-21 12:12:18" + "time": "2013-08-13 20:18:00" }, { "name": "symfony/form", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/Form", "source": { "type": "git", "url": "https://github.com/symfony/Form.git", - "reference": "v2.2.5" + "reference": "33e3fcb6ca3cefe43ab22dcb8bee5ea039033a88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Form/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/Form/zipball/33e3fcb6ca3cefe43ab22dcb8bee5ea039033a88", + "reference": "33e3fcb6ca3cefe43ab22dcb8bee5ea039033a88", "shasum": "" }, "require": { @@ -942,21 +899,21 @@ ], "description": "Symfony Form Component", "homepage": "http://symfony.com", - "time": "2013-08-02 13:12:51" + "time": "2013-08-25 11:59:08" }, { "name": "symfony/http-foundation", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/HttpFoundation", "source": { "type": "git", "url": "https://github.com/symfony/HttpFoundation.git", - "reference": "v2.2.5" + "reference": "9402ff009d4f1ee63e83e8f2262993a7c2a3beea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/9402ff009d4f1ee63e83e8f2262993a7c2a3beea", + "reference": "9402ff009d4f1ee63e83e8f2262993a7c2a3beea", "shasum": "" }, "require": { @@ -992,21 +949,21 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "http://symfony.com", - "time": "2013-08-07 14:00:53" + "time": "2013-08-25 18:21:55" }, { "name": "symfony/http-kernel", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/HttpKernel", "source": { "type": "git", "url": "https://github.com/symfony/HttpKernel.git", - "reference": "v2.2.5" + "reference": "080dea28df16aed1fbc7aeb08a1dcb10d7ab5299" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/080dea28df16aed1fbc7aeb08a1dcb10d7ab5299", + "reference": "080dea28df16aed1fbc7aeb08a1dcb10d7ab5299", "shasum": "" }, "require": { @@ -1062,27 +1019,26 @@ ], "description": "Symfony HttpKernel Component", "homepage": "http://symfony.com", - "time": "2013-08-07 15:57:43" + "time": "2013-08-26 19:27:24" }, { "name": "symfony/icu", - "version": "v1.2.0", + "version": "v1.0.0", "target-dir": "Symfony/Component/Icu", "source": { "type": "git", "url": "https://github.com/symfony/Icu.git", - "reference": "v1.2.0" + "reference": "cac3fdfb111adbe590155f491594636d45129783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Icu/zipball/v1.2.0", - "reference": "v1.2.0", + "url": "https://api.github.com/repos/symfony/Icu/zipball/cac3fdfb111adbe590155f491594636d45129783", + "reference": "cac3fdfb111adbe590155f491594636d45129783", "shasum": "" }, "require": { - "lib-icu": ">=4.4", "php": ">=5.3.3", - "symfony/intl": ">=2.3,<3.0" + "symfony/intl": "~2.3" }, "type": "library", "autoload": { @@ -1110,21 +1066,21 @@ "icu", "intl" ], - "time": "2013-06-03 18:32:58" + "time": "2013-06-03 18:32:07" }, { "name": "symfony/intl", - "version": "v2.3.3", + "version": "v2.3.4", "target-dir": "Symfony/Component/Intl", "source": { "type": "git", "url": "https://github.com/symfony/Intl.git", - "reference": "v2.3.3" + "reference": "ebbcf7e3dab5185b4b24c961431e302a0ffb66ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Intl/zipball/v2.3.3", - "reference": "v2.3.3", + "url": "https://api.github.com/repos/symfony/Intl/zipball/ebbcf7e3dab5185b4b24c961431e302a0ffb66ec", + "reference": "ebbcf7e3dab5185b4b24c961431e302a0ffb66ec", "shasum": "" }, "require": { @@ -1187,21 +1143,21 @@ "l10n", "localization" ], - "time": "2013-08-01 12:40:45" + "time": "2013-08-24 14:32:55" }, { "name": "symfony/locale", - "version": "v2.3.3", + "version": "v2.3.4", "target-dir": "Symfony/Component/Locale", "source": { "type": "git", "url": "https://github.com/symfony/Locale.git", - "reference": "v2.3.3" + "reference": "490825116712881a351b9a13ad6dddd4a39b8bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Locale/zipball/v2.3.3", - "reference": "v2.3.3", + "url": "https://api.github.com/repos/symfony/Locale/zipball/490825116712881a351b9a13ad6dddd4a39b8bb0", + "reference": "490825116712881a351b9a13ad6dddd4a39b8bb0", "shasum": "" }, "require": { @@ -1239,17 +1195,17 @@ }, { "name": "symfony/options-resolver", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/OptionsResolver", "source": { "type": "git", "url": "https://github.com/symfony/OptionsResolver.git", - "reference": "v2.2.5" + "reference": "b36671093db40feacce2d489298f0782a0a61cfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/OptionsResolver/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/OptionsResolver/zipball/b36671093db40feacce2d489298f0782a0a61cfd", + "reference": "b36671093db40feacce2d489298f0782a0a61cfd", "shasum": "" }, "require": { @@ -1291,17 +1247,17 @@ }, { "name": "symfony/process", - "version": "v2.3.3", + "version": "v2.3.4", "target-dir": "Symfony/Component/Process", "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "v2.3.3" + "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/v2.3.3", - "reference": "v2.3.3", + "url": "https://api.github.com/repos/symfony/Process/zipball/1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b", + "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b", "shasum": "" }, "require": { @@ -1334,21 +1290,21 @@ ], "description": "Symfony Process Component", "homepage": "http://symfony.com", - "time": "2013-08-02 21:51:01" + "time": "2013-08-22 06:42:25" }, { "name": "symfony/property-access", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/PropertyAccess", "source": { "type": "git", "url": "https://github.com/symfony/PropertyAccess.git", - "reference": "v2.2.5" + "reference": "2452dd5d49c1602876d9eeb4de15425d5f9a6342" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/PropertyAccess/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/PropertyAccess/zipball/2452dd5d49c1602876d9eeb4de15425d5f9a6342", + "reference": "2452dd5d49c1602876d9eeb4de15425d5f9a6342", "shasum": "" }, "require": { @@ -1392,21 +1348,21 @@ "property path", "reflection" ], - "time": "2013-07-28 18:26:16" + "time": "2013-08-22 04:15:06" }, { "name": "symfony/routing", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/Routing", "source": { "type": "git", "url": "https://github.com/symfony/Routing.git", - "reference": "v2.2.5" + "reference": "2704242137edc19cc61e71027a7a04eef28f42c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Routing/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/Routing/zipball/2704242137edc19cc61e71027a7a04eef28f42c6", + "reference": "2704242137edc19cc61e71027a7a04eef28f42c6", "shasum": "" }, "require": { @@ -1450,21 +1406,21 @@ ], "description": "Symfony Routing Component", "homepage": "http://symfony.com", - "time": "2013-07-30 11:22:46" + "time": "2013-08-23 14:06:02" }, { "name": "symfony/translation", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/Translation", "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "v2.2.5" + "reference": "37a11fe823c28f9235548d253b215f07cec9a0de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/Translation/zipball/37a11fe823c28f9235548d253b215f07cec9a0de", + "reference": "37a11fe823c28f9235548d253b215f07cec9a0de", "shasum": "" }, "require": { @@ -1505,21 +1461,21 @@ ], "description": "Symfony Translation Component", "homepage": "http://symfony.com", - "time": "2013-07-28 18:26:16" + "time": "2013-08-24 12:29:44" }, { "name": "symfony/validator", - "version": "2.3.x-dev", + "version": "v2.3.4", "target-dir": "Symfony/Component/Validator", "source": { "type": "git", "url": "https://github.com/symfony/Validator.git", - "reference": "55808a75bf373a8edb6400239268d315f0a326c7" + "reference": "8f6f6be47fb8e1179cd225b1f949630e26221e42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/55808a75bf373a8edb6400239268d315f0a326c7", - "reference": "55808a75bf373a8edb6400239268d315f0a326c7", + "url": "https://api.github.com/repos/symfony/Validator/zipball/8f6f6be47fb8e1179cd225b1f949630e26221e42", + "reference": "8f6f6be47fb8e1179cd225b1f949630e26221e42", "shasum": "" }, "require": { @@ -1566,21 +1522,21 @@ ], "description": "Symfony Validator Component", "homepage": "http://symfony.com", - "time": "2013-08-13 20:18:00" + "time": "2013-08-24 15:26:22" }, { "name": "symfony/yaml", - "version": "v2.2.5", + "version": "v2.2.6", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "v2.2.5" + "reference": "d135717c1a42cb566cc09433658e7e8dbbe30b0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.2.5", - "reference": "v2.2.5", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/d135717c1a42cb566cc09433658e7e8dbbe30b0a", + "reference": "d135717c1a42cb566cc09433658e7e8dbbe30b0a", "shasum": "" }, "require": { @@ -1613,7 +1569,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2013-07-11 09:28:01" + "time": "2013-08-24 06:36:00" } ], "packages-dev": [ @@ -1623,12 +1579,12 @@ "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "feb6492762a77db946bc13cc44a20a01546be0e6" + "reference": "77a4e394d99a67e7fb611e8b402c2da4b80fa4f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/feb6492762a77db946bc13cc44a20a01546be0e6", - "reference": "feb6492762a77db946bc13cc44a20a01546be0e6", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/77a4e394d99a67e7fb611e8b402c2da4b80fa4f8", + "reference": "77a4e394d99a67e7fb611e8b402c2da4b80fa4f8", "shasum": "" }, "require": { @@ -1661,7 +1617,56 @@ "faker", "fixtures" ], - "time": "2013-08-12 10:05:47" + "time": "2013-08-29 19:11:59" + }, + { + "name": "maximebf/debugbar", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/maximebf/php-debugbar.git", + "reference": "37dccc40da52bf9f85571c30cf302da696db0d05" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/37dccc40da52bf9f85571c30cf302da696db0d05", + "reference": "37dccc40da52bf9f85571c30cf302da696db0d05", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "require-dev": { + "php": ">=5.3.0" + }, + "suggest": { + "kriswallsmith/assetic": "The best way to manage assets", + "monolog/monolog": "Log using Monolog" + }, + "type": "library", + "autoload": { + "psr-0": { + "DebugBar": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maxime Bouroumeau-Fuseau", + "email": "maxime.bouroumeau@gmail.com", + "homepage": "http://maximebf.com" + } + ], + "description": "Debug bar in the browser for php application", + "homepage": "https://github.com/maximebf/php-debugbar", + "keywords": [ + "debug" + ], + "time": "2013-08-17 02:02:49" }, { "name": "phpunit/php-code-coverage", @@ -2036,10 +2041,8 @@ ], "minimum-stability": "stable", "stability-flags": { - "ezyang/htmlpurifier": 20, "ircmaxell/password-compat": 20, - "propel/propel": 15, - "symfony/validator": 20, + "propel/propel": 20, "kriswallsmith/assetic": 20, "leafo/lessphp": 20, "ptachoire/cssembed": 20, diff --git a/core/lib/Thelia/Action/Address.php b/core/lib/Thelia/Action/Address.php new file mode 100644 index 000000000..32ec24c05 --- /dev/null +++ b/core/lib/Thelia/Action/Address.php @@ -0,0 +1,108 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Thelia\Core\Event\AddressCreateOrUpdateEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Model\Address as AddressModel; + + +/** + * Class Address + * @package Thelia\Action + * @author Manuel Raynaud + */ +class Address extends BaseAction implements EventSubscriberInterface +{ + + public function create(AddressCreateOrUpdateEvent $event) + { + $address = new AddressModel(); + $address->setCustomer($event->getCustomer()); + $this->createOrUpdate($address, $event); + } + + public function update(AddressCreateOrUpdateEvent $event) + { + $addressModel = $event->getAddress(); + + $this->createOrUpdate($addressModel, $event); + } + + + protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event) + { + $addressModel->setDispatcher($this->getDispatcher()); + + if ($addressModel->isNew()) { + $addressModel->setLabel($event->getLabel()); + } + + $addressModel + ->setTitleId($event->getTitle()) + ->setFirstname($event->getFirstname()) + ->setLastname($event->getLastname()) + ->setAddress1($event->getAddress1()) + ->setAddress2($event->getAddress2()) + ->setAddress3($event->getAddress3()) + ->setZipcode($event->getZipcode()) + ->setCity($event->getCity()) + ->setCountryId($event->getCountry()) + ->setCellphone($event->getCellphone()) + ->setPhone($event->getPhone()) + ->setCompany($event->getCompany()) + ->save() + ; + + $event->setAddress($addressModel); + } + + /** + * 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::ADDRESS_CREATE => array("create", 128), + TheliaEvents::ADDRESS_UPDATE => array("update", 128) + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Action/BaseAction.php b/core/lib/Thelia/Action/BaseAction.php old mode 100644 new mode 100755 index bef57b30d..2984ddbd6 --- a/core/lib/Thelia/Action/BaseAction.php +++ b/core/lib/Thelia/Action/BaseAction.php @@ -40,52 +40,6 @@ class BaseAction $this->container = $container; } - /** - * Validate a BaseForm - * - * @param BaseForm $aBaseForm the form - * @param string $expectedMethod the expected method, POST or GET, or null for any of them - * @throws FormValidationException is the form contains error, or the method is not the right one - * @return \Symfony\Component\Form\Form Form the symfony form object - */ - protected function validateForm(BaseForm $aBaseForm, $expectedMethod = null) - { - $form = $aBaseForm->getForm(); - - if ($expectedMethod == null || $aBaseForm->getRequest()->isMethod($expectedMethod)) { - - $form->bind($aBaseForm->getRequest()); - - if ($form->isValid()) { - return $form; - } else { - throw new FormValidationException("Missing or invalid data"); - } - } else { - throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod)); - } - } - - /** - * Propagate a form error in the action event - * - * @param BaseForm $aBaseForm the form - * @param string $error_message an error message that may be displayed to the customer - * @param ActionEvent $event the action event - */ - protected function propagateFormError(BaseForm $aBaseForm, $error_message, ActionEvent $event) - { - // The form has an error - $aBaseForm->setError(true); - $aBaseForm->setErrorMessage($error_message); - - // Store the form in the parser context - $event->setErrorForm($aBaseForm); - - // Stop event propagation - $event->stopPropagation(); - } - /** * Return the event dispatcher, * @@ -95,5 +49,4 @@ class BaseAction { return $this->container->get('event_dispatcher'); } - -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Action/Cart.php b/core/lib/Thelia/Action/Cart.php index 86674aedf..9203dc00d 100755 --- a/core/lib/Thelia/Action/Cart.php +++ b/core/lib/Thelia/Action/Cart.php @@ -41,6 +41,7 @@ use Thelia\Model\ConfigQuery; * * Class Cart * @package Thelia\Action + * @author Manuel Raynaud */ class Cart extends BaseAction implements EventSubscriberInterface { @@ -142,7 +143,7 @@ class Cart extends BaseAction implements EventSubscriberInterface return array( "action.addArticle" => array("addItem", 128), "action.deleteArticle" => array("deleteItem", 128), - "action.changeArticle" => array("changeItem", 128), + "action.updateArticle" => array("changeItem", 128), ); } diff --git a/core/lib/Thelia/Action/Category.php b/core/lib/Thelia/Action/Category.php old mode 100644 new mode 100755 index 6e5b7ba00..7b7608dc9 --- a/core/lib/Thelia/Action/Category.php +++ b/core/lib/Thelia/Action/Category.php @@ -24,134 +24,39 @@ namespace Thelia\Action; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Thelia\Core\Event\ActionEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Category as CategoryModel; -use Thelia\Form\CategoryCreationForm; -use Thelia\Core\Event\CategoryEvent; -use Thelia\Tools\Redirect; use Thelia\Model\CategoryQuery; -use Thelia\Model\AdminLog; -use Thelia\Form\CategoryDeletionForm; -use Thelia\Action\Exception\FormValidationException; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\Propel; use Thelia\Model\Map\CategoryTableMap; use Propel\Runtime\Exception\PropelException; +use Thelia\Core\Event\CategoryCreateEvent; +use Thelia\Core\Event\CategoryDeleteEvent; +use Thelia\Core\Event\CategoryToggleVisibilityEvent; +use Thelia\Core\Event\CategoryChangePositionEvent; + class Category extends BaseAction implements EventSubscriberInterface { - public function create(ActionEvent $event) + public function create(CategoryCreateEvent $event) { + $category = new CategoryModel(); - $this->checkAuth("ADMIN", "admin.category.create"); + $category + ->setDispatcher($this->getDispatcher()) + ->create( + $event->getTitle(), + $event->getParent(), + $event->getLocale() + ); - $request = $event->getRequest(); - - try { - $categoryCreationForm = new CategoryCreationForm($request); - - $form = $this->validateForm($categoryCreationForm, "POST"); - - $data = $form->getData(); - - $category = new CategoryModel(); - - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CREATECATEGORY, $event); - - $category->create( - $data["title"], - $data["parent"], - $data["locale"] - ); - - AdminLog::append(sprintf("Category %s (ID %s) created", $category->getTitle(), $category->getId()), $request, $request->getSession()->getAdminUser()); - - $categoryEvent = new CategoryEvent($category); - - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CREATECATEGORY, $categoryEvent); - - // Substitute _ID_ in the URL with the ID of the created category - $successUrl = str_replace('_ID_', $category->getId(), $categoryCreationForm->getSuccessUrl()); - - // Redirect to the success URL - $this->redirect($successUrl); - - } catch (PropelException $e) { - Tlog::getInstance()->error(sprintf('error during creating category with message "%s"', $e->getMessage())); - - $message = "Failed to create this category, please try again."; - } - - // The form has errors, propagate it. - $this->propagateFormError($categoryCreationForm, $message, $event); + $event->setCategory($category); } - public function modify(ActionEvent $event) + public function update(CategoryChangeEvent $event) { - - $this->checkAuth("ADMIN", "admin.category.delete"); - - $request = $event->getRequest(); - - $customerModification = new CustomerModification($request); - - $form = $customerModification->getForm(); - - if ($request->isMethod("post")) { - - $form->bind($request); - - if ($form->isValid()) { - $data = $form->getData(); - - $customer = CustomerQuery::create()->findPk(1); - try { - $customerEvent = new CustomerEvent($customer); - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CHANGECUSTOMER, $customerEvent); - - $data = $form->getData(); - - $customer->createOrUpdate( - $data["title"], - $data["firstname"], - $data["lastname"], - $data["address1"], - $data["address2"], - $data["address3"], - $data["phone"], - $data["cellphone"], - $data["zipcode"], - $data["country"] - ); - - $customerEvent->customer = $customer; - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECUSTOMER, $customerEvent); - - // Update the logged-in user, and redirect to the success URL (exits) - // We don-t send the login event, as the customer si already logged. - $this->processSuccessfullLogin($event, $customer, $customerModification); - } catch (PropelException $e) { - - Tlog::getInstance()->error(sprintf('error during modifying customer on action/modifyCustomer with message "%s"', $e->getMessage())); - - $message = "Failed to change your account, please try again."; - } - } else { - $message = "Missing or invalid data"; - } - } else { - $message = "Wrong form method !"; - } - - // The form has an error - $customerModification->setError(true); - $customerModification->setErrorMessage($message); - - // Dispatch the errored form - $event->setErrorForm($customerModification); - } /** @@ -159,50 +64,14 @@ class Category extends BaseAction implements EventSubscriberInterface * * @param ActionEvent $event */ - public function delete(ActionEvent $event) + public function delete(CategoryDeleteEvent $event) { + $category = CategoryQuery::create()->findPk($event->getCategoryId()); - $this->checkAuth("ADMIN", "admin.category.delete"); + if ($category !== null) { - $request = $event->getRequest(); - - try { - $categoryDeletionForm = new CategoryDeletionForm($request); - - $form = $this->validateForm($categoryDeletionForm, "POST"); - - $data = $form->getData(); - - $category = CategoryQuery::create()->findPk($data['id']); - - $categoryEvent = new CategoryEvent($category); - - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_DELETECATEGORY, $categoryEvent); - - $category->delete(); - - AdminLog::append(sprintf("Category %s (ID %s) deleted", $category->getTitle(), $category->getId()), $request, $request->getSession()->getAdminUser()); - - $categoryEvent->category = $category; - - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_DELETECATEGORY, $categoryEvent); - - // Substitute _ID_ in the URL with the ID of the created category - $successUrl = str_replace('_ID_', $category->getParent(), $categoryDeletionForm->getSuccessUrl()); - - // Redirect to the success URL - Redirect::exec($successUrl); - } catch (PropelException $e) { - - \Thelia\Log\Tlog::getInstance()->error(sprintf('error during deleting category ID=%s on action/modifyCustomer with message "%s"', $data['id'], $e->getMessage())); - - $message = "Failed to change your account, please try again."; - } catch (FormValidationException $e) { - - $message = $e->getMessage(); + $category->setDispatcher($this->getDispatcher())->delete(); } - - $this->propagateFormError($categoryDeletionForm, $message, $event); } /** @@ -210,60 +79,41 @@ class Category extends BaseAction implements EventSubscriberInterface * * @param ActionEvent $event */ - public function toggleVisibility(ActionEvent $event) + public function toggleVisibility(CategoryToggleVisibilityEvent $event) { - - $this->checkAuth("ADMIN", "admin.category.edit"); - - $request = $event->getRequest(); - - $category = CategoryQuery::create()->findPk($request->get('category_id', 0)); + $category = CategoryQuery::create()->findPk($event->getCategoryId()); if ($category !== null) { - $category->setVisible($category->getVisible() ? false : true); - - $category->save(); - - $categoryEvent = new CategoryEvent($category); - - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECATEGORY, $categoryEvent); + $category + ->setDispatcher($this->getDispatcher()) + ->setVisible($category->getVisible() ? false : true) + ->save() + ; } } /** - * Move category up + * Changes category position, selecting absolute ou relative change. * - * @param ActionEvent $event + * @param CategoryChangePositionEvent $event */ - public function changePositionUp(ActionEvent $event) + public function changePosition(CategoryChangePositionEvent $event) { - return $this->exchangePosition($event, 'up'); - } - - /** - * Move category down - * - * @param ActionEvent $event - */ - public function changePositionDown(ActionEvent $event) - { - return $this->exchangePosition($event, 'down'); + if ($event->getMode() == CategoryChangePositionEvent::POSITION_ABSOLUTE) + return $this->changeAbsolutePosition($event); + else + return $this->exchangePosition($event); } /** * Move up or down a category * - * @param ActionEvent $event - * @param string $direction up to move up, down to move down + * @param CategoryChangePositionEvent $event */ - protected function exchangePosition(ActionEvent $event, $direction) + protected function exchangePosition(CategoryChangePositionEvent $event) { - $this->checkAuth("ADMIN", "admin.category.edit"); - - $request = $event->getRequest(); - - $category = CategoryQuery::create()->findPk($request->get('category_id', 0)); + $category = CategoryQuery::create()->findPk($event->getCategoryId()); if ($category !== null) { @@ -275,10 +125,10 @@ class Category extends BaseAction implements EventSubscriberInterface ->filterByParent($category->getParent()); // Up or down ? - if ($direction == 'up') { + if ($event->getMode() == CategoryChangePositionEvent::POSITION_UP) { // Find the category immediately before me $search->filterByPosition(array('max' => $my_position-1))->orderByPosition(Criteria::DESC); - } elseif ($direction == 'down') { + } elseif ($event->getMode() == CategoryChangePositionEvent::POSITION_DOWN) { // Find the category immediately after me $search->filterByPosition(array('min' => $my_position+1))->orderByPosition(Criteria::ASC); } else @@ -295,7 +145,11 @@ class Category extends BaseAction implements EventSubscriberInterface $cnx->beginTransaction(); try { - $category->setPosition($result->getPosition())->save(); + $category + ->setDispatcher($this->getDispatcher()) + ->setPosition($result->getPosition()) + ->save() + ; $result->setPosition($my_position)->save(); @@ -310,20 +164,16 @@ class Category extends BaseAction implements EventSubscriberInterface /** * Changes category position * - * @param ActionEvent $event + * @param CategoryChangePositionEvent $event */ - public function changePosition(ActionEvent $event) + protected function changeAbsolutePosition(CategoryChangePositionEvent $event) { - $this->checkAuth("ADMIN", "admin.category.edit"); - - $request = $event->getRequest(); - - $category = CategoryQuery::create()->findPk($request->get('category_id', 0)); + $category = CategoryQuery::create()->findPk($event->getCategoryId()); if ($category !== null) { // The required position - $new_position = $request->get('position', null); + $new_position = $event->getPosition(); // The current position $current_position = $category->getPosition(); @@ -356,7 +206,11 @@ class Category extends BaseAction implements EventSubscriberInterface $result->setPosition($result->getPosition() + $delta)->save($cnx); } - $category->setPosition($new_position)->save($cnx); + $category + ->setDispatcher($this->getDispatcher()) + ->setPosition($new_position) + ->save($cnx) + ; $cnx->commit(); } catch (Exception $e) { @@ -389,14 +243,16 @@ class Category extends BaseAction implements EventSubscriberInterface public static function getSubscribedEvents() { return array( - "action.createCategory" => array("create", 128), - "action.modifyCategory" => array("modify", 128), - "action.deleteCategory" => array("delete", 128), + TheliaEvents::CATEGORY_CREATE => array("create", 128), + TheliaEvents::CATEGORY_UPDATE => array("update", 128), + TheliaEvents::CATEGORY_DELETE => array("delete", 128), - "action.toggleCategoryVisibility" => array("toggleVisibility", 128), - "action.changeCategoryPositionUp" => array("changePositionUp", 128), - "action.changeCategoryPositionDown" => array("changePositionDown", 128), - "action.changeCategoryPosition" => array("changePosition", 128), + TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128), + TheliaEvents::CATEGORY_CHANGE_POSITION => array("changePosition", 128), + + "action.updateCategoryPositionU" => array("changePositionUp", 128), + "action.updateCategoryPositionDown" => array("changePositionDown", 128), + "action.updateCategoryPosition" => array("changePosition", 128), ); } } diff --git a/core/lib/Thelia/Action/Config.php b/core/lib/Thelia/Action/Config.php new file mode 100644 index 000000000..e0a62f69d --- /dev/null +++ b/core/lib/Thelia/Action/Config.php @@ -0,0 +1,155 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +use Thelia\Model\ConfigQuery; +use Thelia\Model\Config as ConfigModel; + +use Thelia\Core\Event\TheliaEvents; + +use Thelia\Core\Event\ConfigUpdateEvent; +use Thelia\Core\Event\ConfigCreateEvent; +use Thelia\Core\Event\ConfigDeleteEvent; + +class Config extends BaseAction implements EventSubscriberInterface +{ + /** + * Create a new configuration entry + * + * @param ConfigCreateEvent $event + */ + public function create(ConfigCreateEvent $event) + { + $config = new ConfigModel(); + + $config + ->setDispatcher($this->getDispatcher()) + + ->setName($event->getEventName()) + ->setValue($event->getValue()) + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + ->setHidden($event->getHidden()) + ->setSecured($event->getSecured()) + + ->save() + ; + + $event->setConfig($config); + } + + /** + * Change a configuration entry value + * + * @param ConfigUpdateEvent $event + */ + public function setValue(ConfigUpdateEvent $event) + { + $search = ConfigQuery::create(); + + if (null !== $config = $search->findOneById($event->getConfigId())) { + + if ($event->getValue() !== $config->getValue()) { + + $config + ->setDispatcher($this->getDispatcher()) + + ->setValue($event->getValue()) + ->save() + ; + + $event->setConfig($config); + } + } + } + + /** + * Change a configuration entry + * + * @param ConfigUpdateEvent $event + */ + public function modify(ConfigUpdateEvent $event) + { + $search = ConfigQuery::create(); + + if (null !== $config = ConfigQuery::create()->findOneById($event->getConfigId())) { + + $config + ->setDispatcher($this->getDispatcher()) + + ->setName($event->getEventName()) + ->setValue($event->getValue()) + ->setHidden($event->getHidden()) + ->setSecured($event->getSecured()) + + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + ->setDescription($event->getDescription()) + ->setChapo($event->getChapo()) + ->setPostscriptum($event->getPostscriptum()) + + ->save(); + + $event->setConfig($config); + } + } + + /** + * Delete a configuration entry + * + * @param ConfigDeleteEvent $event + */ + public function delete(ConfigDeleteEvent $event) + { + + if (null !== ($config = ConfigQuery::create()->findOneById($event->getConfigId()))) { + + if (! $config->getSecured()) { + + $config + ->setDispatcher($this->getDispatcher()) + ->delete() + ; + + $event->setConfig($config); + } + } + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::CONFIG_CREATE => array("create", 128), + TheliaEvents::CONFIG_SETVALUE => array("setValue", 128), + TheliaEvents::CONFIG_UPDATE => array("modify", 128), + TheliaEvents::CONFIG_DELETE => array("delete", 128), + ); + } +} diff --git a/core/lib/Thelia/Action/Coupon.php b/core/lib/Thelia/Action/Coupon.php new file mode 100755 index 000000000..cc32d2c68 --- /dev/null +++ b/core/lib/Thelia/Action/Coupon.php @@ -0,0 +1,180 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Model\Coupon as CouponModel; +use Propel\Runtime\ActiveQuery\Criteria; +use Propel\Runtime\Propel; +use Thelia\Model\Map\CategoryTableMap; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Process Coupon Events + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class Coupon extends BaseAction implements EventSubscriberInterface +{ + /** + * Occurring when a Coupon is about to be created + * + * @param CouponCreateOrUpdateEvent $event Event creation or update Event + */ + public function create(CouponCreateOrUpdateEvent $event) + { + $coupon = new CouponModel(); + + $this->createOrUpdate($coupon, $event); + } + + /** + * Occurring when a Coupon is about to be updated + * + * @param CouponCreateOrUpdateEvent $event Event creation or update Event + */ + public function update(CouponCreateOrUpdateEvent $event) + { + $coupon = $event->getCoupon(); + + $this->createOrUpdate($coupon, $event); + } + + /** + * Occurring when a Coupon rule is about to be created + * + * @param CouponCreateOrUpdateEvent $event Event creation or update Event + */ + public function createRule(CouponCreateOrUpdateEvent $event) + { + $coupon = $event->getCoupon(); + + $this->createOrUpdate($coupon, $event); + } + + /** + * Occurring when a Coupon rule is about to be updated + * + * @param CouponCreateOrUpdateEvent $event Event creation or update Event + */ + public function updateRule(CouponCreateOrUpdateEvent $event) + { + $coupon = $event->getCoupon(); + + $this->createOrUpdate($coupon, $event); + } + + /** + * Occurring when a Coupon rule is about to be deleted + * + * @param CouponCreateOrUpdateEvent $event Event creation or update Event + */ + public function deleteRule(CouponCreateOrUpdateEvent $event) + { + $coupon = $event->getCoupon(); + + $this->createOrUpdate($coupon, $event); + } + + /** + * Occurring when a Coupon rule is about to be consumed + * + * @param CouponCreateOrUpdateEvent $event Event creation or update Event + */ + public function consume(CouponCreateOrUpdateEvent $event) + { + // @todo implements + } + + /** + * Call the Model and delegate the create or delete action + * Feed the Event with the updated model + * + * @param CouponModel $coupon Model to save + * @param CouponCreateOrUpdateEvent $event Event containing data + */ + protected function createOrUpdate(CouponModel $coupon, CouponCreateOrUpdateEvent $event) + { + $coupon->setDispatcher($this->getDispatcher()); + + $coupon->createOrUpdate( + $event->getCode(), + $event->getTitle(), + $event->getAmount(), + $event->getEffect(), + $event->getShortDescription(), + $event->getDescription(), + $event->isEnabled(), + $event->getExpirationDate(), + $event->isAvailableOnSpecialOffers(), + $event->isCumulative(), + $event->getMaxUsage(), + $event->getRules(), + $event->getLocale() + ); + + $event->setCoupon($coupon); + } + + /** + * Returns an array of event names this subscriber listens 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::COUPON_CREATE => array("create", 128), + TheliaEvents::COUPON_UPDATE => array("update", 128), + TheliaEvents::COUPON_DISABLE => array("disable", 128), + TheliaEvents::COUPON_ENABLE => array("enable", 128), + TheliaEvents::COUPON_CONSUME => array("consume", 128), + TheliaEvents::COUPON_RULE_CREATE => array("createRule", 128), + TheliaEvents::COUPON_RULE_UPDATE => array("updateRule", 128), + TheliaEvents::COUPON_RULE_DELETE => array("deleteRule", 128) + ); + } +} diff --git a/core/lib/Thelia/Action/Currency.php b/core/lib/Thelia/Action/Currency.php new file mode 100644 index 000000000..7f9c3281f --- /dev/null +++ b/core/lib/Thelia/Action/Currency.php @@ -0,0 +1,202 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +use Thelia\Model\CurrencyQuery; +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\Model\ConfigQuery; +use Thelia\Core\Event\CurrencyUpdatePositionEvent; + +class Currency extends BaseAction implements EventSubscriberInterface +{ + /** + * Create a new currencyuration entry + * + * @param CurrencyCreateEvent $event + */ + public function create(CurrencyCreateEvent $event) + { + $currency = new CurrencyModel(); + + $currency + ->setDispatcher($this->getDispatcher()) + + ->setLocale($event->getLocale()) + ->setName($event->getCurrencyName()) + ->setSymbol($event->getSymbol()) + ->setRate($event->getRate()) + ->setCode(strtoupper($event->getCode())) + + ->save() + ; + + + $event->setCurrency($currency); + } + + /** + * Change a currency + * + * @param CurrencyUpdateEvent $event + */ + public function update(CurrencyUpdateEvent $event) + { + $search = CurrencyQuery::create(); + + if (null !== $currency = CurrencyQuery::create()->findOneById($event->getCurrencyId())) { + + $currency + ->setDispatcher($this->getDispatcher()) + + ->setLocale($event->getLocale()) + ->setName($event->getCurrencyName()) + ->setSymbol($event->getSymbol()) + ->setRate($event->getRate()) + ->setCode(strtoupper($event->getCode())) + + ->save(); + + $event->setCurrency($currency); + } + } + + /** + * Set the default currency + * + * @param CurrencyUpdateEvent $event + */ + public function setDefault(CurrencyUpdateEvent $event) + { + $search = CurrencyQuery::create(); + + if (null !== $currency = CurrencyQuery::create()->findOneById($event->getCurrencyId())) { + + if ($currency->getByDefault() != $event->getIsDefault()) { + + // Reset default status + CurrencyQuery::create()->filterByByDefault(true)->update(array('ByDefault' => false)); + + $currency + ->setDispatcher($this->getDispatcher()) + ->setByDefault($event->getIsDefault()) + ->save() + ; + } + + $event->setCurrency($currency); + } + } + + /** + * Delete a currencyuration entry + * + * @param CurrencyDeleteEvent $event + */ + public function delete(CurrencyDeleteEvent $event) + { + + if (null !== ($currency = CurrencyQuery::create()->findOneById($event->getCurrencyId()))) { + + $currency + ->setDispatcher($this->getDispatcher()) + ->delete() + ; + + $event->setCurrency($currency); + } + } + + public function updateRates() { + + $rates_url = ConfigQuery::read('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml'); + + $rate_data = @file_get_contents($rates_url); + + if ($rate_data && $sxe = new \SimpleXMLElement($rate_data)) { + + foreach ($sxe->Cube[0]->Cube[0]->Cube as $last) + { + $code = strtoupper($last["currency"]); + $rate = floatval($last['rate']); + + if (null !== $currency = CurrencyQuery::create()->findOneByCode($code)) { + $currency + ->setDispatcher($this->getDispatcher()) + ->setRate($rate) + ->save() + ; + } + } + } + else { + throw new \RuntimeException(sprintf("Failed to get currency rates data from URL %s", $rates_url)); + } + } + + /** + * Changes position, selecting absolute ou relative change. + * + * @param CategoryChangePositionEvent $event + */ + public function updatePosition(CurrencyUpdatePositionEvent $event) + { + if (null !== $currency = CurrencyQuery::create()->findOneById($event->getObjectId())) { + + $currency->setDispatcher($this->getDispatcher()); + + $mode = $event->getMode(); + + if ($mode == CurrencyUpdatePositionEvent::POSITION_ABSOLUTE) + return $currency->changeAbsolutePosition($event->getPosition()); + else if ($mode == CurrencyUpdatePositionEvent::POSITION_UP) + return $currency->movePositionUp(); + else if ($mode == CurrencyUpdatePositionEvent::POSITION_DOWN) + return $currency->movePositionDown(); + } + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::CURRENCY_CREATE => array("create", 128), + TheliaEvents::CURRENCY_UPDATE => array("update", 128), + TheliaEvents::CURRENCY_DELETE => array("delete", 128), + TheliaEvents::CURRENCY_SET_DEFAULT => array("setDefault", 128), + TheliaEvents::CURRENCY_UPDATE_RATES => array("updateRates", 128), + TheliaEvents::CURRENCY_UPDATE_POSITION => array("updatePosition", 128) + ); + } +} diff --git a/core/lib/Thelia/Action/Customer.php b/core/lib/Thelia/Action/Customer.php index 785ee8f48..962e2e2cf 100755 --- a/core/lib/Thelia/Action/Customer.php +++ b/core/lib/Thelia/Action/Customer.php @@ -38,7 +38,16 @@ use Symfony\Component\Validator\Exception\ValidatorException; use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Security\Exception\UsernameNotFoundException; use Propel\Runtime\Exception\PropelException; +use Thelia\Core\Event\CustomerLoginEvent; +/** + * + * customer class where all actions are managed + * + * Class Customer + * @package Thelia\Action + * @author Manuel Raynaud + */ class Customer extends BaseAction implements EventSubscriberInterface { @@ -46,7 +55,6 @@ class Customer extends BaseAction implements EventSubscriberInterface { $customer = new CustomerModel(); - $customer->setDispatcher($this->getDispatcher()); $this->createOrUpdateCustomer($customer, $event); @@ -56,7 +64,6 @@ class Customer extends BaseAction implements EventSubscriberInterface { $customer = $event->getCustomer(); - $customer->setDispatcher($this->getDispatcher()); $this->createOrUpdateCustomer($customer, $event); @@ -64,6 +71,8 @@ class Customer extends BaseAction implements EventSubscriberInterface private function createOrUpdateCustomer(CustomerModel $customer, CustomerCreateOrUpdateEvent $event) { + $customer->setDispatcher($this->getDispatcher()); + $customer->createOrUpdate( $event->getTitle(), $event->getFirstname(), @@ -87,6 +96,12 @@ class Customer extends BaseAction implements EventSubscriberInterface $event->setCustomer($customer); } + + public function login(CustomerLoginEvent $event) + { + $this->getSecurityContext()->setCustomerUser($event->getCustomer()); + } + /** * Perform user logout. The user is redirected to the provided view, if any. * @@ -94,9 +109,7 @@ class Customer extends BaseAction implements EventSubscriberInterface */ public function logout(ActionEvent $event) { - $event->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_LOGOUT, $event); - - $this->getFrontSecurityContext()->clear(); + $this->getSecurityContext()->clearCustomerUser(); } public function changePassword(ActionEvent $event) @@ -104,6 +117,16 @@ class Customer extends BaseAction implements EventSubscriberInterface // TODO } + /** + * Return the security context + * + * @return Thelia\Core\Security\SecurityContext + */ + protected function getSecurityContext() + { + return $this->container->get('thelia.securityContext'); + } + /** * Returns an array of event names this subscriber wants to listen to. * @@ -127,8 +150,10 @@ class Customer extends BaseAction implements EventSubscriberInterface public static function getSubscribedEvents() { return array( - "action.createCustomer" => array("create", 128), - "action.modifyCustomer" => array("modify", 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), ); } } diff --git a/core/lib/Thelia/Action/Image.php b/core/lib/Thelia/Action/Image.php old mode 100644 new mode 100755 index eabf03b0a..103633165 --- a/core/lib/Thelia/Action/Image.php +++ b/core/lib/Thelia/Action/Image.php @@ -269,8 +269,8 @@ class Image extends BaseAction implements EventSubscriberInterface $event->setCacheFilepath($cacheFilePath); $event->setCacheOriginalFilepath($originalImagePathInCache); - $event->setFileUrl(URL::absoluteUrl($processed_image_url, null, URL::PATH_TO_FILE)); - $event->setOriginalFileUrl(URL::absoluteUrl($original_image_url, null, URL::PATH_TO_FILE)); + $event->setFileUrl(URL::getInstance()->absoluteUrl($processed_image_url, null, URL::PATH_TO_FILE)); + $event->setOriginalFileUrl(URL::getInstance()->absoluteUrl($original_image_url, null, URL::PATH_TO_FILE)); } /** @@ -382,7 +382,7 @@ class Image extends BaseAction implements EventSubscriberInterface { $path = $this->getCachePathFromWebRoot($subdir); - return URL::absoluteUrl(sprintf("%s/%s", $path, $safe_filename), null, URL::PATH_TO_FILE); + return URL::getInstance()->absoluteUrl(sprintf("%s/%s", $path, $safe_filename), null, URL::PATH_TO_FILE); } /** @@ -494,4 +494,4 @@ class Image extends BaseAction implements EventSubscriberInterface TheliaEvents::IMAGE_CLEAR_CACHE => array("clearCache", 128), ); } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Action/Message.php b/core/lib/Thelia/Action/Message.php new file mode 100644 index 000000000..5299efc99 --- /dev/null +++ b/core/lib/Thelia/Action/Message.php @@ -0,0 +1,125 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +use Thelia\Model\MessageQuery; +use Thelia\Model\Message as MessageModel; + +use Thelia\Core\Event\TheliaEvents; + +use Thelia\Core\Event\MessageUpdateEvent; +use Thelia\Core\Event\MessageCreateEvent; +use Thelia\Core\Event\MessageDeleteEvent; + +class Message extends BaseAction implements EventSubscriberInterface +{ + /** + * Create a new messageuration entry + * + * @param MessageCreateEvent $event + */ + public function create(MessageCreateEvent $event) + { + $message = new MessageModel(); + + $message + ->setDispatcher($this->getDispatcher()) + + ->setName($event->getMessageName()) + + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + + ->setSecured($event->getSecured()) + + ->save() + ; + + $event->setMessage($message); + } + + /** + * Change a message + * + * @param MessageUpdateEvent $event + */ + public function modify(MessageUpdateEvent $event) + { + $search = MessageQuery::create(); + + if (null !== $message = MessageQuery::create()->findOneById($event->getMessageId())) { + + $message + ->setDispatcher($this->getDispatcher()) + + ->setName($event->getMessageName()) + ->setSecured($event->getSecured()) + + ->setLocale($event->getLocale()) + + ->setTitle($event->getTitle()) + ->setSubject($event->getSubject()) + ->setHtmlMessage($event->getHtmlMessage()) + ->setTextMessage($event->getTextMessage()) + + ->save(); + + $event->setMessage($message); + } + } + + /** + * Delete a messageuration entry + * + * @param MessageDeleteEvent $event + */ + public function delete(MessageDeleteEvent $event) + { + + if (null !== ($message = MessageQuery::create()->findOneById($event->getMessageId()))) { + + $message + ->setDispatcher($this->getDispatcher()) + ->delete() + ; + + $event->setMessage($message); + } + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::MESSAGE_CREATE => array("create", 128), + TheliaEvents::MESSAGE_UPDATE => array("modify", 128), + TheliaEvents::MESSAGE_DELETE => array("delete", 128), + ); + } +} diff --git a/core/lib/Thelia/Action/PageNotFound.php b/core/lib/Thelia/Action/PageNotFound.php new file mode 100755 index 000000000..a4d715fbb --- /dev/null +++ b/core/lib/Thelia/Action/PageNotFound.php @@ -0,0 +1,85 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\KernelEvents; +use Thelia\Model\ConfigQuery; + +/** + * + * Class PageNotFound + * @package Thelia\Action + * @author Etienne Roudeix + */ +class PageNotFound extends BaseAction implements EventSubscriberInterface +{ + public function display404(GetResponseForExceptionEvent $event) + { + if($event->getException() instanceof NotFoundHttpException) { + + $parser = $this->container->get("thelia.parser"); + + // Define the template thant shoud be used + $parser->setTemplate(ConfigQuery::getActiveTemplate()); + + //$event->getRequest()->attributes->set('_view', ConfigQuery::getPageNotFoundView()); + + $response = new Response($parser->render(ConfigQuery::getPageNotFoundView()), 404); + + $event->setResponse($response); + } + } + + /** + * 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( + KernelEvents::EXCEPTION => array("display404", 128), + ); + } +} diff --git a/core/lib/Thelia/Action/PositionManagementTrait.php b/core/lib/Thelia/Action/PositionManagementTrait.php new file mode 100644 index 000000000..70f91d995 --- /dev/null +++ b/core/lib/Thelia/Action/PositionManagementTrait.php @@ -0,0 +1,157 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + +use Thelia\Core\Event\BaseChangePositionEvent; + +trait PositionManagementTrait { + + const POSITION_UP + /** + * Changes object position, selecting absolute ou relative change. + * + * @param BaseChangePositionEvent $event + */ + public function changePosition(BaseChangePositionEvent $event) + { + if ($event->getMode() == BaseChangePositionEvent::POSITION_ABSOLUTE) + return $this->changeAbsolutePosition($event); + else + return $this->exchangePosition($event); + } + + /** + * Move up or down a object + * + * @param BaseChangePositionEvent $event + */ + protected function exchangePosition(BaseChangePositionEvent $event) + { + $object = CategoryQuery::create()->findPk($event->getCategoryId()); + + if ($object !== null) { + + // The current position of the object + $my_position = $object->getPosition(); + + // Find object to exchange position with + $search = CategoryQuery::create() + ->filterByParent($object->getParent()); + + // Up or down ? + if ($event->getMode() == BaseChangePositionEvent::POSITION_UP) { + // Find the object immediately before me + $search->filterByPosition(array('max' => $my_position-1))->orderByPosition(Criteria::DESC); + } elseif ($event->getMode() == BaseChangePositionEvent::POSITION_DOWN) { + // Find the object immediately after me + $search->filterByPosition(array('min' => $my_position+1))->orderByPosition(Criteria::ASC); + } else + + return; + + $result = $search->findOne(); + + // If we found the proper object, exchange their positions + if ($result) { + + $cnx = Propel::getWriteConnection(CategoryTableMap::DATABASE_NAME); + + $cnx->beginTransaction(); + + try { + $object + ->setDispatcher($this->getDispatcher()) + ->setPosition($result->getPosition()) + ->save() + ; + + $result->setPosition($my_position)->save(); + + $cnx->commit(); + } catch (Exception $e) { + $cnx->rollback(); + } + } + } + } + + /** + * Changes object position + * + * @param BaseChangePositionEvent $event + */ + protected function changeAbsolutePosition(BaseChangePositionEvent $event) + { + $object = CategoryQuery::create()->findPk($event->getCategoryId()); + + if ($object !== null) { + + // The required position + $new_position = $event->getPosition(); + + // The current position + $current_position = $object->getPosition(); + + if ($new_position != null && $new_position > 0 && $new_position != $current_position) { + + // Find categories to offset + $search = CategoryQuery::create()->filterByParent($object->getParent()); + + if ($new_position > $current_position) { + // The new position is after the current position -> we will offset + 1 all categories located between us and the new position + $search->filterByPosition(array('min' => 1+$current_position, 'max' => $new_position)); + + $delta = -1; + } else { + // The new position is brefore the current position -> we will offset - 1 all categories located between us and the new position + $search->filterByPosition(array('min' => $new_position, 'max' => $current_position - 1)); + + $delta = 1; + } + + $results = $search->find(); + + $cnx = Propel::getWriteConnection(CategoryTableMap::DATABASE_NAME); + + $cnx->beginTransaction(); + + try { + foreach ($results as $result) { + $result->setPosition($result->getPosition() + $delta)->save($cnx); + } + + $object + ->setDispatcher($this->getDispatcher()) + ->setPosition($new_position) + ->save($cnx) + ; + + $cnx->commit(); + } catch (Exception $e) { + $cnx->rollback(); + } + } + } + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Cart/CartTrait.php b/core/lib/Thelia/Cart/CartTrait.php old mode 100644 new mode 100755 index ed4f70374..527867d5d --- a/core/lib/Thelia/Cart/CartTrait.php +++ b/core/lib/Thelia/Cart/CartTrait.php @@ -28,9 +28,16 @@ use Thelia\Model\ConfigQuery; use Thelia\Model\Customer; use Symfony\Component\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Session\Session; -use Thelia\Core\Event\Internal\CartEvent; use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Event\CartEvent; +/** + * managed cart + * + * Trait CartTrait + * @package Thelia\Cart + * @author Manuel Raynaud + */ trait CartTrait { /** @@ -42,8 +49,9 @@ trait CartTrait */ public function getCart(Request $request) { + $session = $request->getSession(); - if (null !== $cart = $request->getSession()->getCart()) { + if (null !== $cart = $session->getCart()) { return $cart; } @@ -55,26 +63,26 @@ trait CartTrait if ($cart) { //le panier existe en base - $customer = $request->getSession()->getCustomerUser(); + $customer = $session->getCustomerUser(); if ($customer) { if ($cart->getCustomerId() != $customer->getId()) { //le customer du panier n'est pas le mm que celui connecté, il faut cloner le panier sans le customer_id - $cart = $this->duplicateCart($cart, $request->getSession(), $customer); + $cart = $this->duplicateCart($cart, $session, $customer); } } else { if ($cart->getCustomerId() != null) { //il faut dupliquer le panier sans le customer_id - $cart = $this->duplicateCart($cart, $request->getSession()); + $cart = $this->duplicateCart($cart, $session); } } } else { - $cart = $this->createCart($request->getSession()); + $cart = $this->createCart($session); } } else { //le cookie de panier n'existe pas, il va falloir le créer et faire un enregistrement en base. - $cart = $this->createCart($request->getSession()); + $cart = $this->createCart($session); } return $cart; @@ -116,7 +124,7 @@ trait CartTrait $cartEvent = new CartEvent($newCart); $this->getDispatcher()->dispatch(TheliaEvents::CART_DUPLICATE, $cartEvent); - return $cartEvent->cart; + return $cartEvent->getCart(); } protected function generateCookie() @@ -131,4 +139,4 @@ trait CartTrait return $id; } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Command/BaseModuleGenerate.php b/core/lib/Thelia/Command/BaseModuleGenerate.php old mode 100644 new mode 100755 index fab1b7707..b26db435b --- a/core/lib/Thelia/Command/BaseModuleGenerate.php +++ b/core/lib/Thelia/Command/BaseModuleGenerate.php @@ -22,6 +22,13 @@ /*************************************************************************************/ namespace Thelia\Command; +/** + * base class for module commands + * + * Class BaseModuleGenerate + * @package Thelia\Command + * @author Manuel Raynaud + */ abstract class BaseModuleGenerate extends ContainerAwareCommand { protected $module; diff --git a/core/lib/Thelia/Command/CacheClear.php b/core/lib/Thelia/Command/CacheClear.php index ed1cca8a6..37e853f05 100755 --- a/core/lib/Thelia/Command/CacheClear.php +++ b/core/lib/Thelia/Command/CacheClear.php @@ -24,19 +24,35 @@ namespace Thelia\Command; 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; +/** + * clear the cache + * + * Class CacheClear + * @package Thelia\Command + * @author Manuel Raynaud + * + */ class CacheClear extends ContainerAwareCommand { protected function configure() { $this ->setName("cache:clear") - ->setDescription("Invalidate all caches"); + ->setDescription("Invalidate all caches") + ->addOption( + "without-assets", + null, + InputOption::VALUE_NONE, + "remove cache assets" + ) + ; } protected function execute(InputInterface $input, OutputInterface $output) @@ -44,20 +60,28 @@ class CacheClear extends ContainerAwareCommand $cacheDir = $this->getContainer()->getParameter("kernel.cache_dir"); - if (!is_writable($cacheDir)) { - throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $cacheDir)); - } - - $output->writeln(sprintf("Clearing cache in %s directory", $cacheDir)); - - $fs = new Filesystem(); - try { - $fs->remove($cacheDir); - - $output->writeln("cache cleared successfully"); - } catch (IOException $e) { - $output->writeln(sprintf("error during clearing cache : %s", $e->getMessage())); + $this->clearCache($cacheDir, $output); + if(!$input->getOption("without-assets")) { + $this->clearCache(THELIA_WEB_DIR . "/assets", $output); } } + + protected function clearCache($dir, OutputInterface $output) + { + if (!is_writable($dir)) { + throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $dir)); + } + + $output->writeln(sprintf("Clearing cache in %s directory", $dir)); + + $fs = new Filesystem(); + try { + $fs->remove($dir); + + $output->writeln(sprintf("%s cache dir cleared successfully", $dir)); + } catch (IOException $e) { + $output->writeln(sprintf("error during clearing cache : %s", $e->getMessage())); + } + } } diff --git a/core/lib/Thelia/Command/ClearImageCache.php b/core/lib/Thelia/Command/ClearImageCache.php old mode 100644 new mode 100755 index 801e2e8d0..babbdd619 --- a/core/lib/Thelia/Command/ClearImageCache.php +++ b/core/lib/Thelia/Command/ClearImageCache.php @@ -1,5 +1,4 @@ writeln(sprintf("Failed to clear image cache: %s", $ex->getMessage())); } } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Command/CreateAdminUser.php b/core/lib/Thelia/Command/CreateAdminUser.php new file mode 100644 index 000000000..868ca1496 --- /dev/null +++ b/core/lib/Thelia/Command/CreateAdminUser.php @@ -0,0 +1,147 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Command; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +use Thelia\Command\ContainerAwareCommand; +use Thelia\Model\Admin; + +class CreateAdminUser extends ContainerAwareCommand +{ + /** + * Configure the command + */ + protected function configure() + { + $this + ->setName("thelia:create-admin") + ->setDescription("Create a new adminsitration user") + ->setHelp("The thelia:create-admin command create a new administration user.") + ->addOption( + 'login_name', + null, + InputOption::VALUE_OPTIONAL, + 'Admin login name', + null + ) + ->addOption( + 'first_name', + null, + InputOption::VALUE_OPTIONAL, + 'User first name', + null + ) + ->addOption( + "last_name", + null, + InputOption::VALUE_OPTIONAL, + 'User last name', + null + ) + ->addOption( + 'password', + null, + InputOption::VALUE_OPTIONAL, + 'Password', + null + ) + ; + + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $output->writeln('Please enter the admin user information:'); + + $admin = $this->getAdminInfo($input, $output); // new Admin(); + + $admin->save(); + + $output->writeln(array( + "", + "User ".$admin->getLogin()." successfully created.", + "" + )); + } + + protected function enterData($dialog, $output, $label, $error_message) + { + return $dialog->askAndValidate( + $output, + $this->decorateInfo($label), + function ($answer) { + $answer = trim($answer); + if (empty($answer)) { + throw new \RuntimeException("This information is mandatory."); + } + + return $answer; + } + ); + } + + /** + * Ask to user all needed information + * + * @param InputInterface $input + * @param OutputInterface $output + * @return array + */ + protected function getAdminInfo(InputInterface $input, OutputInterface $output) + { + $dialog = $this->getHelperSet()->get('dialog'); + + $admin = new Admin(); + + $admin->setLogin($input->getOption("login_name") ?: $this->enterData($dialog, $output, "Admin login name : ", "Please enter a login name.")); + $admin->setFirstname($input->getOption("first_name") ?: $this->enterData($dialog, $output, "User first name : ", "Please enter user first name.")); + $admin->setLastname($input->getOption("last_name") ?: $this->enterData($dialog, $output, "User last name : ", "Please enter user last name.")); + + do { + $password = $input->getOption("password") ?: $this->enterData($dialog, $output, "Password : ", "Please enter a password."); + $password_again = $input->getOption("password") ?: $this->enterData($dialog, $output, "Password (again): ", "Please enter the password again."); + + if (! empty($password) && $password == $password_again) { + + $admin->setPassword($password); + + break; + } + + $output->writeln("Passwords are different, please try again."); + } + while (true); + + return $admin; + } + + protected function decorateInfo($text) + { + return sprintf("%s", $text); + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Command/Install.php b/core/lib/Thelia/Command/Install.php index edf459086..03b7fda48 100755 --- a/core/lib/Thelia/Command/Install.php +++ b/core/lib/Thelia/Command/Install.php @@ -28,7 +28,15 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; use Thelia\Command\ContainerAwareCommand; +use Thelia\Install\Database; +/** + * try to install a new instance of Thelia + * + * Class Install + * @package Thelia\Command + * @author Manuel Raynaud + */ class Install extends ContainerAwareCommand { /** @@ -90,14 +98,16 @@ class Install extends ContainerAwareCommand $connectionInfo = $this->getConnectionInfo($input, $output); } - $this->createDatabase($connection, $connectionInfo["dbName"]); + $database = new Database($connection); + + $database->createDatabase($connectionInfo["dbName"]); $output->writeln(array( "", "Creating Thelia database, please wait", "" )); - $this->insertSql($connection, $connectionInfo["dbName"]); + $database->insertSql($connectionInfo["dbName"]); $output->writeln(array( "", @@ -196,65 +206,6 @@ class Install extends ContainerAwareCommand } - /** - * Insert all sql needed in database - * - * @param \PDO $connection - * @param $dbName - */ - protected function insertSql(\PDO $connection, $dbName) - { - $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")) - ); - - for ($i = 0; $i < count($sql); $i ++) { - $connection->query($sql[$i]); - } - } - - /** - * Separate each sql instruction in an array - * - * @param $sql - * @return array - */ - protected function prepareSql($sql) - { - $sql = str_replace(";',", "-CODE-", $sql); - $query = array(); - - $tab = explode(";", $sql); - - for ($i=0; $iquery( - sprintf( - "CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8", - $dbName - ) - ); - } - /** * test database access * diff --git a/core/lib/Thelia/Command/ModuleGenerateCommand.php b/core/lib/Thelia/Command/ModuleGenerateCommand.php old mode 100644 new mode 100755 index 842d421af..b34e43dc1 --- a/core/lib/Thelia/Command/ModuleGenerateCommand.php +++ b/core/lib/Thelia/Command/ModuleGenerateCommand.php @@ -27,6 +27,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; +/** + * generate a new Module + * + * Class ModuleGenerateCommand + * @package Thelia\Command + * @author Manuel Raynaud + */ class ModuleGenerateCommand extends BaseModuleGenerate { protected function configure() diff --git a/core/lib/Thelia/Command/ModuleGenerateModelCommand.php b/core/lib/Thelia/Command/ModuleGenerateModelCommand.php old mode 100644 new mode 100755 index 28e96fa52..fbbe9be6c --- a/core/lib/Thelia/Command/ModuleGenerateModelCommand.php +++ b/core/lib/Thelia/Command/ModuleGenerateModelCommand.php @@ -31,6 +31,13 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; +/** + * generate class model for a specific module + * + * Class ModuleGenerateModelCommand + * @package Thelia\Command + * @author Manuel Raynaud + */ class ModuleGenerateModelCommand extends BaseModuleGenerate { protected function configure() diff --git a/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php b/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php old mode 100644 new mode 100755 index 89d87cb6f..2c6b310a5 --- a/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php +++ b/core/lib/Thelia/Command/ModuleGenerateSqlCommand.php @@ -30,6 +30,13 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; +/** + * generate sql for a specific module + * + * Class ModuleGenerateSqlCommand + * @package Thelia\Command + * @author Manuel Raynaud + */ class ModuleGenerateSqlCommand extends BaseModuleGenerate { public function configure() diff --git a/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php b/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Command/ReloadDatabaseCommand.php b/core/lib/Thelia/Command/ReloadDatabaseCommand.php new file mode 100644 index 000000000..d25add644 --- /dev/null +++ b/core/lib/Thelia/Command/ReloadDatabaseCommand.php @@ -0,0 +1,70 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Command; +use Propel\Runtime\Propel; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Thelia\Install\Database; + + +/** + * Class ReloadDatabasesCommand + * @package Thelia\Command + * @author Manuel Raynaud + */ +class ReloadDatabaseCommand extends BaseModuleGenerate +{ + public function configure() + { + $this + ->setName("thelia:dev:reloadDB") + ->setDescription("erase current database and create new one") +/* ->addOption( + "load-fixtures", + null, + InputOption::VALUE_NONE, + "load fixtures in databases" + )*/ + ; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + $connection = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME); + $connection = $connection->getWrappedConnection(); + + $database = new Database($connection); + $output->writeln(array( + '', + 'starting reloaded database, please wait' + )); + $database->insertSql(); + $output->writeln(array( + '', + 'Database reloaded with success', + '' + )); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Command/Skeleton/Module/Class.php b/core/lib/Thelia/Command/Skeleton/Module/Class.php old mode 100644 new mode 100755 index c9c7109ac..c4c90aa60 --- 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/Command/Skeleton/Module/config.xml b/core/lib/Thelia/Command/Skeleton/Module/config.xml old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Command/Skeleton/Module/plugin.xml b/core/lib/Thelia/Command/Skeleton/Module/plugin.xml old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Command/Skeleton/Module/schema.xml b/core/lib/Thelia/Command/Skeleton/Module/schema.xml old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml index f773b4cd7..dd43bbb91 100755 --- a/core/lib/Thelia/Config/Resources/action.xml +++ b/core/lib/Thelia/Config/Resources/action.xml @@ -22,14 +22,44 @@ - + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index a404fa6f2..26a132e23 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -7,25 +7,35 @@ + + + + + - + + + + + + @@ -35,10 +45,27 @@
+ + + - + + + + + + + + + + + + + + + @@ -49,10 +76,18 @@ + + + + + + + + @@ -69,7 +104,7 @@ - + @@ -78,8 +113,6 @@ - - @@ -102,12 +135,18 @@ + %kernel.environment% + + + + + @@ -145,17 +184,24 @@ - + - + + + + + + + + @@ -167,6 +213,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/lib/Thelia/Config/Resources/routing.xml b/core/lib/Thelia/Config/Resources/routing.xml index 9c61c55a8..a8ad18abf 100755 --- a/core/lib/Thelia/Config/Resources/routing.xml +++ b/core/lib/Thelia/Config/Resources/routing.xml @@ -56,6 +56,17 @@ + + + install.xml + + %kernel.cache_dir% + %kernel.debug% + + + + + front.xml @@ -64,6 +75,10 @@ %kernel.debug% + + + + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index ece222c22..3235171df 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -25,20 +25,185 @@ - + - Thelia\Controller\Admin\CategoryController::indexAction + Thelia\Controller\Admin\CategoryController::defaultAction - - Thelia\Controller\Admin\CategoryController::processAction + + + + Thelia\Controller\Admin\CustomerController::indexAction + + + + + + Thelia\Controller\Admin\CategoryController::defaultAction + + + + Thelia\Controller\Admin\CategoryController::createAction + + + + Thelia\Controller\Admin\CategoryController::changeAction + + + + Thelia\Controller\Admin\CategoryController::saveChangeAction + + + + Thelia\Controller\Admin\CategoryController::toggleOnlineAction + + + + Thelia\Controller\Admin\CategoryController::deleteAction + + + + Thelia\Controller\Admin\CategoryController::updatePositionAction + + + Thelia\Controller\Admin\CategoryController::getByParentIdAction + xml|json + + + + + + + + + + + Thelia\Controller\Admin\CouponController::browseAction + + + Thelia\Controller\Admin\CouponController::createAction + + + Thelia\Controller\Admin\CouponController::updateAction + + + Thelia\Controller\Admin\CouponController::readAction + + + Thelia\Controller\Admin\CouponController::getRuleInputAction + + + + + + + + + + + Thelia\Controller\Admin\ConfigController::defaultAction + + + + Thelia\Controller\Admin\ConfigController::changeValuesAction + + + + Thelia\Controller\Admin\ConfigController::createAction + + + + Thelia\Controller\Admin\ConfigController::changeAction + + + + Thelia\Controller\Admin\ConfigController::saveChangeAction + + + + Thelia\Controller\Admin\ConfigController::deleteAction + + + + + + Thelia\Controller\Admin\MessageController::defaultAction + + + + Thelia\Controller\Admin\MessageController::createAction + + + + Thelia\Controller\Admin\MessageController::changeAction + + + + Thelia\Controller\Admin\MessageController::saveChangeAction + + + + Thelia\Controller\Admin\MessageController::deleteAction + + + + + + Thelia\Controller\Admin\CurrencyController::defaultAction + + + + Thelia\Controller\Admin\CurrencyController::createAction + + + + Thelia\Controller\Admin\CurrencyController::changeAction + + + + Thelia\Controller\Admin\CurrencyController::saveChangeAction + + + + Thelia\Controller\Admin\CurrencyController::setDefaultAction + + + + Thelia\Controller\Admin\CurrencyController::updatePositionAction + + + + Thelia\Controller\Admin\CurrencyController::updateRatesAction + + + + Thelia\Controller\Admin\CurrencyController::deleteAction + + + + Thelia\Controller\Admin\CurrencyController::updatePositionAction + + + + + + Thelia\Controller\Admin\AttributeController::defaultAction + + + + Thelia\Controller\Admin\AttributeController::updateAction + + + + Thelia\Controller\Admin\AdminController::processTemplateAction .* + diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml old mode 100644 new mode 100755 index c420e1550..aeff55d7c --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -9,6 +9,7 @@ index + Thelia\Controller\Front\CustomerController::createAction connexion @@ -18,16 +19,38 @@ Thelia\Controller\Front\CustomerController::updateAction - + Thelia\Controller\Front\CustomerController::loginAction + + Thelia\Controller\Front\CustomerController::logoutAction + + + + + + Thelia\Controller\Front\AddressController::createAction + address + + + + Thelia\Controller\Front\DefaultController::noAction + address_edit + + + + Thelia\Controller\Front\AddressController::updateAction + + + + Thelia\Controller\Front\CartController::addItem cart - + Thelia\Controller\Front\CartController::deleteItem cart @@ -36,4 +59,12 @@ Thelia\Controller\Front\CartController::changeItem cart + + + + Thelia\Controller\Front\DeliveryController::select + \d+ + + + diff --git a/core/lib/Thelia/Config/Resources/routing/install.xml b/core/lib/Thelia/Config/Resources/routing/install.xml new file mode 100644 index 000000000..d53763948 --- /dev/null +++ b/core/lib/Thelia/Config/Resources/routing/install.xml @@ -0,0 +1,15 @@ + + + + + + Thelia\Controller\Install\InstallController::index + + + + Thelia\Controller\Install\InstallController::checkPermission + + + diff --git a/core/lib/Thelia/Constraint/ConstraintFactory.php b/core/lib/Thelia/Constraint/ConstraintFactory.php new file mode 100644 index 000000000..e96509172 --- /dev/null +++ b/core/lib/Thelia/Constraint/ConstraintFactory.php @@ -0,0 +1,162 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint; + +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\Serializer\Encoder\JsonEncoder; +use Thelia\Constraint\Rule\AvailableForTotalAmountManager; +use Thelia\Constraint\Rule\CouponRuleInterface; +use Thelia\Constraint\Rule\SerializableRule; +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Coupon\CouponRuleCollection; + + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Manage how Constraint could interact + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class ConstraintFactory +{ + /** @var ContainerInterface Service Container */ + protected $container = null; + + /** @var CouponAdapterInterface Provide necessary value from Thelia*/ + protected $adapter; + + /** @var array CouponRuleCollection to process*/ + protected $rules = null; + + /** + * Constructor + * + * @param ContainerInterface $container Service container + */ + function __construct(ContainerInterface $container) + { + $this->container = $container; + $this->adapter = $container->get('thelia.adapter'); + } + + /** + * Serialize a collection of rules + * + * @param CouponRuleCollection $collection A collection of rules + * + * @return string A ready to be stored Rule collection + */ + public function serializeCouponRuleCollection(CouponRuleCollection $collection) + { + $serializableRules = array(); + $rules = $collection->getRules(); + if ($rules !== null) { + /** @var $rule CouponRuleInterface */ + foreach ($rules as $rule) { + $serializableRules[] = $rule->getSerializableRule(); + } + } + + return base64_encode(json_encode($serializableRules)); + } + + /** + * Unserialize a collection of rules + * + * @param string $serializedRules Serialized Rules + * + * @return CouponRuleCollection Rules ready to be processed + */ + public function unserializeCouponRuleCollection($serializedRules) + { + $unserializedRules = json_decode(base64_decode($serializedRules)); + + $collection = new CouponRuleCollection(); + + if (!empty($serializedRules) && !empty($unserializedRules)) { + /** @var SerializableRule $rule */ + foreach ($unserializedRules as $rule) { + if ($this->container->has($rule->ruleServiceId)) { + /** @var CouponRuleInterface $couponRule */ + $couponRule = $this->build( + $rule->ruleServiceId, + (array) $rule->operators, + (array) $rule->values + ); + $collection->add(clone $couponRule); + } + } + } + + return $collection; + } + + + /** + * Build a Coupon Rule from form + * + * @param string $ruleServiceId Rule class name + * @param array $operators Rule Operator (<, >, = ) + * @param array $values Values setting this Rule + * + * @throws \InvalidArgumentException + * @return CouponRuleInterface Ready to use Rule or false + */ + public function build($ruleServiceId, array $operators, array $values) + { + if (!$this->container->has($ruleServiceId)) { + return false; + } + + /** @var CouponRuleInterface $rule */ + $rule = $this->container->get($ruleServiceId); + $rule->setValidatorsFromForm($operators, $values); + + return $rule; + } + + /** + * Get Coupon Rule inputs from serviceId + * + * @param string $ruleServiceId Rule class name + * + * @return array Ready to be drawn rule inputs + */ + public function getInputs($ruleServiceId) + { + if (!$this->container->has($ruleServiceId)) { + return false; + } + + /** @var CouponRuleInterface $rule */ + $rule = $this->container->get($ruleServiceId); + + return $rule->getValidators(); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/ConstraintValidator.php b/core/lib/Thelia/Constraint/ConstraintValidator.php new file mode 100644 index 000000000..edacee317 --- /dev/null +++ b/core/lib/Thelia/Constraint/ConstraintValidator.php @@ -0,0 +1,133 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint; + +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\Serializer\Encoder\JsonEncoder; +use Thelia\Constraint\Rule\AvailableForTotalAmountManager; +use Thelia\Constraint\Rule\CouponRuleInterface; +use Thelia\Constraint\Rule\Operators; +use Thelia\Coupon\CouponRuleCollection; + + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Validate Constraints + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class ConstraintValidator +{ + + /** + * Check if a Customer meets SerializableRule + * + * @param CouponRuleCollection $rules Rules to check against the Customer + * + * @return bool + */ + public function test(CouponRuleCollection $rules) + { + $isMatching = true; + /** @var CouponRuleInterface $rule */ + foreach ($rules->getRules() as $rule) { + if (!$rule->isMatching()) { + $isMatching = false; + } + } + + return $isMatching; + + } + + /** + * Do variable comparison + * + * @param mixed $v1 Variable 1 + * @param string $o Operator + * + * @param mixed $v2 Variable 2 + * @throws \Exception + * @return bool + */ + public function variableOpComparison($v1, $o, $v2) { + if ($o == Operators::DIFFERENT) { + return ($v1 != $v2); + } // could put this elsewhere... +// $operators = str_split($o); +// foreach($o as $operator) { + switch ($o) { // return will exit switch, foreach loop, function + case Operators::SUPERIOR : // > + if ($v1 > $v2) { + return true; + } else { + continue; + } break; + case Operators::SUPERIOR_OR_EQUAL : // >= + if ($v1 >= $v2) { + return true; + } else { + continue; + } break; + case Operators::INFERIOR : // < + if ($v1 < $v2) { + return true; + } else { + continue; + } break; + case Operators::INFERIOR_OR_EQUAL : // <= + if ($v1 <= $v2) { + return true; + } else { + continue; + } break; + case Operators::EQUAL : // == + if ($v1 == $v2) { + return true; + } else { + continue; + } break; + case Operators::IN: + if (in_array($v1, $v2)) { // in + return true; + } else { + continue; + } break; + case Operators::OUT: + if (!in_array($v1, $v2)) { // not in + return true; + } else { + continue; + } break; + default: throw new \Exception('Unrecognized operator ' . $o); + } +// } + return false; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/AvailableForCustomer.php b/core/lib/Thelia/Constraint/Rule/AvailableForCustomer.php new file mode 100644 index 000000000..ad722eb5c --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/AvailableForCustomer.php @@ -0,0 +1,178 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +use Thelia\Constraint\Validator\CustomerParam; +use Thelia\Constraint\Validator\RuleValidator; +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Exception\InvalidRuleException; +use Thelia\Exception\InvalidRuleOperatorException; +use Thelia\Exception\InvalidRuleValueException; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForCustomer extends CouponRuleAbstract +{ + + /** Rule 1st parameter : customer id */ + CONST PARAM1 = 'customerId'; + + /** @var array Available Operators (Operators::CONST) */ + protected $availableOperators = array( + Operators::EQUAL, + ); + + /** @var RuleValidator Customer Validator */ + protected $customerValidator = null; + + /** + * Check if backoffice inputs are relevant or not + * + * @throws InvalidRuleOperatorException if Operator is not allowed + * @throws InvalidRuleValueException if Value is not allowed + * @return bool + */ + public function checkBackOfficeInput() + { + if (!isset($this->validators) + || empty($this->validators) + ||!isset($this->validators[self::PARAM1]) + ||!isset($this->validators[self::PARAM1]) + ) { + throw new InvalidRuleValueException(get_class(), self::PARAM1); + } + + /** @var RuleValidator $ruleValidator */ + $ruleValidator = $this->validators[self::PARAM1]; + /** @var CustomerParam $customer */ + $customer = $ruleValidator->getParam(); + + if (!$customer instanceof CustomerParam) { + throw new InvalidRuleValueException(get_class(), self::PARAM1); + } + + $this->checkBackOfficeInputsOperators(); + + return $this->isCustomerValid($customer->getInteger()); + } + + /** + * Generate current Rule param to be validated from adapter + * + * @return $this + */ + protected function setParametersToValidate() + { + $this->paramsToValidate = array( + self::PARAM1 => $this->adapter->getCustomer()->getId() + ); + + return $this; + } + + /** + * Check if Checkout inputs are relevant or not + * + * @throws \Thelia\Exception\InvalidRuleValueException + * @return bool + */ + public function checkCheckoutInput() + { + if (!isset($this->paramsToValidate) + || empty($this->paramsToValidate) + ||!isset($this->paramsToValidate[self::PARAM1]) + ) { + throw new InvalidRuleValueException(get_class(), self::PARAM1); + } + + $customerId = $this->paramsToValidate[self::PARAM1]; + + return $this->isCustomerValid($customerId); + } + + /** + * Check if a Customer is valid + * + * @param int $customerId Customer to check + * + * @throws InvalidRuleValueException if Value is not allowed + * @return bool + */ + protected function isCustomerValid($customerId) + { + $customerValidator = $this->customerValidator; + try { + $customerValidator->getParam()->compareTo($customerId); + } catch(\InvalidArgumentException $e) { + throw new InvalidRuleValueException(get_class(), self::PARAM1); + } + + return true; + } + + /** + * Get I18n name + * + * @return string + */ + public function getName() + { + return $this->adapter + ->getTranslator() + ->trans('Customer', null, 'constraint'); + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + /** @var CustomerParam $param */ + $param = $this->customerValidator->getParam(); + $toolTip = $this->adapter + ->getTranslator() + ->trans( + 'If customer is %fistname% %lastname% (%email%)', + array( + '%fistname%' => $param->getFirstName(), + '%lastname%' => $param->getLastName(), + '%email%' => $param->getEmail(), + ), + 'constraint' + ); + + return $toolTip; + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/AvailableForDate.php b/core/lib/Thelia/Constraint/Rule/AvailableForDate.php new file mode 100644 index 000000000..1ddfd0350 --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/AvailableForDate.php @@ -0,0 +1,59 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForDate extends AvailableForPeriod +{ + + /** + * Check if backoffice inputs are relevant or not + * + * @return bool + */ + public function checkBackOfficeInput() + { + // TODO: Implement checkBackOfficeInput() method. + } + + /** + * Check if Checkout inputs are relevant or not + * + * @return bool + */ + public function checkCheckoutInput() + { + // TODO: Implement checkCheckoutInput() method. + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/AvailableForLocationX.php b/core/lib/Thelia/Constraint/Rule/AvailableForLocationX.php new file mode 100644 index 000000000..5c3ec494c --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/AvailableForLocationX.php @@ -0,0 +1,59 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForLocationX extends CouponRuleAbstract +{ + + /** + * Check if backoffice inputs are relevant or not + * + * @return bool + */ + public function checkBackOfficeInput() + { + // TODO: Implement checkBackOfficeInput() method. + } + + /** + * Check if Checkout inputs are relevant or not + * + * @return bool + */ + public function checkCheckoutInput() + { + // TODO: Implement checkCheckoutInput() method. + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/AvailableForPeriod.php b/core/lib/Thelia/Constraint/Rule/AvailableForPeriod.php new file mode 100644 index 000000000..30679a973 --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/AvailableForPeriod.php @@ -0,0 +1,57 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForPeriod extends CouponRuleAbstract +{ + + /** + * Check if backoffice inputs are relevant or not + * + * @return bool + */ + public function checkBackOfficeInput() + { + // TODO: Implement checkBackOfficeInput() method. + } + + /** + * Check if Checkout inputs are relevant or not + * + * @return bool + */ + public function checkCheckoutInput() + { + // TODO: Implement checkCheckoutInput() method. + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/AvailableForRepeatedDate.php b/core/lib/Thelia/Constraint/Rule/AvailableForRepeatedDate.php new file mode 100644 index 000000000..3449a7f5b --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/AvailableForRepeatedDate.php @@ -0,0 +1,57 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForRepeatedDate extends AvailableForDate +{ + + /** + * Check if backoffice inputs are relevant or not + * + * @return bool + */ + public function checkBackOfficeInput() + { + // TODO: Implement checkBackOfficeInput() method. + } + + /** + * Check if Checkout inputs are relevant or not + * + * @return bool + */ + public function checkCheckoutInput() + { + // TODO: Implement checkCheckoutInput() method. + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/AvailableForRepeatedPeriod.php b/core/lib/Thelia/Constraint/Rule/AvailableForRepeatedPeriod.php new file mode 100644 index 000000000..f5bf9bafc --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/AvailableForRepeatedPeriod.php @@ -0,0 +1,73 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +use Thelia\Coupon\CouponAdapterInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForRepeatedPeriod extends AvailableForPeriod +{ + + /** + * Generate current Rule param to be validated from adapter + * + * @param CouponAdapterInterface $adapter allowing to gather + * all necessary Thelia variables + * + * @throws \Symfony\Component\Intl\Exception\NotImplementedException + * @return $this + */ + public function setParametersToValidate(CouponAdapterInterface $adapter) + { + // @todo implement + } + + /** + * Check if backoffice inputs are relevant or not + * + * @return bool + */ + public function checkBackOfficeInput() + { + // TODO: Implement checkBackOfficeInput() method. + } + + /** + * Check if Checkout inputs are relevant or not + * + * @return bool + */ + public function checkCheckoutInput() + { + // TODO: Implement checkCheckoutInput() method. + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/AvailableForTotalAmountForCategoryY.php b/core/lib/Thelia/Constraint/Rule/AvailableForTotalAmountForCategoryY.php new file mode 100644 index 000000000..0f9f7f10b --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/AvailableForTotalAmountForCategoryY.php @@ -0,0 +1,38 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForTotalAmountForCategoryY extends AvailableForTotalAmount +{ + +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/AvailableForTotalAmountManager.php b/core/lib/Thelia/Constraint/Rule/AvailableForTotalAmountManager.php new file mode 100644 index 000000000..3fe051a20 --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/AvailableForTotalAmountManager.php @@ -0,0 +1,368 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +use Symfony\Component\Intl\Exception\NotImplementedException; +use Symfony\Component\Translation\Translator; +use Thelia\Constraint\ConstraintValidator; +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Constraint\Validator\PriceParam; +use Thelia\Constraint\Validator\RuleValidator; +use Thelia\Exception\InvalidRuleException; +use Thelia\Exception\InvalidRuleOperatorException; +use Thelia\Exception\InvalidRuleValueException; +use Thelia\Type\FloatType; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Rule AvailableForTotalAmount + * Check if a Checkout total amount match criteria + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForTotalAmountManager extends CouponRuleAbstract +{ + /** Rule 1st parameter : price */ + CONST INPUT1 = 'price'; + + /** Rule 1st parameter : currency */ + CONST INPUT2 = 'currency'; + + /** @var string Service Id from Resources/config.xml */ + protected $serviceId = 'thelia.constraint.rule.available_for_total_amount'; + + /** @var array Available Operators (Operators::CONST) */ + protected $availableOperators = array( + self::INPUT1 => array( + Operators::INFERIOR, + Operators::INFERIOR_OR_EQUAL, + Operators::EQUAL, + Operators::SUPERIOR_OR_EQUAL, + Operators::SUPERIOR + ), + self::INPUT2 => array( + Operators::EQUAL, + ) + ); + +// /** @var RuleValidator Price Validator */ +// protected $priceValidator = null; + +// /** +// * Check if backoffice inputs are relevant or not +// * +// * @throws InvalidRuleOperatorException if Operator is not allowed +// * @throws InvalidRuleValueException if Value is not allowed +// * @return bool +// */ +// public function checkBackOfficeInput() +// { +// if (!isset($this->validators) +// || empty($this->validators) +// ||!isset($this->validators[self::PARAM1_PRICE]) +// ||!isset($this->validators[self::PARAM1_PRICE]) +// ) { +// throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE); +// } +// +// /** @var RuleValidator $ruleValidator */ +// $ruleValidator = $this->validators[self::PARAM1_PRICE]; +// /** @var PriceParam $price */ +// $price = $ruleValidator->getParam(); +// +// if (!$price instanceof PriceParam) { +// throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE); +// } +// +// $this->checkBackOfficeInputsOperators(); +// +// return $this->isPriceValid($price->getPrice(), $price->getCurrency()); +// } + +// /** +// * Check if Checkout inputs are relevant or not +// * +// * @throws InvalidRuleValueException if Value is not allowed +// * @return bool +// */ +// public function checkCheckoutInput() +// { +// $currency = $this->adapter->getCheckoutCurrency(); +// if (empty($currency)) { +// throw new InvalidRuleValueException( +// get_class(), self::PARAM1_CURRENCY +// ); +// } +// +// $price = $this->adapter->getCartTotalPrice(); +// if (empty($price)) { +// throw new InvalidRuleValueException( +// get_class(), self::PARAM1_PRICE +// ); +// } +// +// $this->paramsToValidate = array( +// self::PARAM1_PRICE => $this->adapter->getCartTotalPrice(), +// self::PARAM1_CURRENCY => $this->adapter->getCheckoutCurrency() +// ); +// +// return $this->isPriceValid($price, $currency); +// } + + /** + * Check validators relevancy and store them + * + * @param array $operators Operators the Admin set in BackOffice + * @param array $values Values the Admin set in BackOffice + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setValidatorsFromForm(array $operators, array $values) + { + $this->setValidators( + $operators[self::INPUT1], + $values[self::INPUT1], + $operators[self::INPUT2], + $values[self::INPUT2] + ); + + return $this; + } + + /** + * Check validators relevancy and store them + * + * @param string $priceOperator Price Operator ex < + * @param float $priceValue Price set to meet condition + * @param string $currencyOperator Currency Operator ex = + * @param string $currencyValue Currency set to meet condition + * + * @throws \InvalidArgumentException + * @return $this + */ + protected function setValidators($priceOperator, $priceValue, $currencyOperator, $currencyValue) + { + $isOperator1Legit = $this->isOperatorLegit( + $priceOperator, + $this->availableOperators[self::INPUT1] + ); + if (!$isOperator1Legit) { + throw new \InvalidArgumentException( + 'Operator for price field is not legit' + ); + } + + $isOperator1Legit = $this->isOperatorLegit( + $currencyOperator, + $this->availableOperators[self::INPUT2] + ); + if (!$isOperator1Legit) { + throw new \InvalidArgumentException( + 'Operator for currency field is not legit' + ); + } + + $floatType = new FloatType(); + if (!$floatType->isValid($priceValue) || $priceValue <= 0) { + throw new \InvalidArgumentException( + 'Value for price field is not legit' + ); + } + + // @todo check currency is legit or not + + $this->operators = array( + self::INPUT1 => $priceOperator, + self::INPUT2 => $currencyOperator, + ); + $this->values = array( + self::INPUT1 => $priceValue, + self::INPUT2 => $currencyValue, + ); + + return $this; + } + + /** + * Test if Customer meets conditions + * + * @return bool + */ + public function isMatching() + { + $isOperator1Legit = $this->isOperatorLegit( + $this->operators[self::INPUT1], + $this->availableOperators[self::INPUT1] + ); + $isOperator2Legit = $this->isOperatorLegit( + $this->operators[self::INPUT2], + $this->availableOperators[self::INPUT2] + ); + + if (!$isOperator1Legit || !$isOperator2Legit) { + return false; + } + + $constrainValidator = new ConstraintValidator(); + $constraint1 =$constrainValidator->variableOpComparison( + $this->adapter->getCartTotalPrice(), + $this->operators[self::INPUT1], + $this->values[self::INPUT1] + ); + $constraint2 =$constrainValidator->variableOpComparison( + $this->adapter->getCheckoutCurrency(), + $this->operators[self::INPUT2], + $this->values[self::INPUT2] + ); + if ($constraint1 && $constraint2) { + return true; + } + return false; + } + +// /** +// * Check if a price is valid +// * +// * @param float $price Price to check +// * @param string $currency Price currency +// * +// * @throws InvalidRuleValueException if Value is not allowed +// * @return bool +// */ +// protected function isPriceValid($price, $currency) +// { +// $priceValidator = $this->priceValidator; +// +// /** @var PriceParam $param */ +// $param = $priceValidator->getParam(); +// if ($currency == $param->getCurrency()) { +// try { +// $priceValidator->getParam()->compareTo($price); +// } catch(\InvalidArgumentException $e) { +// throw new InvalidRuleValueException(get_class(), self::PARAM1_PRICE); +// } +// } else { +// throw new InvalidRuleValueException(get_class(), self::PARAM1_CURRENCY); +// } +// +// return true; +// } + +// /** +// * Generate current Rule param to be validated from adapter +// * +// * @return $this +// */ +// protected function setParametersToValidate() +// { +// $this->paramsToValidate = array( +// self::PARAM1_PRICE => $this->adapter->getCartTotalPrice(), +// self::PARAM1_CURRENCY => $this->adapter->getCheckoutCurrency() +// ); +// +// return $this; +// } + + /** + * Get I18n name + * + * @return string + */ + public function getName() + { + return $this->adapter->get('thelia.translator')->trans( + 'Cart total amount', + array(), + 'constraint' + ); + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + $i18nOperator = Operators::getI18n( + $this->translator, $this->operators[self::INPUT1] + ); + + $toolTip = $this->translator->trans( + 'If cart total amount is %operator% %amount% %currency%', + array( + '%operator%' => $i18nOperator, + '%amount%' => $this->values[self::INPUT1], + '%currency%' => $this->values[self::INPUT2] + ), + 'constraint' + ); + + return $toolTip; + } + +// /** +// * Populate a Rule from a form admin +// * +// * @param array $operators Rule Operator set by the Admin +// * @param array $values Rule Values set by the Admin +// * +// * @throws \InvalidArgumentException +// * @return $this +// */ +// public function populateFromForm(array $operators, array $values) +// { +// if ($values[self::PARAM1_PRICE] === null +// || $values[self::PARAM1_CURRENCY] === null +// ) { +// throw new \InvalidArgumentException( +// 'The Rule ' . get_class() . 'needs at least a quantity set (' . self::PARAM1_PRICE . ', ' . self::PARAM1_CURRENCY . ')' +// ); +// } +// +// $this->priceValidator = new RuleValidator( +// $operators[self::PARAM1_PRICE], +// new PriceParam( +// $this->translator, +// $values[self::PARAM1_PRICE], +// $values[self::PARAM1_CURRENCY] +// ) +// ); +// +// $this->validators = array(self::PARAM1_PRICE => $this->priceValidator); +// +// return $this; +// } + + + + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/AvailableForXArticlesManager.php b/core/lib/Thelia/Constraint/Rule/AvailableForXArticlesManager.php new file mode 100644 index 000000000..d726447eb --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/AvailableForXArticlesManager.php @@ -0,0 +1,300 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +use InvalidArgumentException; +use Symfony\Component\Translation\Translator; +use Thelia\Constraint\ConstraintValidator; +use Thelia\Constraint\Validator\QuantityParam; +use Thelia\Constraint\Validator\RuleValidator; +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Exception\InvalidRuleException; +use Thelia\Exception\InvalidRuleValueException; +use Thelia\Type\FloatType; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Check a Checkout against its Product number + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForXArticlesManager extends CouponRuleAbstract +{ + /** Rule 1st parameter : quantity */ + CONST INPUT1 = 'quantity'; + + /** @var string Service Id from Resources/config.xml */ + protected $serviceId = 'thelia.constraint.rule.available_for_x_articles'; + + /** @var array Available Operators (Operators::CONST) */ + protected $availableOperators = array( + self::INPUT1 => array( + Operators::INFERIOR, + Operators::INFERIOR_OR_EQUAL, + Operators::EQUAL, + Operators::SUPERIOR_OR_EQUAL, + Operators::SUPERIOR + ) + ); + +// /** @var QuantityParam Quantity Validator */ +// protected $quantityValidator = null; + +// /** +// * Check if backoffice inputs are relevant or not +// * +// * @throws InvalidRuleOperatorException if Operator is not allowed +// * @throws InvalidRuleValueException if Value is not allowed +// * @return bool +// */ +// public function checkBackOfficeInput() +// { +// if (!isset($this->validators) +// || empty($this->validators) +// ||!isset($this->validators[self::PARAM1_QUANTITY]) +// ||!isset($this->validators[self::PARAM1_QUANTITY]) +// ) { +// throw new InvalidRuleValueException(get_class(), self::PARAM1_QUANTITY); +// } +// +// /** @var RuleValidator $ruleValidator */ +// $ruleValidator = $this->validators[self::PARAM1_QUANTITY]; +// /** @var QuantityParam $quantity */ +// $quantity = $ruleValidator->getParam(); +// +// if (!$quantity instanceof QuantityParam) { +// throw new InvalidRuleValueException(get_class(), self::PARAM1_QUANTITY); +// } +// +// $this->checkBackOfficeInputsOperators(); +// +// return $this->isQuantityValid($quantity->getInteger()); +// } + +// /** +// * Generate current Rule param to be validated from adapter +// * +// * @param CouponAdapterInterface $adapter allowing to gather +// * all necessary Thelia variables +// * +// * @return $this +// */ +// protected function setParametersToValidate() +// { +// $this->paramsToValidate = array( +// self::PARAM1_QUANTITY => $this->adapter->getNbArticlesInCart() +// ); +// +// return $this; +// } + +// /** +// * Check if Checkout inputs are relevant or not +// * +// * @throws \Thelia\Exception\InvalidRuleValueException +// * @return bool +// */ +// public function checkCheckoutInput() +// { +// if (!isset($this->paramsToValidate) +// || empty($this->paramsToValidate) +// ||!isset($this->paramsToValidate[self::PARAM1_QUANTITY]) +// ) { +// throw new InvalidRuleValueException(get_class(), self::PARAM1_QUANTITY); +// } +// +// $price = $this->paramsToValidate[self::PARAM1_QUANTITY]; +// +// return $this->isQuantityValid($price); +// } + + /** + * Check validators relevancy and store them + * + * @param array $operators Operators the Admin set in BackOffice + * @param array $values Values the Admin set in BackOffice + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setValidatorsFromForm(array $operators, array $values) + { + $this->setValidators( + $operators[self::INPUT1], + $values[self::INPUT1] + ); + + return $this; + } + + /** + * Check validators relevancy and store them + * + * @param string $quantityOperator Quantity Operator ex < + * @param int $quantityValue Quantity set to meet condition + * + * @throws \InvalidArgumentException + * @return $this + */ + protected function setValidators($quantityOperator, $quantityValue) + { + $isOperator1Legit = $this->isOperatorLegit( + $quantityOperator, + $this->availableOperators[self::INPUT1] + ); + if (!$isOperator1Legit) { + throw new \InvalidArgumentException( + 'Operator for quantity field is not legit' + ); + } + + if (!is_int($quantityValue) || $quantityValue <= 0) { + throw new \InvalidArgumentException( + 'Value for quantity field is not legit' + ); + } + + $this->operators = array( + self::INPUT1 => $quantityOperator, + ); + $this->values = array( + self::INPUT1 => $quantityValue, + ); + + return $this; + } + + /** + * Test if Customer meets conditions + * + * @return bool + */ + public function isMatching() + { + $constrainValidator = new ConstraintValidator(); + $constraint1 =$constrainValidator->variableOpComparison( + $this->adapter->getNbArticlesInCart(), + $this->operators[self::INPUT1], + $this->values[self::INPUT1] + ); + + if ($constraint1) { + return true; + } + return false; + } + +// /** +// * Check if a quantity is valid +// * +// * @param int $quantity Quantity to check +// * +// * @throws InvalidRuleValueException if Value is not allowed +// * @return bool +// */ +// protected function isQuantityValid($quantity) +// { +// $quantityValidator = $this->quantityValidator; +// try { +// $quantityValidator->getParam()->compareTo($quantity); +// } catch(InvalidArgumentException $e) { +// throw new InvalidRuleValueException(get_class(), self::PARAM1_QUANTITY); +// } +// +// return true; +// } + + /** + * Get I18n name + * + * @return string + */ + public function getName() + { + return $this->translator->trans( + 'Number of articles in cart', + array(), + 'constraint' + ); + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + $i18nOperator = Operators::getI18n( + $this->translator, $this->operators[self::INPUT1] + ); + + $toolTip = $this->translator->trans( + 'If cart products quantity is %operator% %quantity%', + array( + '%operator%' => $i18nOperator, + '%quantity%' => $this->values[self::INPUT1] + ), + 'constraint' + ); + + return $toolTip; + } + +// /** +// * Populate a Rule from a form admin +// * +// * @param array $operators Rule Operator set by the Admin +// * @param array $values Rule Values set by the Admin +// * +// * @throws InvalidArgumentException +// * @return $this +// */ +// public function populateFromForm(array $operators, array $values) +// { +// if ($values[self::PARAM1_QUANTITY] === null) { +// throw new InvalidArgumentException( +// 'The Rule ' . get_class() . 'needs at least a quantity set (' . self::PARAM1_QUANTITY. ')' +// ); +// } +// +// $this->quantityValidator = new RuleValidator( +// $operators[self::PARAM1_QUANTITY], +// new QuantityParam( +// $this->adapter, +// $values[self::PARAM1_QUANTITY] +// ) +// ); +// +// $this->validators = array(self::PARAM1_QUANTITY => $this->quantityValidator); +// +// return $this; +// } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/CouponRuleAbstract.php b/core/lib/Thelia/Constraint/Rule/CouponRuleAbstract.php new file mode 100644 index 000000000..7465633bf --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/CouponRuleAbstract.php @@ -0,0 +1,236 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +use Symfony\Component\Intl\Exception\NotImplementedException; +use Thelia\Core\Translation\Translator; +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Constraint\Validator\ComparableInterface; +use Thelia\Constraint\Validator\RuleValidator; +use Thelia\Exception\InvalidRuleException; +use Thelia\Exception\InvalidRuleOperatorException; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Assist in writing a condition of whether the Rule is applied or not + * + * @package Constraint + * @author Guillaume MOREL + * + */ +abstract class CouponRuleAbstract implements CouponRuleInterface +{ +// /** Operator key in $validators */ +// CONST OPERATOR = 'operator'; +// /** Value key in $validators */ +// CONST VALUE = 'value'; + + /** @var string Service Id from Resources/config.xml */ + protected $serviceId = null; + + /** @var array Available Operators (Operators::CONST) */ + protected $availableOperators = array(); + + /** @var array Parameters validating parameters against */ + protected $validators = array(); + +// /** @var array Parameters to be validated */ +// protected $paramsToValidate = array(); + + /** @var CouponAdapterInterface Provide necessary value from Thelia */ + protected $adapter = null; + + /** @var Translator Service Translator */ + protected $translator = null; + + /** @var array Operators set by Admin in BackOffice */ + protected $operators = array(); + + /** @var array Values set by Admin in BackOffice */ + protected $values = array(); + + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Service adapter + */ + function __construct(CouponAdapterInterface $adapter) + { + $this->adapter = $adapter; + $this->translator = $adapter->getTranslator(); + } + +// /** +// * Check validator relevancy and store them +// * +// * @param array $validators Array of RuleValidator +// * validating $paramsToValidate against +// * +// * @return $this +// * @throws InvalidRuleException +// */ +// protected function setValidators(array $validators) +// { +// foreach ($validators as $validator) { +// if (!$validator instanceof RuleValidator) { +// throw new InvalidRuleException(get_class()); +// } +// if (!in_array($validator->getOperator(), $this->availableOperators)) { +// throw new InvalidRuleOperatorException( +// get_class(), +// $validator->getOperator() +// ); +// } +// } +// $this->validators = $validators; +// +// return $this; +// } + + + +// /** +// * Check if the current Checkout matches this condition +// * +// * @return bool +// */ +// public function isMatching() +// { +// $this->checkBackOfficeInput(); +// $this->checkCheckoutInput(); +// +// $isMatching = true; +// /** @var $validator RuleValidator*/ +// foreach ($this->validators as $param => $validator) { +// $a = $this->paramsToValidate[$param]; +// $operator = $validator->getOperator(); +// /** @var ComparableInterface, RuleParameterAbstract $b */ +// $b = $validator->getParam(); +// +// if (!Operators::isValid($a, $operator, $b)) { +// $isMatching = false; +// } +// } +// +// return $isMatching; +// +// } + + /** + * Return all available Operators for this Rule + * + * @return array Operators::CONST + */ + public function getAvailableOperators() + { + return $this->availableOperators; + } + +// /** +// * Check if Operators set for this Rule in the BackOffice are legit +// * +// * @throws InvalidRuleOperatorException if Operator is not allowed +// * @return bool +// */ +// protected function checkBackOfficeInputsOperators() +// { +// /** @var RuleValidator $param */ +// foreach ($this->validators as $key => $param) { +// $operator = $param->getOperator(); +// if (!isset($operator) +// ||!in_array($operator, $this->availableOperators) +// ) { +// throw new InvalidRuleOperatorException(get_class(), $key); +// } +// } +// return true; +// } + +// /** +// * Generate current Rule param to be validated from adapter +// * +// * @throws \Thelia\Exception\NotImplementedException +// * @return $this +// */ +// protected function setParametersToValidate() +// { +// throw new \Thelia\Exception\NotImplementedException(); +// } + + /** + * Return all validators + * + * @return array + */ + public function getValidators() + { + return array( + $this->operators, + $this->values + ); + } + + /** + * Get Rule Service id + * + * @return string + */ + public function getServiceId() + { + return $this->serviceId; + } + + /** + * Validate if Operator given is available for this Coupon + * + * @param string $operator Operator to validate ex < + * @param array $availableOperators Available operators + * + * @return bool + */ + protected function isOperatorLegit($operator, array $availableOperators) + { + return in_array($operator, $availableOperators); + } + + /** + * Return a serializable Rule + * + * @return SerializableRule + */ + public function getSerializableRule() + { + $serializableRule = new SerializableRule(); + $serializableRule->ruleServiceId = $this->serviceId; + $serializableRule->operators = $this->operators; + + $serializableRule->values = $this->values; + + return $serializableRule; + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/CouponRuleInterface.php b/core/lib/Thelia/Constraint/Rule/CouponRuleInterface.php new file mode 100644 index 000000000..79a48aff9 --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/CouponRuleInterface.php @@ -0,0 +1,144 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +use Thelia\Core\Translation\Translator; +use Thelia\Coupon\CouponAdapterInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represents a condition of whether the Rule is applied or not + * + * @package Constraint + * @author Guillaume MOREL + * + */ +interface CouponRuleInterface +{ + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Service adapter + */ + function __construct(CouponAdapterInterface $adapter); + + /** + * Get Rule Service id + * + * @return string + */ + public function getServiceId(); + +// /** +// * Check if backoffice inputs are relevant or not +// * +// * @return bool +// */ +// public function checkBackOfficeInput(); + +// /** +// * Check if Checkout inputs are relevant or not +// * +// * @return bool +// */ +// public function checkCheckoutInput(); + + /** + * Check validators relevancy and store them + * + * @param array $operators Operators the Admin set in BackOffice + * @param array $values Values the Admin set in BackOffice + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setValidatorsFromForm(array $operators, array $values); + +// /** +// * Check if the current Checkout matches this condition +// * +// * @return bool +// */ +// public function isMatching(); + + /** + * Test if Customer meets conditions + * + * @return bool + */ + public function isMatching(); + + /** + * Return all available Operators for this Rule + * + * @return array Operators::CONST + */ + public function getAvailableOperators(); + + + /** + * Get I18n name + * + * @return string + */ + public function getName(); + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip(); + + /** + * Return all validators + * + * @return array + */ + public function getValidators(); + +// /** +// * Populate a Rule from a form admin +// * +// * @param array $operators Rule Operator set by the Admin +// * @param array $values Rule Values set by the Admin +// * +// * @return bool +// */ +// public function populateFromForm(array$operators, array $values); + + + /** + * Return a serializable Rule + * + * @return SerializableRule + */ + public function getSerializableRule(); + + + +} diff --git a/core/lib/Thelia/Constraint/Rule/Operators.php b/core/lib/Thelia/Constraint/Rule/Operators.php new file mode 100644 index 000000000..237c6a5e0 --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/Operators.php @@ -0,0 +1,188 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +use Symfony\Component\Translation\Translator; +use Thelia\Constraint\Validator\ComparableInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represent available Operations in rule checking + * + * @package Constraint + * @author Guillaume MOREL + * + */ +abstract class Operators +{ + /** Param1 is inferior to Param2 */ + CONST INFERIOR = '<'; + /** Param1 is inferior to Param2 */ + CONST INFERIOR_OR_EQUAL = '<='; + /** Param1 is equal to Param2 */ + CONST EQUAL = '=='; + /** Param1 is superior to Param2 */ + CONST SUPERIOR_OR_EQUAL = '>='; + /** Param1 is superior to Param2 */ + CONST SUPERIOR = '>'; + /** Param1 is different to Param2 */ + CONST DIFFERENT = '!='; + /** Param1 is in Param2 */ + CONST IN = 'in'; + /** Param1 is not in Param2 */ + CONST OUT = 'out'; + +// /** +// * Check if a parameter is valid against a ComparableInterface from its operator +// * +// * @param mixed $a Parameter to validate +// * @param string $operator Operator to validate against +// * @param ComparableInterface $b Comparable to validate against +// * +// * @return bool +// */ +// public static function isValid($a, $operator, ComparableInterface $b) +// { +// $ret = false; +// +// try { +// $comparison = $b->compareTo($a); +// } catch (\Exception $e) { +// return false; +// } +// +// switch ($operator) { +// case self::INFERIOR: +// if ($comparison == 1) { +// return true; +// } +// break; +// case self::INFERIOR_OR_EQUAL: +// if ($comparison == 1 || $comparison == 0) { +// return true; +// } +// break; +// case self::EQUAL: +// if ($comparison == 0) { +// return true; +// } +// break; +// case self::SUPERIOR_OR_EQUAL: +// if ($comparison == -1 || $comparison == 0) { +// return true; +// } +// break; +// case self::SUPERIOR: +// if ($comparison == -1) { +// return true; +// } +// break; +// case self::DIFFERENT: +// if ($comparison != 0) { +// return true; +// } +// break; +// default: +// } +// +// return $ret; +// } + + /** + * Get operator translation + * + * @param Translator $translator Provide necessary value from Thelia + * @param string $operator Operator const + * + * @return string + */ + public static function getI18n(Translator $translator, $operator) + { + $ret = $operator; + switch ($operator) { + case self::INFERIOR: + $ret = $translator->trans( + 'inferior to', + array(), + 'constraint' + ); + break; + case self::INFERIOR_OR_EQUAL: + $ret = $translator->trans( + 'inferior or equals to', + array(), + 'constraint' + ); + break; + case self::EQUAL: + $ret = $translator->trans( + 'equals to', + array(), + 'constraint' + ); + break; + case self::SUPERIOR_OR_EQUAL: + $ret = $translator->trans( + 'superior or equals to', + array(), + 'constraint' + ); + break; + case self::SUPERIOR: + $ret = $translator->trans( + 'superior to', + array(), + 'constraint' + ); + break; + case self::DIFFERENT: + $ret = $translator->trans( + 'different from', + array(), + 'constraint' + ); + break; + case self::IN: + $ret = $translator->trans( + 'in', + array(), + 'constraint' + ); + break; + case self::OUT: + $ret = $translator->trans( + 'not in', + array(), + 'constraint' + ); + break; + default: + } + + return $ret; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Rule/SerializableRule.php b/core/lib/Thelia/Constraint/Rule/SerializableRule.php new file mode 100644 index 000000000..011c3e261 --- /dev/null +++ b/core/lib/Thelia/Constraint/Rule/SerializableRule.php @@ -0,0 +1,81 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Rule; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * A rule set by an admin ready to be serialized and stored in DataBase + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class SerializableRule +{ + /** @var string Rule Service id */ + public $ruleServiceId = null; + + /** @var array Operators set by Admin for this Rule */ + public $operators = array(); + + /** @var array Values set by Admin for this Rule */ + public $values = array(); + + /** + * Get Operators set by Admin for this Rule + * + * @return array + */ + public function getOperators() + { + return $this->operators; + } + + /** + * Get Rule Service id + * + * @return string + */ + public function getRuleServiceId() + { + return $this->ruleServiceId; + } + + /** + * Get Values set by Admin for this Rule + * + * @return array + */ + public function getValues() + { + return $this->values; + } + + + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Validator/ComparableInterface.php b/core/lib/Thelia/Constraint/Validator/ComparableInterface.php new file mode 100644 index 000000000..d06187fb0 --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/ComparableInterface.php @@ -0,0 +1,49 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +/** + * Comparable interface + * Allows to compare two value objects to each other for similarity. + * + * @author Benjamin Eberlei + * @author Guilherme Blanco + */ +interface ComparableInterface +{ + /** + * Compare the current object to the passed $other. + * + * Returns 0 if they are semantically equal, 1 if the other object + * is less than the current one, or -1 if its more than the current one. + * + * This method should not check for identity using ===, only for semantically equality for example + * when two different DateTime instances point to the exact same Date + TZ. + * + * @param mixed $other Object + * + * @return int + */ + public function compareTo($other); +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Validator/CustomerParam.php b/core/lib/Thelia/Constraint/Validator/CustomerParam.php new file mode 100644 index 000000000..5b4390ddc --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/CustomerParam.php @@ -0,0 +1,158 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use InvalidArgumentException; +use Propel\Runtime\ActiveQuery\ModelCriteria; +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Model\Customer; +use Thelia\Model\CustomerQuery; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represent a Customer + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class CustomerParam extends IntegerParam +{ + /** @var string Model Class name */ + protected $modelClass = '\Thelia\Model\Customer'; + + /** @var ModelCriteria */ + protected $queryBuilder = null; + + /** @var string Customer firstname */ + protected $firstName = null; + + /** @var string Customer lastname */ + protected $lastName = null; + + /** @var string Customer email */ + protected $email = null; + + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Provide necessary value from Thelia + * @param int $integer Integer + * + * @throws InvalidArgumentException + */ + public function __construct(CouponAdapterInterface $adapter, $integer) + { + $this->integer = $integer; + $this->adapter = $adapter; + + $this->queryBuilder = CustomerQuery::create(); + /** @var Customer $customer */ + $customer = $this->queryBuilder->findById($integer); + if ($customer !== null) { + $this->firstName = $customer->getFirstname(); + $this->lastName = $customer->getLastname(); + $this->email = $customer->getEmail(); + } else { + throw new \InvalidArgumentException( + 'CustomerParam can compare only existing Customers' + ); + } + } + + /** + * Compare the current object to the passed $other. + * + * Returns 0 if they are semantically equal, 1 if the other object + * is less than the current one, or -1 if its more than the current one. + * + * This method should not check for identity using ===, only for semantically equality for example + * when two different DateTime instances point to the exact same Date + TZ. + * + * @param mixed $other Object + * + * @throws InvalidArgumentException + * @return int + */ + public function compareTo($other) + { + if (!is_integer($other) || $other < 0) { + throw new InvalidArgumentException( + 'IntegerParam can compare only positive int' + ); + } + + return parent::compareTo($other); + } + + /** + * Customer email + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Customer first name + * + * @return string + */ + public function getFirstName() + { + return $this->firstName; + } + + /** + * Customer last name + * + * @return string + */ + public function getLastName() + { + return $this->lastName; + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + return $this->adapter + ->getTranslator() + ->trans( + 'A Customer', + null, + 'constraint' + ); + } + +} diff --git a/core/lib/Thelia/Constraint/Validator/DateParam.php b/core/lib/Thelia/Constraint/Validator/DateParam.php new file mode 100644 index 000000000..ae7eff858 --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/DateParam.php @@ -0,0 +1,120 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use Thelia\Coupon\CouponAdapterInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represent a DateTime + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class DateParam extends RuleParameterAbstract +{ + /** @var \DateTime Date */ + protected $dateTime = null; + + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Provide necessary value from Thelia + * @param \DateTime $dateTime DateTime + */ + public function __construct(CouponAdapterInterface $adapter, \DateTime $dateTime) + { + $this->dateTime = $dateTime; + $this->adapter = $adapter; + } + + /** + * Get DateTime + * + * @return \DateTime + */ + public function getDateTime() + { + return clone $this->dateTime; + } + + /** + * Compare the current object to the passed $other. + * + * Returns 0 if they are semantically equal, 1 if the other object + * is less than the current one, or -1 if its more than the current one. + * + * This method should not check for identity using ===, only for semantically equality for example + * when two different DateTime instances point to the exact same Date + TZ. + * + * @param mixed $other Object + * + * @throws \InvalidArgumentException + * @return int + */ + public function compareTo($other) + { + if (!$other instanceof \DateTime) { + throw new \InvalidArgumentException('DateParam can compare only DateTime'); + } + + $ret = -1; + if ($this->dateTime == $other) { + $ret = 0; + } elseif ($this->dateTime > $other) { + $ret = 1; + } else { + $ret = -1; + } + + return $ret; + } + + /** + * Get Parameter value to test against + * + * @return \Datetime + */ + public function getValue() + { + return clone $this->dateTime; + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + return $this->adapter + ->getTranslator() + ->trans('A date (ex: YYYY-MM-DD HH:MM:SS)', null, 'constraint'); + } + +} diff --git a/core/lib/Thelia/Constraint/Validator/IntegerParam.php b/core/lib/Thelia/Constraint/Validator/IntegerParam.php new file mode 100644 index 000000000..c783655c8 --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/IntegerParam.php @@ -0,0 +1,121 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use Thelia\Coupon\CouponAdapterInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represent an Integer + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class IntegerParam extends RuleParameterAbstract +{ + /** @var int Integer to compare with */ + protected $integer = 0; + + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Provide necessary value from Thelia + * @param int $integer Integer + */ + public function __construct(CouponAdapterInterface $adapter, $integer) + { + $this->integer = $integer; + $this->adapter = $adapter; + } + + /** + * Get integer + * + * @return int + */ + public function getInteger() + { + return $this->integer; + } + + + /** + * Compare the current object to the passed $other. + * + * Returns 0 if they are semantically equal, 1 if the other object + * is less than the current one, or -1 if its more than the current one. + * + * This method should not check for identity using ===, only for semantically equality for example + * when two different DateTime instances point to the exact same Date + TZ. + * + * @param mixed $other Object + * + * @throws \InvalidArgumentException + * @return int + */ + public function compareTo($other) + { + if (!is_integer($other)) { + throw new \InvalidArgumentException('IntegerParam can compare only int'); + } + + $ret = -1; + if ($this->integer == $other) { + $ret = 0; + } elseif ($this->integer > $other) { + $ret = 1; + } else { + $ret = -1; + } + + return $ret; + } + + /** + * Get Parameter value to test against + * + * @return int + */ + public function getValue() + { + return $this->integer; + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + return $this->adapter + ->getTranslator() + ->trans('A number (ex: 42)', null, 'constraint'); + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Validator/IntervalParam.php b/core/lib/Thelia/Constraint/Validator/IntervalParam.php new file mode 100644 index 000000000..a4554760a --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/IntervalParam.php @@ -0,0 +1,165 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use Thelia\Coupon\CouponAdapterInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represent an DateTime period + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class IntervalParam extends RuleParameterAbstract +{ + /** @var \DatePeriod Date period */ + protected $datePeriod = null; + + /** @var \DateTime Start date */ + protected $start = null; + + /** @var \DateInterval Interval date */ + protected $interval = null; + + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Provide necessary value from Thelia + * @param \DateTime $start Start interval + * @param \DateInterval $interval Period + */ + public function __construct(CouponAdapterInterface $adapter, \DateTime $start, \DateInterval $interval) + { + $this->datePeriod = new \DatePeriod($start, $interval, 1); + $this->adapter = $adapter; + + $this->start = $start; + $this->interval = $interval; + } + + /** + * Get Interval + * + * @return \DateInterval + */ + public function getInterval() + { + return $this->interval; + } + + /** + * Get start date + * + * @return \DateTime + */ + public function getStart() + { + return $this->start; + } + + + + /** + * Get DatePeriod + * + * @return \DatePeriod + */ + public function getDatePeriod() + { + return clone $this->datePeriod; + } + + /** + * Compare the current object to the passed $other. + * + * Returns 0 if they are semantically equal, 1 if the other object + * is less than the current one, or -1 if its more than the current one. + * + * This method should not check for identity using ===, only for semantically equality for example + * when two different DateTime instances point to the exact same Date + TZ. + * + * @param mixed $other Object + * + * @throws \InvalidArgumentException + * @return int + */ + public function compareTo($other) + { + if (!$other instanceof \DateTime) { + throw new \InvalidArgumentException('IntervalParam can compare only DateTime'); + } + + /** @var \DateTime Start Date */ + $startDate = null; + /** @var \DateTime End Date */ + $endDate = null; + + foreach ($this->datePeriod as $key => $value) { + if ($key == 0) { + $startDate = $value; + } + if ($key == 1) { + $endDate = $value; + } + } + + $ret = -1; + if ($startDate <= $other && $other <= $endDate) { + $ret = 0; + } elseif ($startDate > $other) { + $ret = 1; + } else { + $ret = -1; + } + + return $ret; + } + + /** + * Get Parameter value to test against + * + * @return \DatePeriod + */ + public function getValue() + { + return clone $this->datePeriod; + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + return $this->adapter + ->getTranslator() + ->trans('An interval between two dates', null, 'constraint'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Validator/ModelParam.php b/core/lib/Thelia/Constraint/Validator/ModelParam.php new file mode 100644 index 000000000..7ff4567b8 --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/ModelParam.php @@ -0,0 +1,115 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use InvalidArgumentException; +use Thelia\Coupon\CouponAdapterInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represent a Model + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class ModelParam extends IntegerParam +{ + /** @var string Model Class name */ + protected $modelClass = null; + + /** @var ModelCriteria */ + protected $queryBuilder = null; + + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Provide necessary value from Thelia + * @param int $integer Integer + * @param string $modelClass Model class name + * + * @throws InvalidArgumentException + */ + public function __construct(CouponAdapterInterface $adapter, $integer, $modelClass) + { + if ($integer < 0) { + $integer = 0; + } + $this->integer = $integer; + $this->adapter = $adapter; + + $this->modelClass = $modelClass; + $queryClassName = $modelClass . 'Query'; + try { + $this->queryBuilder = $queryClassName::create(); + } catch (\Exception $e) { + throw new InvalidArgumentException('ModelParam can only compare Models'); + } + } + + /** + * Compare the current object to the passed $other. + * + * Returns 0 if they are semantically equal, 1 if the other object + * is less than the current one, or -1 if its more than the current one. + * + * This method should not check for identity using ===, only for semantically equality for example + * when two different DateTime instances point to the exact same Date + TZ. + * + * @param mixed $other Object + * + * @throws InvalidArgumentException + * @return int + */ + public function compareTo($other) + { + if (!is_integer($other) || $other < 0) { + throw new InvalidArgumentException( + 'IntegerParam can compare only positive int' + ); + } + + return parent::compareTo($other); + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + return $this->adapter + ->getTranslator() + ->trans( + 'A Model', + null, + 'constraint' + ); + } + +} diff --git a/core/lib/Thelia/Constraint/Validator/PriceParam.php b/core/lib/Thelia/Constraint/Validator/PriceParam.php new file mode 100644 index 000000000..e965d6aba --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/PriceParam.php @@ -0,0 +1,145 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use Thelia\Core\Translation\Translator; +use Thelia\Coupon\CouponAdapterInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represent a Price + * Positive value with currency + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class PriceParam extends RuleParameterAbstract +{ + /** @var float Positive Float to compare with */ + protected $price = null; + + /** @var string Currency Code ISO 4217 EUR|USD|GBP */ + protected $currency = null; + + /** + * Constructor + * + * @param Translator $translator Service translator + * @param float $price Positive float + * @param string $currency Currency Code ISO 4217 EUR|USD|GBP + */ + public function __construct(Translator $translator, $price, $currency) + { + $this->price = $price; + $this->currency = $currency; + $this->translator = $translator; + } + + /** + * Get currency code + * + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * Get price + * + * @return float + */ + public function getPrice() + { + return $this->price; + } + + /** + * Compare the current object to the passed $other. + * + * Returns 0 if they are semantically equal, 1 if the other object + * is less than the current one, or -1 if its more than the current one. + * + * This method should not check for identity using ===, only for semantically equality for example + * when two different DateTime instances point to the exact same Date + TZ. + * + * @param mixed $other Object + * + * @throws \InvalidArgumentException + * @return int + */ + public function compareTo($other) + { + if (!is_float($other)) { + throw new \InvalidArgumentException( + 'PriceParam can compare only positive float' + ); + } + + $epsilon = 0.00001; + + $ret = -1; + if (abs($this->price - $other) < $epsilon) { + $ret = 0; + } elseif ($this->price > $other) { + $ret = 1; + } else { + $ret = -1; + } + + return $ret; + } + + /** + * Get Parameter value to test against + * + * @return float + */ + public function getValue() + { + return $this->price; + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + return $this->translator + ->trans( + 'A price in %currency% (ex: 14.50)', + array( + '%currency%' => $this->currency + ), + 'constraint' + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Validator/QuantityParam.php b/core/lib/Thelia/Constraint/Validator/QuantityParam.php new file mode 100644 index 000000000..ac6fcf851 --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/QuantityParam.php @@ -0,0 +1,96 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use Thelia\Coupon\CouponAdapterInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represent a Quantity + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class QuantityParam extends IntegerParam +{ + + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Provide necessary value from Thelia + * @param int $integer Integer + */ + public function __construct(CouponAdapterInterface $adapter, $integer) + { + $this->integer = $integer; + $this->adapter = $adapter; + } + + /** + * Compare the current object to the passed $other. + * + * Returns 0 if they are semantically equal, 1 if the other object + * is less than the current one, or -1 if its more than the current one. + * + * This method should not check for identity using ===, only for semantically equality for example + * when two different DateTime instances point to the exact same Date + TZ. + * + * @param mixed $other Object + * + * @throws \InvalidArgumentException + * @return int + */ + public function compareTo($other) + { + if (!is_integer($other) || $other < 0) { + throw new \InvalidArgumentException( + 'IntegerParam can compare only positive int' + ); + } + + return parent::compareTo($other); + } + + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + return $this->adapter + ->getTranslator() + ->trans( + 'A positive quantity (ex: 42)', + null, + 'constraint' + ); + } + +} diff --git a/core/lib/Thelia/Constraint/Validator/RepeatedDateParam.php b/core/lib/Thelia/Constraint/Validator/RepeatedDateParam.php new file mode 100644 index 000000000..0e8a558cf --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/RepeatedDateParam.php @@ -0,0 +1,117 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use Thelia\Coupon\CouponAdapterInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represent A repeated Date across the time + * Ex : + * A date repeated every 1 months 5 times + * ---------*---*---*---*---*---*---------------------------> time + * 1 2 3 4 5 6 + * 1 : $this->from Start date of the repetition + * *--- : $this->interval Duration of a whole cycle + * x5 : $this->recurrences How many repeated cycle, 1st excluded + * x6 : How many occurrence + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class RepeatedDateParam extends RepeatedParam +{ + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Provide necessary value from Thelia + */ + public function __construct(CouponAdapterInterface $adapter) + { + $this->defaultConstructor(); + $this->adapter = $adapter; + } + + /** + * Compare the current object to the passed $other. + * + * Returns 0 if they are semantically equal, 1 if the other object + * is less than the current one, or -1 if its more than the current one. + * + * This method should not check for identity using ===, only for semantically equality for example + * when two different DateTime instances point to the exact same Date + TZ. + * + * @param mixed $other Object + * + * @throws \InvalidArgumentException + * @return int + */ + public function compareTo($other) + { + if (!$other instanceof \DateTime) { + throw new \InvalidArgumentException('RepeatedDateParam can compare only DateTime'); + } + + $ret = -1; + $dates = array(); + /** @var $value \DateTime */ + foreach ($this->datePeriod as $value) { + $dates[$value->getTimestamp()] = $value; + } + + foreach ($dates as $date) { + if ($date == $other) { + return 0; + } + } + + return $ret; + } + + /** + * Get Parameter value to test against + * + * @return \DatePeriod + */ + public function getValue() + { + return clone $this->datePeriod; + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + return $this->adapter + ->getTranslator() + ->trans('A date (ex: YYYY-MM-DD HH:MM:SS)', null, 'constraint'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Validator/RepeatedIntervalParam.php b/core/lib/Thelia/Constraint/Validator/RepeatedIntervalParam.php new file mode 100644 index 000000000..e37cd3b45 --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/RepeatedIntervalParam.php @@ -0,0 +1,151 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use Thelia\Coupon\CouponAdapterInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represent A repeated DateInterval across the time + * Ex : + * A duration of 1 month repeated every 2 months 5 times + * ---------****----****----****----****----****----****-----------------> time + * 1 2 3 4 5 6 + * 1 : $this->from Start date of the repetition + * ****---- : $this->interval Duration of a whole cycle + * x5 : $this->recurrences How many repeated cycle, 1st excluded + * x6 : How many occurrence + * **** : $this->durationInDays Duration of a period + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class RepeatedIntervalParam extends RepeatedParam +{ + + /** @var int duration of the param */ + protected $durationInDays = 1; + + /** + * Get how many day a Param is lasting + * + * @return int + */ + public function getDurationInDays() + { + return $this->durationInDays; + } + + /** + * Set how many day a Param is lasting + * + * @param int $durationInDays How many day a Param is lasting + * + * @return $this + */ + public function setDurationInDays($durationInDays = 1) + { + $this->durationInDays = $durationInDays; + + return $this; + } + + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Provide necessary value from Thelia + */ + public function __construct(CouponAdapterInterface $adapter) + { + $this->defaultConstructor(); + $this->adapter = $adapter; + } + + /** + * Compare the current object to the passed $other. + * + * Returns 0 if they are semantically equal, 1 if the other object + * is less than the current one, or -1 if its more than the current one. + * + * This method should not check for identity using ===, only for semantically equality for example + * when two different DateTime instances point to the exact same Date + TZ. + * + * @param mixed $other Object + * + * @throws \InvalidArgumentException + * @return int + */ + public function compareTo($other) + { + if (!$other instanceof \DateTime) { + throw new \InvalidArgumentException('RepeatedIntervalParam can compare only DateTime'); + } + + $ret = -1; + $dates = array(); + /** @var $value \DateTime */ + foreach ($this->datePeriod as $value) { + $dates[$value->getTimestamp()]['startDate'] = $value; + $endDate = new \DateTime(); + $dates[$value->getTimestamp()]['endDate'] = $endDate->setTimestamp( + $value->getTimestamp() + ($this->durationInDays * 60 *60 *24) + ); + } + + foreach ($dates as $date) { + if ($date['startDate'] <= $other && $other <= $date['endDate']) { + return 0; + } + } + + return $ret; + + } + + /** + * Get Parameter value to test against + * + * @return \DatePeriod + */ + public function getValue() + { + return clone $this->datePeriod; + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + return $this->adapter + ->getTranslator() + ->trans('A date (ex: YYYY-MM-DD HH:MM:SS)', null, 'constraint'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Validator/RepeatedParam.php b/core/lib/Thelia/Constraint/Validator/RepeatedParam.php new file mode 100644 index 000000000..1188e4fbb --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/RepeatedParam.php @@ -0,0 +1,297 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use DateInterval; +use DatePeriod; +use DateTime; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Allow to set the way a parameter can be repeated across the time + * + * @package Constraint + * @author Guillaume MOREL + * + */ +abstract class RepeatedParam extends RuleParameterAbstract +{ + /** @var DateTime The start date of the period. */ + protected $from = null; + + /** @var DateInterval The interval between recurrences within the period. */ + protected $interval = null; + + /** @var int Nb time the object will be repeated (1st occurrence excluded). */ + protected $recurrences = null; + + /** @var DatePeriod dates recurring at regular intervals, over a given period */ + protected $datePeriod = null; + + /** @var int Frequency the object will be repeated */ + protected $frequency = null; + + /** @var int $nbRepetition Time the object will be repeated */ + protected $nbRepetition = null; + + /** + * Get frequency + * + * @return int + */ + public function getFrequency() + { + return $this->frequency; + } + + /** + * Get Interval + * + * @return \DateInterval + */ + public function getInterval() + { + return $this->interval; + } + + /** + * Get number of time it will be repeated + * + * @return int + */ + public function getNbRepetition() + { + return $this->nbRepetition; + } + + /** + * Get number of recurrences + * + * @return int + */ + public function getRecurrences() + { + return $this->recurrences; + } + + /** + * Generate default repetition + * Every 1 week 100 times from now + * + * @return $this + */ + protected function defaultConstructor() + { + $this->from = new \DateTime(); + $this->interval = new \DateInterval('P1W'); // 1 week + $this->recurrences = 100; + $this->generateDatePeriod(); + + return $this; + } + + /** + * Generate DatePeriod from class attributes + * Will repeat every DatePeriod + * + * @return $this + */ + protected function generateDatePeriod() + { + $this->datePeriod = new DatePeriod( + $this->from, + $this->interval, + $this->recurrences + ); + + return $this; + } + + /** + * Set the Object to be repeated every days + * Ex : $obj->repeatEveryDay() will occur once + * $obj->repeatEveryDay(10) will occur once + * $obj->repeatEveryDay(10, 0) will occur once + * $obj->repeatEveryDay(10, 4) will occur every 10 days 5 times + * + * @param int $frequency Frequency the object will be repeated + * @param int $nbRepetition Time the object will be repeated + * + * @return $this + */ + public function repeatEveryDay($frequency = 1, $nbRepetition = 0) + { + $this->_repeatEveryPeriod($period = 'D', $frequency, $nbRepetition); + + return $this; + } + + /** + * Set the Object to be repeated every week + * Ex : $obj->repeatEveryWeek() will occur once + * $obj->repeatEveryWeek(10) will occur once + * $obj->repeatEveryWeek(10, 0) will occur once + * $obj->repeatEveryWeek(10, 4) will occur every 10 weeks (70days) 5 times + * + * @param int $frequency Frequency the object will be repeated + * @param int $nbRepetition Time the object will be repeated + * + * @return $this + */ + public function repeatEveryWeek($frequency = 1, $nbRepetition = 0) + { + $this->_repeatEveryPeriod($period = 'W', $frequency, $nbRepetition); + + return $this; + } + + /** + * Set the Object to be repeated every month + * Ex : $obj->repeatEveryWeek() will occur once + * $obj->repeatEveryWeek(10) will occur once + * $obj->repeatEveryWeek(10, 0) will occur once + * $obj->repeatEveryWeek(10, 4) will occur every 10 month (70days) 5times + * + * @param int $frequency Frequency the object will be repeated + * @param int $nbRepetition Time the object will be repeated + * + * @return $this + */ + public function repeatEveryMonth($frequency = 1, $nbRepetition = 0) + { + $this->_repeatEveryPeriod($period = 'M', $frequency, $nbRepetition); + + return $this; + } + + /** + * Set the Object to be repeated every year + * Ex : $obj->repeatEveryWeek() will occur once + * $obj->repeatEveryWeek(10) will occur once + * $obj->repeatEveryWeek(10, 0) will occur once + * $obj->repeatEveryWeek(10, 4) will occur every 10 year 5 times + * + * @param int $frequency Frequency the object will be repeated + * @param int $nbRepetition Time the object will be repeated + * + * @return $this + */ + public function repeatEveryYear($frequency = 1, $nbRepetition = 0) + { + $this->_repeatEveryPeriod($period = 'Y', $frequency, $nbRepetition); + + return $this; + } + + /** + * Set the Object to be repeated every Period + * Ex : $obj->repeatEveryPeriod('D') will occur once + * $obj->repeatEveryPeriod('W', 10) will occur once + * $obj->repeatEveryPeriod('W', 10, 0) will occur once + * $obj->repeatEveryPeriod('M', 10, 4) will occur every 10 month 5 times + * + * @param string $period Period Y|M||D|W + * @param int $frequency Frequency the object will be repeated + * @param int $nbRepetition Time the object will be repeated + * + * @return $this + */ + private function _repeatEveryPeriod($period, $frequency = 1, $nbRepetition = 0) + { + if (is_numeric($frequency) && $frequency > 0) { + $this->interval = new \DateInterval('P' . $frequency . $period); + } + + if (is_numeric($nbRepetition) && $nbRepetition >= 0) { + $this->recurrences = $nbRepetition; + } + + $this->generateDatePeriod(); + + return $this; + } + + + + /** + * Set Start time + * + * @param \DateTime $from Start time + * + * @return $this + */ + public function setFrom($from) + { + $this->from = $from; + + return $this; + } + + /** + * Get Start time + * + * @return \DateTime + */ + public function getFrom() + { + return clone $this->from; + } + + /** + * Set DatePeriod + * + * @param DatePeriod $datePeriod DatePeriod + * + * @return $this + */ + public function setDatePeriod(DatePeriod $datePeriod) + { + $this->datePeriod = $datePeriod; + + return $this; + } + + /** + * Get date DatePeriod + * + * @return \DatePeriod + */ + public function getDatePeriod() + { + return clone $this->datePeriod; + } + + /** + * Get Parameter value to test against + * + * @return \DatePeriod + */ + public function getValue() + { + return clone $this->datePeriod; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Validator/RuleParameterAbstract.php b/core/lib/Thelia/Constraint/Validator/RuleParameterAbstract.php new file mode 100644 index 000000000..2be4c581f --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/RuleParameterAbstract.php @@ -0,0 +1,67 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +use Thelia\Core\Translation\Translator; +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Exception\NotImplementedException; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Get a Param value + * + * @package Constraint + * @author Guillaume MOREL + * + */ +abstract class RuleParameterAbstract implements ComparableInterface +{ + /** @var Translator Service Translator */ + protected $translator = null; + + /** + * Get Parameter value to test against + * + * @return mixed + */ + public function getValue() + { + return new NotImplementedException(); + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + return new NotImplementedException(); + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Constraint/Validator/RuleValidator.php b/core/lib/Thelia/Constraint/Validator/RuleValidator.php new file mode 100644 index 000000000..9b0093bc9 --- /dev/null +++ b/core/lib/Thelia/Constraint/Validator/RuleValidator.php @@ -0,0 +1,77 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint\Validator; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Allow to validate parameters + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class RuleValidator +{ + /** @var string Operator ex: Operators::INFERIOR */ + protected $operator = null; + + /** @var ComparableInterface Validator */ + protected $param = null; + + /** + * Constructor + * + * @param string $operator Operator ex: Operators::INFERIOR + * @param ComparableInterface $param Validator ex: PriceParam + */ + function __construct($operator, ComparableInterface $param) + { + $this->operator = $operator; + $this->param = $param; + } + + /** + * Get Validator Operator + * + * @return string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Get Validator Param + * + * @return ComparableInterface + */ + public function getParam() + { + return $this->param; + } + +} \ 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 570bbec99..fdb6b13ac 100755 --- a/core/lib/Thelia/Controller/Admin/AdminController.php +++ b/core/lib/Thelia/Controller/Admin/AdminController.php @@ -29,10 +29,4 @@ class AdminController extends BaseAdminController { return $this->render("home"); } - - public function processAction() - { - echo "not yet coded !"; - exit(); - } } diff --git a/core/lib/Thelia/Controller/Admin/AttributeController.php b/core/lib/Thelia/Controller/Admin/AttributeController.php new file mode 100644 index 000000000..a6dd05c89 --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/AttributeController.php @@ -0,0 +1,63 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + +use Thelia\Core\Event\MessageDeleteEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Tools\URL; +use Thelia\Core\Event\MessageUpdateEvent; +use Thelia\Core\Event\MessageCreateEvent; +use Thelia\Log\Tlog; +use Thelia\Form\Exception\FormValidationException; +use Thelia\Core\Security\Exception\AuthorizationException; +use Thelia\Model\MessageQuery; +use Thelia\Form\MessageModificationForm; +use Thelia\Form\MessageCreationForm; + +/** + * Manages messages sent by mail + * + * @author Franck Allimant + */ +class AttributeController extends BaseAdminController +{ + /** + * The default action is displaying the attributes list. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function defaultAction() { + + if (null !== $response = $this->checkAuth("admin.configuration.attributes.view")) return $response; + + return $this->render('product-attributes'); + } + + public function updateAction() { + + if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response; + + return $this->render('product-attributes-edit'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/BaseAdminController.php b/core/lib/Thelia/Controller/Admin/BaseAdminController.php old mode 100644 new mode 100755 index 67cecd302..5461b8d3f --- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php +++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php @@ -22,6 +22,9 @@ /*************************************************************************************/ namespace Thelia\Controller\Admin; +use Symfony\Component\Routing\Exception\InvalidParameterException; +use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; +use Symfony\Component\Routing\Exception\RouteNotFoundException; use Thelia\Controller\BaseController; use Symfony\Component\HttpFoundation\Response; use Thelia\Core\Security\Exception\AuthorizationException; @@ -30,22 +33,46 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Tools\URL; use Thelia\Tools\Redirect; +use Thelia\Core\Security\SecurityContext; +use Thelia\Model\AdminLog; +use Thelia\Model\Lang; +use Thelia\Model\LangQuery; +use Thelia\Form\BaseForm; +use Thelia\Form\Exception\FormValidationException; +use Thelia\Log\Tlog; class BaseAdminController extends BaseController { const TEMPLATE_404 = "404"; + /** + * Helper to append a message to the admin log. + * + * @param unknown $message + */ + public function adminLogAppend($message) { + AdminLog::append($message, $this->getRequest(), $this->getSecurityContext()->getAdminUser()); + } + + /** + * This method process the rendering of view called from an admin page + * + * @param unknown $template + * @return Response the reponse which contains the rendered view + */ public function processTemplateAction($template) { try { if (! empty($template)) { // If we have a view in the URL, render this view return $this->render($template); - } elseif (null != $view = $this->getRequest()->get('view')) { + } + elseif (null != $view = $this->getRequest()->get('view')) { return $this->render($view); } - } catch (\Exception $ex) { - // Nothing special + } + catch (\Exception $ex) { + return $this->errorPage($ex->getMessage()); } return $this->pageNotFound(); @@ -64,10 +91,16 @@ class BaseAdminController extends BaseController /** * Return a general error page * + * @param mixed $message a message string, or an exception instance + * * @return \Symfony\Component\HttpFoundation\Response */ protected function errorPage($message) { + if ($message instanceof \Exception) { + $message = sprintf($this->getTranslator()->trans("Sorry, an error occured: %msg"), array('msg' => $message->getMessage())); + } + return $this->render('general_error', array( "error_message" => $message) ); @@ -76,19 +109,80 @@ class BaseAdminController extends BaseController /** * Check current admin user authorisations. An ADMIN role is assumed. * - * @param unknown $permissions a single permission or an array of permissions. + * @param mixed $permissions a single permission or an array of permissions. + * + * @return mixed null if authorization is granted, or a Response object which contains the error page otherwise * - * @throws AuthenticationException if permissions are not granted ti the current user. */ protected function checkAuth($permissions) { - if (! $this->getSecurityContext()->isGranted(array("ADMIN"), is_array($permissions) ? $permissions : array($permissions))) { - throw new AuthorizationException("Sorry, you're not allowed to perform this action"); + $permArr = is_array($permissions) ? $permissions : array($permissions); + + if ($this->getSecurityContext()->isGranted(array("ADMIN"), $permArr)) { + // Okay ! + return null; + } + + // Log the problem + $this->adminLogAppend("User is not granted for permissions %s", implode(", ", $permArr)); + + // Generate the proper response + $response = new Response(); + + return $this->errorPage($this->getTranslator()->trans("Sorry, you're not allowed to perform this action")); + } + + /* + * Create the standard message displayed to the user when the form cannot be validated. + */ + protected function createStandardFormValidationErrorMessage(FormValidationException $exception) { + return $this->getTranslator()->trans( + "Please check your input: %error", + array( + '%error' => $exception->getMessage() + ) + ); + } + + /** + * Setup the error context when an error occurs in a action method. + * + * @param string $action the action that caused the error (category modification, variable creation, currency update, etc.) + * @param BaseForm $form the form where the error occured, or null if no form was involved + * @param string $error_message the error message + * @param Exception $exception the exception or null if no exception + */ + protected function setupFormErrorContext($action, $error_message, BaseForm $form = null, \Exception $exception = null) { + + if ($error_message !== false) { + + // Log the error message + Tlog::getInstance()->error( + $this->getTranslator()->trans( + "Error during %action process : %error. Exception was %exc", + array( + '%action' => $action, + '%error' => $error_message, + '%exc' => $exception != null ? $exception->getMessage() : 'no exception' + ) + ) + ); + + if ($form != null) { + // Mark the form as errored + $form->setErrorMessage($error_message); + + // Pass it to the parser context + $this->getParserContext()->addForm($form); + } + + // Pass the error message to the parser. + $this->getParserContext()->setGeneralError($error_message); } } /** - * @return a ParserInterfac instance parser + * @return a ParserInterface instance parser */ protected function getParser() { @@ -117,6 +211,65 @@ class BaseAdminController extends BaseController return $this->container->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST); } + /** + * Return the route path defined for the givent route ID + * + * @param string $routeId a route ID, as defines in Config/Resources/routing/admin.xml + * @param mixed $parameters An array of parameters + * @param Boolean|string $referenceType The type of reference to be generated (one of the constants) + * + * @throws RouteNotFoundException If the named route doesn't exist + * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route + * @throws InvalidParameterException When a parameter value for a placeholder is not correct because + * it does not match the requirement + * @throws \InvalidArgumentException When the router doesn't exist + * @return string The generated URL + * + * @see \Thelia\Controller\BaseController::getRouteFromRouter() + */ + protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH) { + return $this->getRouteFromRouter( + 'router.admin', + $routeId, + $parameters, + $referenceType + ); + } + + /** + * Redirect to à route ID related URL + * + * @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()) { + $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId), $urlParameters)); + } + + /** + * Get the current edition lang ID, checking if a change was requested in the current request. + */ + protected function getCurrentEditionLang() { + + // Return the new language if a change is required. + if (null !== $edit_language_id = $this->getRequest()->get('edit_language_id', null)) { + + if (null !== $edit_language = LangQuery::create()->findOneById($edit_language_id)) { + return $edit_language; + } + } + + // Otherwise return the lang stored in session. + return $this->getSession()->getAdminEditionLang(); + } + + /** + * A simple helper to get the current edition locale. + */ + protected function getCurrentEditionLocale() { + return $this->getCurrentEditionLang()->getLocale(); + } + /** * Render the given template, and returns the result as an Http Response. * @@ -140,26 +293,44 @@ class BaseAdminController extends BaseController */ protected function renderRaw($templateName, $args = array()) { + // Add the template standard extension $templateName .= '.html'; $session = $this->getSession(); + // Find the current edit language ID + $edition_language = $this->getCurrentEditionLang(); + + // Prepare common template variables $args = array_merge($args, array( - 'locale' => $session->getLocale(), - 'lang' => $session->getLang() + 'locale' => $session->getLang()->getLocale(), + 'lang_code' => $session->getLang()->getCode(), + 'lang_id' => $session->getLang()->getId(), + + 'edit_language_id' => $edition_language->getId(), + 'edit_language_locale' => $edition_language->getLocale(), + + 'current_url' => htmlspecialchars($this->getRequest()->getUri()) )); + // Update the current edition language in session + $this->getSession()->setAdminEditionLang($edition_language); + + // Render the template. try { $data = $this->getParser()->render($templateName, $args); return $data; - } catch (AuthenticationException $ex) { - + } + catch (AuthenticationException $ex) { // User is not authenticated, and templates requires authentication -> redirect to login page // We user login_tpl as a path, not a template. - - Redirect::exec(URL::absoluteUrl($ex->getLoginTemplate())); + Redirect::exec(URL::getInstance()->absoluteUrl($ex->getLoginTemplate())); + } + catch (AuthorizationException $ex) { + // User is not allowed to perform the required action. Return the error page instead of the requested page. + return $this->errorPage($this->getTranslator()->trans("Sorry, you are not allowed to perform this action.")); } } } diff --git a/core/lib/Thelia/Controller/Admin/CategoryController.php b/core/lib/Thelia/Controller/Admin/CategoryController.php old mode 100644 new mode 100755 index 0c92d24dc..5eca91cf9 --- a/core/lib/Thelia/Controller/Admin/CategoryController.php +++ b/core/lib/Thelia/Controller/Admin/CategoryController.php @@ -25,126 +25,314 @@ namespace Thelia\Controller\Admin; use Thelia\Core\Security\Exception\AuthenticationException; use Thelia\Core\Security\Exception\AuthorizationException; +use Thelia\Log\Tlog; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Event\CategoryCreateEvent; +use Thelia\Form\CategoryCreationForm; +use Thelia\Core\Event\CategoryDeleteEvent; +use Thelia\Core\Event\CategoryToggleVisibilityEvent; +use Thelia\Core\Event\CategoryChangePositionEvent; +use Thelia\Form\CategoryDeletionForm; +use Thelia\Model\Lang; +use Thelia\Core\Translation\Translator; +use Thelia\Core\Event\CategoryUpdatePositionEvent; +use Thelia\Model\CategoryQuery; +use Thelia\Form\CategoryModificationForm; class CategoryController extends BaseAdminController { - protected function createNewCategory($args) - { - $this->dispatchEvent("createCategory"); - - // At this point, the form has error, and should be redisplayed. - return $this->render('categories', $args); + /** + * Render the categories list, ensuring the sort order is set. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + protected function renderList() { + return $this->render('categories', $this->getTemplateArgs()); } - protected function editCategory($args) - { - $this->checkAuth("ADMIN", "admin.category.edit"); - - return $this->render('edit_category', $args); - } - - protected function deleteCategory($args) - { - $this->dispatchEvent("deleteCategory"); - - // Something was wrong, category was not deleted. Display parent category list - return $this->render('categories', $args); - } - - protected function browseCategory($args) - { - $this->checkAuth("AMIN", "admin.catalog.view"); - - return $this->render('categories', $args); - } - - protected function visibilityToggle($args) - { - $this->dispatchEvent("toggleCategoryVisibility"); - - return $this->nullResponse(); - } - - protected function changePosition($args) - { - $this->dispatchEvent("changeCategoryPosition"); - - return $this->render('categories', $args); - } - - protected function positionDown($args) - { - $this->dispatchEvent("changeCategoryPositionDown"); - - return $this->render('categories', $args); - } - - protected function positionUp($args) - { - $this->dispatchEvent("changeCategoryPositionUp"); - - return $this->render('categories', $args); - } - - public function indexAction() - { - return $this->processAction(); - } - - public function processAction() - { - // Get the current action - $action = $this->getRequest()->get('action', 'browse'); + protected function getTemplateArgs() { // Get the category ID - $id = $this->getRequest()->get('id', 0); + $category_id = $this->getRequest()->get('category_id', 0); - $args = array( - 'action' => $action, - 'current_category_id' => $id + // Find the current category order + $category_order = $this->getRequest()->get( + 'order', + $this->getSession()->get('admin.category_order', 'manual') ); + $args = array( + 'current_category_id' => $category_id, + 'category_order' => $category_order, + ); + + // Store the current sort order in session + $this->getSession()->set('admin.category_order', $category_order); + + return $args; + } + + /** + * The default action is displaying the categories list. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function defaultAction() { + + if (null !== $response = $this->checkAuth("admin.categories.view")) return $response; + + return $this->renderList(); + } + + /** + * Create a new category object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function createAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.categories.create")) return $response; + + $error_msg = false; + + // Create the Creation Form + $creationForm = new CategoryCreationForm($this->getRequest()); + try { - switch ($action) { - case 'browse' : // Browse categories - return $this->browseCategory($args); + // Validate the form, create the CategoryCreation event and dispatch it. + $form = $this->validateForm($creationForm, "POST"); - case 'create' : // Create a new category + $data = $form->getData(); - return $this->createNewCategory($args); + $createEvent = new CategoryCreateEvent( + $data["title"], + $data["parent"], + $data["locale"] + ); - case 'edit' : // Edit an existing category + $this->dispatch(TheliaEvents::CATEGORY_CREATE, $createEvent); - return $this->editCategory($args); + if (! $createEvent->hasCategory()) throw new \LogicException($this->getTranslator()->trans("No category was created.")); - case 'delete' : // Delete an existing category + $createdObject = $createEvent->getCategory(); - return $this->deleteCategory($args); + // Log category creation + $this->adminLogAppend(sprintf("Category %s (ID %s) created", $createdObject->getTitle(), $createdObject->getId())); - case 'visibilityToggle' : // Toggle visibility + // Substitute _ID_ in the URL with the ID of the created object + $successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl()); - return $this->visibilityToggle($id); - - case 'changePosition' : // Change position - - return $this->changePosition($args); - - case 'positionUp' : // Move up category - - return $this->positionUp($args); - - case 'positionDown' : // Move down category - - return $this->positionDown($args); - } - } catch (AuthorizationException $ex) { - return $this->errorPage($ex->getMessage()); - } catch (AuthenticationException $ex) { - return $this->errorPage($ex->getMessage()); + // Redirect to the success URL + $this->redirect($successUrl); + } + catch (FormValidationException $ex) { + // Form cannot be validated + $error_msg = $this->createStandardFormValidationErrorMessage($ex); + } + catch (\Exception $ex) { + // Any other error + $error_msg = $ex->getMessage(); } - // We did not recognized the action -> return a 404 page - return $this->pageNotFound(); + $this->setupFormErrorContext("category creation", $error_msg, $creationForm, $ex); + + // At this point, the form has error, and should be redisplayed. + return $this->renderList(); } -} + + /** + * Load a category object for modification, and display the edit template. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function changeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.categories.update")) return $response; + + // Load the category object + $category = CategoryQuery::create() + ->joinWithI18n($this->getCurrentEditionLocale()) + ->findOneById($this->getRequest()->get('category_id')); + + if ($category != null) { + + // Prepare the data that will hydrate the form + $data = array( + 'id' => $category->getId(), + 'locale' => $category->getLocale(), + 'title' => $category->getTitle(), + 'chapo' => $category->getChapo(), + 'description' => $category->getDescription(), + 'postscriptum' => $category->getPostscriptum(), + 'parent' => $category->getParent(), + 'visible' => $category->getVisible() ? true : false, + 'url' => $category->getUrl($this->getCurrentEditionLocale()) + // tbc !!! + ); + + // Setup the object form + $changeForm = new CategoryModificationForm($this->getRequest(), "form", $data); + + // Pass it to the parser + $this->getParserContext()->addForm($changeForm); + } + + // Render the edition template. + return $this->render('category-edit', $this->getTemplateArgs()); + } + + /** + * Save changes on a modified category object, and either go back to the category list, or stay on the edition page. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function saveChangeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.categories.update")) return $response; + + $error_msg = false; + + // Create the form from the request + $changeForm = new CategoryModificationForm($this->getRequest()); + + // Get the category ID + $category_id = $this->getRequest()->get('category_id'); + + try { + + // Check the form against constraints violations + $form = $this->validateForm($changeForm, "POST"); + + // Get the form field values + $data = $form->getData(); + + $changeEvent = new CategoryUpdateEvent($data['id']); + + // Create and dispatch the change event + $changeEvent + ->setCategoryName($data['name']) + ->setLocale($data["locale"]) + ->setSymbol($data['symbol']) + ->setCode($data['code']) + ->setRate($data['rate']) + ; + + $this->dispatch(TheliaEvents::CATEGORY_UPDATE, $changeEvent); + + if (! $createEvent->hasCategory()) throw new \LogicException($this->getTranslator()->trans("No category was updated.")); + + // Log category modification + $changedObject = $changeEvent->getCategory(); + + $this->adminLogAppend(sprintf("Category %s (ID %s) modified", $changedObject->getTitle(), $changedObject->getId())); + + // If we have to stay on the same page, do not redirect to the succesUrl, + // just redirect to the edit page again. + if ($this->getRequest()->get('save_mode') == 'stay') { + $this->redirectToRoute( + "admin.categories.update", + array('category_id' => $category_id) + ); + } + + // Redirect to the success URL + $this->redirect($changeForm->getSuccessUrl()); + } + catch (FormValidationException $ex) { + // Form cannot be validated + $error_msg = $this->createStandardFormValidationErrorMessage($ex); + } + catch (\Exception $ex) { + // Any other error + $error_msg = $ex->getMessage(); + } + + $this->setupFormErrorContext("category modification", $error_msg, $changeForm, $ex); + + // At this point, the form has errors, and should be redisplayed. + return $this->render('category-edit', array('category_id' => $category_id)); + } + + /** + * Online status toggle category + */ + public function setToggleVisibilityAction() { + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.categories.update")) return $response; + + $changeEvent = new CategoryUpdateEvent($this->getRequest()->get('category_id', 0)); + + // Create and dispatch the change event + $changeEvent->setIsDefault(true); + + try { + $this->dispatch(TheliaEvents::CATEGORY_SET_DEFAULT, $changeEvent); + } + catch (\Exception $ex) { + // Any error + return $this->errorPage($ex); + } + + $this->redirectToRoute('admin.categories.default'); + } + + /** + * Update categoryposition + */ + public function updatePositionAction() { + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.categories.update")) return $response; + + try { + $mode = $this->getRequest()->get('mode', null); + + if ($mode == 'up') + $mode = CategoryUpdatePositionEvent::POSITION_UP; + else if ($mode == 'down') + $mode = CategoryUpdatePositionEvent::POSITION_DOWN; + else + $mode = CategoryUpdatePositionEvent::POSITION_ABSOLUTE; + + $position = $this->getRequest()->get('position', null); + + $event = new CategoryUpdatePositionEvent( + $this->getRequest()->get('category_id', null), + $mode, + $this->getRequest()->get('position', null) + ); + + $this->dispatch(TheliaEvents::CATEGORY_UPDATE_POSITION, $event); + } + catch (\Exception $ex) { + // Any error + return $this->errorPage($ex); + } + + $this->redirectToRoute('admin.categories.default'); + } + + /** + * Delete a category object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function deleteAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.categories.delete")) return $response; + + // Get the category id, and dispatch the deleted request + $event = new CategoryDeleteEvent($this->getRequest()->get('category_id')); + + $this->dispatch(TheliaEvents::CATEGORY_DELETE, $event); + + if ($event->hasCategory()) + $this->adminLogAppend(sprintf("Category %s (ID %s) deleted", $event->getCategory()->getTitle(), $event->getCategory()->getId())); + + $this->redirectToRoute('admin.categories.default'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/ConfigController.php b/core/lib/Thelia/Controller/Admin/ConfigController.php new file mode 100644 index 000000000..6d1a04b05 --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/ConfigController.php @@ -0,0 +1,302 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + +use Thelia\Core\Event\ConfigDeleteEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Tools\URL; +use Thelia\Core\Event\ConfigUpdateEvent; +use Thelia\Core\Event\ConfigCreateEvent; +use Thelia\Log\Tlog; +use Thelia\Form\Exception\FormValidationException; +use Thelia\Core\Security\Exception\AuthorizationException; +use Thelia\Model\ConfigQuery; +use Thelia\Form\ConfigModificationForm; +use Thelia\Form\ConfigCreationForm; + +/** + * Manages Thelmia system variables, aka Config objects. + * + * @author Franck Allimant + */ +class ConfigController extends BaseAdminController +{ + /** + * Render the currencies list, ensuring the sort order is set. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + protected function renderList() { + + // Find the current order + $order = $this->getRequest()->get( + 'order', + $this->getSession()->get('admin.variables_order', 'name') + ); + + // Store the current sort order in session + $this->getSession()->set('admin.variables_order', $order); + + return $this->render('variables', array('order' => $order)); + } + + /** + * The default action is displaying the variables list. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function defaultAction() { + + if (null !== $response = $this->checkAuth("admin.configuration.variables.view")) return $response; + + return $this->renderList(); + } + + /** + * Create a new config object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function createAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.variables.create")) return $response; + + $message = false; + + // Create the Creation Form + $creationForm = new ConfigCreationForm($this->getRequest()); + + try { + + // Validate the form, create the ConfigCreation event and dispatch it. + $form = $this->validateForm($creationForm, "POST"); + + $data = $form->getData(); + + $createEvent = new ConfigCreateEvent(); + + $createEvent + ->setEventName($data['name']) + ->setValue($data['value']) + ->setLocale($data["locale"]) + ->setTitle($data['title']) + ->setHidden($data['hidden']) + ->setSecured($data['secured']) + ; + + $this->dispatch(TheliaEvents::CONFIG_CREATE, $createEvent); + + if (! $createEvent->hasConfig()) throw new \LogicException($this->getTranslator()->trans("No variable was created.")); + + $createdObject = $createEvent->getConfig(); + + // Log config creation + $this->adminLogAppend(sprintf("Variable %s (ID %s) created", $createdObject->getName(), $createdObject->getId())); + + // Substitute _ID_ in the URL with the ID of the created object + $successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl()); + + // Redirect to the success URL + $this->redirect($successUrl); + } + catch (FormValidationException $ex) { + // Form cannot be validated + $message = $this->createStandardFormValidationErrorMessage($ex); + } + catch (\Exception $ex) { + // Any other error + $message = $ex->getMessage(); + } + + $this->setupFormErrorContext("variable creation", $message, $creationForm, $ex); + + // At this point, the form has error, and should be redisplayed. + return $this->renderList(); + } + + /** + * Load a config object for modification, and display the edit template. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function changeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response; + + // Load the config object + $config = ConfigQuery::create() + ->joinWithI18n($this->getCurrentEditionLocale()) + ->findOneById($this->getRequest()->get('variable_id')); + + if ($config != null) { + + // Prepare the data that will hydrate the form + $data = array( + 'id' => $config->getId(), + 'name' => $config->getName(), + 'value' => $config->getValue(), + 'hidden' => $config->getHidden(), + 'secured' => $config->getSecured(), + 'locale' => $config->getLocale(), + 'title' => $config->getTitle(), + 'chapo' => $config->getChapo(), + 'description' => $config->getDescription(), + 'postscriptum' => $config->getPostscriptum() + ); + + // Setup the object form + $changeForm = new ConfigModificationForm($this->getRequest(), "form", $data); + + // Pass it to the parser + $this->getParserContext()->addForm($changeForm); + } + + // Render the edition template. + return $this->render('variable-edit', array('variable_id' => $this->getRequest()->get('variable_id'))); + } + + /** + * Save changes on a modified config object, and either go back to the variable list, or stay on the edition page. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function saveChangeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response; + + $message = false; + + // Create the form from the request + $changeForm = new ConfigModificationForm($this->getRequest()); + + // Get the variable ID + $variable_id = $this->getRequest()->get('variable_id'); + + try { + + // Check the form against constraints violations + $form = $this->validateForm($changeForm, "POST"); + + // Get the form field values + $data = $form->getData(); + + $changeEvent = new ConfigUpdateEvent($data['id']); + + // Create and dispatch the change event + $changeEvent + ->setEventName($data['name']) + ->setValue($data['value']) + ->setHidden($data['hidden']) + ->setSecured($data['secured']) + ->setLocale($data["locale"]) + ->setTitle($data['title']) + ->setChapo($data['chapo']) + ->setDescription($data['description']) + ->setPostscriptum($data['postscriptum']) + ; + + $this->dispatch(TheliaEvents::CONFIG_UPDATE, $changeEvent); + + if (! $changeEvent->hasConfig()) throw new \LogicException($this->getTranslator()->trans("No variable was updated.")); + + // Log config modification + $changedObject = $changeEvent->getConfig(); + + $this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $changedObject->getName(), $changedObject->getId())); + + // If we have to stay on the same page, do not redirect to the succesUrl, + // just redirect to the edit page again. + if ($this->getRequest()->get('save_mode') == 'stay') { + + $this->redirectToRoute( + "admin.configuration.variables.update", + array('variable_id' => $variable_id) + ); + } + + // Redirect to the success URL + $this->redirect($changeForm->getSuccessUrl()); + } + catch (FormValidationException $ex) { + // Form cannot be validated + $message = $this->createStandardFormValidationErrorMessage($ex); + } + catch (\Exception $ex) { + // Any other error + $message = $ex->getMessage(); + } + + $this->setupFormErrorContext("variable edition", $message, $changeForm, $ex); + + // At this point, the form has errors, and should be redisplayed. + return $this->render('variable-edit', array('variable_id' => $variable_id)); + } + + /** + * Change values modified directly from the variable list + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function changeValuesAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response; + + $variables = $this->getRequest()->get('variable', array()); + + // Process all changed variables + foreach($variables as $id => $value) { + $event = new ConfigUpdateEvent($id); + $event->setValue($value); + + $this->dispatch(TheliaEvents::CONFIG_SETVALUE, $event); + } + + $this->redirectToRoute('admin.configuration.variables.default'); + } + + /** + * Delete a config object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function deleteAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.variables.delete")) return $response; + + // Get the config id, and dispatch the delet request + $event = new ConfigDeleteEvent($this->getRequest()->get('variable_id')); + + $this->dispatch(TheliaEvents::CONFIG_DELETE, $event); + + if ($event->hasConfig()) + $this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $event->getConfig()->getName(), $event->getConfig()->getId())); + + $this->redirectToRoute('admin.configuration.variables.default'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/CouponController.php b/core/lib/Thelia/Controller/Admin/CouponController.php new file mode 100755 index 000000000..769a8c406 --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/CouponController.php @@ -0,0 +1,514 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Controller\Admin; + +use Symfony\Component\HttpFoundation\Request; +use Thelia\Constraint\ConstraintFactory; +use Thelia\Constraint\ConstraintFactoryTest; +use Thelia\Constraint\Rule\AvailableForTotalAmount; +use Thelia\Constraint\Rule\CouponRuleInterface; +use Thelia\Constraint\Validator\PriceParam; +use Thelia\Core\Event\Coupon\CouponCreateEvent; +use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent; +use Thelia\Core\Event\Coupon\CouponEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\HttpFoundation\Session\Session; +use Thelia\Core\Security\Exception\AuthenticationException; +use Thelia\Core\Security\Exception\AuthorizationException; +use Thelia\Core\Translation\Translator; +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Coupon\CouponRuleCollection; +use Thelia\Form\CouponCreationForm; +use Thelia\Form\Exception\FormValidationException; +use Thelia\Log\Tlog; +use Thelia\Model\Coupon; +use Thelia\Model\CouponQuery; +use Thelia\Model\Lang; +use Thelia\Tools\I18n; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Control View and Action (Model) via Events + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponController extends BaseAdminController +{ + /** + * Manage Coupons list display + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function browseAction() + { + $this->checkAuth('ADMIN', 'admin.coupon.view'); + + return $this->render('coupon-list'); + } + + /** + * Manage Coupons creation display + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function createAction() + { + // Check current user authorization + $response = $this->checkAuth('admin.coupon.create'); + if ($response !== null) { + return $response; + } + + // Parameters given to the template + $args = array(); + + $i18n = new I18n(); + /** @var Lang $lang */ + $lang = $this->getSession()->get('lang'); + $eventToDispatch = TheliaEvents::COUPON_CREATE; + + if ($this->getRequest()->isMethod('POST')) { + $this->validateCreateOrUpdateForm( + $i18n, + $lang, + $eventToDispatch, + 'created', + 'creation' + ); + } else { + // If no input for expirationDate, now + 2 months + $defaultDate = new \DateTime(); + $args['defaultDate'] = $defaultDate->modify('+2 month') + ->format($lang->getDateFormat()); + } + + $args['formAction'] = 'admin/coupon/create'; + + return $this->render( + 'coupon-create', + $args + ); + } + + /** + * Manage Coupons edition display + * + * @param int $couponId Coupon id + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function updateAction($couponId) + { + // Check current user authorization + $response = $this->checkAuth('admin.coupon.update'); + if ($response !== null) { + return $response; + } + + /** @var Coupon $coupon */ + $coupon = CouponQuery::create()->findOneById($couponId); + if (!$coupon) { + $this->pageNotFound(); + } + + // Parameters given to the template + $args = array(); + + $i18n = new I18n(); + /** @var Lang $lang */ + $lang = $this->getSession()->get('lang'); + $eventToDispatch = TheliaEvents::COUPON_UPDATE; + + if ($this->getRequest()->isMethod('POST')) { + $this->validateCreateOrUpdateForm( + $i18n, + $lang, + $eventToDispatch, + 'updated', + 'update' + ); + } else { + // Prepare the data that will hydrate the form + $data = array( + 'code' => $coupon->getCode(), + 'title' => $coupon->getTitle(), + 'amount' => $coupon->getAmount(), + 'effect' => $coupon->getType(), + 'shortDescription' => $coupon->getShortDescription(), + 'description' => $coupon->getDescription(), + 'isEnabled' => ($coupon->getIsEnabled() == 1), + 'expirationDate' => $coupon->getExpirationDate($lang->getDateFormat()), + 'isAvailableOnSpecialOffers' => ($coupon->getIsAvailableOnSpecialOffers() == 1), + 'isCumulative' => ($coupon->getIsCumulative() == 1), + 'isRemovingPostage' => ($coupon->getIsRemovingPostage() == 1), + 'maxUsage' => $coupon->getMaxUsage(), + 'rules' => new CouponRuleCollection(array()), + 'locale' => $coupon->getLocale(), + ); + + /** @var CouponAdapterInterface $adapter */ + $adapter = $this->container->get('thelia.adapter'); + /** @var Translator $translator */ + $translator = $this->container->get('thelia.translator'); + + $args['rulesObject'] = array(); + /** @var CouponRuleInterface $rule */ + foreach ($coupon->getRules()->getRules() as $rule) { + $args['rulesObject'][] = array( + 'name' => $rule->getName(), + 'tooltip' => $rule->getToolTip(), + 'validators' => $rule->getValidators() + ); + } + + // Setup the object form + $changeForm = new CouponCreationForm($this->getRequest(), 'form', $data); + + // Pass it to the parser + $this->getParserContext()->addForm($changeForm); + } + + $args['formAction'] = 'admin/coupon/update/' . $couponId; + + return $this->render( + 'coupon-update', + $args + ); + } + + + /** + * Manage Coupons Rule creation display + * + * @param int $couponId Coupon id + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function createRuleAction($couponId) + { + // Check current user authorization + $response = $this->checkAuth('admin.coupon.update'); + if ($response !== null) { + return $response; + } + + /** @var Coupon $coupon */ + $coupon = CouponQuery::create()->findOneById($couponId); + if (!$coupon) { + $this->pageNotFound(); + } + + // Parameters given to the template + $args = array(); + + $i18n = new I18n(); + /** @var Lang $lang */ + $lang = $this->getSession()->get('lang'); + $eventToDispatch = TheliaEvents::COUPON_RULE_CREATE; + + if ($this->getRequest()->isMethod('POST')) { + $this->validateCreateOrUpdateForm( + $i18n, + $lang, + $eventToDispatch, + 'updated', + 'update' + ); + } else { + // Prepare the data that will hydrate the form + $data = array( + 'code' => $coupon->getCode(), + 'title' => $coupon->getTitle(), + 'amount' => $coupon->getAmount(), + 'effect' => $coupon->getType(), + 'shortDescription' => $coupon->getShortDescription(), + 'description' => $coupon->getDescription(), + 'isEnabled' => ($coupon->getIsEnabled() == 1), + 'expirationDate' => $coupon->getExpirationDate($lang->getDateFormat()), + 'isAvailableOnSpecialOffers' => ($coupon->getIsAvailableOnSpecialOffers() == 1), + 'isCumulative' => ($coupon->getIsCumulative() == 1), + 'isRemovingPostage' => ($coupon->getIsRemovingPostage() == 1), + 'maxUsage' => $coupon->getMaxUsage(), + 'rules' => new CouponRuleCollection(array()), + 'locale' => $coupon->getLocale(), + ); + + /** @var CouponAdapterInterface $adapter */ + $adapter = $this->container->get('thelia.adapter'); + /** @var Translator $translator */ + $translator = $this->container->get('thelia.translator'); + + $args['rulesObject'] = array(); + /** @var CouponRuleInterface $rule */ + foreach ($coupon->getRules()->getRules() as $rule) { + $args['rulesObject'][] = array( + 'name' => $rule->getName($translator), + 'tooltip' => $rule->getToolTip($translator), + 'validators' => $rule->getValidators() + ); + } + + // Setup the object form + $changeForm = new CouponCreationForm($this->getRequest(), 'form', $data); + + // Pass it to the parser + $this->getParserContext()->addForm($changeForm); + } + + $args['formAction'] = 'admin/coupon/update/' . $couponId; + + return $this->render( + 'coupon-update', + $args + ); + } + + + + /** + * Manage Coupons read display + * + * @param int $couponId Coupon Id + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function readAction($couponId) + { + $this->checkAuth('ADMIN', 'admin.coupon.read'); + + // Database request repeated in the loop but cached + $search = CouponQuery::create(); + $coupon = $search->findOneById($couponId); + + if ($coupon === null) { + return $this->pageNotFound(); + } + + return $this->render('coupon-read', array('couponId' => $couponId)); + } + + /** + * Manage Coupons read display + * + * @param int $couponId Coupon Id + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function getRuleInputAction($ruleId) + { + $this->checkAuth('ADMIN', 'admin.coupon.read'); + + // @todo uncomment +// if (!$this->getRequest()->isXmlHttpRequest()) { +// $this->redirect('index'); +// } + + /** @var ConstraintFactory $constraintFactory */ + $constraintFactory = $this->container->get('thelia.constraint.factory'); + $inputs = $constraintFactory->getInputs($ruleId); + + if (!$inputs) { + return $this->pageNotFound(); + } + + return $this->render( + 'coupon/rule-input-ajax', + array( + 'ruleId' => $ruleId, + 'inputs' => $inputs + ) + ); + } + + /** + * Build a Coupon from its form + * + * @param array $data Form data + * + * @return Coupon + */ + protected function buildCouponFromForm(array $data) + { + $couponBeingCreated = new Coupon(); + $couponBeingCreated->setCode($data['code']); + $couponBeingCreated->setType($data['type']); + $couponBeingCreated->setTitle($data['title']); + $couponBeingCreated->setShortDescription($data['shortDescription']); + $couponBeingCreated->setDescription($data['description']); + $couponBeingCreated->setAmount($data['amount']); + $couponBeingCreated->setIsEnabled($data['isEnabled']); + $couponBeingCreated->setExpirationDate($data['expirationDate']); + $couponBeingCreated->setSerializedRules( + new CouponRuleCollection( + array() + ) + ); + $couponBeingCreated->setIsCumulative($data['isCumulative']); + $couponBeingCreated->setIsRemovingPostage( + $data['isRemovingPostage'] + ); + $couponBeingCreated->setMaxUsage($data['maxUsage']); + $couponBeingCreated->setIsAvailableOnSpecialOffers( + $data['isAvailableOnSpecialOffers'] + ); + + return $couponBeingCreated; + } + + /** + * Log error message + * + * @param string $action Creation|Update|Delete + * @param string $message Message to log + * @param \Exception $e Exception to log + * + * @return $this + */ + protected function logError($action, $message, $e) + { + Tlog::getInstance()->error( + sprintf( + 'Error during Coupon ' . $action . ' process : %s. Exception was %s', + $message, + $e->getMessage() + ) + ); + + return $this; + } + + /** + * Validate the CreateOrUpdate form + * + * @param string $i18n Local code (fr_FR) + * @param Lang $lang Local variables container + * @param string $eventToDispatch Event which will activate actions + * @param string $log created|edited + * @param string $action creation|edition + * + * @return $this + */ + protected function validateCreateOrUpdateForm($i18n, $lang, $eventToDispatch, $log, $action) + { + // Create the form from the request + $creationForm = new CouponCreationForm($this->getRequest()); + + $message = false; + try { + // Check the form against constraints violations + $form = $this->validateForm($creationForm, 'POST'); + + // Get the form field values + $data = $form->getData(); + $couponEvent = new CouponCreateOrUpdateEvent( + $data['code'], + $data['title'], + $data['amount'], + $data['effect'], + $data['shortDescription'], + $data['description'], + $data['isEnabled'], + $i18n->getDateTimeFromForm($lang, $data['expirationDate']), + $data['isAvailableOnSpecialOffers'], + $data['isCumulative'], + $data['isRemovingPostage'], + $data['maxUsage'], + new CouponRuleCollection(array()), + $data['locale'] + ); + + // Dispatch Event to the Action + $this->dispatch( + $eventToDispatch, + $couponEvent + ); + + $this->adminLogAppend( + sprintf( + 'Coupon %s (ID ) ' . $log, + $couponEvent->getTitle(), + $couponEvent->getCoupon()->getId() + ) + ); + + $this->redirect( + str_replace( + '{id}', + $couponEvent->getCoupon()->getId(), + $creationForm->getSuccessUrl() + ) + ); + + } catch (FormValidationException $e) { + // Invalid data entered + $message = 'Please check your input:'; + $this->logError($action, $message, $e); + + } catch (\Exception $e) { + // Any other error + $message = 'Sorry, an error occurred:'; + $this->logError($action, $message, $e); + } + + if ($message !== false) { + // Mark the form as with error + $creationForm->setErrorMessage($message); + + // Send the form and the error to the parser + $this->getParserContext() + ->addForm($creationForm) + ->setGeneralError($message); + } + + return $this; + } + +// /** +// * Validation Rule creation +// * +// * @param string $type Rule class type +// * @param string $operator Rule operator (<, >, =, etc) +// * @param array $values Rules values +// * +// * @return bool +// */ +// protected function validateRulesCreation($type, $operator, $values) +// { +// /** @var CouponAdapterInterface $adapter */ +// $adapter = $this->container->get('thelia.adapter'); +// $validator = new PriceParam() +// try { +// $rule = new AvailableForTotalAmount($adapter, $validators); +// $rule = new $type($adapter, $validators); +// } catch (\Exception $e) { +// return false; +// } +// } + +} diff --git a/core/lib/Thelia/Controller/Admin/CurrencyController.php b/core/lib/Thelia/Controller/Admin/CurrencyController.php new file mode 100644 index 000000000..c6f5afdc3 --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/CurrencyController.php @@ -0,0 +1,347 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + +use Thelia\Core\Event\CurrencyDeleteEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Tools\URL; +use Thelia\Core\Event\CurrencyUpdateEvent; +use Thelia\Core\Event\CurrencyCreateEvent; +use Thelia\Log\Tlog; +use Thelia\Form\Exception\FormValidationException; +use Thelia\Core\Security\Exception\AuthorizationException; +use Thelia\Model\CurrencyQuery; +use Thelia\Form\CurrencyModificationForm; +use Thelia\Form\CurrencyCreationForm; +use Thelia\Core\Event\CurrencyUpdatePositionEvent; + +/** + * Manages currencies sent by mail + * + * @author Franck Allimant + */ +class CurrencyController extends BaseAdminController +{ + /** + * Render the currencies list, ensuring the sort order is set. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + protected function renderList() { + + // Find the current order + $order = $this->getRequest()->get( + 'order', + $this->getSession()->get('admin.currency_order', 'manual') + ); + + // Store the current sort order in session + $this->getSession()->set('admin.currency_order', $order); + + return $this->render('currencies', array('order' => $order)); + } + + /** + * The default action is displaying the currencies list. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function defaultAction() { + + if (null !== $response = $this->checkAuth("admin.configuration.currencies.view")) return $response; + + return $this->renderList(); + } + + /** + * Create a new currency object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function createAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.currencies.create")) return $response; + + $error_msg = false; + + // Create the Creation Form + $creationForm = new CurrencyCreationForm($this->getRequest()); + + try { + + // Validate the form, create the CurrencyCreation event and dispatch it. + $form = $this->validateForm($creationForm, "POST"); + + $data = $form->getData(); + + $createEvent = new CurrencyCreateEvent(); + + $createEvent + ->setCurrencyName($data['name']) + ->setLocale($data["locale"]) + ->setSymbol($data['symbol']) + ->setCode($data['code']) + ->setRate($data['rate']) + ; + + $this->dispatch(TheliaEvents::CURRENCY_CREATE, $createEvent); + + if (! $createEvent->hasCurrency()) throw new \LogicException($this->getTranslator()->trans("No currency was created.")); + + $createdObject = $createEvent->getCurrency(); + + // Log currency creation + $this->adminLogAppend(sprintf("Currency %s (ID %s) created", $createdObject->getName(), $createdObject->getId())); + + // Substitute _ID_ in the URL with the ID of the created object + $successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl()); + + // Redirect to the success URL + $this->redirect($successUrl); + } + catch (FormValidationException $ex) { + // Form cannot be validated + $error_msg = $this->createStandardFormValidationErrorMessage($ex); + } + catch (\Exception $ex) { + // Any other error + $error_msg = $ex->getMessage(); + } + + $this->setupFormErrorContext("currency creation", $error_msg, $creationForm, $ex); + + // At this point, the form has error, and should be redisplayed. + return $this->renderList(); + } + + /** + * Load a currency object for modification, and display the edit template. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function changeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response; + + // Load the currency object + $currency = CurrencyQuery::create() + ->joinWithI18n($this->getCurrentEditionLocale()) + ->findOneById($this->getRequest()->get('currency_id')); + + if ($currency != null) { + + // Prepare the data that will hydrate the form + $data = array( + 'id' => $currency->getId(), + 'name' => $currency->getName(), + 'locale' => $currency->getLocale(), + 'code' => $currency->getCode(), + 'symbol' => $currency->getSymbol(), + 'rate' => $currency->getRate() + ); + + // Setup the object form + $changeForm = new CurrencyModificationForm($this->getRequest(), "form", $data); + + // Pass it to the parser + $this->getParserContext()->addForm($changeForm); + } + + // Render the edition template. + return $this->render('currency-edit', array('currency_id' => $this->getRequest()->get('currency_id'))); + } + + /** + * Save changes on a modified currency object, and either go back to the currency list, or stay on the edition page. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function saveChangeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response; + + $error_msg = false; + + // Create the form from the request + $changeForm = new CurrencyModificationForm($this->getRequest()); + + // Get the currency ID + $currency_id = $this->getRequest()->get('currency_id'); + + try { + + // Check the form against constraints violations + $form = $this->validateForm($changeForm, "POST"); + + // Get the form field values + $data = $form->getData(); + + $changeEvent = new CurrencyUpdateEvent($data['id']); + + // Create and dispatch the change event + $changeEvent + ->setCurrencyName($data['name']) + ->setLocale($data["locale"]) + ->setSymbol($data['symbol']) + ->setCode($data['code']) + ->setRate($data['rate']) + ; + + $this->dispatch(TheliaEvents::CURRENCY_UPDATE, $changeEvent); + + if (! $changeEvent->hasCurrency()) throw new \LogicException($this->getTranslator()->trans("No currency was updated.")); + + // Log currency modification + $changedObject = $changeEvent->getCurrency(); + + $this->adminLogAppend(sprintf("Currency %s (ID %s) modified", $changedObject->getName(), $changedObject->getId())); + + // If we have to stay on the same page, do not redirect to the succesUrl, + // just redirect to the edit page again. + if ($this->getRequest()->get('save_mode') == 'stay') { + $this->redirectToRoute( + "admin.configuration.currencies.update", + array('currency_id' => $currency_id) + ); + } + + // Redirect to the success URL + $this->redirect($changeForm->getSuccessUrl()); + } + catch (FormValidationException $ex) { + // Form cannot be validated + $error_msg = $this->createStandardFormValidationErrorMessage($ex); + } + catch (\Exception $ex) { + // Any other error + $error_msg = $ex->getMessage(); + } + + $this->setupFormErrorContext("currency modification", $error_msg, $changeForm, $ex); + + // At this point, the form has errors, and should be redisplayed. + return $this->render('currency-edit', array('currency_id' => $currency_id)); + } + + /** + * Sets the default currency + */ + public function setDefaultAction() { + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response; + + $changeEvent = new CurrencyUpdateEvent($this->getRequest()->get('currency_id', 0)); + + // Create and dispatch the change event + $changeEvent->setIsDefault(true); + + try { + $this->dispatch(TheliaEvents::CURRENCY_SET_DEFAULT, $changeEvent); + } + catch (\Exception $ex) { + // Any error + return $this->errorPage($ex); + } + + $this->redirectToRoute('admin.configuration.currencies.default'); + } + + /** + * Update currencies rates + */ + public function updateRatesAction() { + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response; + + try { + $this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES); + } + catch (\Exception $ex) { + // Any error + return $this->errorPage($ex); + } + + $this->redirectToRoute('admin.configuration.currencies.default'); + } + + /** + * Update currencyposition + */ + public function updatePositionAction() { + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response; + + try { + $mode = $this->getRequest()->get('mode', null); + + if ($mode == 'up') + $mode = CurrencyUpdatePositionEvent::POSITION_UP; + else if ($mode == 'down') + $mode = CurrencyUpdatePositionEvent::POSITION_DOWN; + else + $mode = CurrencyUpdatePositionEvent::POSITION_ABSOLUTE; + + $position = $this->getRequest()->get('position', null); + + $event = new CurrencyUpdatePositionEvent( + $this->getRequest()->get('currency_id', null), + $mode, + $this->getRequest()->get('position', null) + ); + + $this->dispatch(TheliaEvents::CURRENCY_UPDATE_POSITION, $event); + } + catch (\Exception $ex) { + // Any error + return $this->errorPage($ex); + } + + $this->redirectToRoute('admin.configuration.currencies.default'); + } + + + /** + * Delete a currency object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function deleteAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.currencies.delete")) return $response; + + // Get the currency id, and dispatch the delet request + $event = new CurrencyDeleteEvent($this->getRequest()->get('currency_id')); + + $this->dispatch(TheliaEvents::CURRENCY_DELETE, $event); + + if ($event->hasCurrency()) + $this->adminLogAppend(sprintf("Currency %s (ID %s) modified", $event->getCurrency()->getName(), $event->getCurrency()->getId())); + + $this->redirectToRoute('admin.configuration.currencies.default'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/CustomerController.php b/core/lib/Thelia/Controller/Admin/CustomerController.php new file mode 100644 index 000000000..04c8842cd --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/CustomerController.php @@ -0,0 +1,40 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + + +/** + * Class CustomerController + * @package Thelia\Controller\Admin + * @author Manuel Raynaud + */ +class CustomerController extends BaseAdminController +{ + public function indexAction() + { + if (null !== $response = $this->checkAuth("admin.customers.view")) return $response; + + return $this->render("customers", array("display_customer" => 20)); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/MessageController.php b/core/lib/Thelia/Controller/Admin/MessageController.php new file mode 100644 index 000000000..00fcb17bd --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/MessageController.php @@ -0,0 +1,260 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + +use Thelia\Core\Event\MessageDeleteEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Tools\URL; +use Thelia\Core\Event\MessageUpdateEvent; +use Thelia\Core\Event\MessageCreateEvent; +use Thelia\Log\Tlog; +use Thelia\Form\Exception\FormValidationException; +use Thelia\Core\Security\Exception\AuthorizationException; +use Thelia\Model\MessageQuery; +use Thelia\Form\MessageModificationForm; +use Thelia\Form\MessageCreationForm; + +/** + * Manages messages sent by mail + * + * @author Franck Allimant + */ +class MessageController extends BaseAdminController +{ + /** + * Render the messages list + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + protected function renderList() { + return $this->render('messages'); + } + + /** + * The default action is displaying the messages list. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function defaultAction() { + + if (null !== $response = $this->checkAuth("admin.configuration.messages.view")) return $response; + + return $this->renderList(); + } + + /** + * Create a new message object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function createAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.messages.create")) return $response; + + $message = false; + + // Create the creation Form + $creationForm = new MessageCreationForm($this->getRequest()); + + try { + + // Validate the form, create the MessageCreation event and dispatch it. + $form = $this->validateForm($creationForm, "POST"); + + $data = $form->getData(); + + $createEvent = new MessageCreateEvent(); + + $createEvent + ->setMessageName($data['name']) + ->setLocale($data["locale"]) + ->setTitle($data['title']) + ->setSecured($data['secured']) + ; + + $this->dispatch(TheliaEvents::MESSAGE_CREATE, $createEvent); + + if (! $createEvent->hasMessage()) throw new \LogicException($this->getTranslator()->trans("No message was created.")); + + $createdObject = $createEvent->getMessage(); + + $this->adminLogAppend(sprintf("Message %s (ID %s) created", $createdObject->getName(), $createdObject->getId())); + + // Substitute _ID_ in the URL with the ID of the created object + $successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl()); + + // Redirect to the success URL + $this->redirect($successUrl); + } + catch (FormValidationException $ex) { + // Form cannot be validated + $message = $this->createStandardFormValidationErrorMessage($ex); + } + catch (\Exception $ex) { + // Any other error + $message = $ex->getMessage(); + } + + $this->setupFormErrorContext("message modification", $message, $creationForm, $ex); + + // At this point, the form has error, and should be redisplayed. + return $this->render('messages'); + } + + /** + * Load a message object for modification, and display the edit template. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function changeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response; + + // Load the message object + $message = MessageQuery::create() + ->joinWithI18n($this->getCurrentEditionLocale()) + ->findOneById($this->getRequest()->get('message_id')); + + if ($message != null) { + + // Prepare the data that will hydrate the form + $data = array( + 'id' => $message->getId(), + 'name' => $message->getName(), + 'secured' => $message->getSecured(), + 'locale' => $message->getLocale(), + 'title' => $message->getTitle(), + 'subject' => $message->getSubject(), + 'html_message' => $message->getHtmlMessage(), + 'text_message' => $message->getTextMessage() + ); + + // Setup the object form + $changeForm = new MessageModificationForm($this->getRequest(), "form", $data); + + // Pass it to the parser + $this->getParserContext()->addForm($changeForm); + } + + // Render the edition template. + return $this->render('message-edit', array('message_id' => $this->getRequest()->get('message_id'))); + } + + /** + * Save changes on a modified message object, and either go back to the message list, or stay on the edition page. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function saveChangeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response; + + $message = false; + + // Create the form from the request + $changeForm = new MessageModificationForm($this->getRequest()); + + // Get the message ID + $message_id = $this->getRequest()->get('message_id'); + + try { + + // Check the form against constraints violations + $form = $this->validateForm($changeForm, "POST"); + + // Get the form field values + $data = $form->getData(); + + $changeEvent = new MessageUpdateEvent($data['id']); + + // Create and dispatch the change event + $changeEvent + ->setMessageName($data['name']) + ->setSecured($data['secured']) + ->setLocale($data["locale"]) + ->setTitle($data['title']) + ->setSubject($data['subject']) + ->setHtmlMessage($data['html_message']) + ->setTextMessage($data['text_message']) + ; + + $this->dispatch(TheliaEvents::MESSAGE_UPDATE, $changeEvent); + + if (! $changeEvent->hasMessage()) throw new \LogicException($this->getTranslator()->trans("No message was updated.")); + + $changedObject = $changeEvent->getMessage(); + + $this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $changedObject->getName(), $changedObject->getId())); + + // If we have to stay on the same page, do not redirect to the succesUrl, + // just redirect to the edit page again. + if ($this->getRequest()->get('save_mode') == 'stay') { + $this->redirectToRoute( + "admin.configuration.messages.update", + array('message_id' => $message_id) + ); + } + + // Redirect to the success URL + $this->redirect($changeForm->getSuccessUrl()); + } + catch (FormValidationException $ex) { + // Form cannot be validated + $message = $this->createStandardFormValidationErrorMessage($ex); + } + catch (\Exception $ex) { + // Any other error + $message = $ex->getMessage(); + } + + $this->setupFormErrorContext("message modification", $message, $changeForm, $ex); + + // At this point, the form has errors, and should be redisplayed. + return $this->render('message-edit', array('message_id' => $message_id)); + } + + /** + * Delete a message object + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + public function deleteAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.messages.delete")) return $response; + + // Get the message id, and dispatch the delet request + $event = new MessageDeleteEvent($this->getRequest()->get('message_id')); + + $this->dispatch(TheliaEvents::MESSAGE_DELETE, $event); + + if ($event->hasMessage()) + $this->adminLogAppend(sprintf("Message %s (ID %s) modified", $event->getMessage()->getName(), $event->getMessage()->getId())); + + $this->redirectToRoute('admin.configuration.messages.default'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/SessionController.php b/core/lib/Thelia/Controller/Admin/SessionController.php index 5299253e0..d7385ad1b 100755 --- a/core/lib/Thelia/Controller/Admin/SessionController.php +++ b/core/lib/Thelia/Controller/Admin/SessionController.php @@ -43,25 +43,28 @@ class SessionController extends BaseAdminController { $this->dispatch(TheliaEvents::ADMIN_LOGOUT); - $this->getSecurityContext()->clear(); + $this->getSecurityContext()->clearAdminUser(); // Go back to login page. - return Redirect::exec(URL::absoluteUrl('/admin/login')); // FIXME - should be a parameter + $this->redirectToRoute('admin.login'); } public function checkLoginAction() { - $adminLoginForm = new AdminLogin($this->getRequest()); - $request = $this->getRequest(); - $authenticator = new AdminUsernamePasswordFormAuthenticator($request, $adminLoginForm); + $adminLoginForm = new AdminLogin($request); try { + + $form = $this->validateForm($adminLoginForm, "post"); + + $authenticator = new AdminUsernamePasswordFormAuthenticator($request, $adminLoginForm); + $user = $authenticator->getAuthentifiedUser(); // Success -> store user in security context - $this->getSecurityContext()->setUser($user); + $this->getSecurityContext()->setAdminUser($user); // Log authentication success AdminLog::append("Authentication successful", $request, $user); @@ -70,32 +73,34 @@ class SessionController extends BaseAdminController // Redirect to the success URL return Redirect::exec($adminLoginForm->getSuccessUrl()); - } catch (ValidatorException $ex) { + + } + catch (FormValidationException $ex) { // Validation problem - $message = "Missing or invalid information. Please check your input."; - } catch (AuthenticationException $ex) { + $message = $this->createStandardFormValidationErrorMessage($ex); + } + catch (AuthenticationException $ex) { // Log authentication failure AdminLog::append(sprintf("Authentication failure for username '%s'", $authenticator->getUsername()), $request); - $message = "Login failed. Please check your username and password."; - } catch (\Exception $ex) { + $message = $this->getTranslator()->trans("Login failed. Please check your username and password."); + } + catch (\Exception $ex) { // Log authentication failure AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request); - $message = "Unable to process your request. Please try again."; + $message = $this->getTranslator()->trans( + "Unable to process your request. Please try again (%err).", + array("%err" => $ex->getMessage()) + ); } - // Store error information in the form - $adminLoginForm->setError(true); - $adminLoginForm->setErrorMessage($message); - - // Store the form name in session (see Form Smarty plugin to find usage of this parameter) - $this->getParserContext()->setErrorForm($adminLoginForm); + $this->setupFormErrorContext("Login process", $message, $adminLoginForm, $ex); // Display the login form again return $this->render("login"); } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index 5c6e3eb5e..666e8ca32 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -25,15 +25,22 @@ namespace Thelia\Controller; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\DependencyInjection\ContainerAware; +use Symfony\Component\Routing\Exception\InvalidParameterException; +use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; +use Symfony\Component\Routing\Exception\RouteNotFoundException; +use Symfony\Component\Routing\Router; use Thelia\Core\Security\SecurityContext; use Thelia\Tools\URL; use Thelia\Tools\Redirect; use Thelia\Core\Template\ParserContext; use Thelia\Core\Event\ActionEvent; use Symfony\Component\EventDispatcher\EventDispatcher; -use Thelia\Core\Factory\ActionEventFactory; use Thelia\Form\BaseForm; use Thelia\Form\Exception\FormValidationException; +use Symfony\Component\EventDispatcher\Event; +use Thelia\Core\Event\DefaultActionEvent; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * @@ -56,35 +63,15 @@ class BaseController extends ContainerAware } /** - * Create an action event + * Dispatch a Thelia event * - * @param string $action - * @return EventDispatcher - */ - protected function dispatchEvent($action) - { - // Create the - $eventFactory = new ActionEventFactory($this->getRequest(), $action, $this->container->getParameter("thelia.actionEvent")); - - $actionEvent = $eventFactory->createActionEvent(); - - $this->dispatch("action.$action", $actionEvent); - - if ($actionEvent->hasErrorForm()) { - $this->getParserContext()->setErrorForm($actionEvent->getErrorForm()); - } - - return $actionEvent; - } - - /** - * Dispatch a Thelia event to modules - * - * @param string $eventName a TheliaEvent name, as defined in TheliaEvents class - * @param ActionEvent $event the event + * @param string $eventName a TheliaEvent name, as defined in TheliaEvents class + * @param Event $event the action event, or null (a DefaultActionEvent will be dispatched) */ protected function dispatch($eventName, ActionEvent $event = null) { + if ($event == null) $event = new DefaultActionEvent(); + $this->getDispatcher()->dispatch($eventName, $event); } @@ -98,6 +85,17 @@ class BaseController extends ContainerAware return $this->container->get('event_dispatcher'); } + /** + * + * return the Translator + * + * @return mixed \Thelia\Core\Translation\Translator + */ + public function getTranslator() + { + return $this->container->get('thelia.translator'); + } + /** * Return the parser context, * @@ -113,13 +111,9 @@ class BaseController extends ContainerAware * * @return \Thelia\Core\Security\SecurityContext */ - protected function getSecurityContext($context = false) + protected function getSecurityContext() { - $securityContext = $this->container->get('thelia.securityContext'); - - $securityContext->setContext($context === false ? SecurityContext::CONTEXT_BACK_OFFICE : $context); - - return $securityContext; + return $this->container->get('thelia.securityContext'); } /** @@ -142,6 +136,29 @@ class BaseController extends ContainerAware return $request->getSession(); } + /** + * Get all errors that occured in a form + * + * @param \Symfony\Component\Form\Form $form + * @return string the error string + */ + private function getErrorMessages(\Symfony\Component\Form\Form $form) { + + $errors = ''; + + foreach ($form->getErrors() as $key => $error) { + $errors .= $error->getMessage() . ', '; + } + + foreach ($form->all() as $child) { + if (!$child->isValid()) { + $errors .= $this->getErrorMessages($child) . ', '; + } + } + + return rtrim($errors, ', '); + } + /** * Validate a BaseForm * @@ -160,31 +177,78 @@ class BaseController extends ContainerAware if ($form->isValid()) { return $form; - } else { - throw new FormValidationException("Missing or invalid data"); } - } else { + else { + throw new FormValidationException(sprintf("Missing or invalid data: %s", $this->getErrorMessages($form))); + } + } + else { throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod)); } } /** * - * redirect request to specify url + * redirect request to the specified url + * * @param string $url */ - public function redirect($url) + public function redirect($url, $status = 302) { - Redirect::exec($url); + Redirect::exec($url, $status); } /** - * If success_url param is present in request, follow this link. + * If success_url param is present in request or in the provided form, redirect to this URL. + * + * @param BaseForm $form a base form, which may contains the success URL */ - protected function redirectSuccess() + protected function redirectSuccess(BaseForm $form = null) { - if (null !== $url = $this->getRequest()->get("success_url")) { - $this->redirect($url); + if ($form != null) { + $url = $form->getSuccessUrl(); } + else { + $url = $this->getRequest()->get("success_url"); + } + + echo "url=$url"; + + if (null !== $url) $this->redirect($url); } -} + + /** + * Get a route path from the route id. + * + * @param string $routerName Router name + * @param string $routeId The name of the route + * @param mixed $parameters An array of parameters + * @param Boolean|string $referenceType The type of reference to be generated (one of the constants) + * + * @throws RouteNotFoundException If the named route doesn't exist + * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route + * @throws InvalidParameterException When a parameter value for a placeholder is not correct because + * it does not match the requirement + * @throws \InvalidArgumentException When the router doesn't exist + * @return string The generated URL + */ + protected function getRouteFromRouter($routerName, $routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_PATH) { + /** @var Router $router */ + $router = $this->container->get($routerName); + + if ($router == null) { + throw new \InvalidArgumentException(sprintf("Router '%s' does not exists.", $routerName)); + } + + return $router->generate($routeId, $parameters, $referenceType); + } + + /** + * Return a 404 error + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException + */ + protected function pageNotFound() + { + throw new NotFoundHttpException(); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Front/AddressController.php b/core/lib/Thelia/Controller/Front/AddressController.php new file mode 100644 index 000000000..08e803556 --- /dev/null +++ b/core/lib/Thelia/Controller/Front/AddressController.php @@ -0,0 +1,158 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Front; +use Thelia\Core\Event\AddressCreateOrUpdateEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Form\AddressCreateForm; +use Thelia\Form\AddressUpdateForm; +use Thelia\Form\Exception\FormValidationException; +use Thelia\Model\Base\AddressQuery; +use Thelia\Model\Customer; +use Thelia\Tools\URL; + + +/** + * Class AddressController + * @package Thelia\Controller\Front + * @author Manuel Raynaud + */ +class AddressController extends BaseFrontController +{ + + /** + * Create controller. + * Check if customer is logged in + * + * Dispatch TheliaEvents::ADDRESS_CREATE event + */ + public function createAction() + { + if ($this->getSecurityContext()->hasCustomerUser() === false) { + $this->redirect(URL::getInstance()->getIndexPage()); + } + + $addressCreate = new AddressCreateForm($this->getRequest()); + + try { + $customer = $this->getSecurityContext()->getCustomerUser(); + + $form = $this->validateForm($addressCreate, "post"); + $event = $this->createAddressEvent($form); + $event->setCustomer($customer); + + $this->dispatch(TheliaEvents::ADDRESS_CREATE, $event); + $this->redirectSuccess($addressCreate); + + }catch (FormValidationException $e) { + $message = sprintf("Please check your input: %s", $e->getMessage()); + } + catch (\Exception $e) { + $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + } + + if ($message !== false) { + \Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message)); + + $addressCreate->setErrorMessage($message); + + $this->getParserContext() + ->addForm($addressCreate) + ->setGeneralError($message) + ; + } + } + + public function updateAction() + { + $request = $this->getRequest(); + + if ($this->getSecurityContext()->hasCustomerUser() === false) { + $this->redirectToRoute("home"); + } + + if(null === $address_id = $request->get("address_id")) { + $this->redirectToRoute("home"); + } + + $addressUpdate = new AddressUpdateForm($request); + + try { + $customer = $this->getSecurityContext()->getCustomerUser(); + + $form = $this->validateForm($addressUpdate); + + $address = AddressQuery::create()->findPk($address_id); + + if (null === $address) { + $this->redirectToRoute("home"); + } + + if($address->getCustomer()->getId() != $customer->getId()) { + $this->redirectToRoute("home"); + } + + $event = $this->createAddressEvent($form); + $event->setAddress($address); + + $this->dispatch(TheliaEvents::ADDRESS_UPDATE, $event); + + $this->redirectSuccess($addressUpdate); + }catch (FormValidationException $e) { + $message = sprintf("Please check your input: %s", $e->getMessage()); + } + catch (\Exception $e) { + $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + } + + if ($message !== false) { + \Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message)); + + $addressUpdate->setErrorMessage($message); + + $this->getParserContext() + ->addForm($addressUpdate) + ->setGeneralError($message) + ; + } + } + + protected function createAddressEvent($form) + { + return new AddressCreateOrUpdateEvent( + $form->get("label")->getData(), + $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("cellphone")->getData(), + $form->get("phone")->getData(), + $form->get("company")->getData() + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Front/BaseFrontController.php b/core/lib/Thelia/Controller/Front/BaseFrontController.php old mode 100644 new mode 100755 index c466ab0c6..e92387a83 --- a/core/lib/Thelia/Controller/Front/BaseFrontController.php +++ b/core/lib/Thelia/Controller/Front/BaseFrontController.php @@ -23,7 +23,28 @@ namespace Thelia\Controller\Front; use Thelia\Controller\BaseController; +use Thelia\Tools\URL; class BaseFrontController extends BaseController { + /** + * Return the route path defined for the givent route ID + * + * @param string $routeId a route ID, as defines in Config/Resources/routing/front.xml + * + * @see \Thelia\Controller\BaseController::getRouteFromRouter() + */ + protected function getRoute($routeId) { + return $this->getRouteFromRouter('router.front', $routeId); + } + + /** + * Redirect to à route ID related URL + * + * @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()) { + $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId), $urlParameters)); + } } diff --git a/core/lib/Thelia/Controller/Front/CartController.php b/core/lib/Thelia/Controller/Front/CartController.php old mode 100644 new mode 100755 index 62b68a3fc..c3d928a15 --- a/core/lib/Thelia/Controller/Front/CartController.php +++ b/core/lib/Thelia/Controller/Front/CartController.php @@ -63,7 +63,7 @@ class CartController extends BaseFrontController if ($message) { $cartAdd->setErrorMessage($message); - $this->getParserContext()->setErrorForm($cartAdd); + $this->getParserContext()->addForm($cartAdd); } } @@ -74,7 +74,7 @@ class CartController extends BaseFrontController $cartEvent->setQuantity($this->getRequest()->get("quantity")); try { - $this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent); + $this->getDispatcher()->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent); $this->redirectSuccess(); } catch(PropelException $e) { diff --git a/core/lib/Thelia/Controller/Front/CustomerController.php b/core/lib/Thelia/Controller/Front/CustomerController.php old mode 100644 new mode 100755 index 07f9eb4c8..d753510a6 --- a/core/lib/Thelia/Controller/Front/CustomerController.php +++ b/core/lib/Thelia/Controller/Front/CustomerController.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Controller\Front; -use Propel\Runtime\Exception\PropelException; -use Symfony\Component\Validator\Exception\ValidatorException; use Thelia\Core\Event\CustomerCreateOrUpdateEvent; use Thelia\Core\Event\CustomerLoginEvent; use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator; @@ -36,65 +34,107 @@ use Thelia\Form\CustomerModification; use Thelia\Form\Exception\FormValidationException; use Thelia\Model\Customer; use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Event\CustomerEvent; +use Thelia\Core\Factory\ActionEventFactory; +use Thelia\Tools\URL; +use Thelia\Log\Tlog; +use Thelia\Core\Security\Exception\WrongPasswordException; +/** + * Class CustomerController + * @package Thelia\Controller\Front + * @author Manuel Raynaud + */ class CustomerController extends BaseFrontController { /** - * create a new Customer. Retrieve data in form and dispatch a action.createCustomer event - * - * if error occurs, message is set in the parserContext + * Create a new customer. + * On success, redirect to success_url if exists, otherwise, display the same view again. */ public function createAction() { - $request = $this->getRequest(); - $customerCreation = new CustomerCreation($request); - try { - $form = $this->validateForm($customerCreation, "post"); + if (! $this->getSecurityContext()->hasCustomerUser()) { - $customerCreateEvent = $this->createEventInstance($form->getData()); + $message = false; - $this->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent); + $customerCreation = new CustomerCreation($this->getRequest()); - $this->processLogin($customerCreateEvent->getCustomer()); + try { + $form = $this->validateForm($customerCreation, "post"); - $this->redirectSuccess(); + $customerCreateEvent = $this->createEventInstance($form->getData()); - } catch (FormValidationException $e) { - $customerCreation->setErrorMessage($e->getMessage()); - $this->getParserContext()->setErrorForm($customerCreation); - } catch (PropelException $e) { - \Thelia\Log\Tlog::getInstance()->error(sprintf("error during customer creation process in front context with message : %s", $e->getMessage())); - $this->getParserContext()->setGeneralError($e->getMessage()); + $this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent); + + $this->processLogin($customerCreateEvent->getCustomer()); + + $this->redirectSuccess($customerCreation); + } + catch (FormValidationException $e) { + $message = sprintf("Please check your input: %s", $e->getMessage()); + } + catch (\Exception $e) { + $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + } + + if ($message !== false) { + Tlog::getInstance()->error(sprintf("Error during customer creation process : %s. Exception was %s", $message, $e->getMessage())); + + $customerCreation->setErrorMessage($message); + + $this->getParserContext() + ->addForm($customerCreation) + ->setGeneralError($message) + ; + } } - } + /** + * Update customer data. On success, redirect to success_url if exists. + * Otherwise, display the same view again. + */ public function updateAction() { - $request = $this->getRequest(); - $customerModification = new CustomerModification($request); + if ($this->getSecurityContext()->hasCustomerUser()) { - try { + $message = false; - $customer = $this->getSecurityContext(SecurityContext::CONTEXT_FRONT_OFFICE)->getUser(); + $customerModification = new CustomerModification($this->getRequest()); - $form = $this->validateForm($customerModification, "post"); + try { - $customerChangeEvent = $this->createEventInstance($form->getData()); - $customerChangeEvent->setCustomer($customer); + $customer = $this->getSecurityContext()->getCustomerUser(); - $this->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $customerChangeEvent); + $form = $this->validateForm($customerModification, "post"); - $this->processLogin($customerChangeEvent->getCustomer()); + $customerChangeEvent = $this->createEventInstance($form->getData()); + $customerChangeEvent->setCustomer($customer); - $this->redirectSuccess(); + $this->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $customerChangeEvent); - } catch (FormValidationException $e) { - $customerModification->setErrorMessage($e->getMessage()); - $this->getParserContext()->setErrorForm($customerModification); - } catch (PropelException $e) { - \Thelia\Log\Tlog::getInstance()->error(sprintf("error during updating customer in front context with message : %s", $e->getMessage())); - $this->getParserContext()->setGeneralError($e->getMessage()); + $this->processLogin($customerChangeEvent->getCustomer()); + + $this->redirectSuccess($customerModification); + + } + catch (FormValidationException $e) { + $message = sprintf("Please check your input: %s", $e->getMessage()); + } + catch (\Exception $e) { + $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + } + + if ($message !== false) { + Tlog::getInstance()->error(sprintf("Error during customer modification process : %s.", $message)); + + $customerModification->setErrorMessage($message); + + $this->getParserContext() + ->addForm($customerModification) + ->setGeneralError($message) + ; + } } } @@ -102,41 +142,77 @@ class CustomerController extends BaseFrontController * Perform user login. On a successful login, the user is redirected to the URL * found in the success_url form parameter, or / if none was found. * - * If login is not successfull, the same view is dispolyed again. + * If login is not successfull, the same view is displayed again. * */ public function loginAction() { - $request = $this->getRequest(); + if (! $this->getSecurityContext()->hasCustomerUser()) { + $message = false; - $customerLoginForm = new CustomerLogin($request); + $request = $this->getRequest(); + $customerLoginForm = new CustomerLogin($request); - $authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm); + try { - try { - $customer = $authenticator->getAuthentifiedUser(); + $form = $this->validateForm($customerLoginForm, "post"); - $customerLoginEvent = new CustomerLoginEvent($customer); + $authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm); - $this->processLogin($customer, $customerLoginEvent); + $customer = $authenticator->getAuthentifiedUser(); - $this->redirectSuccess(); - } catch (ValidatorException $e) { + $this->processLogin($customer); - } catch(UsernameNotFoundException $e) { + $this->redirectSuccess($customerLoginForm); - } catch(AuthenticationException $e) { + } + catch (FormValidationException $e) { + $message = sprintf("Please check your input: %s", $e->getMessage()); + } + catch(UsernameNotFoundException $e) { + $message = "This customer email was not found."; + } + catch (WrongPasswordException $e) { + $message = "Wrong password. Please try again."; + } + catch(AuthenticationException $e) { + $message = "Sorry, we failed to authentify you. Please try again."; + } + catch (\Exception $e) { + $message = sprintf("Sorry, an error occured: %s", $e->getMessage()); + } - } catch (\Exception $e) { + if ($message !== false) { + Tlog::getInstance()->error(sprintf("Error during customer login process : %s. Exception was %s", $message, $e->getMessage())); + $customerLoginForm->setErrorMessage($message); + + $this->getParserContext()->addForm($customerLoginForm); + } } } - public function processLogin(Customer $customer,$event = null) + /** + * Perform customer logout. + */ + public function logoutAction() { - $this->getSecurityContext(SecurityContext::CONTEXT_FRONT_OFFICE)->setUser($customer); + if ($this->getSecurityContext()->hasCustomerUser()) { + $this->dispatch(TheliaEvents::CUSTOMER_LOGOUT); + } - if($event) $this->dispatch(TheliaEvents::CUSTOMER_LOGIN, $event); + // Redirect to home page + $this->redirect(URL::getInstance()->getIndexPage()); + } + + /** + * Dispatch event for customer login action + * + * @param Customer $customer + */ + protected function processLogin(Customer $customer) + { + $this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer)); } /** @@ -162,10 +238,9 @@ class CustomerController extends BaseFrontController $this->getRequest()->getSession()->getLang(), isset($data["reseller"])?$data["reseller"]:null, isset($data["sponsor"])?$data["sponsor"]:null, - isset($data["discount"])?$data["discount"]:nullsch + isset($data["discount"])?$data["discount"]:null ); return $customerCreateEvent; } - } diff --git a/core/lib/Thelia/Controller/Front/DefaultController.php b/core/lib/Thelia/Controller/Front/DefaultController.php index 235e1bb64..fe7e1aede 100755 --- a/core/lib/Thelia/Controller/Front/DefaultController.php +++ b/core/lib/Thelia/Controller/Front/DefaultController.php @@ -23,6 +23,9 @@ namespace Thelia\Controller\Front; use Symfony\Component\HttpFoundation\Request; +use Thelia\Model\ConfigQuery; +use Thelia\Tools\Redirect; +use Thelia\Tools\URL; /** * @@ -43,13 +46,30 @@ class DefaultController extends BaseFrontController */ public function noAction(Request $request) { + $view = null; + if (! $view = $request->query->get('view')) { - $view = "index"; if ($request->request->has('view')) { $view = $request->request->get('view'); } } + if(null !== $view) { + $request->attributes->set('_view', $view); + } - $request->attributes->set('_view', $view); + if (null === $view && null === $request->attributes->get("_view")) { + $request->attributes->set("_view", "index"); + } + + if(ConfigQuery::isRewritingEnable()) { + if($request->attributes->get('_rewritten', false) === false) { + /* Does the query GET parameters match a rewritten URL ? */ + $rewrittenUrl = URL::getInstance()->retrieveCurrent($request); + if($rewrittenUrl->rewrittenUrl !== null) { + /* 301 redirection to rewritten URL */ + $this->redirect($rewrittenUrl->rewrittenUrl, 301); + } + } + } } } diff --git a/core/lib/Thelia/Controller/Front/DeliveryController.php b/core/lib/Thelia/Controller/Front/DeliveryController.php new file mode 100644 index 000000000..ef84be6ab --- /dev/null +++ b/core/lib/Thelia/Controller/Front/DeliveryController.php @@ -0,0 +1,56 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Front; +use Thelia\Model\ModuleQuery; +use Thelia\Tools\URL; + + +/** + * Class DeliveryController + * @package Thelia\Controller\Front + * @author Manuel Raynaud + */ +class DeliveryController extends BaseFrontController +{ + public function select($delivery_id) + { + if ($this->getSecurityContext()->hasCustomerUser() === false) { + $this->redirect(URL::getInstance()->getIndexPage()); + } + + $request = $this->getRequest(); + + $deliveryModule = ModuleQuery::create() + ->filterById($delivery_id) + ->filterByActivate(1) + ->findOne() + ; + + if ($deliveryModule) { + $request->getSession()->setDelivery($delivery_id); + } else { + $this->pageNotFound(); + } + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Install/BaseInstallController.php b/core/lib/Thelia/Controller/Install/BaseInstallController.php new file mode 100644 index 000000000..a5cbbd506 --- /dev/null +++ b/core/lib/Thelia/Controller/Install/BaseInstallController.php @@ -0,0 +1,60 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Install; +use Symfony\Component\HttpFoundation\Response; +use Thelia\Controller\BaseController; + + +/** + * Class BaseInstallController + * @package Thelia\Controller\Install + * @author Manuel Raynaud + */ +class BaseInstallController extends BaseController +{ + /** + * @return a ParserInterface instance parser + */ + protected function getParser() + { + $parser = $this->container->get("thelia.parser"); + + // Define the template thant shoud be used + $parser->setTemplate("install"); + + return $parser; + } + + public function render($templateName, $args = array()) + { + return new Response($this->renderRaw($templateName, $args)); + } + + public function renderRaw($templateName, $args = array()) + { + $data = $this->getParser()->render($templateName, $args); + + return $data; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Install/InstallController.php b/core/lib/Thelia/Controller/Install/InstallController.php new file mode 100644 index 000000000..209eea82b --- /dev/null +++ b/core/lib/Thelia/Controller/Install/InstallController.php @@ -0,0 +1,69 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Install; +use Thelia\Install\BaseInstall; +use Thelia\Install\CheckPermission; + +/** + * Class InstallController + * @package Thelia\Controller\Install + * @author Manuel Raynaud + */ +class InstallController extends BaseInstallController { + + public function index() + { + $this->verifyStep(1); + + $this->getSession()->set("step", 1); + + $this->render("index.html"); + } + + public function checkPermission() + { + $this->verifyStep(2); + + $permission = new CheckPermission(); + } + + protected function verifyStep($step) + { + $session = $this->getSession(); + + if ($session->has("step")) { + $sessionStep = $session->get("step"); + } else { + return true; + } + + switch($step) { + case "1" : + if ($sessionStep > 1) { + $this->redirect("/install/step/2"); + } + break; + } + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Application.php b/core/lib/Thelia/Core/Application.php index 531d8802c..bb0eec79a 100755 --- a/core/lib/Thelia/Core/Application.php +++ b/core/lib/Thelia/Core/Application.php @@ -29,6 +29,12 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\HttpKernel\KernelInterface; +/** + * cli application for Thelia + * Class Application + * @package Thelia\Core + * mfony\Component\HttpFoundation\Session\Session + */ class Application extends BaseApplication { diff --git a/core/lib/Thelia/Core/Bundle/TheliaBundle.php b/core/lib/Thelia/Core/Bundle/TheliaBundle.php index 9c8b8fedf..a9704b350 100755 --- a/core/lib/Thelia/Core/Bundle/TheliaBundle.php +++ b/core/lib/Thelia/Core/Bundle/TheliaBundle.php @@ -26,9 +26,11 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Scope; +use Thelia\Core\DependencyInjection\Compiler\RegisterCouponPass; use Thelia\Core\DependencyInjection\Compiler\RegisterListenersPass; use Thelia\Core\DependencyInjection\Compiler\RegisterParserPluginPass; use Thelia\Core\DependencyInjection\Compiler\RegisterRouterPass; +use Thelia\Core\DependencyInjection\Compiler\RegisterRulePass; /** * First Bundle use in Thelia @@ -60,6 +62,8 @@ class TheliaBundle extends Bundle ->addCompilerPass(new RegisterListenersPass()) ->addCompilerPass(new RegisterParserPluginPass()) ->addCompilerPass(new RegisterRouterPass()) + ->addCompilerPass(new RegisterCouponPass()) + ->addCompilerPass(new RegisterRulePass()) ; } diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponPass.php new file mode 100755 index 000000000..cf6f32842 --- /dev/null +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterCouponPass.php @@ -0,0 +1,69 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Core\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * Created by JetBrains PhpStorm. + * Date: 9/05/13 + * Time: 3:24 PM + * + * Class RegisterListenersPass + * Source code come from Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RegisterKernelListenersPass class + * + * @package Thelia\Core\DependencyInjection\Compiler + * @author Guillaume MOREL + * + */ +class RegisterCouponPass implements CompilerPassInterface +{ + /** + * You can modify the container here before it is dumped to PHP code. + * + * @param ContainerBuilder $container Container + * + * @api + */ + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition('thelia.coupon.manager')) { + return; + } + + $couponManager = $container->getDefinition('thelia.coupon.manager'); + $services = $container->findTaggedServiceIds("thelia.coupon.addCoupon"); + + foreach ($services as $id => $rule) { + $couponManager->addMethodCall( + 'addAvailableCoupon', + array( + new Reference($id) + ) + ); + } + } +} diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php index 9f7e9f31f..08fcd777b 100755 --- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterListenersPass.php @@ -31,6 +31,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; * @package Thelia\Core\DependencyInjection\Compiler * * Source code come from Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RegisterKernelListenersPass class + * @author Manuel Raynaud */ class RegisterListenersPass implements CompilerPassInterface { diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php index 80c3ba933..71d96ca40 100755 --- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php @@ -31,7 +31,7 @@ use Symfony\Component\DependencyInjection\Reference; * Register parser plugins. These plugins shouild be tagged thelia.parser.register_plugin * in the configuration. * - * + * @author Manuel Raynaud */ class RegisterParserPluginPass implements CompilerPassInterface { diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php old mode 100644 new mode 100755 index 2bd902e64..505d7a3fa --- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php @@ -28,6 +28,14 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Reference; +/** + * + * this compiler can add many router to symfony-cms routing + * + * Class RegisterRouterPass + * @package Thelia\Core\DependencyInjection\Compiler + * @author Manuel Raynaud + */ class RegisterRouterPass implements CompilerPassInterface { @@ -76,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), 1)); } } } diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRulePass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRulePass.php new file mode 100755 index 000000000..6d66e4bf1 --- /dev/null +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRulePass.php @@ -0,0 +1,69 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Core\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +/** + * Created by JetBrains PhpStorm. + * Date: 9/05/13 + * Time: 3:24 PM + * + * Class RegisterListenersPass + * Source code come from Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RegisterKernelListenersPass class + * + * @package Thelia\Core\DependencyInjection\Compiler + * @author Guillaume MOREL + * + */ +class RegisterRulePass implements CompilerPassInterface +{ + /** + * You can modify the container here before it is dumped to PHP code. + * + * @param ContainerBuilder $container Container + * + * @api + */ + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition('thelia.coupon.manager')) { + return; + } + + $couponManager = $container->getDefinition('thelia.coupon.manager'); + $services = $container->findTaggedServiceIds("thelia.coupon.addCoupon"); + + foreach ($services as $id => $rule) { + $couponManager->addMethodCall( + 'addAvailableCoupon', + array( + new Reference($id) + ) + ); + } + } +} diff --git a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php index a95e7d668..294c9b671 100755 --- a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php +++ b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php @@ -36,6 +36,14 @@ use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Loader\FileLoader; +/** + * + * Load, read and validate config xml files + * + * Class XmlFileLoader + * @package Thelia\Core\DependencyInjection\Loader + * @author Manuel Raynaud + */ class XmlFileLoader extends FileLoader { /** diff --git a/core/lib/Thelia/Core/Event/ActionEvent.php b/core/lib/Thelia/Core/Event/ActionEvent.php index c5c188235..5040be7f5 100755 --- a/core/lib/Thelia/Core/Event/ActionEvent.php +++ b/core/lib/Thelia/Core/Event/ActionEvent.php @@ -35,27 +35,8 @@ use Thelia\Form\BaseForm; */ abstract class ActionEvent extends Event { - - /** - * - * @var Symfony\Component\HttpFoundation\Request - */ - protected $request; - - protected $errorForm = null; - protected $parameters = array(); - /** - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param string $action - */ - public function __construct(Request $request) - { - $this->request = $request; - } - public function __set($name, $value) { $this->parameters[$name] = $value; @@ -69,30 +50,4 @@ abstract class ActionEvent extends Event return null; } - - /** - * - * @return \Symfony\Component\HttpFoundation\Request - */ - public function getRequest() - { - return $this->request; - } - - public function setErrorForm(BaseForm $form) - { - $this->errorForm = $form; - - if ($form != null) $this->stopPropagation(); - } - - public function getErrorForm() - { - return $this->errorForm; - } - - public function hasErrorForm() - { - return $this->errorForm != null ? true : false; - } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php new file mode 100644 index 000000000..d6dd6e3ed --- /dev/null +++ b/core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php @@ -0,0 +1,267 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Symfony\Component\EventDispatcher\Event; +use Thelia\Model\Address; +use Thelia\Model\Customer; + + +/** + * Class AddressCreateOrUpdateEvent + * @package Thelia\Core\Event + * @author Manuel Raynaud + */ +class AddressCreateOrUpdateEvent extends ActionEvent +{ + /** + * @var string address label + */ + protected $label; + + /** + * @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 cell phone + */ + protected $cellphone; + + /** + * @var string phone + */ + protected $phone; + + /** + * @var \Thelia\Model\Customer + */ + protected $customer; + + /** + * @var \Thelia\Model\Address + */ + protected $address; + + function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company) + { + $this->address1 = $address1; + $this->address2 = $address2; + $this->address3 = $address3; + $this->cellphone = $cellphone; + $this->city = $city; + $this->company = $company; + $this->country = $country; + $this->firstname = $firstname; + $this->label = $label; + $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 getCellphone() + { + return $this->cellphone; + } + + /** + * @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 getLabel() + { + return $this->label; + } + + /** + * @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\Customer $customer + */ + public function setCustomer(Customer $customer) + { + $this->customer = $customer; + } + + /** + * @return \Thelia\Model\Customer + */ + public function getCustomer() + { + return $this->customer; + } + + /** + * @param \Thelia\Model\Address $address + */ + public function setAddress(Address $address) + { + $this->address = $address; + $this->setCustomer($address->getCustomer()); + } + + /** + * @return \Thelia\Model\Address + */ + public function getAddress() + { + return $this->address; + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/AddressEvent.php b/core/lib/Thelia/Core/Event/AddressEvent.php new file mode 100644 index 000000000..5167108fd --- /dev/null +++ b/core/lib/Thelia/Core/Event/AddressEvent.php @@ -0,0 +1,54 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Symfony\Component\EventDispatcher\Event; +use Thelia\Model\Address; + + +/** + * Class AddressEvent + * @package Thelia\Core\Event + * @author Manuel Raynaud + */ +class AddressEvent extends ActionEvent +{ + /** + * @var \Thelia\Model\Address + */ + protected $address; + + function __construct(Address $address) + { + $this->address = $address; + } + + + /** + * @return \Thelia\Model\Address + */ + public function getAddress() + { + return $this->address; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/BaseToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/BaseToggleVisibilityEvent.php new file mode 100644 index 000000000..2dbd54374 --- /dev/null +++ b/core/lib/Thelia/Core/Event/BaseToggleVisibilityEvent.php @@ -0,0 +1,48 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + + +class BaseToggleVisibilityEvent extends ActionEvent +{ + protected $object_id; + + protected $object; + + public function __construct($object_id) + { + $this->object_id = $object_id; + } + + public function getObjectId() + { + return $this->object_id; + } + + public function setObjectId($object_id) + { + $this->object_id = $object_id; + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/BaseUpdatePositionEvent.php b/core/lib/Thelia/Core/Event/BaseUpdatePositionEvent.php new file mode 100644 index 000000000..41907c29c --- /dev/null +++ b/core/lib/Thelia/Core/Event/BaseUpdatePositionEvent.php @@ -0,0 +1,77 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +class BaseUpdatePositionEvent extends ActionEvent +{ + const POSITION_UP = 1; + const POSITION_DOWN = 2; + const POSITION_ABSOLUTE = 3; + + protected $object_id; + protected $mode; + protected $position; + + protected $object; + + public function __construct($object_id, $mode, $position = null) + { + $this->object_id = $object_id; + $this->mode = $mode; + $this->position = $position; + } + + public function getMode() + { + return $this->mode; + } + + public function setMode($mode) + { + $this->mode = $mode; + return $this; + } + + public function getPosition() + { + return $this->position; + } + + public function setPosition($position) + { + $this->position = $position; + return $this; + } + + public function getObjectId() + { + return $this->object_id; + } + + public function setObjectId($object_id) + { + $this->object_id = $object_id; + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/CartEvent.php b/core/lib/Thelia/Core/Event/CartEvent.php old mode 100644 new mode 100755 index 59e67e2bf..61d58e9d2 --- a/core/lib/Thelia/Core/Event/CartEvent.php +++ b/core/lib/Thelia/Core/Event/CartEvent.php @@ -26,7 +26,7 @@ namespace Thelia\Core\Event; use Symfony\Component\EventDispatcher\Event; use Thelia\Model\Cart; -class CartEvent extends Event +class CartEvent extends ActionEvent { protected $cart; protected $quantity; diff --git a/core/lib/Thelia/Core/Event/CartItemEvent.php b/core/lib/Thelia/Core/Event/CartItemEvent.php old mode 100644 new mode 100755 index 59deffb37..6718b63ff --- a/core/lib/Thelia/Core/Event/CartItemEvent.php +++ b/core/lib/Thelia/Core/Event/CartItemEvent.php @@ -25,7 +25,7 @@ namespace Thelia\Core\Event; use Thelia\Model\CartItem; -class CartItemEvent extends InternalEvent +class CartItemEvent extends ActionEvent { protected $cartItem; diff --git a/core/lib/Thelia/Core/Event/CategoryCreateEvent.php b/core/lib/Thelia/Core/Event/CategoryCreateEvent.php new file mode 100644 index 000000000..0a6b79269 --- /dev/null +++ b/core/lib/Thelia/Core/Event/CategoryCreateEvent.php @@ -0,0 +1,73 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Category; + +class CategoryCreateEvent extends CategoryEvent +{ + protected $title; + protected $parent; + protected $locale; + + public function __construct($title, $parent, $locale) + { + $this->title = $title; + $this->parent = $parent; + $this->locale = $locale; + } + + public function getTitle() + { + return $this->title; + } + + public function setTitle($title) + { + $this->title = $title; + return $this; + } + + public function getParent() + { + return $this->parent; + } + + public function setParent($parent) + { + $this->parent = $parent; + return $this; + } + + public function getLocale() + { + return $this->locale; + } + + public function setLocale($locale) + { + $this->locale = $locale; + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CategoryDeleteEvent.php b/core/lib/Thelia/Core/Event/CategoryDeleteEvent.php new file mode 100644 index 000000000..ad686563d --- /dev/null +++ b/core/lib/Thelia/Core/Event/CategoryDeleteEvent.php @@ -0,0 +1,45 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Category; + +class CategoryDeleteEvent extends CategoryEvent +{ + public function __construct($category_id) + { + $this->category_id = $category_id; + } + + public function getCategoryId() + { + return $this->category_id; + } + + public function setCategoryId($category_id) + { + $this->category_id = $category_id; + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CategoryEvent.php b/core/lib/Thelia/Core/Event/CategoryEvent.php index 44986e8b9..ac04f15c9 100644 --- a/core/lib/Thelia/Core/Event/CategoryEvent.php +++ b/core/lib/Thelia/Core/Event/CategoryEvent.php @@ -24,13 +24,30 @@ namespace Thelia\Core\Event; use Thelia\Model\Category; +use Thelia\Core\Event\ActionEvent; -class CategoryEvent extends InternalEvent +class CategoryEvent extends ActionEvent { - public $category; + public $category = null; - public function __construct(Category $category) + public function __construct(Category $category = null) { $this->category = $category; } + + public function hasCategory() { + return ! is_null($this->category); + } + + public function getCategory() + { + return $this->category; + } + + public function setCategory(Category $category) + { + $this->category = $category; + + return $this; + } } diff --git a/core/lib/Thelia/Core/Event/Internal/CartEvent.php b/core/lib/Thelia/Core/Event/CategoryToggleVisibilityEvent.php similarity index 89% rename from core/lib/Thelia/Core/Event/Internal/CartEvent.php rename to core/lib/Thelia/Core/Event/CategoryToggleVisibilityEvent.php index 7d35bea55..103c5207e 100644 --- a/core/lib/Thelia/Core/Event/Internal/CartEvent.php +++ b/core/lib/Thelia/Core/Event/CategoryToggleVisibilityEvent.php @@ -21,17 +21,8 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event\Internal; +namespace Thelia\Core\Event; -use Thelia\Model\Cart; - -class CartEvent extends InternalEvent +class CategoryToggleVisibilityEvent extends BaseToggleVisibilityEvent { - public $cart; - - public function __construct(Cart $cart) - { - $this->cart = $cart; - } - -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CategoryUpdateEvent.php b/core/lib/Thelia/Core/Event/CategoryUpdateEvent.php new file mode 100644 index 000000000..305cf9369 --- /dev/null +++ b/core/lib/Thelia/Core/Event/CategoryUpdateEvent.php @@ -0,0 +1,120 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Category; + +class CategoryUpdateEvent extends CategoryCreateEvent +{ + protected $category_id; + + protected $chapo; + protected $description; + protected $postscriptum; + + protected $url; + protected $visibility; + protected $parent; + + public function __construct($category_id) + { + $this->category_id = $category_id; + } + + public function getCategoryId() + { + return $this->category_id; + } + + public function setCategoryId($category_id) + { + $this->category_id = $category_id; + return $this; + } + + public function getChapo() + { + return $this->chapo; + } + + public function setChapo($chapo) + { + $this->chapo = $chapo; + return $this; + } + + public function getDescription() + { + return $this->description; + } + + public function setDescription($description) + { + $this->description = $description; + return $this; + } + + public function getPostscriptum() + { + return $this->postscriptum; + } + + public function setPostscriptum($postscriptum) + { + $this->postscriptum = $postscriptum; + return $this; + } + + public function getUrl() + { + return $this->url; + } + + public function setUrl($url) + { + $this->url = $url; + return $this; + } + + public function getVisibility() + { + return $this->visibility; + } + + public function setVisibility($visibility) + { + $this->visibility = $visibility; + return $this; + } + + public function getParent() + { + return $this->parent; + } + + public function setParent($parent) + { + $this->parent = $parent; + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/CategoryUpdatePositionEvent.php b/core/lib/Thelia/Core/Event/CategoryUpdatePositionEvent.php new file mode 100644 index 000000000..44af9b946 --- /dev/null +++ b/core/lib/Thelia/Core/Event/CategoryUpdatePositionEvent.php @@ -0,0 +1,28 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +class CategoryUpdatePositionEvent extends BaseUpdatePositionEvent +{ +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/ConfigCreateEvent.php b/core/lib/Thelia/Core/Event/ConfigCreateEvent.php new file mode 100644 index 000000000..79440c491 --- /dev/null +++ b/core/lib/Thelia/Core/Event/ConfigCreateEvent.php @@ -0,0 +1,108 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Config; + +class ConfigCreateEvent extends ConfigEvent +{ + protected $event_name; + protected $value; + protected $locale; + protected $title; + protected $hidden; + protected $secured; + + // Use event_name to prevent conflict with Event::name property. + public function getEventName() + { + return $this->event_name; + } + + public function setEventName($event_name) + { + $this->event_name = $event_name; + + return $this; + } + + public function getValue() + { + return $this->value; + } + + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + public function getLocale() + { + return $this->locale; + } + + public function setLocale($locale) + { + $this->locale = $locale; + + return $this; + } + + public function getTitle() + { + return $this->title; + } + + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + public function getHidden() + { + return $this->hidden; + } + + public function setHidden($hidden) + { + $this->hidden = $hidden; + + return $this; + } + + public function getSecured() + { + return $this->secured; + } + + public function setSecured($secured) + { + $this->secured = $secured; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/ConfigDeleteEvent.php b/core/lib/Thelia/Core/Event/ConfigDeleteEvent.php new file mode 100644 index 000000000..6cc39438c --- /dev/null +++ b/core/lib/Thelia/Core/Event/ConfigDeleteEvent.php @@ -0,0 +1,48 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Config; + +class ConfigDeleteEvent extends ConfigEvent +{ + protected $config_id; + + public function __construct($config_id) + { + $this->setConfigId($config_id); + } + + public function getConfigId() + { + return $this->config_id; + } + + public function setConfigId($config_id) + { + $this->config_id = $config_id; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/ConfigEvent.php b/core/lib/Thelia/Core/Event/ConfigEvent.php new file mode 100644 index 000000000..5e1c673cf --- /dev/null +++ b/core/lib/Thelia/Core/Event/ConfigEvent.php @@ -0,0 +1,51 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Config; + +class ConfigEvent extends ActionEvent +{ + protected $config = null; + + public function __construct(Config $config = null) + { + $this->config = $config; + } + + public function hasConfig() { + return ! is_null($this->config); + } + + public function getConfig() + { + return $this->config; + } + + public function setConfig($config) + { + $this->config = $config; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/ConfigUpdateEvent.php b/core/lib/Thelia/Core/Event/ConfigUpdateEvent.php new file mode 100644 index 000000000..a73613699 --- /dev/null +++ b/core/lib/Thelia/Core/Event/ConfigUpdateEvent.php @@ -0,0 +1,88 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Config; + +class ConfigUpdateEvent extends ConfigCreateEvent +{ + protected $config_id; + + protected $description; + protected $chapo; + protected $postscriptum; + + public function __construct($config_id) + { + $this->setConfigId($config_id); + } + + public function getConfigId() + { + return $this->config_id; + } + + public function setConfigId($config_id) + { + $this->config_id = $config_id; + + return $this; + } + + public function getDescription() + { + return $this->description; + } + + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + public function getChapo() + { + return $this->chapo; + } + + public function setChapo($chapo) + { + $this->chapo = $chapo; + + return $this; + } + + public function getPostscriptum() + { + return $this->postscriptum; + } + + public function setPostscriptum($postscriptum) + { + $this->postscriptum = $postscriptum; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php new file mode 100644 index 000000000..796baed08 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Coupon/CouponCreateOrUpdateEvent.php @@ -0,0 +1,312 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Core\Event\Coupon; +use Thelia\Core\Event\ActionEvent; +use Thelia\Coupon\CouponRuleCollection; +use Thelia\Model\Coupon; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/29/13 + * Time: 3:45 PM + * + * Occurring when a Coupon is created + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponCreateOrUpdateEvent extends ActionEvent +{ + /** @var CouponRuleCollection Array of CouponRuleInterface */ + protected $rules = null; + + /** @var string Coupon code (ex: XMAS) */ + protected $code = null; + + /** @var string Coupon title (ex: Coupon for XMAS) */ + protected $title = null; + + /** @var string Coupon short description */ + protected $shortDescription = null; + + /** @var string Coupon description */ + protected $description = null; + + /** @var bool if Coupon is enabled */ + protected $isEnabled = false; + + /** @var \DateTime Coupon expiration date */ + protected $expirationDate = null; + + /** @var bool if Coupon is cumulative */ + protected $isCumulative = false; + + /** @var bool if Coupon is removing postage */ + protected $isRemovingPostage = false; + + /** @var float Amount that will be removed from the Checkout (Coupon Effect) */ + protected $amount = 0; + + /** @var int Max time a Coupon can be used (-1 = unlimited) */ + protected $maxUsage = -1; + + /** @var bool if Coupon is available for Products already on special offers */ + protected $isAvailableOnSpecialOffers = false; + + /** @var Coupon Coupon model */ + protected $coupon = null; + + /** @var string Coupon effect */ + protected $effect; + + /** @var string Language code ISO (ex: fr_FR) */ + protected $locale = null; + + /** + * Constructor + * + * @param string $code Coupon Code + * @param string $title Coupon title + * @param float $amount Amount removed from the Total Checkout + * @param string $effect Coupon effect + * @param string $shortDescription Coupon short description + * @param string $description Coupon description + * @param boolean $isEnabled Enable/Disable + * @param \DateTime $expirationDate Coupon expiration date + * @param boolean $isAvailableOnSpecialOffers Is available on special offers + * @param boolean $isCumulative Is cumulative + * @param boolean $isRemovingPostage Is removing Postage + * @param int $maxUsage Coupon quantity + * @param CouponRuleCollection $rules CouponRuleInterface to add + * @param string $locale Coupon Language code ISO (ex: fr_FR) + */ + function __construct( + $code, + $title, + $amount, + $effect, + $shortDescription, + $description, + $isEnabled, + \DateTime $expirationDate, + $isAvailableOnSpecialOffers, + $isCumulative, + $isRemovingPostage, + $maxUsage, + $rules, + $locale + ) { + $this->amount = $amount; + $this->code = $code; + $this->description = $description; + $this->expirationDate = $expirationDate; + $this->isAvailableOnSpecialOffers = $isAvailableOnSpecialOffers; + $this->isCumulative = $isCumulative; + $this->isEnabled = $isEnabled; + $this->isRemovingPostage = $isRemovingPostage; + $this->maxUsage = $maxUsage; + $this->rules = $rules; + $this->shortDescription = $shortDescription; + $this->title = $title; + $this->effect = $effect; + $this->locale = $locale; + } + + /** + * Return Coupon code (ex: XMAS) + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Return Coupon title (ex: Coupon for XMAS) + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Return Coupon short description + * + * @return string + */ + public function getShortDescription() + { + return $this->shortDescription; + } + + /** + * Return Coupon description + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * If Coupon is cumulative or prevent any accumulation + * If is cumulative you can sum Coupon effects + * If not cancel all other Coupon and take the last given + * + * @return bool + */ + public function isCumulative() + { + return $this->isCumulative; + } + + /** + * If Coupon is removing Checkout Postage + * + * @return bool + */ + public function isRemovingPostage() + { + return $this->isRemovingPostage; + } + + /** + * Return effects generated by the coupon + * + * @return float Amount removed from the Total Checkout + */ + public function getAmount() + { + return $this->amount; + } + + /** + * Return condition to validate the Coupon or not + * + * @return CouponRuleCollection + */ + public function getRules() + { + if ($this->rules === null || !is_object($this->rules)) { + $rules = $this->rules; + } else { + $rules = clone $this->rules; + } + + return $rules; + } + + /** + * Return Coupon expiration date + * + * @return \DateTime + */ + public function getExpirationDate() + { + return clone $this->expirationDate; + } + + /** + * If Coupon is available on special offers + * + * @return boolean + */ + public function isAvailableOnSpecialOffers() + { + return $this->isAvailableOnSpecialOffers; + } + + /** + * Get if Coupon is enabled or not + * + * @return boolean + */ + public function isEnabled() + { + return $this->isEnabled; + } + + /** + * Return how many time the Coupon can be used again + * Ex : -1 unlimited + * + * @return int + */ + public function getMaxUsage() + { + return $this->maxUsage; + } + + /** + * Get Coupon effect + * + * @return string + */ + public function getEffect() + { + return $this->effect; + } + + /** + * Coupon Language code ISO (ex: fr_FR) + * + * @return string + */ + public function getLocale() + { + return $this->locale; + } + + /** + * Set Coupon Model + * + * @param \Thelia\Model\Coupon $coupon Coupon Model + * + * @return $this + */ + public function setCoupon($coupon) + { + $this->coupon = $coupon; + + return $this; + } + + /** + * Return Coupon Model + * + * @return \Thelia\Model\Coupon + */ + public function getCoupon() + { + return $this->coupon; + } + + + +} diff --git a/core/lib/Thelia/Core/Event/Coupon/CouponDisableEvent.php b/core/lib/Thelia/Core/Event/Coupon/CouponDisableEvent.php new file mode 100644 index 000000000..db8e14243 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Coupon/CouponDisableEvent.php @@ -0,0 +1,103 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Core\Event\Coupon; +use Thelia\Model\Coupon; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/29/13 + * Time: 3:45 PM + * + * Occurring when a Coupon is disabled + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponDisableEvent extends ActionEvent +{ + /** @var int Coupon id */ + protected $couponId; + + /** @var Coupon Coupon being disabled */ + protected $disabledCoupon; + + /** + * Constructor + * + * @param int $id Coupon Id + */ + public function __construct($id) + { + $this->id = $id; + } + + /** + * Get Coupon id + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set Coupon id + * + * @param int $id Coupon id + * + * @return $this + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get Coupon being disabled + * + * @return Coupon + */ + public function getDisabledCoupon() + { + return $this->disabledCoupon; + } + + /** + * Set Coupon to be disabled + * + * @param Coupon $disabledCoupon Coupon to disable + * + * @return $this + */ + public function setDisabledCoupon(Coupon $disabledCoupon) + { + $this->disabledCoupon = $disabledCoupon; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/Coupon/CouponEnableEvent.php b/core/lib/Thelia/Core/Event/Coupon/CouponEnableEvent.php new file mode 100644 index 000000000..ab06953e5 --- /dev/null +++ b/core/lib/Thelia/Core/Event/Coupon/CouponEnableEvent.php @@ -0,0 +1,103 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Core\Event\Coupon; +use Thelia\Model\Coupon; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/29/13 + * Time: 3:45 PM + * + * Occurring when a Coupon is enabled + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponEnableEvent extends ActionEvent +{ + /** @var int Coupon id */ + protected $couponId; + + /** @var Coupon Coupon being enabled */ + protected $enabledCoupon; + + /** + * Constructor + * + * @param int $id Coupon Id + */ + public function __construct($id) + { + $this->id = $id; + } + + /** + * Get Coupon id + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Set Coupon id + * + * @param int $id Coupon id + * + * @return $this + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get Coupon being enabled + * + * @return Coupon + */ + public function getEnabledCoupon() + { + return $this->enabledCoupon; + } + + /** + * Set Coupon to be enabled + * + * @param Coupon $enabledCoupon Coupon to enabled + * + * @return $this + */ + public function setEnabledCoupon(Coupon $enabledCoupon) + { + $this->enabledCoupon = $enabledCoupon; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/CurrencyCreateEvent.php b/core/lib/Thelia/Core/Event/CurrencyCreateEvent.php new file mode 100644 index 000000000..d9d345ddd --- /dev/null +++ b/core/lib/Thelia/Core/Event/CurrencyCreateEvent.php @@ -0,0 +1,95 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Currency; + +class CurrencyCreateEvent extends CurrencyEvent +{ + protected $currency_name; + protected $locale; + protected $symbol; + protected $code; + protected $rate; + + // Use currency_name to prevent conflict with Event::name property. + public function getCurrencyName() + { + return $this->currency_name; + } + + public function setCurrencyName($currency_name) + { + $this->currency_name = $currency_name; + + return $this; + } + + public function getLocale() + { + return $this->locale; + } + + public function setLocale($locale) + { + $this->locale = $locale; + + return $this; + } + + public function getSymbol() + { + return $this->symbol; + } + + public function setSymbol($symbol) + { + $this->symbol = $symbol; + + return $this; + } + + public function getCode() + { + return $this->code; + } + + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + public function getRate() + { + return $this->rate; + } + + public function setRate($rate) + { + $this->rate = $rate; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CurrencyDeleteEvent.php b/core/lib/Thelia/Core/Event/CurrencyDeleteEvent.php new file mode 100644 index 000000000..5b9714b47 --- /dev/null +++ b/core/lib/Thelia/Core/Event/CurrencyDeleteEvent.php @@ -0,0 +1,48 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Currency; + +class CurrencyDeleteEvent extends CurrencyEvent +{ + protected $currency_id; + + public function __construct($currency_id) + { + $this->setCurrencyId($currency_id); + } + + public function getCurrencyId() + { + return $this->currency_id; + } + + public function setCurrencyId($currency_id) + { + $this->currency_id = $currency_id; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CurrencyEvent.php b/core/lib/Thelia/Core/Event/CurrencyEvent.php new file mode 100644 index 000000000..65ac60513 --- /dev/null +++ b/core/lib/Thelia/Core/Event/CurrencyEvent.php @@ -0,0 +1,51 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Currency; + +class CurrencyEvent extends ActionEvent +{ + protected $currency = null; + + public function __construct(Currency $currency = null) + { + $this->currency = $currency; + } + + public function hasCurrency() { + return ! is_null($this->currency); + } + + public function getCurrency() + { + return $this->currency; + } + + public function setCurrency($currency) + { + $this->currency = $currency; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/CurrencyUpdateEvent.php b/core/lib/Thelia/Core/Event/CurrencyUpdateEvent.php new file mode 100644 index 000000000..044a93baa --- /dev/null +++ b/core/lib/Thelia/Core/Event/CurrencyUpdateEvent.php @@ -0,0 +1,60 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Currency; + +class CurrencyUpdateEvent extends CurrencyCreateEvent +{ + protected $currency_id; + protected $is_default; + + public function __construct($currency_id) + { + $this->setCurrencyId($currency_id); + } + + public function getCurrencyId() + { + return $this->currency_id; + } + + public function setCurrencyId($currency_id) + { + $this->currency_id = $currency_id; + + return $this; + } + + public function getIsDefault() + { + return $this->is_default; + } + + public function setIsDefault($is_default) + { + $this->is_default = $is_default; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/CurrencyUpdatePositionEvent.php b/core/lib/Thelia/Core/Event/CurrencyUpdatePositionEvent.php new file mode 100644 index 000000000..3a3dbb18f --- /dev/null +++ b/core/lib/Thelia/Core/Event/CurrencyUpdatePositionEvent.php @@ -0,0 +1,28 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +class CurrencyUpdatePositionEvent extends BaseUpdatePositionEvent +{ +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php old mode 100644 new mode 100755 index e7cf83b5c..9bee163ae --- a/core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/CustomerCreateOrUpdateEvent.php @@ -13,7 +13,7 @@ namespace Thelia\Core\Event; use Symfony\Component\EventDispatcher\Event; use Thelia\Model\Customer; -class CustomerCreateOrUpdateEvent extends Event { +class CustomerCreateOrUpdateEvent extends ActionEvent { //base parameters for creating new customer protected $title; diff --git a/core/lib/Thelia/Core/Event/Internal/CustomerEvent.php b/core/lib/Thelia/Core/Event/CustomerEvent.php old mode 100644 new mode 100755 similarity index 95% rename from core/lib/Thelia/Core/Event/Internal/CustomerEvent.php rename to core/lib/Thelia/Core/Event/CustomerEvent.php index 46c9278cb..656f023c9 --- a/core/lib/Thelia/Core/Event/Internal/CustomerEvent.php +++ b/core/lib/Thelia/Core/Event/CustomerEvent.php @@ -21,11 +21,12 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event\Internal; +namespace Thelia\Core\Event; use Thelia\Model\Customer; +use Thelia\Core\Event\ActionEvent; -class CustomerEvent extends InternalEvent +class CustomerEvent extends ActionEvent { public $customer; diff --git a/core/lib/Thelia/Core/Event/CustomerLoginEvent.php b/core/lib/Thelia/Core/Event/CustomerLoginEvent.php old mode 100644 new mode 100755 index cc363790d..9a26bba3f --- a/core/lib/Thelia/Core/Event/CustomerLoginEvent.php +++ b/core/lib/Thelia/Core/Event/CustomerLoginEvent.php @@ -26,7 +26,7 @@ namespace Thelia\Core\Event; use Thelia\Model\Customer; -class CustomerLoginEvent { +class CustomerLoginEvent extends ActionEvent { protected $customer; diff --git a/core/lib/Thelia/Core/Event/ImageEvent.php b/core/lib/Thelia/Core/Event/ImageEvent.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Core/Event/MessageCreateEvent.php b/core/lib/Thelia/Core/Event/MessageCreateEvent.php new file mode 100644 index 000000000..0d698168a --- /dev/null +++ b/core/lib/Thelia/Core/Event/MessageCreateEvent.php @@ -0,0 +1,82 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Message; + +class MessageCreateEvent extends MessageEvent +{ + protected $message_name; + protected $locale; + protected $title; + protected $secured; + + // Use message_name to prevent conflict with Event::name property. + public function getMessageName() + { + return $this->message_name; + } + + public function setMessageName($message_name) + { + $this->message_name = $message_name; + + return $this; + } + + public function getLocale() + { + return $this->locale; + } + + public function setLocale($locale) + { + $this->locale = $locale; + + return $this; + } + + public function getTitle() + { + return $this->title; + } + + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + public function getSecured() + { + return $this->secured; + } + + public function setSecured($secured) + { + $this->secured = $secured; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/MessageDeleteEvent.php b/core/lib/Thelia/Core/Event/MessageDeleteEvent.php new file mode 100644 index 000000000..5513c85a9 --- /dev/null +++ b/core/lib/Thelia/Core/Event/MessageDeleteEvent.php @@ -0,0 +1,48 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Message; + +class MessageDeleteEvent extends MessageEvent +{ + protected $message_id; + + public function __construct($message_id) + { + $this->setMessageId($message_id); + } + + public function getMessageId() + { + return $this->message_id; + } + + public function setMessageId($message_id) + { + $this->message_id = $message_id; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/MessageEvent.php b/core/lib/Thelia/Core/Event/MessageEvent.php new file mode 100644 index 000000000..0f46ae590 --- /dev/null +++ b/core/lib/Thelia/Core/Event/MessageEvent.php @@ -0,0 +1,51 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Message; + +class MessageEvent extends ActionEvent +{ + protected $message = null; + + public function __construct(Message $message = null) + { + $this->message = $message; + } + + public function hasMessage() { + return ! is_null($this->message); + } + + public function getMessage() + { + return $this->message; + } + + public function setMessage($message) + { + $this->message = $message; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/MessageUpdateEvent.php b/core/lib/Thelia/Core/Event/MessageUpdateEvent.php new file mode 100644 index 000000000..1b3712266 --- /dev/null +++ b/core/lib/Thelia/Core/Event/MessageUpdateEvent.php @@ -0,0 +1,88 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Message; + +class MessageUpdateEvent extends MessageCreateEvent +{ + protected $message_id; + + protected $text_message; + protected $html_message; + protected $subject; + + public function __construct($message_id) + { + $this->setMessageId($message_id); + } + + public function getMessageId() + { + return $this->message_id; + } + + public function setMessageId($message_id) + { + $this->message_id = $message_id; + + return $this; + } + + public function getTextMessage() + { + return $this->text_message; + } + + public function setTextMessage($text_message) + { + $this->text_message = $text_message; + + return $this; + } + + public function getHtmlMessage() + { + return $this->html_message; + } + + public function setHtmlMessage($html_message) + { + $this->html_message = $html_message; + + return $this; + } + + public function getSubject() + { + return $this->subject; + } + + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 81fc34097..c5ae0afbf 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -33,6 +33,11 @@ namespace Thelia\Core\Event; final class TheliaEvents { + /** + * sent at the beginning + */ + const BOOT = "thelia.boot"; + /** * ACTION event * @@ -64,7 +69,7 @@ final class TheliaEvents /** * sent on customer account update */ - const CUSTOMER_UPDATEACCOUNT = "action.modifyCustomer"; + const CUSTOMER_UPDATEACCOUNT = "action.updateCustomer"; /** * Sent before the logout of the administrator. @@ -88,17 +93,56 @@ final class TheliaEvents /** * Sent once the customer change form has been successfully validated, and before customer update in the database. */ - const BEFORE_CHANGECUSTOMER = "action.before_changecustomer"; + const BEFORE_UPDATECUSTOMER = "action.before_updateCustomer"; /** * Sent just after a successful update of a customer in the database. */ - const AFTER_CHANGECUSTOMER = "action.after_changecustomer"; + const AFTER_UPDATECUSTOMER = "action.after_updateCustomer"; + + // -- ADDRESS MANAGEMENT --------------------------------------------------------- + /** + * sent for address creation + */ + const ADDRESS_CREATE = "action.createAddress"; + + /** + * sent for address creation + */ + const ADDRESS_UPDATE = "action.updateAddress"; + + const BEFORE_CREATEADDRESS = "action.before_createAddress"; + const AFTER_CREATEADDRESS = "action.after_createAddress"; + + const BEFORE_UPDATEADDRESS = "action.before_updateAddress"; + const AFTER_UPDATEADDRESS = "action.after_updateAddress"; + + const BEFORE_DELETEADDRESS = "action.before_deleteAddress"; + const AFTER_DELETEADDRESS = "action.after_deleteAddress"; + + // -- END ADDRESS MANAGEMENT --------------------------------------------------------- /** * Sent once the category creation form has been successfully validated, and before category insertion in the database. */ const BEFORE_CREATECATEGORY = "action.before_createcategory"; + /** + * Create, change or delete a category + */ + const CATEGORY_CREATE = "action.createCategory"; + const CATEGORY_UPDATE = "action.updateCategory"; + const CATEGORY_DELETE = "action.deleteCategory"; + + /** + * Toggle category visibility + */ + const CATEGORY_TOGGLE_VISIBILITY = "action.toggleCategoryVisibility"; + + /** + * Change category position + */ + const CATEGORY_CHANGE_POSITION = "action.updateCategoryPosition"; + /** * Sent just after a successful insert of a new category in the database. */ @@ -113,10 +157,15 @@ final class TheliaEvents */ const AFTER_DELETECATEGORY = "action.after_deletecategory"; + /** + * Sent just before a successful change of a category in the database. + */ + const BEFORE_UPDATECATEGORY = "action.before_updateCategory"; + /** * Sent just after a successful change of a category in the database. */ - const AFTER_CHANGECATEGORY = "action.after_changecategory"; + const AFTER_UPDATECATEGORY = "action.after_updateCategory"; /** * sent when a new existing cat id duplicated. This append when current customer is different from current cart @@ -131,7 +180,7 @@ final class TheliaEvents /** * sent when a cart item is modify */ - const AFTER_CARTCHANGEITEM = "cart.modifyItem"; + const AFTER_CARTUPDATEITEM = "cart.updateItem"; /** * sent for addArticle action @@ -141,7 +190,7 @@ final class TheliaEvents /** * sent on modify article action */ - const CART_CHANGEITEM = "action.changeArticle"; + const CART_UPDATEITEM = "action.updateArticle"; const CART_DELETEITEM = "action.deleteArticle"; @@ -155,4 +204,178 @@ final class TheliaEvents */ const IMAGE_CLEAR_CACHE = "action.clearImageCache"; + + + /** + * Sent when creating a Coupon + */ + const COUPON_CREATE = "action.create_coupon"; + + /** + * Sent just before a successful insert of a new Coupon in the database. + */ + const BEFORE_CREATE_COUPON = "action.before_create_coupon"; + + /** + * Sent just after a successful insert of a new Coupon in the database. + */ + const AFTER_CREATE_COUPON = "action.after_create_coupon"; + + /** + * Sent when editing a Coupon + */ + const COUPON_UPDATE = "action.update_coupon"; + + /** + * Sent just before a successful update of a new Coupon in the database. + */ + const BEFORE_UPDATE_COUPON = "action.before_update_coupon"; + + /** + * Sent just after a successful update of a new Coupon in the database. + */ + const AFTER_UPDATE_COUPON = "action.after_update_coupon"; + + /** + * Sent when disabling a Coupon + */ + const COUPON_DISABLE = "action.disable_coupon"; + + /** + * Sent just before a successful disable of a new Coupon in the database. + */ + const BEFORE_DISABLE_COUPON = "action.before_disable_coupon"; + + /** + * Sent just after a successful disable of a new Coupon in the database. + */ + const AFTER_DISABLE_COUPON = "action.after_disable_coupon"; + + /** + * Sent when enabling a Coupon + */ + const COUPON_ENABLE = "action.enable_coupon"; + + /** + * Sent just before a successful enable of a new Coupon in the database. + */ + const BEFORE_ENABLE_COUPON = "action.before_enable_coupon"; + + /** + * Sent just after a successful enable of a new Coupon in the database. + */ + const AFTER_ENABLE_COUPON = "action.after_enable_coupon"; + + /** + * Sent when attempting to use a Coupon + */ + const COUPON_CONSUME = "action.consume_coupon"; + + /** + * Sent just before an attempt to use a Coupon + */ + const BEFORE_CONSUME_COUPON = "action.before_consume_coupon"; + + /** + * Sent just after an attempt to use a Coupon + */ + const AFTER_CONSUME_COUPON = "action.after_consume_coupon"; + + + /** + * Sent when attempting to create Coupon Rule + */ + const COUPON_RULE_CREATE = "action.create_coupon_rule"; + + /** + * Sent just before an attempt to create a Coupon Rule + */ + const BEFORE_COUPON_RULE_CREATE = "action.before_create_coupon_rule"; + + /** + * Sent just after an attempt to create a Coupon Rule + */ + const AFTER_COUPON_RULE_CREATE = "action.after_create_coupon_rule"; + + /** + * Sent when attempting to update Coupon Rule + */ + const COUPON_RULE_UPDATE = "action.update_coupon_rule"; + + /** + * Sent just before an attempt to update a Coupon Rule + */ + const BEFORE_COUPON_RULE_UPDATE = "action.before_update_coupon_rule"; + + /** + * Sent just after an attempt to update a Coupon Rule + */ + const AFTER_COUPON_RULE_UPDATE = "action.after_update_coupon_rule"; + + /** + * Sent when attempting to delete Coupon Rule + */ + const COUPON_RULE_DELETE = "action.delete_coupon_rule"; + + /** + * Sent just before an attempt to delete a Coupon Rule + */ + const BEFORE_COUPON_RULE_DELETE = "action.before_delete_coupon_rule"; + + /** + * Sent just after an attempt to delete a Coupon Rule + */ + const AFTER_COUPON_RULE_DELETE = "action.after_delete_coupon_rule"; + + + // -- Configuration management --------------------------------------------- + + const CONFIG_CREATE = "action.createConfig"; + const CONFIG_SETVALUE = "action.setConfigValue"; + const CONFIG_UPDATE = "action.updateConfig"; + const CONFIG_DELETE = "action.deleteConfig"; + + const BEFORE_CREATECONFIG = "action.before_createConfig"; + const AFTER_CREATECONFIG = "action.after_createConfig"; + + const BEFORE_UPDATECONFIG = "action.before_updateConfig"; + const AFTER_UPDATECONFIG = "action.after_updateConfig"; + + const BEFORE_DELETECONFIG = "action.before_deleteConfig"; + const AFTER_DELETECONFIG = "action.after_deleteConfig"; + + // -- Messages management --------------------------------------------- + + const MESSAGE_CREATE = "action.createMessage"; + const MESSAGE_UPDATE = "action.updateMessage"; + const MESSAGE_DELETE = "action.deleteMessage"; + + const BEFORE_CREATEMESSAGE = "action.before_createMessage"; + const AFTER_CREATEMESSAGE = "action.after_createMessage"; + + const BEFORE_UPDATEMESSAGE = "action.before_updateMessage"; + const AFTER_UPDATEMESSAGE = "action.after_updateMessage"; + + const BEFORE_DELETEMESSAGE = "action.before_deleteMessage"; + const AFTER_DELETEMESSAGE = "action.after_deleteMessage"; + + // -- Currencies management --------------------------------------------- + + const CURRENCY_CREATE = "action.createCurrency"; + const CURRENCY_UPDATE = "action.updateCurrency"; + const CURRENCY_DELETE = "action.deleteCurrency"; + const CURRENCY_SET_DEFAULT = "action.setDefaultCurrency"; + const CURRENCY_UPDATE_RATES = "action.updateCurrencyRates"; + const CURRENCY_UPDATE_POSITION = "action.updateCurrencyPosition"; + + const BEFORE_CREATECURRENCY = "action.before_createCurrency"; + const AFTER_CREATECURRENCY = "action.after_createCurrency"; + + const BEFORE_UPDATECURRENCY = "action.before_updateCurrency"; + const AFTER_UPDATECURRENCY = "action.after_updateCurrency"; + + const BEFORE_DELETECURRENCY = "action.before_deleteCurrency"; + const AFTER_DELETECURRENCY = "action.after_deleteCurrency"; + + } diff --git a/core/lib/Thelia/Core/EventListener/ControllerListener.php b/core/lib/Thelia/Core/EventListener/ControllerListener.php index 9bb432e6a..097afb189 100755 --- a/core/lib/Thelia/Core/EventListener/ControllerListener.php +++ b/core/lib/Thelia/Core/EventListener/ControllerListener.php @@ -36,6 +36,7 @@ use Thelia\Core\Template\ParserContext; * * Class ControllerListener * @package Thelia\Core\EventListener + * @author Manuel Raynaud */ class ControllerListener implements EventSubscriberInterface { @@ -59,12 +60,7 @@ class ControllerListener implements EventSubscriberInterface $event = new ActionEventFactory($request, $action, $event->getKernel()->getContainer()->getParameter("thelia.actionEvent")); $actionEvent = $event->createActionEvent(); $dispatcher->dispatch("action.".$action, $actionEvent); - - // Process form errors - if ($actionEvent->hasErrorForm()) { - $this->parserContext->setErrorForm($actionEvent->getErrorForm()); - } - } + } } public static function getSubscribedEvents() diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php index 22c31a2e4..3bd3147a4 100755 --- a/core/lib/Thelia/Core/EventListener/ViewListener.php +++ b/core/lib/Thelia/Core/EventListener/ViewListener.php @@ -86,7 +86,7 @@ class ViewListener implements EventSubscriberInterface } catch (AuthenticationException $ex) { // Redirect to the login template - $event->setResponse(Redirect::exec(URL::viewUrl($ex->getLoginTemplate()))); + Redirect::exec($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate())); } } diff --git a/core/lib/Thelia/Core/Factory/ActionEventFactory.php b/core/lib/Thelia/Core/Factory/ActionEventFactory.php index 9ef0644ff..cbbb7caf8 100755 --- a/core/lib/Thelia/Core/Factory/ActionEventFactory.php +++ b/core/lib/Thelia/Core/Factory/ActionEventFactory.php @@ -25,6 +25,14 @@ namespace Thelia\Core\Factory; use Symfony\Component\HttpFoundation\Request; +/** + * * + * try to instanciate the good action class + * + * Class ActionEventFactory + * @package Thelia\Core\Factory + * @author Manuel Raynaud + */ class ActionEventFactory { diff --git a/core/lib/Thelia/Core/HttpFoundation/Request.php b/core/lib/Thelia/Core/HttpFoundation/Request.php index a30806a4b..e86ce8b65 100755 --- a/core/lib/Thelia/Core/HttpFoundation/Request.php +++ b/core/lib/Thelia/Core/HttpFoundation/Request.php @@ -24,6 +24,13 @@ namespace Thelia\Core\HttpFoundation; use Symfony\Component\HttpFoundation\Request as BaseRequest; +/** + * extends Symfony\Component\HttpFoundation\Request for adding some helpers + * + * Class Request + * @package Thelia\Core\HttpFoundation + * @author Manuel Raynaud + */ class Request extends BaseRequest { diff --git a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php index 784258ad3..8c6a241ec 100755 --- a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php +++ b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php @@ -29,60 +29,87 @@ use Thelia\Exception\InvalidCartException; use Thelia\Model\CartQuery; use Thelia\Model\Cart; use Thelia\Tools\URL; +use Thelia\Model\Lang; +/** + * + * extends mfony\Component\HttpFoundation\Session\Session for adding some helpers + * + * Class Session + * @package Thelia\Core\HttpFoundation\Session + * Symfony\Component\HttpFoundation\Request + */ class Session extends BaseSession { - // -- Language ------------------------------------------------------------ - - public function getLocale() - { - return $this->get("locale", "en_US"); - } - + /** + * @return \Thelia\Model\Lang|null + */ public function getLang() { - return substr($this->getLocale(), 0, 2); + return $this->get("thelia.current.lang", Lang::getDefaultLanguage()); + } + + public function setLang(Lang $lang) + { + $this->set("thelia.current.lang", $lang); + + return $this; + } + + public function getAdminEditionLang() + { + return $this->get('thelia.admin.edition.lang', Lang::getDefaultLanguage()); + } + + public function setAdminEditionLang($langId) + { + $this->set('thelia.admin.edition.lang', $langId); + + return $this; } // -- Customer user -------------------------------------------------------- public function setCustomerUser(UserInterface $user) { - $this->set('customer_user', $user); + $this->set('thelia.customer_user', $user); + return $this; } public function getCustomerUser() { - return $this->get('customer_user'); + return $this->get('thelia.customer_user'); } public function clearCustomerUser() { - return $this->remove('customer_user'); + return $this->remove('thelia.customer_user'); } // -- Admin user ----------------------------------------------------------- public function setAdminUser(UserInterface $user) { - $this->set('admin_user', $user); + $this->set('thelia.admin_user', $user); + return $this; } public function getAdminUser() { - return $this->get('admin_user'); + return $this->get('thelia.admin_user'); } public function clearAdminUser() { - return $this->remove('admin_user'); + return $this->remove('thelia.admin_user'); } // -- Return page ---------------------------------------------------------- public function setReturnToUrl($url) { - $this->set('return_to_url', $url); + $this->set('thelia.return_to_url', $url); + return $this; } /** @@ -91,7 +118,7 @@ class Session extends BaseSession */ public function getReturnToUrl() { - return $this->get('return_to_url', URL::getIndexPage()); + return $this->get('thelia.return_to_url', URL::getInstance()->getIndexPage()); } // -- Cart ------------------------------------------------------------------ @@ -103,7 +130,7 @@ class Session extends BaseSession */ public function getCart() { - $cart_id = $this->get("cart_id"); + $cart_id = $this->get("thelia.cart_id"); $cart = null; if ($cart_id) { $cart = CartQuery::create()->findPk($cart_id); @@ -137,10 +164,28 @@ class Session extends BaseSession * assign cart id in session * * @param $cart_id + * @return $this */ public function setCart($cart_id) { - $this->set("cart_id", $cart_id); + $this->set("thelia.cart_id", $cart_id); + return $this; } -} + /** + * assign delivery id in session + * + * @param $delivery_id + * @return $this + */ + public function setDelivery($delivery_id) + { + $this->set("thelia.delivery_id", $delivery_id); + return $this; + } + + public function getDelivery() + { + return $this->get("thelia.delivery_id"); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Routing/RewritingRouter.php b/core/lib/Thelia/Core/Routing/RewritingRouter.php new file mode 100644 index 000000000..79d5dc80b --- /dev/null +++ b/core/lib/Thelia/Core/Routing/RewritingRouter.php @@ -0,0 +1,219 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Routing; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Exception\InvalidParameterException; +use Symfony\Component\Routing\Exception\MethodNotAllowedException; +use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; +use Symfony\Component\Routing\Exception\ResourceNotFoundException; +use Symfony\Component\Routing\Exception\RouteNotFoundException; +use Symfony\Component\Routing\Matcher\RequestMatcherInterface; +use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RouteCollection; +use Symfony\Component\Routing\RouterInterface; +use Thelia\Exception\RedirectException; +use Thelia\Exception\UrlRewritingException; +use Thelia\Model\ConfigQuery; +use Thelia\Tools\Redirect; +use Thelia\Tools\URL; + + +/** + * Class RewritingRouter + * @package Thelia\Core\Routing + * @author Manuel Raynaud + * @author Etienne Roudeix + */ +class RewritingRouter implements RouterInterface, RequestMatcherInterface +{ + + /** + * @var RequestContext The context + */ + protected $context; + + /** + * @var options, don't use for now but mandatory + */ + protected $options; + + /** + * Sets the request context. + * + * @param RequestContext $context The context + * + * @api + */ + public function setContext(RequestContext $context) + { + // TODO: Implement setContext() method. + $this->context = $context; + } + + /** + * Gets the request context. + * + * @return RequestContext The context + * + * @api + */ + public function getContext() + { + // TODO: Implement getContext() method. + return $this->context; + } + + public function setOption($key, $value) + { + //NOTHING TO DO FOR NOW + } + + /** + * Gets the RouteCollection instance associated with this Router. + * + * @return RouteCollection A RouteCollection instance + */ + public function getRouteCollection() + { + return new RouteCollection(); + } + + /** + * Generates a URL or path for a specific route based on the given parameters. + * + * Parameters that reference placeholders in the route pattern will substitute them in the + * path or host. Extra params are added as query string to the URL. + * + * When the passed reference type cannot be generated for the route because it requires a different + * host or scheme than the current one, the method will return a more comprehensive reference + * that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH + * but the route requires the https scheme whereas the current scheme is http, it will instead return an + * ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches + * the route in any case. + * + * If there is no route with the given name, the generator must throw the RouteNotFoundException. + * + * @param string $name The name of the route + * @param mixed $parameters An array of parameters + * @param Boolean|string $referenceType The type of reference to be generated (one of the constants) + * + * @return string The generated URL + * + * @throws RouteNotFoundException If the named route doesn't exist + * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route + * @throws InvalidParameterException When a parameter value for a placeholder is not correct because + * it does not match the requirement + * + * @api + */ + public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) + { + // TODO: Implement generate() method. + } + + /** + * Tries to match a URL path with a set of routes. + * + * If the matcher can not find information, it must throw one of the exceptions documented + * below. + * + * @param string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded) + * + * @return array An array of parameters + * + * @throws ResourceNotFoundException If the resource could not be found + * @throws MethodNotAllowedException If the resource was found but the request method is not allowed + * + * @api + */ + public function match($pathinfo) + { + throw new ResourceNotFoundException("impossible to find route with this method, please use matchRequest method"); + } + + /** + * Tries to match a request with a set of routes. + * + * If the matcher can not find information, it must throw one of the exceptions documented + * below. + * + * @param Request $request The request to match + * + * @throws \Exception|\Thelia\Exception\UrlRewritingException + * @throws \Symfony\Component\Routing\Exception\ResourceNotFoundException + * @throws \Thelia\Exception\RedirectException + * @return array An array of parameters + * + */ + public function matchRequest(Request $request) + { + if(ConfigQuery::isRewritingEnable()) { + try { + $rewrittenUrlData = URL::getInstance()->resolve($request->getPathInfo()); + } catch(UrlRewritingException $e) { + switch($e->getCode()) { + case UrlRewritingException::URL_NOT_FOUND : + throw new ResourceNotFoundException(); + break; + default: + throw $e; + } + } + + /* is the URL redirected ? */ + + if(null !== $rewrittenUrlData->redirectedToUrl) { + $this->redirect($rewrittenUrlData->redirectedToUrl, 301); + } + + /* define GET arguments in request */ + + if(null !== $rewrittenUrlData->view) { + $request->attributes->set('_view', $rewrittenUrlData->view); + if(null !== $rewrittenUrlData->viewId) { + $request->query->set($rewrittenUrlData->view . '_id', $rewrittenUrlData->viewId); + } + } + if(null !== $rewrittenUrlData->locale) { + $request->query->set('locale', $rewrittenUrlData->locale); + } + + foreach($rewrittenUrlData->otherParameters as $parameter => $value) { + $request->query->set($parameter, $value); + } + + return array ( + '_controller' => 'Thelia\\Controller\\Front\\DefaultController::noAction', + '_route' => 'rewrite', + '_rewritten' => true, + ); + } + throw new ResourceNotFoundException(); + } + + protected function redirect($url, $status = 302) + { + Redirect::exec($url, $status); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Core/Security/Authentication/AuthenticatorInterface.php b/core/lib/Thelia/Core/Security/Authentication/AuthenticatorInterface.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php old mode 100644 new mode 100755 index 6dc938d88..d9a223430 --- a/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php +++ b/core/lib/Thelia/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php @@ -55,8 +55,6 @@ class UsernamePasswordFormAuthenticator implements AuthenticatorInterface ); $this->options = array_merge($defaults, $options); - - $this->loginForm->bind($this->request); } /** diff --git a/core/lib/Thelia/Core/Security/Exception/AuthenticationException.php b/core/lib/Thelia/Core/Security/Exception/AuthenticationException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Core/Security/Exception/AuthorizationException.php b/core/lib/Thelia/Core/Security/Exception/AuthorizationException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Core/Security/Exception/UsernameNotFoundException.php b/core/lib/Thelia/Core/Security/Exception/UsernameNotFoundException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Core/Security/Exception/WrongPasswordException.php b/core/lib/Thelia/Core/Security/Exception/WrongPasswordException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Core/Security/SecurityContext.php b/core/lib/Thelia/Core/Security/SecurityContext.php index 9df25de9e..3f60db08f 100755 --- a/core/lib/Thelia/Core/Security/SecurityContext.php +++ b/core/lib/Thelia/Core/Security/SecurityContext.php @@ -33,36 +33,11 @@ use Thelia\Core\HttpFoundation\Request; */ class SecurityContext { - const CONTEXT_FRONT_OFFICE = 'front'; - const CONTEXT_BACK_OFFICE = 'admin'; - private $request; - private $context; public function __construct(Request $request) { $this->request = $request; - - $this->context = null; - } - - public function setContext($context) - { - if ($context !== self::CONTEXT_FRONT_OFFICE && $context !== self::CONTEXT_BACK_OFFICE) { - throw new \InvalidArgumentException(sprintf("Invalid or empty context identifier '%s'", $context)); - } - - $this->context = $context; - - return $this; - } - - public function getContext($exception_if_context_undefined = false) - { - if (null === $this->context && $exception_if_context_undefined === true) - throw new \LogicException("No context defined. Please use setContext() first."); - - return $this->context; } private function getSession() @@ -76,28 +51,67 @@ class SecurityContext } /** - * Gets the currently authenticated user in the current context, or null if none is defined + * Gets the currently authenticated user in the admin, or null if none is defined * * @return UserInterface|null A UserInterface instance or null if no user is available */ - public function getUser() + public function getAdminUser() { - $context = $this->getContext(true); - - if ($context === self::CONTEXT_FRONT_OFFICE) - $user = $this->getSession()->getCustomerUser(); - else if ($context == self::CONTEXT_BACK_OFFICE) - $user = $this->getSession()->getAdminUser(); - else - $user = null; - - return $user; + return $this->getSession()->getAdminUser(); } - final public function isAuthenticated() + /** + * Check if an admin user is logged in. + * + * @return true if an admin user is logged in, false otherwise. + */ + public function hasAdminUser() { - if (null !== $this->getUser()) { - return true; + return $this->getSession()->getAdminUser() !== null; + } + + /** + * Gets the currently authenticated customer, or null if none is defined + * + * @return UserInterface|null A UserInterface instance or null if no user is available + */ + public function getCustomerUser() + { + return $this->getSession()->getCustomerUser(); + } + + /** + * Check if a customer user is logged in. + * + * @return true if a customer is logged in, false otherwise. + */ + public function hasCustomerUser() + { + return $this->getSession()->getCustomerUser() !== null; + } + + /** + * Check if a user has at least one of the required roles + * + * @param UserInterface $user the user + * @param array $roles the roles + * @return boolean true if the user has the required role, false otherwise + */ + final public function hasRequiredRole($user, array $roles) { + + if ($user != null) { + // Check if user's roles matches required roles + $userRoles = $user->getRoles(); + + $roleFound = false; + + foreach ($userRoles as $role) { + if (in_array($role, $roles)) { + $roleFound = true; + + return true; + } + } } return false; @@ -110,85 +124,88 @@ class SecurityContext */ final public function isGranted(array $roles, array $permissions) { - if ($this->isAuthenticated() === true) { + // Find a user which matches the required roles. + $user = $this->getCustomerUser(); - $user = $this->getUser(); + if (! $this->hasRequiredRole($user, $roles)) { + $user = $this->getAdminUser(); - // Check if user's roles matches required roles - $userRoles = $user->getRoles(); + if (! $this->hasRequiredRole($user, $roles)) { + $user = null; + } + } - $roleFound = false; + if ($user != null) { - foreach ($userRoles as $role) { - if (in_array($role, $roles)) { - $roleFound = true; - - break; - } + if (empty($permissions)) { + return true; } - if ($roleFound) { + // Get permissions from profile + // $userPermissions = $user->getPermissions(); FIXME - if (empty($permissions)) { - return true; - } + // TODO: Finalize permissions system !; - // Get permissions from profile - // $userPermissions = $user->getPermissions(); FIXME + $userPermissions = array('*'); // FIXME ! - // TODO: Finalize permissions system !; + $permissionsFound = true; - $userPermissions = array('*'); // FIXME ! + // User have all permissions ? + if (in_array('*', $userPermissions)) + return true; - $permissionsFound = true; + // Check that user's permissions matches required permissions + foreach ($permissions as $permission) { + if (! in_array($permission, $userPermissions)) { + $permissionsFound = false; - // User have all permissions ? - if (in_array('*', $userPermissions)) - return true; - - // Check that user's permissions matches required permissions - foreach ($permissions as $permission) { - if (! in_array($permission, $userPermissions)) { - $permissionsFound = false; - - break; - } - } - - return $permissionsFound; + break; + } } + + return $permissionsFound; } return false; } /** - * Sets the authenticated user. + * Sets the authenticated admin user. * * @param UserInterface $user A UserInterface, or null if no further user should be stored */ - public function setUser(UserInterface $user) + public function setAdminUser(UserInterface $user) { - $context = $this->getContext(true); - $user->eraseCredentials(); - if ($context === self::CONTEXT_FRONT_OFFICE) - $this->getSession()->setCustomerUser($user); - else if ($context == self::CONTEXT_BACK_OFFICE) - $this->getSession()->setAdminUser($user); + $this->getSession()->setAdminUser($user); } /** - * Clear the user from the security context + * Sets the authenticated customer user. + * + * @param UserInterface $user A UserInterface, or null if no further user should be stored */ - public function clear() + public function setCustomerUser(UserInterface $user) { - $context = $this->getContext(true); + $user->eraseCredentials(); - if ($context === self::CONTEXT_FRONT_OFFICE) - $this->getSession()->clearCustomerUser(); - else if ($context == self::CONTEXT_BACK_OFFICE) - $this->getSession()->clearAdminUser(); + $this->getSession()->setCustomerUser($user); } -} + + /** + * Clear the customer from the security context + */ + public function clearCustomerUser() + { + $this->getSession()->clearCustomerUser(); + } + + /** + * Clear the admin from the security context + */ + public function clearAdminUser() + { + $this->getSession()->clearAdminUser(); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Assets/AsseticHelper.php b/core/lib/Thelia/Core/Template/Assets/AsseticHelper.php index c5995e3de..cd7f06ac8 100755 --- a/core/lib/Thelia/Core/Template/Assets/AsseticHelper.php +++ b/core/lib/Thelia/Core/Template/Assets/AsseticHelper.php @@ -43,15 +43,16 @@ class AsseticHelper * Generates assets from $asset_path in $output_path, using $filters. * * @param string $asset_path the full path to the asset file (or file collection) - * @param unknown $output_path the full disk path to the output directory (shoud be visible to web server) - * @param unknown $output_url the URL to the generated asset directory - * @param unknown $asset_type the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension. - * @param unknown $filters a list of filters, as defined below (see switch($filter_name) ...) - * @param unknown $debug true / false + * @param string $output_path the full disk path to the output directory (shoud be visible to web server) + * @param string $output_url the URL to the generated asset directory + * @param string $asset_type the asset type: css, js, ... The generated files will have this extension. Pass an empty string to use the asset source extension. + * @param array $filters a list of filters, as defined below (see switch($filter_name) ...) + * @param boolean $debug true / false + * @param boolean $dev_mode true / false. If true, assets are not cached and always compiled. * @throws \InvalidArgumentException if an invalid filter name is found * @return string The URL to the generated asset file. */ - public function asseticize($asset_path, $output_path, $output_url, $asset_type, $filters, $debug) + public function asseticize($asset_path, $output_path, $output_url, $asset_type, $filters, $debug, $dev_mode = false) { $asset_name = basename($asset_path); $asset_dir = dirname($asset_path); @@ -106,17 +107,49 @@ class AsseticHelper $factory->setDebug($debug); - $factory->addWorker(new CacheBustingWorker()); + $factory->addWorker(new CacheBustingWorker('-')); - // Prepare the assets writer - $writer = new AssetWriter($output_path); + // We do not pass the filter list here, juste to get the asset file name + $asset = $factory->createAsset($asset_name); - $asset = $factory->createAsset($asset_name, $filter_list); + $asset_target_path = $asset->getTargetPath(); - $cache = new AssetCache($asset, new FilesystemCache($output_path)); + $target_file = sprintf("%s/%s", $output_path, $asset_target_path); - $writer->writeAsset($cache); + // As it seems that assetic cannot handle a real file cache, let's do the job ourselves. + // It works only if the CacheBustingWorker is used, as a new file name is generated for each version. + // + // the previous version of the file is deleted, by getting the first part of the ouput file name + // (the one before '-'), and delete aby file beginning with the same string. Example: + // old name: 3bc974a-dfacc1f.css + // new name: 3bc974a-ad3ef47.css + // + // before generating 3bc974a-ad3ef47.css, delete 3bc974a-* files. + // + if ($dev_mode == true || ! file_exists($target_file)) { - return rtrim($output_url, '/').'/'.$asset->getTargetPath(); + // Delete previous version of the file + list($commonPart, $dummy) = explode('-', $asset_target_path); + + foreach (glob("$output_path/$commonPart-*") as $filename) { + @unlink($filename); + } + + // Apply filters now + foreach ($filter_list as $filter) { + if ('?' != $filter[0]) { + $asset->ensureFilter($fm->get($filter)); + } + elseif (!$debug) { + $asset->ensureFilter($fm->get(substr($filter, 1))); + } + } + + $writer = new AssetWriter($output_path); + + $writer->writeAsset($asset); + } + + return rtrim($output_url, '/').'/'.$asset_target_path; } } diff --git a/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php b/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php new file mode 100644 index 000000000..18eadce3c --- /dev/null +++ b/core/lib/Thelia/Core/Template/Element/BaseI18nLoop.php @@ -0,0 +1,79 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Element; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Thelia\Core\Template\Loop\Argument\Argument; +use Propel\Runtime\ActiveQuery\ModelCriteria; +use Thelia\Core\Security\SecurityContext; +use Thelia\Model\Tools\ModelCriteriaTools; + +/** + * + * Class BaseI18nLoop, imlplemented by loops providing internationalized data, such as title, description, etc. + * + * @package Thelia\Core\Template\Element + */ +abstract class BaseI18nLoop extends BaseLoop +{ + /** + * Define common loop arguments + * + * @return Argument[] + */ + protected function getDefaultArgs() + { + $args = parent::getDefaultArgs(); + + $args[] = Argument::createIntTypeArgument('lang'); + + return $args; + } + + /** + * Setup ModelCriteria for proper i18n processing + * + * @param ModelCriteria $search the Propel Criteria to configure + * @param array $columns the i18n columns + * @param string $foreignTable the specified table (default to criteria table) + * @param string $foreignKey the foreign key in this table (default to criteria table) + * + * @return mixed the locale + */ + protected function configureI18nProcessing(ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID', $forceReturn = false) { + + /* manage translations */ + return ModelCriteriaTools::getI18n( + $this->getBackend_context(), + $this->getLang(), + $search, + $this->request->getSession()->getLang()->getLocale(), + $columns, + $foreignTable, + $foreignKey, + $forceReturn + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php index b5ee03955..d74f9894b 100755 --- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php +++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php @@ -28,6 +28,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Thelia\Core\Template\Loop\Argument\Argument; use Propel\Runtime\ActiveQuery\ModelCriteria; use Thelia\Core\Security\SecurityContext; +use Thelia\Model\Tools\ModelCriteriaTools; /** * @@ -53,6 +54,10 @@ abstract class BaseLoop protected $args; + public $countable = true; + public $timestampable = false; + public $versionable = false; + /** * Create a new Loop * @@ -80,6 +85,7 @@ abstract class BaseLoop Argument::createIntTypeArgument('offset', 0), Argument::createIntTypeArgument('page'), Argument::createIntTypeArgument('limit', PHP_INT_MAX), + Argument::createBooleanTypeArgument('backend_context', false), ); } @@ -136,7 +142,7 @@ abstract class BaseLoop } elseif ($value !== null && !$argument->type->isValid($value)) { /* check type */ $faultActor[] = $argument->name; - $faultDetails[] = sprintf('Invalid value for "%s" argument in loop type: %s, name: %s', $argument->name, $loopType, $loopName); + $faultDetails[] = sprintf('Invalid value "%s" for "%s" argument in loop type: %s, name: %s', $value, $argument->name, $loopType, $loopName); } else { /* set default */ /* did it as last checking for we consider default value is acceptable no matter type or empty restriction */ @@ -187,8 +193,8 @@ abstract class BaseLoop } /** - * @param \ModelCriteria $search - * @param null $pagination + * @param ModelCriteria $search + * @param null $pagination * * @return array|mixed|\PropelModelPager|\PropelObjectCollection */ @@ -202,7 +208,7 @@ abstract class BaseLoop } /** - * @param \ModelCriteria $search + * @param ModelCriteria $search * * @return array|mixed|\PropelObjectCollection */ @@ -217,10 +223,10 @@ abstract class BaseLoop } /** - * @param \ModelCriteria $search - * @param $pagination + * @param ModelCriteria $search + * @param $pagination * - * @return array|\PropelModelPager + * @return array|\Propel\Runtime\Util\PropelModelPager */ protected function searchWithPagination(ModelCriteria $search, &$pagination) { @@ -237,23 +243,9 @@ abstract class BaseLoop * * this function have to be implement in your own loop class. * - * All your parameters are defined in defineArgs() and can be accessible like a class property. + * All loops parameters can be accessible via getter. * - * example : - * - * public function defineArgs() - * { - * return array ( - * "ref", - * "id" => "optional", - * "stock" => array( - * "optional", - * "default" => 10 - * ) - * ); - * } - * - * you can retrieve ref value using $this->ref + * for example, ref parameter is accessible through getRef method * * @param $pagination * @@ -265,18 +257,31 @@ abstract class BaseLoop * * define all args used in your loop * - * array key is your arg name. * * example : * - * return array ( - * "ref", - * "id" => "optional", - * "stock" => array( - * "optional", - * "default" => 10 - * ) - * ); + * 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 */ diff --git a/core/lib/Thelia/Core/Template/Element/LoopResult.php b/core/lib/Thelia/Core/Template/Element/LoopResult.php index c3a97983f..169fdb4f7 100755 --- a/core/lib/Thelia/Core/Template/Element/LoopResult.php +++ b/core/lib/Thelia/Core/Template/Element/LoopResult.php @@ -23,6 +23,8 @@ namespace Thelia\Core\Template\Element; +use Propel\Runtime\Collection\ObjectCollection; +use Propel\Runtime\Util\PropelModelPager; use Thelia\Core\Template\Element\LoopResultRow; class LoopResult implements \Iterator @@ -30,9 +32,14 @@ class LoopResult implements \Iterator private $position; protected $collection = array(); - public function __construct() + public $modelCollection = null; + + public function __construct($modelCollection = null) { $this->position = 0; + if($modelCollection instanceof ObjectCollection || $modelCollection instanceof PropelModelPager) { + $this->modelCollection = $modelCollection; + } } public function isEmpty() diff --git a/core/lib/Thelia/Core/Template/Element/LoopResultRow.php b/core/lib/Thelia/Core/Template/Element/LoopResultRow.php index 8485bd78c..cfea52d8f 100755 --- a/core/lib/Thelia/Core/Template/Element/LoopResultRow.php +++ b/core/lib/Thelia/Core/Template/Element/LoopResultRow.php @@ -23,10 +23,37 @@ namespace Thelia\Core\Template\Element; +use Propel\Runtime\ActiveRecord\ActiveRecordInterface; + class LoopResultRow { protected $substitution = array(); + public $model = null; + public $loopResult; + + public $versionable = false; + public $timestampable = false; + public $countable = false; + + public function __construct($loopResult = null, $model = null, $versionable = false, $timestampable = false, $countable = true) + { + if($model instanceof ActiveRecordInterface) { + $this->model = $model; + + $this->versionable = $versionable; + $this->timestampable = $timestampable; + } + + if($loopResult instanceof LoopResult) { + $this->loopResult = $loopResult; + + $this->countable = $countable; + } + + $this->assignDefaultOutputs(); + } + public function set($key, $value) { $this->substitution[$key] = $value === null ? '' : $value; @@ -49,4 +76,38 @@ class LoopResultRow return array_keys($this->substitution); } + protected function getTimestampOutputs() + { + return array( + array('CREATE_DATE', 'getCreatedAt'), + array('UPDATE_DATE', 'getUpdatedAt'), + ); + } + + protected function getVersionOutputs() + { + return array( + array('VERSION', 'getVersion'), + array('VERSION_DATE', 'getVersionCreatedAt'), + array('VERSION_AUTHOR', 'getVersionCreatedBy'), + ); + } + + protected function assignDefaultOutputs() + { + if(true === $this->versionable) { + foreach($this->getVersionOutputs() as $output) { + $this->set($output[0], $this->model->$output[1]()); + } + } + if(true === $this->timestampable) { + foreach($this->getTimestampOutputs() as $output) { + $this->set($output[0], $this->model->$output[1]()); + } + } + if(true === $this->countable) { + $this->set('LOOP_COUNT', 1 + $this->loopResult->getCount()); + $this->set('LOOP_TOTAL', $this->loopResult->modelCollection->count()); + } + } } diff --git a/core/lib/Thelia/Core/Template/Loop/Address.php b/core/lib/Thelia/Core/Template/Loop/Address.php index eb837eb4b..3ac9370f8 100755 --- a/core/lib/Thelia/Core/Template/Loop/Address.php +++ b/core/lib/Thelia/Core/Template/Loop/Address.php @@ -24,6 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; +use Propel\Runtime\Collection\ObjectCollection; use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -46,6 +47,8 @@ use Thelia\Type; */ class Address extends BaseLoop { + public $timestampable = true; + /** * @return ArgumentCollection */ @@ -61,7 +64,7 @@ class Address extends BaseLoop ), 'current' ), - Argument::createBooleanTypeArgument('default'), + Argument::createBooleanTypeArgument('default', false), Argument::createIntListTypeArgument('exclude') ); } @@ -84,7 +87,7 @@ class Address extends BaseLoop $customer = $this->getCustomer(); if ($customer === 'current') { - $currentCustomer = $this->request->getSession()->getCustomerUser(); + $currentCustomer = $this->securityContext->getCustomerUser(); if ($currentCustomer === null) { return new LoopResult(); } else { @@ -96,10 +99,9 @@ class Address extends BaseLoop $default = $this->getDefault(); + if ($default === true) { $search->filterByIsDefault(1, Criteria::EQUAL); - } elseif ($default === false) { - $search->filterByIsDefault(1, Criteria::NOT_EQUAL); } $exclude = $this->getExclude(); @@ -110,26 +112,28 @@ class Address extends BaseLoop $addresses = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($addresses); foreach ($addresses as $address) { - $loopResultRow = new LoopResultRow(); - $loopResultRow->set("ID", $address->getId()); - $loopResultRow->set("NAME", $address->getName()); - $loopResultRow->set("CUSTOMER", $address->getCustomerId()); - $loopResultRow->set("TITLE", $address->getTitleId()); - $loopResultRow->set("COMPANY", $address->getCompany()); - $loopResultRow->set("FIRSTNAME", $address->getFirstname()); - $loopResultRow->set("LASTNAME", $address->getLastname()); - $loopResultRow->set("ADDRESS1", $address->getAddress1()); - $loopResultRow->set("ADDRESS2", $address->getAddress2()); - $loopResultRow->set("ADDRESS3", $address->getAddress3()); - $loopResultRow->set("ZIPCODE", $address->getZipcode()); - $loopResultRow->set("CITY", $address->getCity()); - $loopResultRow->set("COUNTRY", $address->getCountryId()); - $loopResultRow->set("PHONE", $address->getPhone()); - $loopResultRow->set("CELLPHONE", $address->getCellphone()); - $loopResultRow->set("DEFAULT", $address->getIsDefault()); + $loopResultRow = new LoopResultRow($loopResult, $address, $this->versionable, $this->timestampable, $this->countable); + $loopResultRow + ->set("ID", $address->getId()) + ->set("LABEL", $address->getLabel()) + ->set("CUSTOMER", $address->getCustomerId()) + ->set("TITLE", $address->getTitleId()) + ->set("COMPANY", $address->getCompany()) + ->set("FIRSTNAME", $address->getFirstname()) + ->set("LASTNAME", $address->getLastname()) + ->set("ADDRESS1", $address->getAddress1()) + ->set("ADDRESS2", $address->getAddress2()) + ->set("ADDRESS3", $address->getAddress3()) + ->set("ZIPCODE", $address->getZipcode()) + ->set("CITY", $address->getCity()) + ->set("COUNTRY", $address->getCountryId()) + ->set("PHONE", $address->getPhone()) + ->set("CELLPHONE", $address->getCellphone()) + ->set("DEFAULT", $address->getIsDefault()) + ; $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php b/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php new file mode 100755 index 000000000..5c73d0602 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php @@ -0,0 +1,128 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; + +use Thelia\Core\Template\Loop\Content; + +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Core\Template\Element\LoopResult; + +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Core\Template\Loop\Argument\Argument; + +use Thelia\Model\ProductAssociatedContentQuery; +use Thelia\Model\CategoryAssociatedContentQuery; +use Thelia\Type; + +/** + * + * AssociatedContent loop + * + * + * Class AssociatedContent + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix + */ +class AssociatedContent extends Content +{ + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + $argumentCollection = parent::getArgDefinitions(); + + $argumentCollection->addArgument(Argument::createIntTypeArgument('product')) + ->addArgument(Argument::createIntTypeArgument('category')); + + $argumentCollection->get('order')->default = "associated_content"; + + $argumentCollection->get('order')->type->getKey(0)->addValue('associated_content'); + $argumentCollection->get('order')->type->getKey(0)->addValue('associated_content_reverse'); + + return $argumentCollection; + } + + /** + * @param $pagination + * + * @return LoopResult + * @throws \InvalidArgumentException + */ + public function exec(&$pagination) + { + // + + $product = $this->getProduct(); + $category = $this->getCategory(); + + if($product === null && $category === null) { + throw new \InvalidArgumentException('You have to provide either `product` or `category` argument in associated_content loop'); + } + + if($product !== null) { + $search = ProductAssociatedContentQuery::create(); + + $search->filterByProductId($product, Criteria::EQUAL); + } elseif($category !== null) { + $search = CategoryAssociatedContentQuery::create(); + + $search->filterByCategoryId($category, Criteria::EQUAL); + } + + $order = $this->getOrder(); + $orderByAssociatedContent = array_search('associated_content', $order); + $orderByAssociatedContentReverse = array_search('associated_content_reverse', $order); + + if ($orderByAssociatedContent !== false) { + $search->orderByPosition(Criteria::ASC); + $order[$orderByAssociatedContent] = 'given_id'; + $this->args->get('order')->setValue( implode(',', $order) ); + } + if ($orderByAssociatedContentReverse !== false) { + $search->orderByPosition(Criteria::DESC); + $order[$orderByAssociatedContentReverse] = 'given_id'; + $this->args->get('order')->setValue( implode(',', $order) ); + } + + $associatedContents = $this->search($search); + + $associatedContentIdList = array(0); + foreach ($associatedContents as $associatedContent) { + array_push($associatedContentIdList, $associatedContent->getContentId()); + } + + $receivedIdList = $this->getId(); + + /* if an Id list is receive, loop will only match accessories from this list */ + if ($receivedIdList === null) { + $this->args->get('id')->setValue( implode(',', $associatedContentIdList) ); + } else { + $this->args->get('id')->setValue( implode(',', array_intersect($receivedIdList, $associatedContentIdList)) ); + } + + return parent::exec($pagination); + } + +} diff --git a/core/lib/Thelia/Core/Template/Loop/Attribute.php b/core/lib/Thelia/Core/Template/Loop/Attribute.php new file mode 100755 index 000000000..ecdc551d2 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Attribute.php @@ -0,0 +1,173 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; + +use Propel\Runtime\ActiveQuery\Criteria; +use Propel\Runtime\ActiveQuery\Join; +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\Log\Tlog; + +use Thelia\Model\Base\LangQuery; + +use Thelia\Model\Base\CategoryQuery; +use Thelia\Model\Base\ProductCategoryQuery; +use Thelia\Model\Base\AttributeQuery; +use Thelia\Model\ConfigQuery; +use Thelia\Model\Map\ProductCategoryTableMap; +use Thelia\Type\TypeCollection; +use Thelia\Type; +use Thelia\Type\BooleanOrBothType; + +/** + * + * Attribute loop + * + * + * Class Attribute + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix + */ +class Attribute extends BaseI18nLoop +{ + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntListTypeArgument('id'), + Argument::createIntListTypeArgument('product'), + Argument::createIntListTypeArgument('category'), + Argument::createBooleanOrBothTypeArgument('visible', 1), + Argument::createIntListTypeArgument('exclude'), + new Argument( + 'order', + new TypeCollection( + new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse')) + ), + 'manual' + ) + ); + } + + /** + * @param $pagination + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $search = AttributeQuery::create(); + + $backendContext = $this->getBackend_context(); + + $lang = $this->getLang(); + + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + + $id = $this->getId(); + + if (null !== $id) { + $search->filterById($id, Criteria::IN); + } + + $exclude = $this->getExclude(); + + if (null !== $exclude) { + $search->filterById($exclude, Criteria::NOT_IN); + } + + $visible = $this->getVisible(); + + if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible); + + $product = $this->getProduct(); + $category = $this->getCategory(); + + if(null !== $product) { + $productCategories = ProductCategoryQuery::create()->select(array(ProductCategoryTableMap::CATEGORY_ID))->filterByProductId($product, Criteria::IN)->find()->getData(); + + if(null === $category) { + $category = $productCategories; + } else { + $category = array_merge($category, $productCategories); + } + } + + if(null !== $category) { + $search->filterByCategory( + CategoryQuery::create()->filterById($category)->find(), + Criteria::IN + ); + } + + $orders = $this->getOrder(); + + foreach($orders as $order) { + switch ($order) { + case "alpha": + $search->addAscendingOrderByColumn('i18n_TITLE'); + break; + case "alpha_reverse": + $search->addDescendingOrderByColumn('i18n_TITLE'); + break; + case "manual": + $search->orderByPosition(Criteria::ASC); + break; + case "manual_reverse": + $search->orderByPosition(Criteria::DESC); + break; + } + } + + /* perform search */ + $attributes = $this->search($search, $pagination); + + $loopResult = new LoopResult($attributes); + + foreach ($attributes as $attribute) { + $loopResultRow = new LoopResultRow($loopResult, $attribute, $this->versionable, $this->timestampable, $this->countable); + $loopResultRow->set("ID", $attribute->getId()) + ->set("IS_TRANSLATED",$attribute->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("TITLE",$attribute->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $attribute->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $attribute->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $attribute->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("POSITION", $attribute->getPosition()); + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php b/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php new file mode 100755 index 000000000..ca4618f53 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/AttributeAvailability.php @@ -0,0 +1,142 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; + +use Propel\Runtime\ActiveQuery\Criteria; +use Propel\Runtime\ActiveQuery\Join; +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\Log\Tlog; + +use Thelia\Model\Base\AttributeAvQuery; +use Thelia\Model\ConfigQuery; +use Thelia\Type\TypeCollection; +use Thelia\Type; + +/** + * AttributeAvailability loop + * + * + * Class AttributeAvailability + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix + */ +class AttributeAvailability extends BaseI18nLoop +{ + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntListTypeArgument('id'), + Argument::createIntListTypeArgument('attribute'), + Argument::createIntListTypeArgument('exclude'), + new Argument( + 'order', + new TypeCollection( + new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse')) + ), + 'manual' + ) + ); + } + + /** + * @param $pagination + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $search = AttributeAvQuery::create(); + + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + + $id = $this->getId(); + + if (null !== $id) { + $search->filterById($id, Criteria::IN); + } + + $exclude = $this->getExclude(); + + if (null !== $exclude) { + $search->filterById($exclude, Criteria::NOT_IN); + } + + $attribute = $this->getAttribute(); + + if(null !== $attribute) { + $search->filterByAttributeId($attribute, Criteria::IN); + } + + $orders = $this->getOrder(); + + foreach($orders as $order) { + switch ($order) { + case "alpha": + $search->addAscendingOrderByColumn('i18n_TITLE'); + break; + case "alpha_reverse": + $search->addDescendingOrderByColumn('i18n_TITLE'); + break; + case "manual": + $search->orderByPosition(Criteria::ASC); + break; + case "manual_reverse": + $search->orderByPosition(Criteria::DESC); + break; + } + } + + /* perform search */ + $attributesAv = $this->search($search, $pagination); + + $loopResult = new LoopResult($attributesAv); + + foreach ($attributesAv as $attributeAv) { + $loopResultRow = new LoopResultRow($loopResult, $attributeAv, $this->versionable, $this->timestampable, $this->countable); + $loopResultRow->set("ID", $attributeAv->getId()) + ->set("IS_TRANSLATED",$attributeAv->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("TITLE",$attributeAv->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $attributeAv->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $attributeAv->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $attributeAv->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("POSITION", $attributeAv->getPosition()); + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php b/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php new file mode 100755 index 000000000..78cf33e21 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/AttributeCombination.php @@ -0,0 +1,137 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; + +use Propel\Runtime\ActiveQuery\Criteria; +use Propel\Runtime\ActiveQuery\Join; +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\Log\Tlog; + +use Thelia\Model\Base\AttributeCombinationQuery; +use Thelia\Model\Map\AttributeAvTableMap; +use Thelia\Model\Map\AttributeTableMap; +use Thelia\Model\ConfigQuery; +use Thelia\Type\TypeCollection; +use Thelia\Type; + +/** + * + * Attribute Combination loop + * + * Class AttributeCombination + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix + */ +class AttributeCombination extends BaseI18nLoop +{ + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('product_sale_elements', 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 = AttributeCombinationQuery::create(); + + /* manage attribute translations */ + $locale = $this->configureI18nProcessing( + $search, + array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), + AttributeTableMap::TABLE_NAME, + 'ATTRIBUTE_ID' + ); + + /* manage attributeAv translations */ + $locale = $this->configureI18nProcessing( + $search, + array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), + AttributeAvTableMap::TABLE_NAME, + 'ATTRIBUTE_AV_ID' + ); + + $productSaleElements = $this->getProduct_sale_elements(); + + $search->filterByProductSaleElementsId($productSaleElements, Criteria::EQUAL); + + $orders = $this->getOrder(); + + foreach($orders as $order) { + switch ($order) { + case "alpha": + $search->addAscendingOrderByColumn(AttributeTableMap::TABLE_NAME . '_i18n_TITLE'); + break; + case "alpha_reverse": + $search->addDescendingOrderByColumn(AttributeTableMap::TABLE_NAME . '_i18n_TITLE'); + 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->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_TITLE')) + ->set("ATTRIBUTE_CHAPO", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_CHAPO')) + ->set("ATTRIBUTE_DESCRIPTION", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_DESCRIPTION')) + ->set("ATTRIBUTE_POSTSCRIPTUM", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM')) + ->set("ATTRIBUTE_AVAILABILITY_TITLE", $attributeCombination->getVirtualColumn(AttributeAvTableMap::TABLE_NAME . '_i18n_TITLE')) + ->set("ATTRIBUTE_AVAILABILITY_CHAPO", $attributeCombination->getVirtualColumn(AttributeAvTableMap::TABLE_NAME . '_i18n_CHAPO')) + ->set("ATTRIBUTE_AVAILABILITY_DESCRIPTION", $attributeCombination->getVirtualColumn(AttributeAvTableMap::TABLE_NAME . '_i18n_DESCRIPTION')) + ->set("ATTRIBUTE_AVAILABILITY_POSTSCRIPTUM", $attributeCombination->getVirtualColumn(AttributeAvTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM')); + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Auth.php b/core/lib/Thelia/Core/Template/Loop/Auth.php index b645a0f95..ff9f3cfd3 100755 --- a/core/lib/Thelia/Core/Template/Loop/Auth.php +++ b/core/lib/Thelia/Core/Template/Loop/Auth.php @@ -68,15 +68,12 @@ class Auth extends BaseLoop */ public function exec(&$pagination) { - $context = $this->getContext(); $roles = $this->_explode($this->getRoles()); $permissions = $this->_explode($this->getPermissions()); $loopResult = new LoopResult(); try { - $this->securityContext->setContext($context); - if (true === $this->securityContext->isGranted($roles, $permissions == null ? array() : $permissions)) { // Create an empty row: loop is no longer empty :) diff --git a/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php b/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php new file mode 100644 index 000000000..3b4e54be6 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php @@ -0,0 +1,109 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Core\Template\Element\BaseI18nLoop; +use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Model\ModuleQuery; + + +/** + * Class Delivery + * @package Thelia\Core\Template\Loop + * @author Manuel Raynaud + */ +class BaseSpecificModule extends BaseI18nLoop { + public $timestampable = true; + + /** + * + * 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('id'), + Argument::createIntListTypeArgument('exclude') + ); + } + + /** + * + * this function have to be implement in your own loop class. + * + * All loops parameters can be accesible via getter. + * + * for example, ref parameter is accessible through getRef method + * + * @param $pagination + * + * @return \Thelia\Model\ModuleQuery + */ + public function exec(&$pagination) + { + $search = ModuleQuery::create(); + + if(null !== $id = $this->getId()) + { + $search->filterById($id); + } + + + if (null !== $exclude = $this->getExclude()) { + $search->filterById($exclude, Criteria::NOT_IN); + } + + return $search; + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Cart.php b/core/lib/Thelia/Core/Template/Loop/Cart.php old mode 100644 new mode 100755 index 27f295ed1..8e4d78683 --- a/core/lib/Thelia/Core/Template/Loop/Cart.php +++ b/core/lib/Thelia/Core/Template/Loop/Cart.php @@ -71,20 +71,22 @@ class Cart extends BaseLoop */ public function exec(&$pagination) { - $result = new LoopResult(); + + + $cart = $this->getCart($this->request); + $cartItems = $cart->getCartItems(); + $result = new LoopResult($cartItems); if ($cart === null) { return $result; } - $cartItems = $cart->getCartItems(); - foreach ($cartItems as $cartItem) { $product = $cartItem->getProduct(); //$product->setLocale($this->request->getSession()->getLocale()); - $loopResultRow = new LoopResultRow(); + $loopResultRow = new LoopResultRow($result, $cartItem, $this->versionable, $this->timestampable, $this->countable); $loopResultRow->set("ITEM_ID", $cartItem->getId()); $loopResultRow->set("TITLE", $product->getTitle()); diff --git a/core/lib/Thelia/Core/Template/Loop/Category.php b/core/lib/Thelia/Core/Template/Loop/Category.php index 4cde51824..68ae33507 100755 --- a/core/lib/Thelia/Core/Template/Loop/Category.php +++ b/core/lib/Thelia/Core/Template/Loop/Category.php @@ -24,12 +24,13 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Log\Tlog; use Thelia\Model\CategoryQuery; use Thelia\Model\ConfigQuery; @@ -46,7 +47,7 @@ use Thelia\Type\BooleanOrBothType; * - current : current id is used if you are on a category page * - not_empty : if value is 1, category and subcategories must have at least 1 product * - visible : default 1, if you want category not visible put 0 - * - order : all value available : 'alpha', 'alpha-reverse', 'manual' (default), 'manual-reverse', 'random' + * - order : all value available : 'alpha', 'alpha_reverse', 'manual' (default), 'manual_reverse', 'random' * - exclude : all category id you want to exclude (as for id, an integer or a "string list" can be used) * * example : @@ -61,8 +62,11 @@ use Thelia\Type\BooleanOrBothType; * @author Manuel Raynaud * @author Etienne Roudeix */ -class Category extends BaseLoop +class Category extends BaseI18nLoop { + public $timestampable = true; + public $versionable = true; + /** * @return ArgumentCollection */ @@ -77,7 +81,7 @@ class Category extends BaseLoop new Argument( 'order', new TypeCollection( - new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual-reverse', 'random')) + new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'random')) ), 'manual' ), @@ -94,7 +98,10 @@ class Category extends BaseLoop { $search = CategoryQuery::create(); - $id = $this->getId(); + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + + $id = $this->getId(); if (!is_null($id)) { $search->filterById($id, Criteria::IN); @@ -106,7 +113,8 @@ class Category extends BaseLoop $search->filterByParent($parent); } - $current = $this->getCurrent(); + + $current = $this->getCurrent(); if ($current === true) { $search->filterById($this->request->get("category_id")); @@ -114,6 +122,7 @@ class Category extends BaseLoop $search->filterById($this->request->get("category_id"), Criteria::NOT_IN); } + $exclude = $this->getExclude(); if (!is_null($exclude)) { @@ -121,24 +130,30 @@ class Category extends BaseLoop } if ($this->getVisible() != BooleanOrBothType::ANY) - $search->filterByVisible($this->getVisible() ? 1 : 0); + $search->filterByVisible($this->getVisible() ? 1 : 0); $orders = $this->getOrder(); - foreach ($orders as $order) { + foreach($orders as $order) { switch ($order) { case "alpha": - $search->addAscendingOrderByColumn(\Thelia\Model\Map\CategoryI18nTableMap::TITLE); + $search->addAscendingOrderByColumn('i18n_TITLE'); break; - case "alpha-reverse": - $search->addDescendingOrderByColumn(\Thelia\Model\Map\CategoryI18nTableMap::TITLE); + case "alpha_reverse": + $search->addDescendingOrderByColumn('i18n_TITLE'); break; - case "manual-reverse": + case "manual_reverse": $search->orderByPosition(Criteria::DESC); break; case "manual": $search->orderByPosition(Criteria::ASC); break; + case "visible": + $search->orderByVisible(Criteria::ASC); + break; + case "visible_reverse": + $search->orderByVisible(Criteria::DESC); + break; case "random": $search->clearOrderByColumns(); $search->addAscendingOrderByColumn('RAND()'); @@ -147,51 +162,40 @@ class Category extends BaseLoop } } - /** - * \Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation. - * - * @todo : verify here if we want results for row without translations. - */ - - $search->joinWithI18n( - $this->request->getSession()->getLocale(), - (ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN - ); - + /* perform search */ $categories = $this->search($search, $pagination); + /* @todo */ $notEmpty = $this->getNot_empty(); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($categories); foreach ($categories as $category) { + /* + * no cause pagination lost : + * if ($this->getNotEmpty() && $category->countAllProducts() == 0) continue; + */ - if ($this->getNotEmpty() && $category->countAllProducts() == 0) continue; - - $loopResultRow = new LoopResultRow(); + $loopResultRow = new LoopResultRow($loopResult, $category, $this->versionable, $this->timestampable, $this->countable); $loopResultRow - ->set("ID", $category->getId()) - ->set("TITLE",$category->getTitle()) - ->set("CHAPO", $category->getChapo()) - ->set("DESCRIPTION", $category->getDescription()) - ->set("POSTSCRIPTUM", $category->getPostscriptum()) - ->set("PARENT", $category->getParent()) - ->set("URL", $category->getUrl()) - ->set("PRODUCT_COUNT", $category->countChild()) - ->set("VISIBLE", $category->getVisible() ? "1" : "0") - ->set("POSITION", $category->getPosition()) - - ->set("CREATE_DATE", $category->getCreatedAt()) - ->set("UPDATE_DATE", $category->getUpdatedAt()) - ->set("VERSION", $category->getVersion()) - ->set("VERSION_DATE", $category->getVersionCreatedAt()) - ->set("VERSION_AUTHOR", $category->getVersionCreatedBy()) - ; + ->set("ID", $category->getId()) + ->set("IS_TRANSLATED",$category->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("TITLE", $category->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $category->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $category->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $category->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("PARENT", $category->getParent()) + ->set("URL", $category->getUrl($locale)) + ->set("PRODUCT_COUNT", $category->countChild()) + ->set("VISIBLE", $category->getVisible() ? "1" : "0") + ->set("POSITION", $category->getPosition()) + ; $loopResult->addRow($loopResultRow); } return $loopResult; } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/CategoryPath.php b/core/lib/Thelia/Core/Template/Loop/CategoryPath.php old mode 100644 new mode 100755 index d6c0cd02c..0582ad3ee --- a/core/lib/Thelia/Core/Template/Loop/CategoryPath.php +++ b/core/lib/Thelia/Core/Template/Loop/CategoryPath.php @@ -23,7 +23,7 @@ namespace Thelia\Core\Template\Loop; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -54,7 +54,7 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Franck Allimant */ -class CategoryPath extends BaseLoop +class CategoryPath extends BaseI18nLoop { /** * @return ArgumentCollection @@ -80,6 +80,9 @@ class CategoryPath extends BaseLoop $visible = $this->getVisible(); $search = CategoryQuery::create(); + + $locale = $this->configureI18nProcessing($search, array('TITLE')); + $search->filterById($id); if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible); @@ -95,9 +98,10 @@ class CategoryPath extends BaseLoop $loopResultRow = new LoopResultRow(); $loopResultRow - ->set("TITLE",$category->getTitle()) - ->set("URL", $category->getUrl()) + ->set("TITLE",$category->getVirtualColumn('i18n_TITLE')) + ->set("URL", $category->getUrl($locale)) ->set("ID", $category->getId()) + ->set("LOCALE",$locale) ; $results[] = $loopResultRow; @@ -114,8 +118,11 @@ class CategoryPath extends BaseLoop $ids[] = $parent; $search = CategoryQuery::create(); + + $this->configureI18nProcessing($search, array('TITLE')); + $search->filterById($parent); - if ($visible == true) $search->filterByVisible($visible); + if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible); } } } while ($category != null && $parent > 0); diff --git a/core/lib/Thelia/Core/Template/Loop/CategoryTree.php b/core/lib/Thelia/Core/Template/Loop/CategoryTree.php old mode 100644 new mode 100755 index 330466f49..afcd0410e --- a/core/lib/Thelia/Core/Template/Loop/CategoryTree.php +++ b/core/lib/Thelia/Core/Template/Loop/CategoryTree.php @@ -22,9 +22,7 @@ /*************************************************************************************/ namespace Thelia\Core\Template\Loop; - use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -34,6 +32,7 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\CategoryQuery; use Thelia\Type; use Thelia\Type\BooleanOrBothType; +use Thelia\Core\Template\Element\BaseI18nLoop; /** * @@ -46,19 +45,17 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Franck Allimant */ -class CategoryTree extends BaseLoop +class CategoryTree extends BaseI18nLoop { /** * @return ArgumentCollection */ protected function getArgDefinitions() { - return new ArgumentCollection( - Argument::createIntTypeArgument('category', null, true), - Argument::createIntTypeArgument('depth', PHP_INT_MAX), - Argument::createBooleanOrBothTypeArgument('visible', true, false), - Argument::createIntListTypeArgument('exclude', array()) - ); + return new ArgumentCollection(Argument::createIntTypeArgument('category', null, true), + Argument::createIntTypeArgument('depth', PHP_INT_MAX), + Argument::createBooleanOrBothTypeArgument('visible', true, false), + Argument::createIntListTypeArgument('exclude', array())); } // changement de rubrique @@ -66,7 +63,11 @@ class CategoryTree extends BaseLoop { if ($level > $max_level) return; - $search = CategoryQuery::create(); + $search = CategoryQuery::create(); + + $locale = $this->configureI18nProcessing($search, array( + 'TITLE' + )); $search->filterByParent($parent); @@ -82,18 +83,15 @@ class CategoryTree extends BaseLoop $loopResultRow = new LoopResultRow(); - $loopResultRow - ->set("ID", $result->getId()) - ->set("TITLE",$result->getTitle()) - ->set("PARENT", $result->getParent()) - ->set("URL", $result->getUrl()) - ->set("VISIBLE", $result->getVisible() ? "1" : "0") - ->set("LEVEL", $level) + $loopResultRow + ->set("ID", $result->getId())->set("TITLE", $result->getVirtualColumn('i18n_TITLE')) + ->set("PARENT", $result->getParent())->set("URL", $result->getUrl($locale)) + ->set("VISIBLE", $result->getVisible() ? "1" : "0")->set("LEVEL", $level) ; - $loopResult->addRow($loopResultRow); + $loopResult->addRow($loopResultRow); - $this->buildCategoryTree($result->getId(), $visible, 1 + $level, $max_level, $exclude, $loopResult); + $this->buildCategoryTree($result->getId(), $visible, 1 + $level, $max_level, $exclude, $loopResult); } } @@ -105,12 +103,10 @@ class CategoryTree extends BaseLoop public function exec(&$pagination) { $id = $this->getCategory(); - $depth = $this->getDepth(); + $depth = $this->getDepth(); $visible = $this->getVisible(); $exclude = $this->getExclude(); - //echo "exclude=".print_r($exclude); - $loopResult = new LoopResult(); $this->buildCategoryTree($id, $visible, 0, $depth, $exclude, $loopResult); diff --git a/core/lib/Thelia/Core/Template/Loop/Config.php b/core/lib/Thelia/Core/Template/Loop/Config.php new file mode 100644 index 000000000..8e03de636 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Config.php @@ -0,0 +1,176 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; + +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Core\Template\Element\BaseI18nLoop; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; + +use Thelia\Core\Template\Loop\Argument\Argument; + +use Thelia\Model\LangQuery; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Model\ConfigQuery; +use Thelia\Type\BooleanOrBothType; +use Thelia\Type\TypeCollection; +use Thelia\Type\EnumListType; + +/** + * Config loop, to access configuration variables + * + * - id is the config id + * - name is the config name + * - hidden filters by hidden status (yes, no, both) + * - secured filters by secured status (yes, no, both) + * - exclude is a comma separated list of config IDs that will be excluded from output + * + * @package Thelia\Core\Template\Loop + * @author Franck Allimant + */ +class Config extends BaseI18nLoop +{ + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('id'), + Argument::createIntListTypeArgument('exclude'), + Argument::createAnyTypeArgument('variable'), + Argument::createBooleanOrBothTypeArgument('hidden'), + Argument::createBooleanOrBothTypeArgument('secured'), + new Argument( + 'order', + new TypeCollection( + new EnumListType( + array( + 'id', 'id_reverse', + 'name', 'name_reverse', + 'title', 'title_reverse', + 'value', 'value_reverse', + ) + ) + ), + 'name' + ) + ); + } + + /** + * @param $pagination (ignored) + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $id = $this->getId(); + $name = $this->getVariable(); + $secured = $this->getSecured(); + + $search = ConfigQuery::create(); + + $locale = $this->configureI18nProcessing($search); + + if (! is_null($id)) + $search->filterById($id); + + if (! is_null($name)) + $search->filterByName($name); + + if (! is_null($exclude)) { + $search->filterById($exclude, Criteria::NOT_IN); + } + + if ($this->getHidden() != BooleanOrBothType::ANY) + $search->filterByHidden($this->getHidden() ? 1 : 0); + + if (! is_null($secured) && $secured != BooleanOrBothType::ANY) + $search->filterBySecured($secured ? 1 : 0); + + $orders = $this->getOrder(); + + foreach($orders as $order) { + switch ($order) { + case 'id': + $search->orderById(Criteria::ASC); + break; + case 'id_reverse': + $search->orderById(Criteria::DESC); + break; + + case 'name': + $search->orderByName(Criteria::ASC); + break; + case 'name_reverse': + $search->orderByName(Criteria::DESC); + break; + + case 'title': + $search->addAscendingOrderByColumn('i18n_TITLE'); + break; + case 'title_reverse': + $search->addDescendingOrderByColumn('i18n_TITLE'); + break; + + case 'value': + $search->orderByValue(Criteria::ASC); + break; + case 'value_reverse': + $search->orderByValue(Criteria::DESC); + break; + } + } + + $results = $this->search($search, $pagination); + + $loopResult = new LoopResult($results); + + foreach ($results as $result) { + + $loopResultRow = new LoopResultRow($loopResult, $result, $this->versionable, $this->timestampable, $this->countable); + + $loopResultRow + ->set("ID" , $result->getId()) + ->set("NAME" , $result->getName()) + ->set("VALUE" , $result->getValue()) + ->set("IS_TRANSLATED", $result->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE" , $locale) + ->set("TITLE" , $result->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO" , $result->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION" , $result->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM" , $result->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("HIDDEN" , $result->getHidden()) + ->set("SECURED" , $result->getSecured()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/core/lib/Thelia/Core/Template/Loop/Content.php b/core/lib/Thelia/Core/Template/Loop/Content.php index 15bb2068c..baec33344 100755 --- a/core/lib/Thelia/Core/Template/Loop/Content.php +++ b/core/lib/Thelia/Core/Template/Loop/Content.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -49,8 +49,11 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Content extends BaseLoop +class Content extends BaseI18nLoop { + public $timestampable = true; + public $versionable = true; + /** * @return ArgumentCollection */ @@ -85,6 +88,9 @@ class Content extends BaseLoop { $search = ContentQuery::create(); + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + $id = $this->getId(); if (!is_null($id)) { @@ -153,10 +159,10 @@ class Content extends BaseLoop foreach ($orders as $order) { switch ($order) { case "alpha": - $search->addAscendingOrderByColumn(\Thelia\Model\Map\ContentI18nTableMap::TITLE); + $search->addAscendingOrderByColumn('i18n_TITLE'); break; case "alpha-reverse": - $search->addDescendingOrderByColumn(\Thelia\Model\Map\ContentI18nTableMap::TITLE); + $search->addDescendingOrderByColumn('i18n_TITLE'); break; case "manual": if(null === $folder || count($folder) != 1) @@ -199,32 +205,25 @@ class Content extends BaseLoop ); } - /** - * Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation. - * - * @todo : verify here if we want results for row without translations. - */ - - $search->joinWithI18n( - $this->request->getSession()->getLocale(), - (ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN - ); - + /* perform search */ $search->groupBy(ContentTableMap::ID); $contents = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($contents); foreach ($contents as $content) { - $loopResultRow = new LoopResultRow(); + $loopResultRow = new LoopResultRow($loopResult, $content, $this->versionable, $this->timestampable, $this->countable); $loopResultRow->set("ID", $content->getId()) - ->set("TITLE",$content->getTitle()) - ->set("CHAPO", $content->getChapo()) - ->set("DESCRIPTION", $content->getDescription()) - ->set("POSTSCRIPTUM", $content->getPostscriptum()) + ->set("IS_TRANSLATED",$content->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("TITLE",$content->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $content->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $content->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $content->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSITION", $content->getPosition()) + ->set("URL", $content->getUrl($locale)) ; $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Core/Template/Loop/Country.php b/core/lib/Thelia/Core/Template/Loop/Country.php index 475a4608b..0aeb62b15 100755 --- a/core/lib/Thelia/Core/Template/Loop/Country.php +++ b/core/lib/Thelia/Core/Template/Loop/Country.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -43,15 +43,16 @@ use Thelia\Model\ConfigQuery; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Country extends BaseLoop +class Country extends BaseI18nLoop { + public $timestampable = true; + /** * @return ArgumentCollection */ protected function getArgDefinitions() { return new ArgumentCollection( - Argument::createIntTypeArgument('limit', 500), // overwrite orginal param to increase the limit Argument::createIntListTypeArgument('id'), Argument::createIntListTypeArgument('area'), Argument::createBooleanTypeArgument('with_area'), @@ -68,6 +69,9 @@ class Country extends BaseLoop { $search = CountryQuery::create(); + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + $id = $this->getId(); if (null !== $id) { @@ -94,34 +98,25 @@ class Country extends BaseLoop $search->filterById($exclude, Criteria::NOT_IN); } - /** - * Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation. - * - * @todo : verify here if we want results for row without translations. - */ - - $search->joinWithI18n( - $this->request->getSession()->getLocale(), - (ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN - ); - - $search->addAscendingOrderByColumn(\Thelia\Model\Map\CountryI18nTableMap::TITLE); + $search->addAscendingOrderByColumn('i18n_TITLE'); + /* perform search */ $countries = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($countries); foreach ($countries as $country) { - $loopResultRow = new LoopResultRow(); - $loopResultRow->set("ID", $country->getId()); - $loopResultRow->set("AREA", $country->getAreaId()); - $loopResultRow->set("TITLE", $country->getTitle()); - $loopResultRow->set("CHAPO", $country->getChapo()); - $loopResultRow->set("DESCRIPTION", $country->getDescription()); - $loopResultRow->set("POSTSCRIPTUM", $country->getPostscriptum()); - $loopResultRow->set("ISOCODE", $country->getIsocode()); - $loopResultRow->set("ISOALPHA2", $country->getIsoalpha2()); - $loopResultRow->set("ISOALPHA3", $country->getIsoalpha3()); + $loopResultRow = new LoopResultRow($loopResult, $country, $this->versionable, $this->timestampable, $this->countable); + $loopResultRow->set("ID", $country->getId()) + ->set("IS_TRANSLATED",$country->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("TITLE",$country->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $country->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $country->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $country->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("ISOCODE", $country->getIsocode()) + ->set("ISOALPHA2", $country->getIsoalpha2()) + ->set("ISOALPHA3", $country->getIsoalpha3()); $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Core/Template/Loop/Coupon.php b/core/lib/Thelia/Core/Template/Loop/Coupon.php new file mode 100755 index 000000000..ee3cc0a5a --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Coupon.php @@ -0,0 +1,110 @@ +. */ +/* */ +/**********************************************************************************/ + +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\CategoryQuery; +use Thelia\Model\ConfigQuery; +use Thelia\Model\CouponQuery; +use Thelia\Model\Coupon as MCoupon; +use Thelia\Model\Map\ProductCategoryTableMap; +use Thelia\Type; +use Thelia\Type\BooleanOrBothType; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Coupon Loop + * + * @package Thelia\Core\Template\Loop + * @author Guillaume MOREL + * + */ +class Coupon extends BaseI18nLoop +{ + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntListTypeArgument('id') + ); + } + + /** + * @param $pagination + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $search = CouponQuery::create(); + + /* manage translations */ + $locale = $this->configureI18nProcessing($search, array('TITLE', 'DESCRIPTION', 'SHORT_DESCRIPTION')); + + $id = $this->getId(); + + if (null !== $id) { + $search->filterById($id, Criteria::IN); + } + + // Perform search + $coupons = $this->search($search, $pagination); + + $loopResult = new LoopResult(); + + /** @var MCoupon $coupon */ + foreach ($coupons as $coupon) { + $loopResultRow = new LoopResultRow(); + $loopResultRow->set("ID", $coupon->getId()) + ->set("IS_TRANSLATED", $coupon->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE", $locale) + ->set("CODE", $coupon->getCode()) + ->set("TITLE", $coupon->getVirtualColumn('i18n_TITLE')) + ->set("SHORT_DESCRIPTION", $coupon->getVirtualColumn('i18n_SHORT_DESCRIPTION')) + ->set("DESCRIPTION", $coupon->getVirtualColumn('i18n_DESCRIPTION')) + ->set("EXPIRATION_DATE", $coupon->getExpirationDate()) + ->set("USAGE_LEFT", $coupon->getMaxUsage()) + ->set("IS_CUMULATIVE", $coupon->getIsCumulative()) + ->set("IS_REMOVING_POSTAGE", $coupon->getIsRemovingPostage()) + ->set("IS_ENABLED", $coupon->getIsEnabled()) + ->set("AMOUNT", $coupon->getAmount()) + ->set("APPLICATION_CONDITIONS", $coupon->getRules()); + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/core/lib/Thelia/Core/Template/Loop/Currency.php b/core/lib/Thelia/Core/Template/Loop/Currency.php new file mode 100755 index 000000000..b7261ba45 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Currency.php @@ -0,0 +1,190 @@ +. */ +/* */ +/*************************************************************************************/ + +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\CurrencyQuery; +use Thelia\Model\ConfigQuery; +use Thelia\Type\TypeCollection; +use Thelia\Type\EnumListType; + +/** + * + * Currency loop + * + * + * Class Currency + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix + */ +class Currency extends BaseI18nLoop +{ + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntListTypeArgument('id'), + Argument::createIntListTypeArgument('exclude'), + Argument::createBooleanTypeArgument('default_only', false), + new Argument( + 'order', + new TypeCollection( + new EnumListType( + array( + 'id', 'id_reverse', + 'name', 'name_reverse', + 'code', 'code_reverse', + 'symbol', 'symbol_reverse', + 'rate', 'rate_reverse', + 'is_default', 'is_default_reverse', + 'manual', 'manual_reverse') + ) + ), + 'manual' + ) + ); + } + + /** + * @param $pagination + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $search = CurrencyQuery::create(); + + /* manage translations */ + $locale = $this->configureI18nProcessing($search, array('NAME')); + + $id = $this->getId(); + + if (null !== $id) { + $search->filterById($id, Criteria::IN); + } + + $exclude = $this->getExclude(); + + if (!is_null($exclude)) { + $search->filterById($exclude, Criteria::NOT_IN); + } + + $default_only = $this->getDefaultOnly(); + + if ($default_only === true) { + $search->filterByByDefault(true); + } + + $orders = $this->getOrder(); + + foreach($orders as $order) { + switch ($order) { + case 'id': + $search->orderById(Criteria::ASC); + break; + case 'id_reverse': + $search->orderById(Criteria::DESC); + break; + + case 'name': + $search->addAscendingOrderByColumn('i18n_NAME'); + break; + case 'name_reverse': + $search->addDescendingOrderByColumn('i18n_NAME'); + break; + + case 'code': + $search->orderByCode(Criteria::ASC); + break; + case 'code_reverse': + $search->orderByCode(Criteria::DESC); + break; + + case 'symbol': + $search->orderBySymbol(Criteria::ASC); + break; + case 'symbol_reverse': + $search->orderBySymbol(Criteria::DESC); + break; + + case 'rate': + $search->orderByRate(Criteria::ASC); + break; + case 'rate_reverse': + $search->orderByRate(Criteria::DESC); + break; + + case 'is_default': + $search->orderByByDefault(Criteria::ASC); + break; + case 'is_default_reverse': + $search->orderByByDefault(Criteria::DESC); + break; + + case 'manual': + $search->orderByPosition(Criteria::ASC); + break; + case 'manual_reverse': + $search->orderByPosition(Criteria::DESC); + break; + } + } + + /* perform search */ + $currencies = $this->search($search, $pagination); + + $loopResult = new LoopResult($currencies); + + foreach ($currencies as $currency) { + + $loopResultRow = new LoopResultRow($loopResult, $currency, $this->versionable, $this->timestampable, $this->countable); + $loopResultRow + ->set("ID" , $currency->getId()) + ->set("IS_TRANSLATED" , $currency->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE" , $locale) + ->set("NAME" , $currency->getVirtualColumn('i18n_NAME')) + ->set("ISOCODE" , $currency->getCode()) + ->set("SYMBOL" , $currency->getSymbol()) + ->set("RATE" , $currency->getRate()) + ->set("POSITION" , $currency->getPosition()) + ->set("IS_DEFAULT" , $currency->getByDefault()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/core/lib/Thelia/Core/Template/Loop/Customer.php b/core/lib/Thelia/Core/Template/Loop/Customer.php index 478c3d5bb..9861be29a 100755 --- a/core/lib/Thelia/Core/Template/Loop/Customer.php +++ b/core/lib/Thelia/Core/Template/Loop/Customer.php @@ -24,6 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; +use Propel\Runtime\Collection\ObjectCollection; use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -46,6 +47,8 @@ use Thelia\Type; */ class Customer extends BaseLoop { + public $timestampable = true; + /** * @return ArgumentCollection */ @@ -61,6 +64,7 @@ class Customer extends BaseLoop ) ), Argument::createBooleanTypeArgument('reseller'), + Argument::createBooleanTypeArgument('last_order'), Argument::createIntTypeArgument('sponsor') ); } @@ -77,7 +81,7 @@ class Customer extends BaseLoop $current = $this->getCurrent(); if ($current === true) { - $currentCustomer = $this->request->getSession()->getCustomerUser(); + $currentCustomer = $this->securityContext->getCustomerUser(); if ($currentCustomer === null) { return new LoopResult(); } else { @@ -113,10 +117,10 @@ class Customer extends BaseLoop $customers = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($customers); foreach ($customers as $customer) { - $loopResultRow = new LoopResultRow(); + $loopResultRow = new LoopResultRow($loopResult, $customer, $this->versionable, $this->timestampable, $this->countable); $loopResultRow->set("ID", $customer->getId()); $loopResultRow->set("REF", $customer->getRef()); $loopResultRow->set("TITLE", $customer->getTitleId()); @@ -127,6 +131,20 @@ 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 new file mode 100644 index 000000000..7ef46eedc --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Delivery.php @@ -0,0 +1,85 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; +use Thelia\Core\Template\Loop\Argument\Argument; + + +/** + * Class Delivery + * @package Thelia\Core\Template\Loop + * @author Manuel Raynaud + */ +class Delivery extends BaseSpecificModule +{ + + public function getArgDefinitions() + { + $collection = parent::getArgDefinitions(); + + $collection->addArgument( + Argument::createIntTypeArgument("country") + ); + + return $collection; + } + + public function exec(&$pagination) + { + $search = parent::exec($pagination); + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + /* perform search */ + $deliveryModules = $this->search($search, $pagination); + + $loopResult = new LoopResult($deliveryModules); + + foreach ($deliveryModules as $deliveryModule) { + $loopResultRow = new LoopResultRow($loopResult, $deliveryModule, $this->versionable, $this->timestampable, $this->countable); + + $moduleReflection = new \ReflectionClass($deliveryModule->getFullNamespace()); + if($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) { + throw new \RuntimeException(sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $deliveryModule->getCode())); + } + $moduleInstance = $moduleReflection->newInstance(); + + $moduleInstance->setRequest($this->request); + $moduleInstance->setDispatcher($this->dispatcher); + + $loopResultRow + ->set('ID', $deliveryModule->getId()) + ->set('TITLE', $deliveryModule->getVirtualColumn('i18n_TITLE')) + ->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO')) + ->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION')) + ->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set('PRICE', $moduleInstance->calculate($this->getCountry())) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Feature.php b/core/lib/Thelia/Core/Template/Loop/Feature.php index cf8dcc563..14b7afaf5 100755 --- a/core/lib/Thelia/Core/Template/Loop/Feature.php +++ b/core/lib/Thelia/Core/Template/Loop/Feature.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -49,8 +49,10 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Feature extends BaseLoop +class Feature extends BaseI18nLoop { + public $timestampable = true; + /** * @return ArgumentCollection */ @@ -81,6 +83,9 @@ class Feature extends BaseLoop { $search = FeatureQuery::create(); + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + $id = $this->getId(); if (null !== $id) { @@ -122,10 +127,10 @@ class Feature extends BaseLoop foreach ($orders as $order) { switch ($order) { case "alpha": - $search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE); + $search->addAscendingOrderByColumn('i18n_TITLE'); break; case "alpha-reverse": - $search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE); + $search->addDescendingOrderByColumn('i18n_TITLE'); break; case "manual": $search->orderByPosition(Criteria::ASC); @@ -136,28 +141,21 @@ class Feature extends BaseLoop } } - /** - * Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation. - * - * @todo : verify here if we want results for row without translations. - */ - - $search->joinWithI18n( - $this->request->getSession()->getLocale(), - (ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN - ); - + /* perform search */ $features = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($features); foreach ($features as $feature) { - $loopResultRow = new LoopResultRow(); - $loopResultRow->set("ID", $feature->getId()); - $loopResultRow->set("TITLE",$feature->getTitle()); - $loopResultRow->set("CHAPO", $feature->getChapo()); - $loopResultRow->set("DESCRIPTION", $feature->getDescription()); - $loopResultRow->set("POSTSCRIPTUM", $feature->getPostscriptum()); + $loopResultRow = new LoopResultRow($loopResult, $feature, $this->versionable, $this->timestampable, $this->countable); + $loopResultRow->set("ID", $feature->getId()) + ->set("IS_TRANSLATED",$feature->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("TITLE",$feature->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $feature->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $feature->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $feature->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("POSITION", $feature->getPosition()); $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Core/Template/Loop/FeatureAvailable.php b/core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php similarity index 77% rename from core/lib/Thelia/Core/Template/Loop/FeatureAvailable.php rename to core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php index 838937558..38bee46f0 100755 --- a/core/lib/Thelia/Core/Template/Loop/FeatureAvailable.php +++ b/core/lib/Thelia/Core/Template/Loop/FeatureAvailability.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -37,16 +37,17 @@ use Thelia\Type\TypeCollection; use Thelia\Type; /** - *todo : to be finished - * FeatureAvailable loop + * FeatureAvailability loop * * - * Class FeatureAvailable + * Class FeatureAvailability * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class FeatureAvailable extends BaseLoop +class FeatureAvailability extends BaseI18nLoop { + public $timestampable = true; + /** * @return ArgumentCollection */ @@ -75,6 +76,9 @@ class FeatureAvailable extends BaseLoop { $search = FeatureAvQuery::create(); + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + $id = $this->getId(); if (null !== $id) { @@ -98,10 +102,10 @@ class FeatureAvailable extends BaseLoop foreach ($orders as $order) { switch ($order) { case "alpha": - $search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureAvI18nTableMap::TITLE); + $search->addAscendingOrderByColumn('i18n_TITLE'); break; case "alpha-reverse": - $search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureAvI18nTableMap::TITLE); + $search->addDescendingOrderByColumn('i18n_TITLE'); break; case "manual": $search->orderByPosition(Criteria::ASC); @@ -112,28 +116,21 @@ class FeatureAvailable extends BaseLoop } } - /** - * Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation. - * - * @todo : verify here if we want results for row without translations. - */ - - $search->joinWithI18n( - $this->request->getSession()->getLocale(), - (ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN - ); - + /* perform search */ $featuresAv = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($featuresAv); foreach ($featuresAv as $featureAv) { - $loopResultRow = new LoopResultRow(); - $loopResultRow->set("ID", $featureAv->getId()); - $loopResultRow->set("TITLE",$featureAv->getTitle()); - $loopResultRow->set("CHAPO", $featureAv->getChapo()); - $loopResultRow->set("DESCRIPTION", $featureAv->getDescription()); - $loopResultRow->set("POSTSCRIPTUM", $featureAv->getPostscriptum()); + $loopResultRow = new LoopResultRow($loopResult, $featureAv, $this->versionable, $this->timestampable, $this->countable); + $loopResultRow->set("ID", $featureAv->getId()) + ->set("IS_TRANSLATED",$featureAv->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("TITLE",$featureAv->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $featureAv->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $featureAv->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $featureAv->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("POSITION", $featureAv->getPosition()); $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php index 9988c500f..998dfe4e0 100755 --- a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php +++ b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php @@ -24,15 +24,19 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Propel\Runtime\ActiveQuery\Join; +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\Log\Tlog; use Thelia\Model\Base\FeatureProductQuery; use Thelia\Model\ConfigQuery; +use Thelia\Model\Map\FeatureAvTableMap; +use Thelia\Model\Map\FeatureProductTableMap; use Thelia\Type\TypeCollection; use Thelia\Type; @@ -45,8 +49,10 @@ use Thelia\Type; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class FeatureValue extends BaseLoop +class FeatureValue extends BaseI18nLoop { + public $timestampable = true; + /** * @return ArgumentCollection */ @@ -55,13 +61,13 @@ class FeatureValue extends BaseLoop return new ArgumentCollection( Argument::createIntTypeArgument('feature', null, true), Argument::createIntTypeArgument('product', null, true), - Argument::createIntListTypeArgument('feature_available'), - Argument::createBooleanTypeArgument('exclude_feature_available', 0), - Argument::createBooleanTypeArgument('exclude_default_values', 0), + Argument::createIntListTypeArgument('feature_availability'), + Argument::createBooleanTypeArgument('exclude_feature_availability', 0), + Argument::createBooleanTypeArgument('exclude_personal_values', 0), new Argument( 'order', new TypeCollection( - new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse')) + new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse')) ), 'manual' ) @@ -77,6 +83,15 @@ class FeatureValue extends BaseLoop { $search = FeatureProductQuery::create(); + /* manage featureAv translations */ + $locale = $this->configureI18nProcessing( + $search, + array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), + FeatureAvTableMap::TABLE_NAME, + 'FEATURE_AV_ID', + true + ); + $feature = $this->getFeature(); $search->filterByFeatureId($feature, Criteria::EQUAL); @@ -85,31 +100,31 @@ class FeatureValue extends BaseLoop $search->filterByProductId($product, Criteria::EQUAL); - $featureAvailable = $this->getFeature_available(); + $featureAvailability = $this->getFeature_availability(); - if (null !== $featureAvailable) { - $search->filterByFeatureAvId($featureAvailable, Criteria::IN); + if (null !== $featureAvailability) { + $search->filterByFeatureAvId($featureAvailability, Criteria::IN); } - $excludeFeatureAvailable = $this->getExclude_feature_available(); - if ($excludeFeatureAvailable == true) { + $excludeFeatureAvailability = $this->getExclude_feature_availability(); + if($excludeFeatureAvailability == true) { $search->filterByFeatureAvId(null, Criteria::NULL); } - $excludeDefaultValues = $this->getExclude_default_values(); - if ($excludeDefaultValues == true) { + $excludeDefaultValues = $this->getExclude_personal_values(); + if($excludeDefaultValues == true) { $search->filterByByDefault(null, Criteria::NULL); } $orders = $this->getOrder(); - foreach ($orders as $order) { + foreach($orders as $order) { switch ($order) { case "alpha": - $search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE); + $search->addAscendingOrderByColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE'); break; - case "alpha-reverse": - $search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE); + case "alpha_reverse": + $search->addDescendingOrderByColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE'); break; case "manual": $search->orderByPosition(Criteria::ASC); @@ -120,32 +135,26 @@ class FeatureValue extends BaseLoop } } - /** - * Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation. - * - * @todo : verify here if we want results for row without translations. - */ - - /*$search->joinWithI18n( - $this->request->getSession()->getLocale(), - (ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN - );*/ - $featureValues = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($featureValues); foreach ($featureValues as $featureValue) { - $loopResultRow = new LoopResultRow(); + $loopResultRow = new LoopResultRow($loopResult, $featureValue, $this->versionable, $this->timestampable, $this->countable); $loopResultRow->set("ID", $featureValue->getId()); - /*$loopResultRow->set("TITLE",$featureValue->getTitle()); - $loopResultRow->set("CHAPO", $featureValue->getChapo()); - $loopResultRow->set("DESCRIPTION", $featureValue->getDescription()); - $loopResultRow->set("POSTSCRIPTUM", $featureValue->getPostscriptum());*/ + + $loopResultRow + ->set("LOCALE",$locale) + ->set("PERSONAL_VALUE", $featureValue->getByDefault()) + ->set("TITLE",$featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE')) + ->set("CHAPO", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_CHAPO')) + ->set("DESCRIPTION", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM')) + ->set("POSITION", $featureValue->getPosition()); $loopResult->addRow($loopResultRow); } return $loopResult; } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Folder.php b/core/lib/Thelia/Core/Template/Loop/Folder.php index c2f45682a..ca07ffa02 100755 --- a/core/lib/Thelia/Core/Template/Loop/Folder.php +++ b/core/lib/Thelia/Core/Template/Loop/Folder.php @@ -24,12 +24,13 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Log\Tlog; use Thelia\Model\FolderQuery; use Thelia\Model\ConfigQuery; @@ -43,8 +44,11 @@ use Thelia\Type\BooleanOrBothType; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Folder extends BaseLoop +class Folder extends BaseI18nLoop { + public $timestampable = true; + public $versionable = true; + /** * @return ArgumentCollection */ @@ -59,7 +63,7 @@ class Folder extends BaseLoop new Argument( 'order', new TypeCollection( - new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual-reverse', 'random')) + new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'random')) ), 'manual' ), @@ -76,7 +80,10 @@ class Folder extends BaseLoop { $search = FolderQuery::create(); - $id = $this->getId(); + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + + $id = $this->getId(); if (!is_null($id)) { $search->filterById($id, Criteria::IN); @@ -88,7 +95,8 @@ class Folder extends BaseLoop $search->filterByParent($parent); } - $current = $this->getCurrent(); + + $current = $this->getCurrent(); if ($current === true) { $search->filterById($this->request->get("folder_id")); @@ -96,6 +104,7 @@ class Folder extends BaseLoop $search->filterById($this->request->get("folder_id"), Criteria::NOT_IN); } + $exclude = $this->getExclude(); if (!is_null($exclude)) { @@ -108,15 +117,15 @@ class Folder extends BaseLoop $orders = $this->getOrder(); - foreach ($orders as $order) { + foreach($orders as $order) { switch ($order) { case "alpha": - $search->addAscendingOrderByColumn(\Thelia\Model\Map\FolderI18nTableMap::TITLE); + $search->addAscendingOrderByColumn('i18n_TITLE'); break; - case "alpha-reverse": - $search->addDescendingOrderByColumn(\Thelia\Model\Map\FolderI18nTableMap::TITLE); + case "alpha_reverse": + $search->addDescendingOrderByColumn('i18n_TITLE'); break; - case "manual-reverse": + case "manual_reverse": $search->orderByPosition(Criteria::DESC); break; case "manual": @@ -130,50 +139,41 @@ class Folder extends BaseLoop } } - /** - * \Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation. - * - * @todo : verify here if we want results for row without translations. - */ - - $search->joinWithI18n( - $this->request->getSession()->getLocale(), - (ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN - ); - + /* perform search */ $folders = $this->search($search, $pagination); + /* @todo */ $notEmpty = $this->getNot_empty(); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($folders); foreach ($folders as $folder) { - if ($notEmpty && $folder->countAllProducts() == 0) continue; + /* + * no cause pagination lost : + * if ($notEmpty && $folder->countAllProducts() == 0) continue; + */ - $loopResultRow = new LoopResultRow(); + $loopResultRow = new LoopResultRow($loopResult, $folder, $this->versionable, $this->timestampable, $this->countable); $loopResultRow - ->set("ID", $folder->getId()) - ->set("TITLE",$folder->getTitle()) - ->set("CHAPO", $folder->getChapo()) - ->set("DESCRIPTION", $folder->getDescription()) - ->set("POSTSCRIPTUM", $folder->getPostscriptum()) - ->set("PARENT", $folder->getParent()) - ->set("CONTENT_COUNT", $folder->countChild()) - ->set("VISIBLE", $folder->getVisible() ? "1" : "0") - ->set("POSITION", $folder->getPosition()) - - ->set("CREATE_DATE", $folder->getCreatedAt()) - ->set("UPDATE_DATE", $folder->getUpdatedAt()) - ->set("VERSION", $folder->getVersion()) - ->set("VERSION_DATE", $folder->getVersionCreatedAt()) - ->set("VERSION_AUTHOR", $folder->getVersionCreatedBy()) - ; + ->set("ID", $folder->getId()) + ->set("IS_TRANSLATED",$folder->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("TITLE",$folder->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $folder->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $folder->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("PARENT", $folder->getParent()) + ->set("URL", $folder->getUrl($locale)) + ->set("CONTENT_COUNT", $folder->countChild()) + ->set("VISIBLE", $folder->getVisible() ? "1" : "0") + ->set("POSITION", $folder->getPosition()) + ; $loopResult->addRow($loopResultRow); } 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 old mode 100644 new mode 100755 index a1e866cb2..793b5c03e --- a/core/lib/Thelia/Core/Template/Loop/Image.php +++ b/core/lib/Thelia/Core/Template/Loop/Image.php @@ -22,7 +22,7 @@ /*************************************************************************************/ namespace Thelia\Core\Template\Loop; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Event\ImageEvent; use Thelia\Model\CategoryImageQuery; @@ -43,13 +43,69 @@ use Thelia\Log\Tlog; * * @author Franck Allimant */ -class Image extends BaseLoop +class Image extends BaseI18nLoop { + public $timestampable = true; + /** * @var array Possible image sources */ protected $possible_sources = array('category', 'product', 'folder', 'content'); + /** + * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection + */ + protected function getArgDefinitions() + { + $collection = new ArgumentCollection( + + Argument::createIntListTypeArgument('id'), + Argument::createIntListTypeArgument('exclude'), + new Argument( + 'order', + new TypeCollection( + new EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual-reverse', 'random')) + ), + 'manual' + ), + Argument::createIntTypeArgument('lang'), + + Argument::createIntTypeArgument('width'), + Argument::createIntTypeArgument('height'), + Argument::createIntTypeArgument('rotation', 0), + Argument::createAnyTypeArgument('background_color'), + Argument::createIntTypeArgument('quality'), + new Argument( + 'resize_mode', + new TypeCollection( + new EnumType(array('crop', 'borders', 'none')) + ), + 'none' + ), + Argument::createAnyTypeArgument('effects'), + + Argument::createIntTypeArgument('category'), + Argument::createIntTypeArgument('product'), + Argument::createIntTypeArgument('folder'), + Argument::createIntTypeArgument('content'), + + new Argument( + 'source', + new TypeCollection( + new EnumType($this->possible_sources) + ) + ), + Argument::createIntTypeArgument('source_id') + ); + + // Add possible image sources + foreach($this->possible_sources as $source) { + $collection->addArgument(Argument::createIntTypeArgument($source)); + } + + return $collection; + } + /** * Dynamically create the search query, and set the proper filter and order * @@ -63,7 +119,6 @@ class Image extends BaseLoop $queryClass = sprintf("\Thelia\Model\%sImageQuery", $object); $filterMethod = sprintf("filterBy%sId", $object); - $mapClass = sprintf("\Thelia\Model\Map\%sI18nTableMap", $object); // xxxImageQuery::create() $method = new \ReflectionMethod($queryClass, 'create'); @@ -73,19 +128,16 @@ class Image extends BaseLoop $method = new \ReflectionMethod($queryClass, $filterMethod); $method->invoke($search, $object_id); - $map = new \ReflectionClass($mapClass); - $title_map = $map->getConstant('TITLE'); - $orders = $this->getOrder(); // Results ordering foreach ($orders as $order) { switch ($order) { case "alpha": - $search->addAscendingOrderByColumn($title_map); + $search->addAscendingOrderByColumn('i18n_TITLE'); break; case "alpha-reverse": - $search->addDescendingOrderByColumn($title_map); + $search->addDescendingOrderByColumn('i18n_TITLE'); break; case "manual-reverse": $search->orderByPosition(Criteria::DESC); @@ -122,7 +174,7 @@ class Image extends BaseLoop $source_id = $this->getSourceId(); - // echo "source = ".$this->getSource().", id=".$id."
"; + // echo "source = ".$this->getSource().", id=".$source_id." - ".$this->getArg('source_id')->getValue()."
"; if (is_null($source_id)) { throw new \InvalidArgumentException("'source_id' argument cannot be null if 'source' argument is specified."); @@ -167,6 +219,9 @@ class Image extends BaseLoop $search = $this->getSearchQuery($object_type, $object_id); + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + $id = $this->getId(); if (! is_null($id)) { @@ -187,7 +242,7 @@ class Image extends BaseLoop $background_color = $this->getBackgroundColor(); $quality = $this->getQuality(); $effects = $this->getEffects(); - $effects = $this->getEffects(); + if (! is_null($effects)) { $effects = explode(',', $effects); } @@ -207,20 +262,11 @@ class Image extends BaseLoop } - /** - * \Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation. - * - * @todo : verify here if we want results for row without translations. - */ - - $search->joinWithI18n( - $this->request->getSession()->getLocale(), - (ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN - ); + // echo "sql=".$search->toString(); $results = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($results); foreach ($results as $result) { @@ -251,21 +297,22 @@ class Image extends BaseLoop // Dispatch image processing event $this->dispatcher->dispatch(TheliaEvents::IMAGE_PROCESS, $event); - $loopResultRow = new LoopResultRow(); + $loopResultRow = new LoopResultRow($loopResult, $result, $this->versionable, $this->timestampable, $this->countable); $loopResultRow - ->set("ID", $result->getId()) - ->set("IMAGE_URL", $event->getFileUrl()) - ->set("ORIGINAL_IMAGE_URL", $event->getOriginalFileUrl()) - ->set("IMAGE_PATH", $event->getCacheFilepath()) - ->set("ORIGINAL_IMAGE_PATH", $source_filepath) - ->set("TITLE", $result->getTitle()) - ->set("CHAPO", $result->getChapo()) - ->set("DESCRIPTION", $result->getDescription()) - ->set("POSTSCRIPTUM", $result->getPostscriptum()) - ->set("POSITION", $result->getPosition()) - ->set("OBJECT_TYPE", $object_type) - ->set("OBJECT_ID", $object_id) + ->set("ID" , $result->getId()) + ->set("LOCALE" ,$locale) + ->set("IMAGE_URL" , $event->getFileUrl()) + ->set("ORIGINAL_IMAGE_URL" , $event->getOriginalFileUrl()) + ->set("IMAGE_PATH" , $event->getCacheFilepath()) + ->set("ORIGINAL_IMAGE_PATH" , $source_filepath) + ->set("TITLE" , $result->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO" , $result->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION" , $result->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM" , $result->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("POSITION" , $result->getPosition()) + ->set("OBJECT_TYPE" , $object_type) + ->set("OBJECT_ID" , $object_id) ; $loopResult->addRow($loopResultRow); @@ -278,59 +325,4 @@ class Image extends BaseLoop return $loopResult; } - - /** - * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection - */ - protected function getArgDefinitions() - { - $collection = new ArgumentCollection( - - Argument::createIntListTypeArgument('id'), - Argument::createIntListTypeArgument('exclude'), - new Argument( - 'order', - new TypeCollection( - new EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual-reverse', 'random')) - ), - 'manual' - ), - - Argument::createIntTypeArgument('width'), - Argument::createIntTypeArgument('height'), - Argument::createIntTypeArgument('rotation', 0), - Argument::createAnyTypeArgument('background_color'), - Argument::createIntTypeArgument('quality'), - new Argument( - 'resize_mode', - new TypeCollection( - new EnumType(array('crop', 'borders', 'none')) - ), - 'none' - ), - Argument::createAnyTypeArgument('effects'), - - Argument::createIntTypeArgument('category'), - Argument::createIntTypeArgument('product'), - Argument::createIntTypeArgument('folder'), - Argument::createIntTypeArgument('content'), - - new Argument( - 'source', - new TypeCollection( - new EnumType($this->possible_sources) - ) - ), - Argument::createIntTypeArgument('source_id'), - - Argument::createIntListTypeArgument('lang') - ); - - // Add possible image sources - foreach($this->possible_sources as $source) { - $collection->addArgument(Argument::createIntTypeArgument($source)); - } - - return $collection; - } } \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Lang.php b/core/lib/Thelia/Core/Template/Loop/Lang.php old mode 100644 new mode 100755 index 3986fdb56..487acb565 --- a/core/lib/Thelia/Core/Template/Loop/Lang.php +++ b/core/lib/Thelia/Core/Template/Loop/Lang.php @@ -45,6 +45,8 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection; */ class Lang extends BaseLoop { + public $timestampable = true; + /** * @return ArgumentCollection */ @@ -84,11 +86,11 @@ class Lang extends BaseLoop $results = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($results); foreach ($results as $result) { - $loopResultRow = new LoopResultRow(); + $loopResultRow = new LoopResultRow($loopResult, $result, $this->versionable, $this->timestampable, $this->countable); $loopResultRow ->set("ID", $result->getId()) @@ -99,9 +101,6 @@ class Lang extends BaseLoop ->set("IS_DEFAULT", $result->getByDefault()) ->set("URL", $result->getUrl()) ->set("POSITION", $result->getPosition()) - - ->set("CREATE_DATE", $result->getCreatedAt()) - ->set("UPDATE_DATE", $result->getUpdatedAt()) ; $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Core/Template/Loop/Message.php b/core/lib/Thelia/Core/Template/Loop/Message.php new file mode 100644 index 000000000..ad6bd29aa --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Message.php @@ -0,0 +1,129 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; + +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Core\Template\Element\BaseI18nLoop; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; + +use Thelia\Core\Template\Loop\Argument\Argument; + +use Thelia\Model\LangQuery; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Model\MessageQuery; +use Thelia\Type\BooleanOrBothType; + +/** + * Message loop, to access messageuration variables + * + * - id is the message id + * - name is the message name + * - hidden filters by hidden status (yes, no, both) + * - secured filters by secured status (yes, no, both) + * - exclude is a comma separated list of message IDs that will be excluded from output + * + * @package Thelia\Core\Template\Loop + * @author Franck Allimant + */ +class Message extends BaseI18nLoop +{ + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('id'), + Argument::createIntListTypeArgument('exclude'), + Argument::createAnyTypeArgument('variable'), + Argument::createBooleanOrBothTypeArgument('hidden'), + Argument::createBooleanOrBothTypeArgument('secured') + ); + } + + /** + * @param $pagination (ignored) + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $id = $this->getId(); + $name = $this->getVariable(); + $secured = $this->getSecured(); + + $search = MessageQuery::create(); + + $locale = $this->configureI18nProcessing($search, array( + 'TITLE', + 'SUBJECT', + 'TEXT_MESSAGE', + 'HTML_MESSAGE' + ) + ); + + if (! is_null($id)) + $search->filterById($id); + + if (! is_null($name)) + $search->filterByName($name); + + if (! is_null($exclude)) { + $search->filterById($exclude, Criteria::NOT_IN); + } + + if (! is_null($secured) && $secured != BooleanOrBothType::ANY) + $search->filterBySecured($secured ? 1 : 0); + + $search->orderByName(Criteria::ASC); + + $results = $this->search($search, $pagination); + + $loopResult = new LoopResult($results); + + foreach ($results as $result) { + + $loopResultRow = new LoopResultRow($loopResult, $result, $this->versionable, $this->timestampable, $this->countable); + + $loopResultRow + ->set("ID" , $result->getId()) + ->set("NAME" , $result->getName()) + ->set("IS_TRANSLATED", $result->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE" , $locale) + ->set("TITLE" , $result->getVirtualColumn('i18n_TITLE')) + ->set("SUBJECT" , $result->getVirtualColumn('i18n_SUBJECT')) + ->set("TEXT_MESSAGE" , $result->getVirtualColumn('i18n_TEXT_MESSAGE')) + ->set("HTML_MESSAGE" , $result->getVirtualColumn('i18n_HTML_MESSAGE')) + ->set("SECURED" , $result->getSecured()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} diff --git a/core/lib/Thelia/Core/Template/Loop/Order.php b/core/lib/Thelia/Core/Template/Loop/Order.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Core/Template/Loop/OrderStatus.php b/core/lib/Thelia/Core/Template/Loop/OrderStatus.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php index 88f33c3b3..b7a7c13fe 100755 --- a/core/lib/Thelia/Core/Template/Loop/Product.php +++ b/core/lib/Thelia/Core/Template/Loop/Product.php @@ -24,14 +24,20 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Propel\Runtime\ActiveQuery\Join; +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\Log\Tlog; use Thelia\Model\CategoryQuery; +use Thelia\Model\CountryQuery; +use Thelia\Model\Map\FeatureProductTableMap; +use Thelia\Model\Map\ProductPriceTableMap; +use Thelia\Model\Map\ProductSaleElementsTableMap; use Thelia\Model\Map\ProductTableMap; use Thelia\Model\ProductCategoryQuery; use Thelia\Model\ProductQuery; @@ -48,9 +54,14 @@ use Thelia\Type\BooleanOrBothType; * Class Product * @package Thelia\Core\Template\Loop * @author Etienne Roudeix + * + * @todo : manage currency in price filter */ -class Product extends BaseLoop +class Product extends BaseI18nLoop { + public $timestampable = true; + public $versionable = true; + /** * @return ArgumentCollection */ @@ -65,13 +76,13 @@ class Product extends BaseLoop ) ), 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('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'), Argument::createBooleanTypeArgument('current_category'), Argument::createIntTypeArgument('depth', 1), @@ -79,14 +90,14 @@ class Product extends BaseLoop new Argument( 'order', new TypeCollection( - new Type\EnumListType(array('alpha', 'alpha-reverse', /*'min_price', 'max_price',*/ 'manual', 'manual_reverse', 'ref', /*'promo', 'new',*/ 'random', 'given_id')) + new Type\EnumListType(array('alpha', 'alpha_reverse', 'min_price', 'max_price', 'manual', 'manual_reverse', 'ref', 'promo', 'new', 'random', 'given_id')) ), 'alpha' ), Argument::createIntListTypeArgument('exclude'), Argument::createIntListTypeArgument('exclude_category'), new Argument( - 'feature_available', + 'feature_availability', new TypeCollection( new Type\IntToCombinedIntsListType() ) @@ -96,6 +107,24 @@ class Product extends BaseLoop new TypeCollection( new Type\IntToCombinedStringsListType() ) + ), + /* + * promo, new, quantity, weight or price may differ depending on the different attributes + * by default, product loop will look for at least 1 attribute which matches all the loop criteria : attribute_non_strict_match="none" + * you can also provide a list of non-strict attributes. + * ie : attribute_non_strict_match="promo,new" + * loop will return the product if he has at least an attribute in promo and at least an attribute as new ; even if it's not the same attribute. + * you can set all the attributes as non strict : attribute_non_strict_match="*" + * + * In order to allow such a process, we will have to make a LEFT JOIN foreach of the following case. + */ + new Argument( + 'attribute_non_strict_match', + new TypeCollection( + new Type\EnumListType(array('min_stock', 'promo', 'new', 'min_weight', 'max_weight', 'min_price', 'max_price')), + new Type\EnumType(array('*', 'none')) + ), + 'none' ) ); } @@ -110,7 +139,12 @@ class Product extends BaseLoop { $search = ProductQuery::create(); - //$search->withColumn('CASE WHEN ' . ProductTableMap::PROMO . '=1 THEN ' . ProductTableMap::PRICE2 . ' ELSE ' . ProductTableMap::PRICE . ' END', 'real_price'); + /* manage translations */ + $locale = $this->configureI18nProcessing($search); + + $attributeNonStrictMatch = $this->getAttribute_non_strict_match(); + $isPSELeftJoinList = array(); + $isProductPriceLeftJoinList = array(); $id = $this->getId(); @@ -124,15 +158,15 @@ class Product extends BaseLoop $search->filterByRef($ref, Criteria::IN); } - $category = $this->getCategory(); + $category = $this->getCategory(); if (!is_null($category)) { $categories = CategoryQuery::create()->filterById($category, Criteria::IN)->find(); $depth = $this->getDepth(); - if (null !== $depth) { - foreach (CategoryQuery::findAllChild($category, $depth) as $subCategory) { + if(null !== $depth) { + foreach(CategoryQuery::findAllChild($category, $depth) as $subCategory) { $categories->prepend($subCategory); } } @@ -143,79 +177,174 @@ class Product extends BaseLoop ); } - /*$new = $this->getNew(); + $new = $this->getNew(); if ($new === true) { - $search->filterByNewness(1, Criteria::EQUAL); - } elseif ($new === false) { - $search->filterByNewness(0, Criteria::EQUAL); + $isPSELeftJoinList[] = 'is_new'; + $search->joinProductSaleElements('is_new', Criteria::LEFT_JOIN) + ->where('`is_new`.NEWNESS' . Criteria::EQUAL . '1') + ->where('NOT ISNULL(`is_new`.ID)'); + } else if($new === false) { + $isPSELeftJoinList[] = 'is_new'; + $search->joinProductSaleElements('is_new', Criteria::LEFT_JOIN) + ->where('`is_new`.NEWNESS' . Criteria::EQUAL . '0') + ->where('NOT ISNULL(`is_new`.ID)'); } $promo = $this->getPromo(); if ($promo === true) { - $search->filterByPromo(1, Criteria::EQUAL); - } elseif ($promo === false) { - $search->filterByNewness(0, Criteria::EQUAL); + $isPSELeftJoinList[] = 'is_promo'; + $search->joinProductSaleElements('is_promo', Criteria::LEFT_JOIN) + ->where('`is_promo`.PROMO' . Criteria::EQUAL . '1') + ->where('NOT ISNULL(`is_promo`.ID)'); + } else if($promo === false) { + $isPSELeftJoinList[] = 'is_promo'; + $search->joinProductSaleElements('is_promo', Criteria::LEFT_JOIN) + ->where('`is_promo`.PROMO' . Criteria::EQUAL . '0') + ->where('NOT ISNULL(`is_promo`.ID)'); } $min_stock = $this->getMin_stock(); if (null != $min_stock) { - $search->filterByQuantity($min_stock, Criteria::GREATER_EQUAL); + $isPSELeftJoinList[] = 'is_min_stock'; + $search->joinProductSaleElements('is_min_stock', Criteria::LEFT_JOIN) + ->where('`is_min_stock`.QUANTITY' . Criteria::GREATER_THAN . '?', $min_stock, \PDO::PARAM_INT) + ->where('NOT ISNULL(`is_min_stock`.ID)'); } - $min_price = $this->getMin_price();*/ + $min_weight = $this->getMin_weight(); - //if (null !== $min_price) { - /** - * Following should work but does not : - * - * $search->filterBy('real_price', $max_price, Criteria::GREATER_EQUAL); - */ - /*$search->condition('in_promo', ProductTableMap::PROMO . Criteria::EQUAL . '1') - ->condition('not_in_promo', ProductTableMap::PROMO . Criteria::NOT_EQUAL . '1') - ->condition('min_price2', ProductTableMap::PRICE2 . Criteria::GREATER_EQUAL . '?', $min_price) - ->condition('min_price', ProductTableMap::PRICE . Criteria::GREATER_EQUAL . '?', $min_price) - ->combine(array('in_promo', 'min_price2'), Criteria::LOGICAL_AND, 'in_promo_min_price') - ->combine(array('not_in_promo', 'min_price'), Criteria::LOGICAL_AND, 'not_in_promo_min_price') - ->where(array('not_in_promo_min_price', 'in_promo_min_price'), Criteria::LOGICAL_OR); - } - - $max_price = $this->getMax_price();*/ - - //if (null !== $max_price) { - /** - * Following should work but does not : - * - * $search->filterBy('real_price', $max_price, Criteria::LESS_EQUAL); - */ - /*$search->condition('in_promo', ProductTableMap::PROMO . Criteria::EQUAL . '1') - ->condition('not_in_promo', ProductTableMap::PROMO . Criteria::NOT_EQUAL . '1') - ->condition('max_price2', ProductTableMap::PRICE2 . Criteria::LESS_EQUAL . '?', $max_price) - ->condition('max_price', ProductTableMap::PRICE . Criteria::LESS_EQUAL . '?', $max_price) - ->combine(array('in_promo', 'max_price2'), Criteria::LOGICAL_AND, 'in_promo_max_price') - ->combine(array('not_in_promo', 'max_price'), Criteria::LOGICAL_AND, 'not_in_promo_max_price') - ->where(array('not_in_promo_max_price', 'in_promo_max_price'), Criteria::LOGICAL_OR); - }*/ - - /*$min_weight = $this->getMin_weight(); - - if (null !== $min_weight) { - $search->filterByWeight($min_weight, Criteria::GREATER_EQUAL); + if (null != $min_weight) { + $isPSELeftJoinList[] = 'is_min_weight'; + $search->joinProductSaleElements('is_min_weight', Criteria::LEFT_JOIN) + ->where('`is_min_weight`.WEIGHT' . Criteria::GREATER_THAN . '?', $min_weight, \PDO::PARAM_STR) + ->where('NOT ISNULL(`is_min_weight`.ID)'); } $max_weight = $this->getMax_weight(); - if (null !== $max_weight) { - $search->filterByWeight($max_weight, Criteria::LESS_EQUAL); - }*/ + if (null != $max_weight) { + $isPSELeftJoinList[] = 'is_max_weight'; + $search->joinProductSaleElements('is_max_weight', Criteria::LEFT_JOIN) + ->where('`is_max_weight`.WEIGHT' . Criteria::LESS_THAN . '?', $max_weight, \PDO::PARAM_STR) + ->where('NOT ISNULL(`is_max_weight`.ID)'); + } + + $min_price = $this->getMin_price(); + + if(null !== $min_price) { + $isPSELeftJoinList[] = 'is_min_price'; + $isProductPriceLeftJoinList['is_min_price'] = 'min_price_data'; + $minPriceJoin = new Join(); + $minPriceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'is_min_price', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'min_price_data'); + $minPriceJoin->setJoinType(Criteria::LEFT_JOIN); + + $search->joinProductSaleElements('is_min_price', Criteria::LEFT_JOIN) + ->addJoinObject($minPriceJoin) + ->condition('in_promo', '`is_min_price`.promo'. Criteria::EQUAL .'1') + ->condition('not_in_promo', '`is_min_price`.promo'. Criteria::NOT_EQUAL .'1') + ->condition('min_promo_price', '`min_price_data`.promo_price' . Criteria::GREATER_EQUAL . '?', $min_price, \PDO::PARAM_STR) + ->condition('min_price', '`min_price_data`.price' . Criteria::GREATER_EQUAL . '?', $min_price, \PDO::PARAM_STR) + ->combine(array('in_promo', 'min_promo_price'), Criteria::LOGICAL_AND, 'in_promo_min_price') + ->combine(array('not_in_promo', 'min_price'), Criteria::LOGICAL_AND, 'not_in_promo_min_price') + ->where(array('not_in_promo_min_price', 'in_promo_min_price'), Criteria::LOGICAL_OR); + } + + $max_price = $this->getMax_price(); + + if(null !== $max_price) { + $isPSELeftJoinList[] = 'is_max_price'; + $isProductPriceLeftJoinList['is_max_price'] = 'max_price_data'; + $minPriceJoin = new Join(); + $minPriceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'is_max_price', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'max_price_data'); + $minPriceJoin->setJoinType(Criteria::LEFT_JOIN); + + $search->joinProductSaleElements('is_max_price', Criteria::LEFT_JOIN) + ->addJoinObject($minPriceJoin) + ->condition('in_promo', '`is_max_price`.promo'. Criteria::EQUAL .'1') + ->condition('not_in_promo', '`is_max_price`.promo'. Criteria::NOT_EQUAL .'1') + ->condition('min_promo_price', '`max_price_data`.promo_price' . Criteria::LESS_EQUAL . '?', $max_price, \PDO::PARAM_STR) + ->condition('max_price', '`max_price_data`.price' . Criteria::LESS_EQUAL . '?', $max_price, \PDO::PARAM_STR) + ->combine(array('in_promo', 'min_promo_price'), Criteria::LOGICAL_AND, 'in_promo_max_price') + ->combine(array('not_in_promo', 'max_price'), Criteria::LOGICAL_AND, 'not_in_promo_max_price') + ->where(array('not_in_promo_max_price', 'in_promo_max_price'), Criteria::LOGICAL_OR); + } + + if( $attributeNonStrictMatch != '*' ) { + if($attributeNonStrictMatch == 'none') { + $actuallyUsedAttributeNonStrictMatchList = $isPSELeftJoinList; + } else { + $actuallyUsedAttributeNonStrictMatchList = array_values(array_intersect($isPSELeftJoinList, $attributeNonStrictMatch)); + } + + foreach($actuallyUsedAttributeNonStrictMatchList as $key => $actuallyUsedAttributeNonStrictMatch) { + if($key == 0) + continue; + $search->where('`' . $actuallyUsedAttributeNonStrictMatch . '`.ID=' . '`' . $actuallyUsedAttributeNonStrictMatchList[$key-1] . '`.ID'); + } + } + + /* + * for ordering and outputs, the product will be : + * - new if at least one the criteria matching PSE is new + * - in promo if at least one the criteria matching PSE is in promo + */ + + if(count($isProductPriceLeftJoinList) == 0) { + if(count($isPSELeftJoinList) == 0) { + $joiningTable = "global"; + $isPSELeftJoinList[] = $joiningTable; + $search->joinProductSaleElements('global', Criteria::LEFT_JOIN); + } else { + $joiningTable = $isPSELeftJoinList[0]; + } + + $isProductPriceLeftJoinList[$joiningTable] = 'global_price_data'; + + $minPriceJoin = new Join(); + $minPriceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', $joiningTable, ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'global_price_data'); + $minPriceJoin->setJoinType(Criteria::LEFT_JOIN); + + $search->addJoinObject($minPriceJoin); + } + + /* + * we need to test all promo field from our previous conditions. Indeed ie: + * product P0, attributes color : red + * P0red is in promo and is the only attribute combinaton availability. + * so the product might be consider as in promo (in outputs and ordering) + * We got the following loop to display in promo AND new product but we don't care it's the same attribute which is new and in promo : + * {loop type="product" promo="1" new="1" attribute_non_strict_match="promo,new"} {/loop} + * our request will so far returns 1 line + * + * is_promo.ID | is_promo.PROMO | is_promo.NEWNESS | is_new.ID | is_new.PROMO | is_new.NEWNESS + * NULL NULL NULL red_id 1 0 + * + * So that we can say the product is in global promo only with is_promo.PROMO, we must acknowledge it with (is_promo.PROMO OR is_new.PROMO) + */ + $booleanMatchedPromoList = array(); + $booleanMatchedNewnessList = array(); + foreach($isPSELeftJoinList as $isPSELeftJoin) { + $booleanMatchedPromoList[] = '`' . $isPSELeftJoin . '`.PROMO'; + $booleanMatchedNewnessList[] = '`' . $isPSELeftJoin . '`.NEWNESS'; + } + $booleanMatchedPriceList = array(); + foreach($isProductPriceLeftJoinList as $pSE => $isProductPriceLeftJoin) { + $booleanMatchedPriceList[] = 'CASE WHEN `' . $pSE . '`.PROMO=1 THEN `' . $isProductPriceLeftJoin . '`.PROMO_PRICE ELSE `' . $isProductPriceLeftJoin . '`.PRICE END'; + } + $search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedPromoList) . '), 2)', 'main_product_is_promo'); + $search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedNewnessList) . '), 2)', 'main_product_is_new'); + $search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedPriceList) . '), 2)', 'real_highest_price'); + $search->withColumn('ROUND(MIN(' . implode(' OR ', $booleanMatchedPriceList) . '), 2)', 'real_lowest_price'); + $current = $this->getCurrent(); if ($current === true) { $search->filterById($this->request->get("product_id")); - } elseif ($current === false) { + } elseif($current === false) { $search->filterById($this->request->get("product_id"), Criteria::NOT_IN); } @@ -232,7 +361,7 @@ class Product extends BaseLoop )->find(), Criteria::IN ); - } elseif ($current_category === false) { + } elseif($current_category === false) { $search->filterByCategory( CategoryQuery::create()->filterByProduct( ProductCategoryQuery::create()->filterByProductId( @@ -249,57 +378,6 @@ class Product extends BaseLoop if ($visible != BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0); - $orders = $this->getOrder(); - - foreach ($orders as $order) { - switch ($order) { - case "alpha": - $search->addAscendingOrderByColumn(\Thelia\Model\Map\ProductI18nTableMap::TITLE); - break; - case "alpha-reverse": - $search->addDescendingOrderByColumn(\Thelia\Model\Map\ProductI18nTableMap::TITLE); - break; - /*case "min_price": - $search->orderBy('real_price', Criteria::ASC); - break; - case "max_price": - $search->orderBy('real_price', Criteria::DESC); - break;*/ - case "manual": - if(null === $category || count($category) != 1) - throw new \InvalidArgumentException('Manual order cannot be set without single category argument'); - $search->orderByPosition(Criteria::ASC); - break; - case "manual_reverse": - if(null === $category || count($category) != 1) - throw new \InvalidArgumentException('Manual order cannot be set without single category argument'); - $search->orderByPosition(Criteria::DESC); - break; - case "ref": - $search->orderByRef(Criteria::ASC); - break; - /*case "promo": - $search->orderByPromo(Criteria::DESC); - break; - case "new": - $search->orderByNewness(Criteria::DESC); - break;*/ - case "given_id": - if(null === $id) - throw new \InvalidArgumentException('Given_id order cannot be set without `id` argument'); - foreach ($id as $singleId) { - $givenIdMatched = 'given_id_matched_' . $singleId; - $search->withColumn(ProductTableMap::ID . "='$singleId'", $givenIdMatched); - $search->orderBy($givenIdMatched, Criteria::DESC); - } - break; - case "random": - $search->clearOrderByColumns(); - $search->addAscendingOrderByColumn('RAND()'); - break(2); - } - } - $exclude = $this->getExclude(); if (!is_null($exclude)) { @@ -315,11 +393,11 @@ class Product extends BaseLoop ); } - $feature_available = $this->getFeature_available(); + $feature_availability = $this->getFeature_availability(); - if (null !== $feature_available) { - foreach ($feature_available as $feature => $feature_choice) { - foreach ($feature_choice['values'] as $feature_av) { + if(null !== $feature_availability) { + foreach($feature_availability as $feature => $feature_choice) { + foreach($feature_choice['values'] as $feature_av) { $featureAlias = 'fa_' . $feature; if($feature_av != '*') $featureAlias .= '_' . $feature_av; @@ -331,7 +409,7 @@ class Product extends BaseLoop /* format for mysql */ $sqlWhereString = $feature_choice['expression']; - if ($sqlWhereString == '*') { + if($sqlWhereString == '*') { $sqlWhereString = 'NOT ISNULL(`fa_' . $feature . '`.ID)'; } else { $sqlWhereString = preg_replace('#([0-9]+)#', 'NOT ISNULL(`fa_' . $feature . '_' . '\1`.ID)', $sqlWhereString); @@ -345,9 +423,9 @@ class Product extends BaseLoop $feature_values = $this->getFeature_values(); - if (null !== $feature_values) { - foreach ($feature_values as $feature => $feature_choice) { - foreach ($feature_choice['values'] as $feature_value) { + if(null !== $feature_values) { + foreach($feature_values as $feature => $feature_choice) { + foreach($feature_choice['values'] as $feature_value) { $featureAlias = 'fv_' . $feature; if($feature_value != '*') $featureAlias .= '_' . $feature_value; @@ -359,7 +437,7 @@ class Product extends BaseLoop /* format for mysql */ $sqlWhereString = $feature_choice['expression']; - if ($sqlWhereString == '*') { + if($sqlWhereString == '*') { $sqlWhereString = 'NOT ISNULL(`fv_' . $feature . '`.ID)'; } else { $sqlWhereString = preg_replace('#([a-zA-Z0-9_\-]+)#', 'NOT ISNULL(`fv_' . $feature . '_' . '\1`.ID)', $sqlWhereString); @@ -371,37 +449,87 @@ class Product extends BaseLoop } } - /** - * Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation. - * - * @todo : verify here if we want results for row without translations. - */ - - $search->joinWithI18n( - $this->request->getSession()->getLocale(), - (ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN - ); - $search->groupBy(ProductTableMap::ID); + $orders = $this->getOrder(); + + foreach($orders as $order) { + switch ($order) { + case "alpha": + $search->addAscendingOrderByColumn('i18n_TITLE'); + break; + case "alpha_reverse": + $search->addDescendingOrderByColumn('i18n_TITLE'); + break; + case "min_price": + $search->addAscendingOrderByColumn('real_lowest_price', Criteria::ASC); + break; + case "max_price": + $search->addDescendingOrderByColumn('real_lowest_price'); + break; + case "manual": + if(null === $category || count($category) != 1) + throw new \InvalidArgumentException('Manual order cannot be set without single category argument'); + $search->orderByPosition(Criteria::ASC); + break; + case "manual_reverse": + if(null === $category || count($category) != 1) + throw new \InvalidArgumentException('Manual order cannot be set without single category argument'); + $search->orderByPosition(Criteria::DESC); + break; + case "ref": + $search->orderByRef(Criteria::ASC); + break; + case "promo": + $search->addDescendingOrderByColumn('main_product_is_promo'); + break; + case "new": + $search->addDescendingOrderByColumn('main_product_is_new'); + break; + case "given_id": + if(null === $id) + throw new \InvalidArgumentException('Given_id order cannot be set without `id` argument'); + foreach($id as $singleId) { + $givenIdMatched = 'given_id_matched_' . $singleId; + $search->withColumn(ProductTableMap::ID . "='$singleId'", $givenIdMatched); + $search->orderBy($givenIdMatched, Criteria::DESC); + } + break; + case "random": + $search->clearOrderByColumns(); + $search->addAscendingOrderByColumn('RAND()'); + break(2); + } + } + + /* perform search */ $products = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($products); foreach ($products as $product) { - $loopResultRow = new LoopResultRow(); + $loopResultRow = new LoopResultRow($loopResult, $product, $this->versionable, $this->timestampable, $this->countable); + + $price = $product->getRealLowestPrice(); + $taxedPrice = $product->getTaxedPrice( + CountryQuery::create()->findOneById(64) // @TODO : make it magic + ); + $loopResultRow->set("ID", $product->getId()) ->set("REF",$product->getRef()) - ->set("TITLE",$product->getTitle()) - ->set("CHAPO", $product->getChapo()) - ->set("DESCRIPTION", $product->getDescription()) - ->set("POSTSCRIPTUM", $product->getPostscriptum()) - //->set("PRICE", $product->getPrice()) - //->set("PROMO_PRICE", $product->getPrice2()) - //->set("WEIGHT", $product->getWeight()) - //->set("PROMO", $product->getPromo()) - //->set("NEW", $product->getNewness()) + ->set("IS_TRANSLATED",$product->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("TITLE",$product->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO", $product->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION", $product->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM", $product->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("URL", $product->getUrl($locale)) + ->set("BEST_PRICE", $price) + ->set("BEST_PRICE_TAX", $taxedPrice - $price) + ->set("BEST_TAXED_PRICE", $taxedPrice) + ->set("IS_PROMO", $product->getVirtualColumn('main_product_is_promo')) + ->set("IS_NEW", $product->getVirtualColumn('main_product_is_new')) ->set("POSITION", $product->getPosition()) ; @@ -410,5 +538,4 @@ class Product extends BaseLoop return $loopResult; } - } diff --git a/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php b/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php new file mode 100755 index 000000000..ec4c73230 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php @@ -0,0 +1,156 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; + +use Propel\Runtime\ActiveQuery\Criteria; +use Propel\Runtime\ActiveQuery\Join; +use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; + +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Log\Tlog; + +use Thelia\Model\Base\ProductSaleElementsQuery; +use Thelia\Model\ConfigQuery; +use Thelia\Model\CountryQuery; +use Thelia\Type\TypeCollection; +use Thelia\Type; + +/** + * + * Product Sale Elements loop + * + * @todo : manage currency and attribute_availability + * + * Class ProductSaleElements + * @package Thelia\Core\Template\Loop + * @author Etienne Roudeix + */ +class ProductSaleElements extends BaseLoop +{ + public $timestampable = true; + + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('currency'), + Argument::createIntTypeArgument('product', null, true), + new Argument( + 'attribute_availability', + new TypeCollection( + new Type\IntToCombinedIntsListType() + ) + ), + new Argument( + 'order', + new TypeCollection( + new Type\EnumListType(array('alpha', 'alpha_reverse', 'attribute', 'attribute_reverse')) + ), + 'attribute' + ) + ); + } + + /** + * @param $pagination + * + * @return \Thelia\Core\Template\Element\LoopResult + */ + public function exec(&$pagination) + { + $search = ProductSaleElementsQuery::create(); + + $product = $this->getProduct(); + + $search->filterByProductId($product, Criteria::EQUAL); + + $orders = $this->getOrder(); + + foreach($orders as $order) { + switch ($order) { + case "alpha": + //$search->addAscendingOrderByColumn(\Thelia\Model\Map\AttributeI18nTableMap::TITLE); + break; + case "alpha_reverse": + //$search->addDescendingOrderByColumn(\Thelia\Model\Map\AttributeI18nTableMap::TITLE); + break; + case "attribute": + //$search->orderByPosition(Criteria::ASC); + break; + case "attribute_reverse": + //$search->orderByPosition(Criteria::DESC); + break; + } + } + + $currency = $this->getCurrency(); + + $search->joinProductPrice('price', Criteria::INNER_JOIN); + //->addJoinCondition('price', ''); + + $search->withColumn('`price`.CURRENCY_ID', 'price_CURRENCY_ID') + ->withColumn('`price`.PRICE', 'price_PRICE') + ->withColumn('`price`.PROMO_PRICE', 'price_PROMO_PRICE'); + + $PSEValues = $this->search($search, $pagination); + + $loopResult = new LoopResult($PSEValues); + + foreach ($PSEValues as $PSEValue) { + $loopResultRow = new LoopResultRow($loopResult, $PSEValue, $this->versionable, $this->timestampable, $this->countable); + + $price = $PSEValue->getPrice(); + $taxedPrice = $PSEValue->getTaxedPrice( + CountryQuery::create()->findOneById(64) // @TODO : make it magic + ); + $promoPrice = $PSEValue->getPromoPrice(); + $taxedPromoPrice = $PSEValue->getTaxedPromoPrice( + CountryQuery::create()->findOneById(64) // @TODO : make it magic + ); + + $loopResultRow->set("ID", $PSEValue->getId()) + ->set("QUANTITY", $PSEValue->getQuantity()) + ->set("IS_PROMO", $PSEValue->getPromo() === 1 ? 1 : 0) + ->set("IS_NEW", $PSEValue->getNewness() === 1 ? 1 : 0) + ->set("WEIGHT", $PSEValue->getWeight()) + + ->set("CURRENCY", $PSEValue->getVirtualColumn('price_CURRENCY_ID')) + ->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); + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Title.php b/core/lib/Thelia/Core/Template/Loop/Title.php index b4b7c5421..4243f83f1 100755 --- a/core/lib/Thelia/Core/Template/Loop/Title.php +++ b/core/lib/Thelia/Core/Template/Loop/Title.php @@ -24,7 +24,7 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -43,8 +43,10 @@ use Thelia\Model\ConfigQuery; * @package Thelia\Core\Template\Loop * @author Etienne Roudeix */ -class Title extends BaseLoop +class Title extends BaseI18nLoop { + public $timestampable = true; + /** * @return ArgumentCollection */ @@ -64,35 +66,31 @@ class Title extends BaseLoop { $search = CustomerTitleQuery::create(); + /* manage translations */ + $locale = $this->configureI18nProcessing($search, array('SHORT', 'LONG')); + $id = $this->getId(); if (null !== $id) { $search->filterById($id, Criteria::IN); } - /** - * Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation. - * - * @todo : verify here if we want results for row without translations. - */ - - $search->joinWithI18n( - $this->request->getSession()->getLocale(), - (ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN - ); - $search->orderByPosition(); + /* perform search */ $titles = $this->search($search, $pagination); - $loopResult = new LoopResult(); + $loopResult = new LoopResult($titles); foreach ($titles as $title) { - $loopResultRow = new LoopResultRow(); - $loopResultRow->set("ID", $title->getId()); - $loopResultRow->set("DEFAULT", $title->getByDefault()); - $loopResultRow->set("SHORT", $title->getShort()); - $loopResultRow->set("LONG", $title->getLong()); + $loopResultRow = new LoopResultRow($loopResult, $title, $this->versionable, $this->timestampable, $this->countable); + $loopResultRow->set("ID", $title->getId()) + ->set("IS_TRANSLATED",$title->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE",$locale) + ->set("DEFAULT", $title->getByDefault()) + ->set("SHORT", $title->getVirtualColumn('i18n_SHORT')) + ->set("LONG", $title->getVirtualColumn('i18n_LONG')) + ->set("POSITION", $title->getPosition()); $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Core/Template/ParserContext.php b/core/lib/Thelia/Core/Template/ParserContext.php old mode 100644 new mode 100755 index 03c3cf45f..90079abf5 --- a/core/lib/Thelia/Core/Template/ParserContext.php +++ b/core/lib/Thelia/Core/Template/ParserContext.php @@ -40,11 +40,7 @@ class ParserContext implements \IteratorAggregate public function __construct(Request $request) { // Setup basic variables - $this - ->set('BASE_URL' , ConfigQuery::read('base_url', '/')) - ->set('INDEX_PAGE' , URL::getIndexPage()) - ->set('RETURN_TO_URL' , URL::absoluteUrl($request->getSession()->getReturnToUrl())) - ->set('THELIA_VERSION' , ConfigQuery::read('thelia_version', 'undefined')) + $this->set('THELIA_VERSION' , ConfigQuery::read('thelia_version', 'undefined')) ; } @@ -53,24 +49,23 @@ class ParserContext implements \IteratorAggregate /** * @param BaseForm $form the errored form */ - public function setErrorForm(BaseForm $form) + public function addForm(BaseForm $form) { - $this->set('error_form', $form); + $this->set($form->getName(), $form); + + return $this; + } + + public function getForm($name) + { + return $this->get($name, null); } public function setGeneralError($error) { $this->set('general_error', $error); - } - public function getErrorForm() - { - return $this->get('error_form', null); - } - - public function clearErrorForm() - { - return $this->remove('error_form'); + return $this; } // -- Internal table manipulation ------------------------------------------ diff --git a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php index a07eba565..f19eded95 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php +++ b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php @@ -34,18 +34,22 @@ class SmartyAssetsManager private $web_root; private $path_relative_to_web_root; + private $developmentMode; /** * Creates a new SmartyAssetsManager instance * - * @param string $web_root the disk path to the web root - * @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated + * @param string $web_root the disk path to the web root + * @param string $path_relative_to_web_root the path (relative to web root) where the assets will be generated + * @param boolean $developmentMode true / false. If true, assets are not cached, and always generated. */ - public function __construct($web_root, $path_relative_to_web_root) + public function __construct($web_root, $path_relative_to_web_root, $developmentMode) { $this->web_root = $web_root; $this->path_relative_to_web_root = $path_relative_to_web_root; + $this->developmentMode = $developmentMode; + $this->assetic_manager = new AsseticHelper(); } @@ -70,10 +74,11 @@ class SmartyAssetsManager $url = $this->assetic_manager->asseticize( $asset_dir.'/'.$asset_file, $this->web_root."/".$this->path_relative_to_web_root, - URL::absoluteUrl($this->path_relative_to_web_root, null, URL::PATH_TO_FILE /* path only */), + URL::getInstance()->absoluteUrl($this->path_relative_to_web_root, null, URL::PATH_TO_FILE /* path only */), $assetType, $filters, - $debug + $debug, + $this->developmentMode ); return $url; diff --git a/core/lib/Thelia/Core/Template/Smarty/Exception/SmartyPluginException.php b/core/lib/Thelia/Core/Template/Smarty/Exception/SmartyPluginException.php new file mode 100644 index 000000000..fdaf93608 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Smarty/Exception/SmartyPluginException.php @@ -0,0 +1,33 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Smarty\Exception; + + +/** + * Class SmartyPluginException + * @package Thelia\Core\Template\Smarty\Exception + * @author Manuel Raynaud + */ +class SmartyPluginException extends \SmartyException +{} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php new file mode 100644 index 000000000..bb9770520 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php @@ -0,0 +1,144 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Smarty\Plugins; + +use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; +use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; +use Thelia\Tools\URL; +use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\Security\SecurityContext; + +/** + * This class implements variour admin template utilities + * + * @author Franck Allimant + */ +class AdminUtilities extends AbstractSmartyPlugin +{ + private $securityContext; + + public function __construct(SecurityContext $securityContext) + { + $this->securityContext = $securityContext; + } + + public function generatePositionChangeBlock($params, &$smarty) { + // The required permissions + $permission = $this->getParam($params, 'permission'); + + // The base position change path + $path = $this->getParam($params, 'path'); + + // The URL parameter the object ID is assigned + $url_parameter = $this->getParam($params, 'url_parameter'); + + // The current object position + $position = $this->getParam($params, 'position'); + + // The object ID + $id = $this->getParam($params, 'id'); + + // The in place dition class + $in_place_edit_class = $this->getParam($params, 'in_place_edit_class'); + + /* + + {$POSITION} + + */ + + if ($permissions == null || $this->securityContext->isGranted("ADMIN", array($permission))) { + return sprintf( + '%s', + URL::getInstance()->absoluteUrl($path, array('mode' => 'up', $url_parameter => $id)), + $in_place_edit_class, + $id, + $position, + URL::getInstance()->absoluteUrl($path, array('mode' => 'down', $url_parameter => $id)) + ); + } + else { + return $position; + } + } + + + /** + * Generates the link of a sortable column header + * + * @param array $params + * @param unknown $smarty + * @return string no text is returned. + */ + public function generateSortableColumnHeader($params, &$smarty) + { + // The current order of the table + $current_order = $this->getParam($params, 'current_order'); + + // The column ascending order + $order = $this->getParam($params, 'order'); + + // The column descending order label + $reverse_order = $this->getParam($params, 'reverse_order'); + + // The order change path + $path = $this->getParam($params, 'path'); + + // The column label + $label = $this->getParam($params, 'label'); + + if ($current_order == $order) { + $icon = 'up'; + $order_change = $reverse_order; + } + else if ($current_order == $reverse_order) { + $icon = 'down'; + $order_change = $order; + } + else { + $order_change = $order; + } + + if (! empty($icon)) + $output = sprintf(' ', $icon); + else + $output = ''; + + return sprintf('%s%s', $output, URL::getInstance()->absoluteUrl($path, array('order' => $order_change)), $label); + } + + + /** + * Define the various smarty plugins handled by this class + * + * @return an array of smarty plugin descriptors + */ + public function getPluginDescriptors() + { + return array( + new SmartyPluginDescriptor('function', 'admin_sortable_header', $this, 'generateSortableColumnHeader'), + new SmartyPluginDescriptor('function', 'admin_position_block' , $this, 'generatePositionChangeBlock'), + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Assetic.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Assetic.php index f8ea1c2ef..b7bb95b83 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Assetic.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Assetic.php @@ -32,13 +32,13 @@ class Assetic extends AbstractSmartyPlugin { public $assetManager; - public function __construct() + public function __construct($developmentMode) { $web_root = THELIA_WEB_DIR; $asset_dir_from_web_root = ConfigQuery::read('asset_dir_from_web_root', 'assets'); - $this->assetManager = new SmartyAssetsManager($web_root, $asset_dir_from_web_root); + $this->assetManager = new SmartyAssetsManager($web_root, $asset_dir_from_web_root, $developmentMode == 'dev'); } public function blockJavascripts($params, $content, \Smarty_Internal_Template $template, &$repeat) diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php old mode 100644 new mode 100755 index d9f08bbdf..1fdb6e4bf --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php @@ -23,10 +23,20 @@ namespace Thelia\Core\Template\Smarty\Plugins; +use Propel\Runtime\ActiveQuery\ModelCriteria; +use Symfony\Component\HttpFoundation\Request; 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\CategoryQuery; +use Thelia\Model\ContentQuery; +use Thelia\Model\FolderQuery; +use Thelia\Model\Product; +use Thelia\Model\ProductQuery; +use Thelia\Model\Tools\ModelCriteriaTools; +use Thelia\Tools\DateTimeFormat; + /** * Implementation of data access to main Thelia objects (users, cart, etc.) * @@ -37,10 +47,13 @@ class DataAccessFunctions extends AbstractSmartyPlugin { private $securityContext; protected $parserContext; + protected $request; - public function __construct(SecurityContext $securityContext, ParserContext $parserContext) + public function __construct(Request $request, SecurityContext $securityContext, ParserContext $parserContext) { $this->securityContext = $securityContext; + $this->parserContext = $parserContext; + $this->request = $request; } /** @@ -52,7 +65,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin */ public function adminDataAccess($params, &$smarty) { - return $this->userDataAccess("Admin User", SecurityContext::CONTEXT_BACK_OFFICE, $params); + return $this->dataAccess("Admin User", $params, $this->securityContext->getAdminUser()); } /** @@ -64,38 +77,146 @@ class DataAccessFunctions extends AbstractSmartyPlugin */ public function customerDataAccess($params, &$smarty) { - return $this->userDataAccess("Customer User", SecurityContext::CONTEXT_FRONT_OFFICE, $params); + return $this->dataAccess("Customer User", $params, $this->securityContext->getCustomerUser()); } + public function productDataAccess($params, &$smarty) + { + $productId = $this->request->get('product_id'); + + if($productId !== null) { + + $search = ProductQuery::create() + ->filterById($productId); + + return $this->dataAccessWithI18n("Product", $params, $search); + } + } + + public function categoryDataAccess($params, &$smarty) + { + $categoryId = $this->request->get('category_id'); + + if($categoryId !== null) { + + $search = CategoryQuery::create() + ->filterById($categoryId); + + return $this->dataAccessWithI18n("Category", $params, $search); + } + } + + public function contentDataAccess($params, &$smarty) + { + $contentId = $this->request->get('content_id'); + + if($contentId !== null) { + + $search = ContentQuery::create() + ->filterById($contentId); + + return $this->dataAccessWithI18n("Content", $params, $search); + } + } + + public function folderDataAccess($params, &$smarty) + { + $folderId = $this->request->get('folder_id'); + + if($folderId !== null) { + + $search = FolderQuery::create() + ->filterById($folderId); + + return $this->dataAccessWithI18n("Folder", $params, $search); + } + } + /** - * Provides access to user attributes using the accessors. + * @param $objectLabel + * @param $params + * @param ModelCriteria $search + * @param array $columns + * @param null $foreignTable + * @param string $foreignKey * - * @param array $params - * @param unknown $smarty - * @return string the value of the requested attribute - * @throws InvalidArgumentException if the object does not have the requested attribute. + * @return string */ - protected function userDataAccess($objectLabel, $context, $params) - { - $attribute = $this->getNormalizedParam($params, array('attribute', 'attrib', 'attr')); + protected function dataAccessWithI18n($objectLabel, $params, ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID') + { + $lang = $this->getNormalizedParam($params, array('lang')); + if($lang === null) { + $lang = $this->request->getSession()->getLang()->getId(); + } - if (! empty($attribute)) { - $user = $this->securityContext->setContext($context)->getUser(); + ModelCriteriaTools::getI18n( + false, + $lang, + $search, + $this->request->getSession()->getLang()->getLocale(), + $columns, + $foreignTable, + $foreignKey, + true + ); - if (null != $user) { - $getter = sprintf("get%s", ucfirst($attribute)); + $data = $search->findOne(); - if (method_exists($user, $getter)) { - return $user->$getter(); - } + $noGetterData = array(); + foreach($columns as $column) { + $noGetterData[$column] = $data->getVirtualColumn('i18n_' . $column); + } - throw new \InvalidArgumentException(sprintf("%s has no '%s' attribute", $objectLabel, $attribute)); + return $this->dataAccess($objectLabel, $params, $data, $noGetterData); + } - } - } + /** + * @param $objectLabel + * @param $params + * @param $data + * @param array $noGetterData + * + * @return string + * @throws \InvalidArgumentException + */ + protected function dataAccess($objectLabel, $params, $data, $noGetterData = array()) + { + $attribute = $this->getNormalizedParam($params, array('attribute', 'attrib', 'attr')); + + if (! empty($attribute)) { + + if (null != $data) { + + $keyAttribute = strtoupper($attribute); + if(array_key_exists($keyAttribute, $noGetterData)) { + return $noGetterData[$keyAttribute]; + } + + $getter = sprintf("get%s", ucfirst($attribute)); + if (method_exists($data, $getter)) { + $return = $data->$getter(); + + if($return instanceof \DateTime) { + if (array_key_exists("format", $params)) { + $format = $params["format"]; + } else { + $format = DateTimeFormat::getInstance($this->request)->getFormat(array_key_exists("output", $params) ? $params["output"] : null); + } + + $return = $return->format($format); + } + + return $return; + } + + throw new \InvalidArgumentException(sprintf("%s has no '%s' attribute", $objectLabel, $attribute)); + + } + } + + return ''; + } - return ''; - } /** * Define the various smarty plugins hendled by this class * @@ -105,7 +226,11 @@ class DataAccessFunctions extends AbstractSmartyPlugin { return array( new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'), - new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess') + new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess'), + new SmartyPluginDescriptor('function', 'product', $this, 'productDataAccess'), + new SmartyPluginDescriptor('function', 'category', $this, 'categoryDataAccess'), + new SmartyPluginDescriptor('function', 'content', $this, 'contentDataAccess'), + new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'), ); } } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php index 5216dbfbe..625c89e1f 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php @@ -82,6 +82,7 @@ class Form extends AbstractSmartyPlugin public function generateForm($params, $content, \Smarty_Internal_Template $template, &$repeat) { + if ($repeat) { $name = $this->getParam($params, 'name'); @@ -93,15 +94,11 @@ class Form extends AbstractSmartyPlugin $instance = $this->createInstance($name); // Check if parser context contains our form - $errorForm = $this->parserContext->getErrorForm(); + $form = $this->parserContext->getForm($instance->getName()); - if (null != $errorForm && $errorForm->getName() == $instance->getName()) { - - // Re-use the errored form - $instance = $errorForm; - - // Don't do that, as we may want to use this form firther in the template code - //$this->parserContext->clearErrorForm(); + if (null != $form) { + // Re-use the form + $instance = $form; } $instance->createView(); @@ -110,7 +107,8 @@ class Form extends AbstractSmartyPlugin $template->assign("form_error", $instance->hasError() ? true : false); $template->assign("form_error_message", $instance->getErrorMessage()); - } else { + } + else { return $content; } } @@ -122,9 +120,17 @@ class Form extends AbstractSmartyPlugin $formFieldView = $this->getFormFieldView($params); $template->assign("options", $formFieldView->vars); + $template->assign("name", $formFieldView->vars["full_name"]); $template->assign("value", $formFieldView->vars["value"]); + + // If Checkbox input type + if ($formFieldView->vars['checked'] !== null) { + $this->renderFormFieldCheckBox($template, $formFieldView); + } + $template->assign("label", $formFieldView->vars["label"]); + $template->assign("label_attr", $formFieldView->vars["label_attr"]); $errors = $formFieldView->vars["errors"]; @@ -267,4 +273,17 @@ class Form extends AbstractSmartyPlugin new SmartyPluginDescriptor("block", "form_error", $this, "formError") ); } + + /** + * @param \Smarty_Internal_Template $template + * @param $formFieldView + */ + public function renderFormFieldCheckBox(\Smarty_Internal_Template $template, $formFieldView) + { + $template->assign("value", 0); + if ($formFieldView->vars['checked']) { + $template->assign("value", 1); + } + $template->assign("value", $formFieldView->vars['checked']); + } } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php new file mode 100644 index 000000000..3deffc1aa --- /dev/null +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Format.php @@ -0,0 +1,142 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Smarty\Plugins; + +use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; +use Thelia\Core\Template\Smarty\Exception\SmartyPluginException; +use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; +use Thelia\Tools\DateTimeFormat; + +/** + * + * format_date and format_date smarty function. + * + * Class Format + * @package Thelia\Core\Template\Smarty\Plugins + * @author Manuel Raynaud + */ +class Format extends AbstractSmartyPlugin +{ + protected $request; + + public function __construct(Request $request) + { + $this->request = $request; + } + + /** + * return date in expected format + * + * available parameters : + * date => DateTime object (mandatory) + * format => expected format + * output => list of default system format. Values available : + * date => date format + * time => time format + * datetime => datetime format (default) + * + * ex : + * {format_date date=$dateTimeObject format="Y-m-d H:i:s"} will output the format with specific format + * {format_date date=$dateTimeObject output="date"} will output the date using the default date system format + * {format_date date=$dateTimeObject} will output with the default datetime system format + * + * @param array $params + * @param null $template + * @throws \Thelia\Core\Template\Smarty\Exception\SmartyPluginException + * @return string + */ + public function formatDate($params, $template = null) + { + + if (array_key_exists("date", $params) === false) { + throw new SmartyPluginException("date is a mandatory parameter in format_date function"); + } + + $date = $params["date"]; + + if(!$date instanceof \DateTime) { + return ""; + } + + if (array_key_exists("format", $params)) { + $format = $params["format"]; + } else { + $format = DateTimeFormat::getInstance($this->request)->getFormat(array_key_exists("output", $params) ? $params["output"] : null); + } + + return $date->format($format); + + } + + /** + * + * display numbers in expected format + * + * available parameters : + * number => int or float number + * decimals => how many decimals format expected + * dec_point => separator for the decimal point + * thousands_sep => thousands separator + * + * ex : {format_number number="1246.12" decimals="1" dec_point="," thousands_sep=" "} will output "1 246,1" + * + * @param $params + * @param null $template + * @throws \Thelia\Core\Template\Smarty\Exception\SmartyPluginException + * @return string the expected number formatted + */ + public function formatNumber($params, $template = null) + { + if (array_key_exists("number", $params) === false) { + throw new SmartyPluginException("number is a mandatory parameter in format_number function"); + } + + $number = $params["number"]; + + if(empty($number)) { + return ""; + } + + $lang = $this->request->getSession()->getLang(); + + + $decimals = array_key_exists("decimals", $params) ? $params["decimals"] : $lang->getDecimals(); + $decPoint = array_key_exists("dec_point", $params) ? $params["dec_point"] : $lang->getDecimalSeparator(); + $thousandsSep = array_key_exists("thousands_sep", $params) ? $params["thousands_sep"] : $lang->getThousandsSeparator(); + + return number_format($number, $decimals, $decPoint, $thousandsSep); + } + + /** + * @return an array of SmartyPluginDescriptor + */ + public function getPluginDescriptors() + { + return array( + new SmartyPluginDescriptor("function", "format_date", $this, "formatDate"), + new SmartyPluginDescriptor("function", "format_number", $this, "formatNumber") + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php index eb19d97f5..24d2c29ee 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php @@ -46,11 +46,6 @@ class Security extends AbstractSmartyPlugin */ public function checkAuthFunction($params, &$smarty) { - // Context: 'front' or 'admin' - $context = $this->getNormalizedParam($params, 'context'); - - $this->securityContext->setContext($context); - $roles = $this->_explode($this->getParam($params, 'roles')); $permissions = $this->_explode($this->getParam($params, 'permissions')); diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php index a6eaa2e56..e9c91b7df 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php @@ -61,7 +61,7 @@ class TheliaLoop extends AbstractSmartyPlugin */ public static function getPagination($loopId) { - if (!empty(self::$pagination[$loopId])) { + if(!empty(self::$pagination[$loopId])) { return self::$pagination[$loopId]; } else { return null; @@ -75,8 +75,9 @@ class TheliaLoop extends AbstractSmartyPlugin { $type = $this->getParam($params, 'type'); - if (null == $type) + if (null == $type) { throw new \InvalidArgumentException("Missing 'type' parameter in count arguments"); + } $loop = $this->createLoopInstance($params); @@ -101,13 +102,15 @@ class TheliaLoop extends AbstractSmartyPlugin { $name = $this->getParam($params, 'name'); - if (null == $name) + if (null == $name) { throw new \InvalidArgumentException("Missing 'name' parameter in loop arguments"); + } $type = $this->getParam($params, 'type'); - if (null == $type) + if (null == $type) { throw new \InvalidArgumentException("Missing 'type' parameter in loop arguments"); + } if ($content === null) { // Check if a loop with the same name exists in the current scope, and abort if it's the case. @@ -133,6 +136,7 @@ class TheliaLoop extends AbstractSmartyPlugin } if ($loopResults->valid()) { + $loopResultRow = $loopResults->current(); // On first iteration, save variables that may be overwritten by this loop @@ -141,8 +145,6 @@ class TheliaLoop extends AbstractSmartyPlugin $saved_vars = array(); $varlist = $loopResultRow->getVars(); - $varlist[] = 'LOOP_COUNT'; - $varlist[] = 'LOOP_TOTAL'; foreach ($varlist as $var) { $saved_vars[$var] = $template->getTemplateVars($var); @@ -158,10 +160,6 @@ class TheliaLoop extends AbstractSmartyPlugin $repeat = true; } - // Assign meta information - $template->assign('LOOP_COUNT', 1 + $loopResults->key()); - $template->assign('LOOP_TOTAL', $loopResults->getCount()); - // Loop is terminated. Cleanup. if (! $repeat) { // Restore previous variables values before terminating @@ -295,26 +293,24 @@ class TheliaLoop extends AbstractSmartyPlugin } /** + * @param $smartyParams * - * find the loop class with his name and construct an instance of this class - * - * @param string $name - * @return \Thelia\Core\Template\Element\BaseLoop - * @throws InvalidElementException - * @throws ElementNotFoundException + * @return object + * @throws \Thelia\Core\Template\Element\Exception\InvalidElementException + * @throws \Thelia\Core\Template\Element\Exception\ElementNotFoundException */ protected function createLoopInstance($smartyParams) { $type = strtolower($smartyParams['type']); if (! isset($this->loopDefinition[$type])) { - throw new ElementNotFoundException(sprintf("%s loop does not exists", $type)); + throw new ElementNotFoundException(sprintf("'%s' loop type does not exists", $type)); } $class = new \ReflectionClass($this->loopDefinition[$type]); if ($class->isSubclassOf("Thelia\Core\Template\Element\BaseLoop") === false) { - throw new InvalidElementException(sprintf("%s Loop class have to extends Thelia\Core\Template\Element\BaseLoop", + throw new InvalidElementException(sprintf("'%s' Loop class should extends Thelia\Core\Template\Element\BaseLoop", $type)); } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php old mode 100644 new mode 100755 index b3814f088..f6c20ecfb --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php @@ -47,14 +47,15 @@ class UrlGenerator extends AbstractSmartyPlugin public function generateUrlFunction($params, &$smarty) { // the path to process - $path = $this->getParam($params, 'path'); + $path = $this->getParam($params, 'path'); - $target = $this->getParam($params, 'target', null); + $target = $this->getParam($params, 'target', null); - $url = URL::absoluteUrl($path, $this->getArgsFromParam($params, array('path', 'target'))); + $url = URL::getInstance()->absoluteUrl($path, $this->getArgsFromParam($params, array('path', 'target'))); - if ($target != null) $url .= '#'.$target; - return $url; + if ($target != null) $url .= '#'.$target; + + return $url; } /** @@ -81,6 +82,15 @@ class UrlGenerator extends AbstractSmartyPlugin return $this->generateViewUrlFunction($params, true); } + public function navigateToUrlFunction($params, &$smarty) + { + $to = $this->getParam($params, 'to', null); + + $toMethod = $this->getNavigateToMethod($to); + + return $this->$toMethod(); + } + protected function generateViewUrlFunction($params, $forAdmin) { // the view name (without .html) @@ -92,7 +102,7 @@ class UrlGenerator extends AbstractSmartyPlugin $args = $this->getArgsFromParam($params, array('view', 'action', 'target')); if (! empty($action)) $args['action'] = $action; - return $forAdmin ? URL::adminViewUrl($view, $args) : URL::viewUrl($view, $args); + return $forAdmin ? URL::getInstance()->adminViewUrl($view, $args) : URL::getInstance()->viewUrl($view, $args); } /** @@ -125,7 +135,50 @@ class UrlGenerator extends AbstractSmartyPlugin return array( new SmartyPluginDescriptor('function', 'url', $this, 'generateUrlFunction'), new SmartyPluginDescriptor('function', 'viewurl', $this, 'generateFrontViewUrlFunction'), - new SmartyPluginDescriptor('function', 'admin_viewurl', $this, 'generateAdminViewUrlFunction') + new SmartyPluginDescriptor('function', 'admin_viewurl', $this, 'generateAdminViewUrlFunction'), + new SmartyPluginDescriptor('function', 'navigate', $this, 'navigateToUrlFunction'), ); } + + /** + * @return array sur le format "to_value" => "method_name" + */ + protected function getNavigateToValues() + { + return array( + "current" => "getCurrentUrl", + "return_to" => "getReturnToUrl", + "index" => "getIndexUrl", + ); + } + + protected function getNavigateToMethod($to) + { + if($to === null) { + throw new \InvalidArgumentException("Missing 'to' parameter in `navigate` substitution."); + } + + $navigateToValues = $this->getNavigateToValues(); + + if(!array_key_exists($to, $navigateToValues)) { + throw new \InvalidArgumentException("Incorrect value for parameter `to` in `navigate` substitution."); + } + + return $navigateToValues[$to]; + } + + protected function getCurrentUrl() + { + return URL::getInstance()->retrieveCurrent($this->request)->toString(); + } + + protected function getReturnToUrl() + { + return URL::getInstance()->absoluteUrl($this->request->getSession()->getReturnToUrl()); + } + + protected function getIndexUrl() + { + return URL::getInstance()->getIndexPage(); + } } diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php index ed74fe3f0..ad656df32 100755 --- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php +++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php @@ -36,6 +36,7 @@ class SmartyParser extends Smarty implements ParserInterface /** * @param Request $request * @param EventDispatcherInterface $dispatcher + * @param ParserContext $parserContext * @param bool $template * @param string $env * @param bool $debug @@ -64,7 +65,7 @@ class SmartyParser extends Smarty implements ParserInterface $this->setTemplate($template ?: ConfigQuery::read('active-template', 'default')); $this->debugging = $debug; - + // Prevent smarty ErrorException: Notice: Undefined index bla bla bla... $this->error_reporting = E_ALL ^ E_NOTICE; @@ -83,12 +84,13 @@ class SmartyParser extends Smarty implements ParserInterface $this->registerFilter('pre', array($this, "preThelia")); $this->registerFilter('output', array($this, "removeBlankLines")); + $this->registerFilter('variable', array(__CLASS__, "theliaEscape")); } public function preThelia($tpl_source, \Smarty_Internal_Template $template) { - $new_source = preg_replace('`{#([a-zA-Z][a-zA-Z0-9\-_]*)(.*)}`', '{\$$1$2}', $tpl_source); - $new_source = preg_replace('`#([a-zA-Z][a-zA-Z0-9\-_]*)`', '{\$$1|dieseCanceller:\'#$1\'}', $new_source); + $new_source = preg_replace('`{#([a-zA-Z][a-zA-Z0-9_]*)(.*)}`', '{\$$1$2}', $tpl_source); + $new_source = preg_replace('`#([a-zA-Z][a-zA-Z0-9_]*)`', '{\$$1|dieseCanceller:\'#$1\'}', $new_source); return $new_source; } @@ -98,6 +100,15 @@ class SmartyParser extends Smarty implements ParserInterface return preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $tpl_source); } + public static function theliaEscape($content, $smarty) + { + if(!is_object($content)) { + return htmlspecialchars($content ,ENT_QUOTES, Smarty::$_CHARSET); + } else { + return $content; + } + } + public function setTemplate($template_path_from_template_base) { $this->template = $template_path_from_template_base; @@ -212,14 +223,14 @@ class SmartyParser extends Smarty implements ParserInterface $templateDir = realpath(THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/"); if (strpos($pathFileName, $templateDir) !== 0) { - throw new ResourceNotFoundException(sprintf("%s view does not exists", $file)); + throw new ResourceNotFoundException(sprintf("'%s' view does not exists", $file)); } if (!file_exists($fileName)) { $fileName .= ".html"; if (!file_exists($fileName)) { - throw new ResourceNotFoundException(sprintf("%s file not found in %s template", $file, $this->template)); + throw new ResourceNotFoundException(sprintf("'%s' file not found in %s template", $file, $this->template)); } } diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index 54a3fd13c..e5148e408 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -26,19 +26,22 @@ namespace Thelia\Core; /** * Root class of Thelia * - * It extends Symfony\Component\HttpKernel\Kernel for changing some fonctionnality + * It extends Symfony\Component\HttpKernel\Kernel for changing some features * * * @author Manuel Raynaud */ use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\Validator\Tests\Fixtures\Reference; use Symfony\Component\Yaml\Yaml; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Thelia\Core\Bundle; +use Thelia\Core\Event\TheliaEvents; use Thelia\Log\Tlog; use Thelia\Config\DatabaseConfiguration; use Thelia\Config\DefinePropel; @@ -73,7 +76,6 @@ class Thelia extends Kernel $definePropel = new DefinePropel(new DatabaseConfiguration(), Yaml::parse(THELIA_ROOT . '/local/config/database.yml')); - $propelConfig = $definePropel->getConfig(); $serviceContainer = Propel::getServiceContainer(); $serviceContainer->setAdapterClass('thelia', 'mysql'); $manager = new ConnectionManagerSingle(); @@ -81,13 +83,21 @@ class Thelia extends Kernel $serviceContainer->setConnectionManager('thelia', $manager); if ($this->isDebug()) { - $serviceContainer->setLogger('defaultLogger', Tlog::getInstance()); - $con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME); $con->useDebug(true); } } + /** + * dispatch an event when application is boot + */ + public function boot() + { + parent::boot(); + + $this->getContainer()->get("event_dispatcher")->dispatch(TheliaEvents::BOOT); + } + /** * * Load some configuration @@ -107,6 +117,16 @@ class Thelia extends Kernel foreach ($modules as $module) { try { + + $defintion = new Definition(); + $defintion->setClass($module->getFullNamespace()); + $defintion->addMethodCall("setContainer", array('service_container')); + + $container->setDefinition( + "module.".$module->getCode(), + $defintion + ); + $loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config")); $loader->load("config.xml"); } catch (\InvalidArgumentException $e) { diff --git a/core/lib/Thelia/Core/TheliaContainerBuilder.php b/core/lib/Thelia/Core/TheliaContainerBuilder.php index a97019b60..7e49a8141 100755 --- a/core/lib/Thelia/Core/TheliaContainerBuilder.php +++ b/core/lib/Thelia/Core/TheliaContainerBuilder.php @@ -25,6 +25,13 @@ namespace Thelia\Core; use Symfony\Component\DependencyInjection\ContainerBuilder; +/** + * extends Symfony\Component\DependencyInjection\ContainerBuilder for changing some behavior + * + * Class TheliaContainerBuilder + * @package Thelia\Core + * @author Manuel Raynaud + */ class TheliaContainerBuilder extends ContainerBuilder { diff --git a/core/lib/Thelia/Core/TheliaHttpKernel.php b/core/lib/Thelia/Core/TheliaHttpKernel.php index b34eb4bed..3c0f14808 100755 --- a/core/lib/Thelia/Core/TheliaHttpKernel.php +++ b/core/lib/Thelia/Core/TheliaHttpKernel.php @@ -122,11 +122,21 @@ class TheliaHttpKernel extends HttpKernel */ protected function initParam(Request $request) { + // Ensure an instaciation of URL service, which is accessed as a pseudo-singleton + // in the rest of the application. + // See Thelia\Tools\URL class. + $this->container->get('thelia.url.manager'); + + // Same thing for the Translator service. + $this->container->get('thelia.translator'); + $lang = $this->detectLang($request); if ($lang) { - $request->getSession()->set("lang", $lang->getCode()); - $request->getSession()->set("locale", $lang->getLocale()); + $request->getSession() + ->setLang($lang) + ->setLocale($lang->getLocale()) + ; } } @@ -137,6 +147,7 @@ class TheliaHttpKernel extends HttpKernel protected function detectLang(Request $request) { $lang = null; + //first priority => lang parameter present in request (get or post) if ($request->query->has("lang")) { $lang = Model\LangQuery::create()->findOneByCode($request->query->get("lang")); @@ -164,7 +175,7 @@ class TheliaHttpKernel extends HttpKernel } //check if lang is not defined. If not we have to search the good one. - if (null === $request->getSession()->get("lang")) { + if (null === $request->getSession()->getLang()) { if (Model\ConfigQuery::read("one_domain_foreach_lang", false) == 1) { //find lang with domain @@ -173,9 +184,7 @@ class TheliaHttpKernel extends HttpKernel //find default lang return Model\LangQuery::create()->findOneByByDefault(1); - } - } protected function initSession(Request $request) diff --git a/core/lib/Thelia/Core/Translation/Translator.php b/core/lib/Thelia/Core/Translation/Translator.php old mode 100644 new mode 100755 index 83114d478..d941fefb7 --- a/core/lib/Thelia/Core/Translation/Translator.php +++ b/core/lib/Thelia/Core/Translation/Translator.php @@ -5,6 +5,29 @@ use Symfony\Component\Translation\Translator as BaseTranslator; class Translator extends BaseTranslator { + + protected static $instance = null; + + public function __construct() + { + // Allow singleton style calls once intanciated. + // For this to work, the Translator service has to be instanciated very early. This is done manually + // in TheliaHttpKernel, by calling $this->container->get('thelia.translator'); + self::$instance = $this; + } + + /** + * Return this class instance, only once instanciated. + * + * @throws \RuntimeException if the class has not been instanciated. + * @return Thelia\Core\Translation\Translator the instance. + */ + public static function getInstance() { + if (self::$instance == null) throw new \RuntimeException("Translator instance is not initialized."); + + return self::$instance; + } + /** * {@inheritdoc} * @@ -21,7 +44,7 @@ class Translator extends BaseTranslator } if ($this->catalogues[$locale]->has((string) $id, $domain)) - return parent::trans($id, $parameters, $domain = 'messages', $locale = null); + return parent::trans($id, $parameters, $domain, $locale); else return strtr($id, $parameters); } diff --git a/core/lib/Thelia/Coupon/CouponAdapterInterface.php b/core/lib/Thelia/Coupon/CouponAdapterInterface.php new file mode 100644 index 000000000..134d061be --- /dev/null +++ b/core/lib/Thelia/Coupon/CouponAdapterInterface.php @@ -0,0 +1,158 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\Translation\Translator; +use Symfony\Component\Translation\TranslatorInterface; +use Thelia\Coupon\Type\CouponInterface; +use Thelia\Model\Coupon; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Allow a CouponManager class to be fed with relevant Thelia data + * + * @package Coupon + * @author Guillaume MOREL + * + */ +interface CouponAdapterInterface +{ + + /** + * Constructor + * + * @param ContainerInterface $container Service container + */ + function __construct(ContainerInterface $container); + + /** + * Return a Cart a CouponManager can process + * + * @return \Thelia\Model\Cart + */ + public function getCart(); + + /** + * Return an Address a CouponManager can process + * + * @return \Thelia\Model\Address + */ + public function getDeliveryAddress(); + + /** + * Return an Customer a CouponManager can process + * + * @return \Thelia\Model\Customer + */ + public function getCustomer(); + + /** + * Return Checkout total price + * + * @return float + */ + public function getCheckoutTotalPrice(); + + /** + * Return Products total price + * CartTotalPrice = Checkout total - discount - postage + * + * @return float + */ + public function getCartTotalPrice(); + + /** + * Return the Checkout currency EUR|USD + * + * @return string + */ + public function getCheckoutCurrency(); + + /** + * Return Checkout total postage (only) price + * + * @return float + */ + public function getCheckoutPostagePrice(); + + /** + * Return the number of Products in the Cart + * + * @return int + */ + public function getNbArticlesInCart(); + + /** + * Return all Coupon given during the Checkout + * + * @return array Array of CouponInterface + */ + public function getCurrentCoupons(); + + /** + * Find one Coupon in the database from its code + * + * @param string $code Coupon code + * + * @return Coupon + */ + public function findOneCouponByCode($code); + + /** + * Save a Coupon in the database + * + * @param CouponInterface $coupon Coupon + * + * @return $this + */ + public function saveCoupon(CouponInterface $coupon); + + /** + * Return platform Container + * + * @return Container + */ + public function getContainer(); + + /** + * Return platform TranslatorInterface + * + * @return TranslatorInterface + */ + public function getTranslator(); + + /** + * Return the main currency + * THe one used to set prices in BackOffice + * + * @return string + */ + public function getMainCurrency(); + +} \ No newline at end of file diff --git a/core/lib/Thelia/Coupon/CouponBaseAdapter.php b/core/lib/Thelia/Coupon/CouponBaseAdapter.php new file mode 100644 index 000000000..4d813960f --- /dev/null +++ b/core/lib/Thelia/Coupon/CouponBaseAdapter.php @@ -0,0 +1,235 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\Translation\Translator; +use Symfony\Component\Translation\TranslatorInterface; +use Thelia\Coupon\Type\CouponInterface; +use Thelia\Model\Coupon; +use Thelia\Model\CouponQuery; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Coupon + * @author Guillaume MOREL + * @todo implements + * + */ +class CouponBaseAdapter implements CouponAdapterInterface +{ + /** @var ContainerInterface Service Container */ + protected $container = null; + + /** @var Translator Service Translator */ + protected $translator = null; + + /** + * Constructor + * + * @param ContainerInterface $container Service container + */ + function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + /** + * Return a Cart a CouponManager can process + * + * @return \Thelia\Model\Cart + */ + public function getCart() + { + // TODO: Implement getCart() method. + } + + /** + * Return an Address a CouponManager can process + * + * @return \Thelia\Model\Address + */ + public function getDeliveryAddress() + { + // TODO: Implement getDeliveryAddress() method. + } + + /** + * Return an Customer a CouponManager can process + * + * @return \Thelia\Model\Customer + */ + public function getCustomer() + { + // TODO: Implement getCustomer() method. + } + + /** + * Return Checkout total price + * + * @return float + */ + public function getCheckoutTotalPrice() + { + // TODO: Implement getCheckoutTotalPrice() method. + } + + /** + * Return Checkout total postage (only) price + * + * @return float + */ + public function getCheckoutPostagePrice() + { + // TODO: Implement getCheckoutPostagePrice() method. + } + + /** + * Return Products total price + * + * @return float + */ + public function getCartTotalPrice() + { + // TODO: Implement getCartTotalPrice() method. + } + + /** + * Return the Checkout currency EUR|USD + * + * @return string + */ + public function getCheckoutCurrency() + { + // TODO: Implement getCheckoutCurrency() method. + } + + + /** + * Return the number of Products in the Cart + * + * @return int + */ + public function getNbArticlesInCart() + { + // TODO: Implement getNbArticlesInCart() method. + } + + /** + * Return all Coupon given during the Checkout + * + * @return array Array of CouponInterface + */ + public function getCurrentCoupons() + { + $couponFactory = new CouponFactory($this); + + // @todo Get from Session + $couponCodes = array('XMAS', 'SPRINGBREAK'); + + $coupons = array(); + foreach ($couponCodes as $couponCode) { + $coupons[] = $couponFactory->buildCouponFromCode($couponCode); + } + + return $coupons; + } + + /** + * Find one Coupon in the database from its code + * + * @param string $code Coupon code + * + * @return Coupon + */ + public function findOneCouponByCode($code) + { + $couponQuery = CouponQuery::create(); + + return $couponQuery->findOneByCode($code); + } + + /** + * Save a Coupon in the database + * + * @param CouponInterface $coupon Coupon + * + * @return $this + */ + public function saveCoupon(CouponInterface $coupon) + { +// $couponModel = new Coupon(); +// $couponModel->setCode($coupon->getCode()); +// $couponModel->setType(get_class($coupon)); +// $couponModel->setTitle($coupon->getTitle()); +// $couponModel->setShortDescription($coupon->getShortDescription()); +// $couponModel->setDescription($coupon->getDescription()); +// $couponModel->setAmount($coupon->getDiscount()); +// $couponModel->setIsUsed(0); +// $couponModel->setIsEnabled(1); +// $couponModel->set +// $couponModel->set +// $couponModel->set +// $couponModel->set +// $couponModel->set +// $couponModel->set +// $couponModel->set + } + + /** + * Return plateform Container + * + * @return Container + */ + public function getContainer() + { + // TODO: Implement getContainer() method. + } + + /** + * Return platform TranslatorInterface + * + * @return TranslatorInterface + */ + public function getTranslator() + { + return $this->container->get('thelia.translator'); + } + + + /** + * Return the main currency + * THe one used to set prices in BackOffice + * + * @return string + */ + public function getMainCurrency() + { + // TODO: Implement getMainCurrency() method. + } +} diff --git a/core/lib/Thelia/Coupon/CouponFactory.php b/core/lib/Thelia/Coupon/CouponFactory.php new file mode 100644 index 000000000..b23eb56ea --- /dev/null +++ b/core/lib/Thelia/Coupon/CouponFactory.php @@ -0,0 +1,132 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Symfony\Component\Translation\Exception\NotFoundResourceException; +use Thelia\Constraint\Rule\CouponRuleInterface; +use Thelia\Coupon\Type\CouponInterface; +use Thelia\Exception\CouponExpiredException; +use Thelia\Exception\InvalidRuleException; +use Thelia\Model\Coupon; +use Symfony\Component\Serializer\Encoder\JsonEncoder; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Generate a CouponInterface + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponFactory +{ + /** @var CouponAdapterInterface Provide necessary value from Thelia*/ + protected $adapter; + + /** + * Constructor + * + * @param CouponAdapterInterface $adapter Provide necessary value from Thelia + */ + function __construct(CouponAdapterInterface $adapter) + { + $this->adapter = $adapter; + } + + /** + * Build a CouponInterface from its database data + * + * @param string $couponCode Coupon code ex: XMAS + * + * @throws \Thelia\Exception\CouponExpiredException + * @throws \Symfony\Component\Translation\Exception\NotFoundResourceException + * @return CouponInterface ready to be processed + */ + public function buildCouponFromCode($couponCode) + { + /** @var Coupon $couponModel */ + $couponModel = $this->adapter->findOneCouponByCode($couponCode); + if ($couponModel === null) { + throw new NotFoundResourceException( + 'Coupon ' . $couponCode . ' not found in Database' + ); + } + + if ($couponModel->getExpirationDate() < new \DateTime()) { + throw new CouponExpiredException($couponCode); + } + + /** @var CouponInterface $couponInterface */ + $couponInterface = $this->buildCouponInterfacFromModel($couponModel); + if ($couponInterface->getRules()->isEmpty()) { + throw new InvalidRuleException( + get_class($couponInterface) + ); + } + + return $couponInterface; + } + + /** + * Build a CouponInterface from its Model data contained in the DataBase + * + * @param Coupon $model Database data + * + * @return CouponInterface ready to use CouponInterface object instance + */ + protected function buildCouponInterfacFromModel(Coupon $model) + { + $isCumulative = ($model->getIsCumulative() == 1 ? true : false); + $isRemovingPostage = ($model->getIsRemovingPostage() == 1 ? true : false); + $couponClass = $model->getType(); + + /** @var CouponInterface $coupon*/ + $coupon = new $couponClass( + $model->getCode(), + $model->getTitle(), + $model->getShortDescription(), + $model->getDescription(), + $model->getAmount(), + $isCumulative, + $isRemovingPostage, + $model->getIsAvailableOnSpecialOffers(), + $model->getIsEnabled(), + $model->getMaxUsage(), + $model->getExpirationDate() + ); + + /** @var CouponRuleCollection $rules */ + $rules = unserialize(base64_decode($model->getSerializedRules())); + + $coupon->setRules($rules); + + return $coupon; + } + + + +} diff --git a/core/lib/Thelia/Coupon/CouponManager.php b/core/lib/Thelia/Coupon/CouponManager.php new file mode 100644 index 000000000..ee20b4fd0 --- /dev/null +++ b/core/lib/Thelia/Coupon/CouponManager.php @@ -0,0 +1,211 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Symfony\Component\DependencyInjection\ContainerInterface; +use Thelia\Constraint\Rule\CouponRuleInterface; +use Thelia\Coupon\Type\CouponInterface; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Manage how Coupons could interact with a Checkout + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponManager +{ + /** @var CouponAdapterInterface Provides necessary value from Thelia */ + protected $adapter = null; + + /** @var ContainerInterface Service Container */ + protected $container = null; + + /** @var array CouponInterface to process*/ + protected $coupons = array(); + + /** + * Constructor + * + * @param ContainerInterface $container Service container + */ + function __construct(ContainerInterface $container) + { + $this->container = $container; + $this->adapter = $container->get('thelia.adapter'); + $this->coupons = $this->adapter->getCurrentCoupons(); + } + + + /** + * Get Discount for the given Coupons + * + * @api + * @return float checkout discount + */ + public function getDiscount() + { + $discount = 0.00; + + if (count($this->coupons) > 0) { + $couponsKept = $this->sortCoupons($this->coupons); + + $isRemovingPostage = $this->isCouponRemovingPostage($couponsKept); + + $discount = $this->getEffect($couponsKept); + + if ($isRemovingPostage) { + $postage = $this->adapter->getCheckoutPostagePrice(); + $discount += $postage; + } + + // Just In Case test + $checkoutTotalPrice = $this->adapter->getCartTotalPrice(); + if ($discount >= $checkoutTotalPrice) { + $discount = $checkoutTotalPrice; + } + } + + return $discount; + } + + /** + * Check if there is a Coupon removing Postage + * + * @param array $couponsKept Array of CouponInterface sorted + * + * @return bool + */ + protected function isCouponRemovingPostage(array $couponsKept) + { + $isRemovingPostage = false; + + /** @var CouponInterface $coupon */ + foreach ($couponsKept as $coupon) { + if ($coupon->isRemovingPostage()) { + $isRemovingPostage = true; + } + } + + return $isRemovingPostage; + } + + /** + * Sort Coupon to keep + * Coupon not cumulative cancels previous + * + * @param array $coupons CouponInterface to process + * + * @return array Array of CouponInterface sorted + */ + protected function sortCoupons(array $coupons) + { + $couponsKept = array(); + + /** @var CouponInterface $coupon */ + foreach ($coupons as $coupon) { + if (!$coupon->isExpired()) { + if ($coupon->isCumulative()) { + if (isset($couponsKept[0])) { + /** @var CouponInterface $previousCoupon */ + $previousCoupon = $couponsKept[0]; + if ($previousCoupon->isCumulative()) { + // Add Coupon + $couponsKept[] = $coupon; + } else { + // Reset Coupons, add last + $couponsKept = array($coupon); + } + } else { + // Reset Coupons, add last + $couponsKept = array($coupon); + } + } else { + // Reset Coupons, add last + $couponsKept = array($coupon); + } + } + } + + $coupons = $couponsKept; + $couponsKept = array(); + + /** @var CouponInterface $coupon */ + foreach ($coupons as $coupon) { + if ($coupon->isMatching($this->adapter)) { + $couponsKept[] = $coupon; + } + } + + return $couponsKept; + } + + /** + * Process given Coupon in order to get their cumulative effects + * + * @param array $coupons CouponInterface to process + * + * @return float discount + */ + protected function getEffect(array $coupons) + { + $discount = 0.00; + /** @var CouponInterface $coupon */ + foreach ($coupons as $coupon) { + $discount += $coupon->getDiscount($this->adapter); + } + + return $discount; + } + + /** + * Build a CouponRuleInterface from data coming from a form + * + * @param string $ruleServiceId Rule service id you want to instantiate + * @param array $operators Rule Operator set by the Admin + * @param array $values Rule Values set by the Admin + * + * @return CouponRuleInterface + */ + public function buildRuleFromForm($ruleServiceId, array $operators, array $values) + { + $rule = false; + try { + + if ($this->container->has($ruleServiceId)) { + /** @var CouponRuleInterface $rule */ + $rule = $this->container->get($ruleServiceId); + $rule->populateFromForm($operators, $values); + } + } catch (\InvalidArgumentException $e) { + + } + + return $rule; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Coupon/CouponRuleCollection.php b/core/lib/Thelia/Coupon/CouponRuleCollection.php new file mode 100644 index 000000000..311e543c1 --- /dev/null +++ b/core/lib/Thelia/Coupon/CouponRuleCollection.php @@ -0,0 +1,105 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Symfony\Component\DependencyInjection\ContainerInterface; +use Thelia\Constraint\Rule\CouponRuleInterface; +use Thelia\Constraint\Rule\SerializableRule; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Manage a set of CouponRuleInterface + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponRuleCollection +{ + /** @var array Array of CouponRuleInterface */ + protected $rules = array(); + + /** + * Constructor + */ + function __construct() + { + + } + + /** + * Get Rules + * + * @return array Array of CouponRuleInterface + */ + public function getRules() + { + return $this->rules; + } + + /** + * Add a CouponRuleInterface to the Collection + * + * @param CouponRuleInterface $rule Rule + * + * @return $this + */ + public function add(CouponRuleInterface $rule) + { + $this->rules[] = $rule; + + return $this; + } + + /** + * Check if there is at least one rule in the collection + * + * @return bool + */ + public function isEmpty() + { + return isEmpty($this->rules); + } + + /** + * Allow to compare 2 set of rules + * + * @return string Jsoned data + */ + public function __toString() + { + $arrayToSerialize = array(); + /** @var CouponRuleInterface $rule */ + foreach ($this->getRules() as $rule) { + $arrayToSerialize[] = $rule->getSerializableRule(); + } + + return json_encode($arrayToSerialize); + } + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Coupon/RuleOrganizer.php b/core/lib/Thelia/Coupon/RuleOrganizer.php new file mode 100644 index 000000000..4c16ea1ff --- /dev/null +++ b/core/lib/Thelia/Coupon/RuleOrganizer.php @@ -0,0 +1,51 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Manage how Coupons could interact with a Checkout + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RuleOrganizer implements RuleOrganizerInterface +{ + /** + * Organize CouponRuleInterface + * + * @param array $rules Array of CouponRuleInterface + * + * @return array Array of CouponRuleInterface sorted + */ + public function organize(array $rules) + { + // TODO: Implement organize() method. + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Coupon/RuleOrganizerInterface.php b/core/lib/Thelia/Coupon/RuleOrganizerInterface.php new file mode 100644 index 000000000..b8b222028 --- /dev/null +++ b/core/lib/Thelia/Coupon/RuleOrganizerInterface.php @@ -0,0 +1,47 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Manage how Coupons could interact with a Checkout + * + * @package Coupon + * @author Guillaume MOREL + * + */ +interface RuleOrganizerInterface +{ + /** + * Organize CouponRuleInterface + * + * @param array $rules Array of CouponRuleInterface + * + * @return array Array of CouponRuleInterface sorted + */ + public function organize(array $rules); +} \ No newline at end of file diff --git a/core/lib/Thelia/Coupon/Type/CouponAbstract.php b/core/lib/Thelia/Coupon/Type/CouponAbstract.php new file mode 100644 index 000000000..79e0b760c --- /dev/null +++ b/core/lib/Thelia/Coupon/Type/CouponAbstract.php @@ -0,0 +1,281 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon\Type; + +use Symfony\Component\Intl\Exception\NotImplementedException; +use Thelia\Constraint\ConstraintManager; +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Coupon\CouponRuleCollection; +use Thelia\Coupon\RuleOrganizerInterface; +use Thelia\Exception\InvalidRuleException; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Assist in writing a CouponInterface + * + * @package Coupon + * @author Guillaume MOREL + * + */ +abstract class CouponAbstract implements CouponInterface +{ + /** @var CouponAdapterInterface Provides necessary value from Thelia */ + protected $adapter = null; + + /** @var RuleOrganizerInterface */ + protected $organizer = null; + + /** @var CouponRuleCollection Array of CouponRuleInterface */ + protected $rules = null; + + /** @var ConstraintManager CouponRuleInterface Manager*/ + protected $constraintManager = null; + + /** @var string Coupon code (ex: XMAS) */ + protected $code = null; + + /** @var string Coupon title (ex: Coupon for XMAS) */ + protected $title = null; + + /** @var string Coupon short description */ + protected $shortDescription = null; + + /** @var string Coupon description */ + protected $description = null; + + /** @var bool if Coupon is enabled */ + protected $isEnabled = false; + + /** @var \DateTime Coupon expiration date */ + protected $expirationDate = null; + + /** @var bool if Coupon is cumulative */ + protected $isCumulative = false; + + /** @var bool if Coupon is removing postage */ + protected $isRemovingPostage = false; + + /** @var float Amount that will be removed from the Checkout (Coupon Effect) */ + protected $amount = 0; + + /** @var int Max time a Coupon can be used (-1 = unlimited) */ + protected $maxUsage = -1; + + /** @var bool if Coupon is available for Products already on special offers */ + protected $isAvailableOnSpecialOffers = false; + + /** + * Set Rule Organizer + * + * @param RuleOrganizerInterface $organizer Manage Rule groups (&& and ||) + * + * @return $this + */ + public function setOrganizer($organizer) + { + $this->organizer = $organizer; + + return $this; + } + + /** + * Return Coupon code (ex: XMAS) + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Return Coupon title (ex: Coupon for XMAS) + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Return Coupon short description + * + * @return string + */ + public function getShortDescription() + { + return $this->shortDescription; + } + + /** + * Return Coupon description + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * If Coupon is cumulative or prevent any accumulation + * If is cumulative you can sum Coupon effects + * If not cancel all other Coupon and take the last given + * + * @return bool + */ + public function isCumulative() + { + return $this->isCumulative; + } + + /** + * If Coupon is removing Checkout Postage + * + * @return bool + */ + public function isRemovingPostage() + { + return $this->isRemovingPostage; + } + + /** + * Return effects generated by the coupon + * A negative value + * + * @return float Amount removed from the Total Checkout + */ + public function getDiscount() + { + return $this->amount; + } + + /** + * Return condition to validate the Coupon or not + * + * @return CouponRuleCollection + */ + public function getRules() + { + return clone $this->rules; + } + + /** + * Replace the existing Rules by those given in parameter + * If one Rule is badly implemented, no Rule will be added + * + * @param CouponRuleCollection $rules CouponRuleInterface to add + * + * @return $this + * @throws \Thelia\Exception\InvalidRuleException + */ + public function setRules(CouponRuleCollection $rules) + { + $this->rules = $rules; + $this->constraintManager = new ConstraintManager( + $this->adapter, + $this->rules + ); + + return $this; + } + + /** + * Check if the current Coupon is matching its conditions (Rules) + * Thelia variables are given by the CouponAdapterInterface + * + * @param CouponAdapterInterface $adapter allowing to gather + * all necessary Thelia variables + * + * @return bool + */ + public function isMatching(CouponAdapterInterface $adapter) + { + return $this->constraintManager->isMatching(); + } + + /** + * Return Coupon expiration date + * + * @return \DateTime + */ + public function getExpirationDate() + { + return clone $this->expirationDate; + } + + /** + * Check if the Coupon can be used against a + * product already with a special offer price + * + * @return boolean + */ + public function isAvailableOnSpecialOffers() + { + return $this->isAvailableOnSpecialOffers; + } + + + /** + * Check if Coupon has been disabled by admin + * + * @return boolean + */ + public function isEnabled() + { + return $this->isEnabled; + } + + /** + * Return how many time the Coupon can be used again + * Ex : -1 unlimited + * + * @return int + */ + public function getMaxUsage() + { + return $this->maxUsage; + } + + /** + * Check if the Coupon is already Expired + * + * @return bool + */ + public function isExpired() + { + $ret = true; + + $now = new \DateTime(); + if ($this->expirationDate > $now) { + $ret = false; + } + + return $ret; + } +} diff --git a/core/lib/Thelia/Coupon/Type/CouponInterface.php b/core/lib/Thelia/Coupon/Type/CouponInterface.php new file mode 100644 index 000000000..aa7dc9a79 --- /dev/null +++ b/core/lib/Thelia/Coupon/Type/CouponInterface.php @@ -0,0 +1,180 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon\Type; + +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Coupon\CouponRuleCollection; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Represents a Coupon ready to be processed in a Checkout process + * + * @package Coupon + * @author Guillaume MOREL + * + */ +interface CouponInterface +{ + /** + * Return Coupon code (ex: XMAS) + * + * @return string + */ + public function getCode(); + + /** + * Return Coupon title (ex: Coupon for XMAS) + * + * @return string + */ + public function getTitle(); + + /** + * Return Coupon short description + * + * @return string + */ + public function getShortDescription(); + + /** + * Return Coupon description + * + * @return string + */ + public function getDescription(); + + /** + * If Coupon is cumulative or prevent any accumulation + * If is cumulative you can sum Coupon effects + * If not cancel all other Coupon and take the last given + * + * @return bool + */ + public function isCumulative(); + + /** + * If Coupon is removing Checkout Postage + * + * @return bool + */ + public function isRemovingPostage(); + + /** + * Return effects generated by the coupon + * A positive value + * + * Effects could also affect something else than the final Checkout price + * CouponAdapter $adapter could be use to directly pass a Session value + * some would wish to modify + * Hence affecting a wide variety of Thelia elements + * + * @return float Amount removed from the Total Checkout + */ + public function getDiscount(); + + /** + * Return condition to validate the Coupon or not + * + * @return CouponRuleCollection A set of CouponRuleInterface + */ + public function getRules(); + + /** + * Check if the current Coupon is matching its conditions (Rules) + * Thelia variables are given by the CouponAdapterInterface + * + * @param CouponAdapterInterface $adapter allowing to gather + * all necessary Thelia variables + * + * @return bool + */ + public function isMatching(CouponAdapterInterface $adapter); + + /** + * Replace the existing Rules by those given in parameter + * If one Rule is badly implemented, no Rule will be added + * + * @param CouponRuleCollection $rules CouponRuleInterface to add + * + * @return $this + * @throws \Thelia\Exception\InvalidRuleException + */ + public function setRules(CouponRuleCollection $rules); + + /** + * Return Coupon expiration date + * + * @return \DateTime + */ + public function getExpirationDate(); + + /** + * Check if the Coupon can be used against a + * product already with a special offer price + * + * @return boolean + */ + public function isAvailableOnSpecialOffers(); + + + /** + * Check if Coupon has been disabled by admin + * + * @return boolean + */ + public function isEnabled(); + + /** + * Return how many time the Coupon can be used again + * Ex : -1 unlimited + * + * @return int + */ + public function getMaxUsage(); + + /** + * Check if the Coupon is already Expired + * + * @return bool + */ + public function isExpired(); + + /** + * Get I18n name + * + * @return string + */ + public function getName(); + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip(); + +} diff --git a/core/lib/Thelia/Coupon/Type/RemoveXAmount.php b/core/lib/Thelia/Coupon/Type/RemoveXAmount.php new file mode 100644 index 000000000..672c8a856 --- /dev/null +++ b/core/lib/Thelia/Coupon/Type/RemoveXAmount.php @@ -0,0 +1,120 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon\Type; + +use Thelia\Constraint\ConstraintManager; +use Thelia\Coupon\Type\CouponAbstract; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Allow to remove an amount from the checkout total + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RemoveXAmount extends CouponAbstract +{ + /** + * Constructor + * + * @param CouponInterface $adapter Provides necessary value from Thelia + * @param string $code Coupon code (ex: XMAS) + * @param string $title Coupon title (ex: Coupon for XMAS) + * @param string $shortDescription Coupon short description + * @param string $description Coupon description + * @param float $amount Coupon amount to deduce + * @param bool $isCumulative If Coupon is cumulative + * @param bool $isRemovingPostage If Coupon is removing postage + * @param bool $isAvailableOnSpecialOffers If available on Product already + * on special offer price + * @param bool $isEnabled False if Coupon is disabled by admin + * @param int $maxUsage How many usage left + * @param \Datetime $expirationDate When the Code is expiring + */ + function __construct( + $adapter, + $code, + $title, + $shortDescription, + $description, + $amount, + $isCumulative, + $isRemovingPostage, + $isAvailableOnSpecialOffers, + $isEnabled, + $maxUsage, + \DateTime $expirationDate + ) + { + $this->code = $code; + $this->title = $title; + $this->shortDescription = $shortDescription; + $this->description = $description; + + $this->isCumulative = $isCumulative; + $this->isRemovingPostage = $isRemovingPostage; + + $this->amount = $amount; + + $this->isAvailableOnSpecialOffers = $isAvailableOnSpecialOffers; + $this->isEnabled = $isEnabled; + $this->maxUsage = $maxUsage; + $this->expirationDate = $expirationDate; + $this->adapter = $adapter; + } + + /** + * Get I18n name + * + * @return string + */ + public function getName() + { + return $this->adapter + ->getTranslator() + ->trans('Remove X amount to total cart', null, 'constraint'); + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + $toolTip = $this->adapter + ->getTranslator() + ->trans( + 'This coupon will remove the entered amount to the customer total checkout. If the discount is superior to the total checkout price the customer will only pay the postage. Unless if the coupon is set to remove postage too.', + null, + 'constraint' + ); + + return $toolTip; + } +} diff --git a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php new file mode 100644 index 000000000..6279c3536 --- /dev/null +++ b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php @@ -0,0 +1,143 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon\Type; + +use Thelia\Coupon\CouponAdapterInterface; +use Thelia\Coupon\Type\CouponAbstract; +use Thelia\Exception\MissingAdapterException; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RemoveXPercent extends CouponAbstract +{ + protected $percent = 0; + + /** + * Constructor + * + * @param CouponInterface $adapter Provides necessary value from Thelia + * @param string $code Coupon code (ex: XMAS) + * @param string $title Coupon title (ex: Coupon for XMAS) + * @param string $shortDescription Coupon short description + * @param string $description Coupon description + * @param float $percent Coupon percentage to deduce + * @param bool $isCumulative If Coupon is cumulative + * @param bool $isRemovingPostage If Coupon is removing postage + * @param bool $isAvailableOnSpecialOffers If available on Product already + * on special offer price + * @param bool $isEnabled False if Coupon is disabled by admin + * @param int $maxUsage How many usage left + * @param \Datetime $expirationDate When the Code is expiring + */ + function __construct( + $adapter, + $code, + $title, + $shortDescription, + $description, + $percent, + $isCumulative, + $isRemovingPostage, + $isAvailableOnSpecialOffers, + $isEnabled, + $maxUsage, + \DateTime $expirationDate) + { + $this->code = $code; + $this->title = $title; + $this->shortDescription = $shortDescription; + $this->description = $description; + + $this->isCumulative = $isCumulative; + $this->isRemovingPostage = $isRemovingPostage; + + $this->percent = $percent; + + $this->isAvailableOnSpecialOffers = $isAvailableOnSpecialOffers; + $this->isEnabled = $isEnabled; + $this->maxUsage = $maxUsage; + $this->expirationDate = $expirationDate; + $this->adapter = $adapter; + } + + /** + * Return effects generated by the coupon + * A negative value + * + * @throws \Thelia\Exception\MissingAdapterException + * @throws \InvalidArgumentException + * @return float + */ + public function getDiscount() + { + if ($this->percent >= 100) { + throw new \InvalidArgumentException( + 'Percentage must be inferior to 100' + ); + } + + $basePrice = $this->adapter->getCartTotalPrice(); + + return $basePrice * (( $this->percent ) / 100); + } + + + /** + * Get I18n name + * + * @return string + */ + public function getName() + { + return $this->adapter + ->getTranslator() + ->trans('Remove X percent to total cart', null, 'constraint'); + } + + /** + * Get I18n tooltip + * + * @return string + */ + public function getToolTip() + { + $toolTip = $this->adapter + ->getTranslator() + ->trans( + 'This coupon will remove the entered percentage to the customer total checkout. If the discount is superior to the total checkout price the customer will only pay the postage. Unless if the coupon is set to remove postage too.', + null, + 'constraint' + ); + + return $toolTip; + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Coupon/Type/RemoveXPercentForAttributeY.php b/core/lib/Thelia/Coupon/Type/RemoveXPercentForAttributeY.php new file mode 100644 index 000000000..f0a7ef472 --- /dev/null +++ b/core/lib/Thelia/Coupon/Type/RemoveXPercentForAttributeY.php @@ -0,0 +1,38 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon\Type; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RemoveXPercentForAttributeY extends RemoveXPercent +{ + +} \ No newline at end of file diff --git a/core/lib/Thelia/Coupon/Type/RemoveXPercentForCategoryY.php b/core/lib/Thelia/Coupon/Type/RemoveXPercentForCategoryY.php new file mode 100644 index 000000000..717807da7 --- /dev/null +++ b/core/lib/Thelia/Coupon/Type/RemoveXPercentForCategoryY.php @@ -0,0 +1,38 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon\Type; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RemoveXPercentForCategoryY extends RemoveXPercent +{ + +} \ No newline at end of file diff --git a/core/lib/Thelia/Coupon/Type/RemoveXPercentForProductSaleElementIdY.php b/core/lib/Thelia/Coupon/Type/RemoveXPercentForProductSaleElementIdY.php new file mode 100644 index 000000000..bb052cd68 --- /dev/null +++ b/core/lib/Thelia/Coupon/Type/RemoveXPercentForProductSaleElementIdY.php @@ -0,0 +1,38 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon\Type; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RemoveXPercentForProductSaleElementIdY extends RemoveXPercent +{ + +} \ No newline at end of file diff --git a/core/lib/Thelia/Coupon/Type/RemoveXPercentForProductY.php b/core/lib/Thelia/Coupon/Type/RemoveXPercentForProductY.php new file mode 100644 index 000000000..0b88ca44d --- /dev/null +++ b/core/lib/Thelia/Coupon/Type/RemoveXPercentForProductY.php @@ -0,0 +1,38 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon\Type; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RemoveXPercentForProductY extends RemoveXPercent +{ + +} \ No newline at end of file diff --git a/core/lib/Thelia/Exception/CouponExpiredException.php b/core/lib/Thelia/Exception/CouponExpiredException.php new file mode 100644 index 000000000..c1ccace0a --- /dev/null +++ b/core/lib/Thelia/Exception/CouponExpiredException.php @@ -0,0 +1,53 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Exception; + +use Thelia\Log\Tlog; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Thrown when an Expired Coupon is tried + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponExpiredException extends \Exception +{ + /** + * CouponExpiredException thrown when a Coupon is expired + * + * @param string $couponCode Coupon code + */ + public function __construct($couponCode) + { + $message = 'Expired Coupon ' . $couponCode . 'attempt'; + Tlog::getInstance()->addInfo($message); + + parent::__construct($message); + } +} diff --git a/core/lib/Thelia/Exception/ImageException.php b/core/lib/Thelia/Exception/ImageException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Exception/InvalidCartException.php b/core/lib/Thelia/Exception/InvalidCartException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Exception/InvalidRuleException.php b/core/lib/Thelia/Exception/InvalidRuleException.php new file mode 100644 index 000000000..a891ded4a --- /dev/null +++ b/core/lib/Thelia/Exception/InvalidRuleException.php @@ -0,0 +1,54 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Exception; + +use Thelia\Log\Tlog; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Thrown when a Rule is badly implemented + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class InvalidRuleException extends \RuntimeException +{ + /** + * InvalidRuleOperatorException thrown when a Rule is badly implemented + * + * @param string $className Class name + */ + public function __construct($className) + { + + $message = 'Invalid Rule given to ' . $className; + Tlog::getInstance()->addError($message); + + parent::__construct($message); + } +} diff --git a/core/lib/Thelia/Exception/InvalidRuleOperatorException.php b/core/lib/Thelia/Exception/InvalidRuleOperatorException.php new file mode 100644 index 000000000..d40c723c2 --- /dev/null +++ b/core/lib/Thelia/Exception/InvalidRuleOperatorException.php @@ -0,0 +1,55 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Exception; + +use Thelia\Log\Tlog; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Thrown when a Rule receive an invalid Operator + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class InvalidRuleOperatorException extends \RuntimeException +{ + /** + * InvalidRuleOperatorException thrown when a Rule is given a bad Operator + * + * @param string $className Class name + * @param string $parameter array key parameter + */ + public function __construct($className, $parameter) + { + + $message = 'Invalid Operator for Rule ' . $className . ' on parameter ' . $parameter; + Tlog::getInstance()->addError($message); + + parent::__construct($message); + } +} diff --git a/core/lib/Thelia/Exception/InvalidRuleValueException.php b/core/lib/Thelia/Exception/InvalidRuleValueException.php new file mode 100644 index 000000000..2f16f32f1 --- /dev/null +++ b/core/lib/Thelia/Exception/InvalidRuleValueException.php @@ -0,0 +1,55 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Exception; + +use Thelia\Log\Tlog; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Thrown when a Rule receive an invalid Parameter + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class InvalidRuleValueException extends \RuntimeException +{ + /** + * InvalidRuleValueException thrown when a Rule is given a bad Parameter + * + * @param string $className Class name + * @param string $parameter array key parameter + */ + public function __construct($className, $parameter) + { + + $message = 'Invalid Parameter for Rule ' . $className . ' on parameter ' . $parameter; + Tlog::getInstance()->addError($message); + + parent::__construct($message); + } +} diff --git a/core/lib/Thelia/Exception/MissingAdapterException.php b/core/lib/Thelia/Exception/MissingAdapterException.php new file mode 100644 index 000000000..645020cab --- /dev/null +++ b/core/lib/Thelia/Exception/MissingAdapterException.php @@ -0,0 +1,50 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Exception; + +use Thelia\Log\Tlog; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Thrown when the Adapter is not set + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class MissingAdapterException extends \RuntimeException +{ + /** + * {@inheritdoc} + */ + public function __construct($message, $code = null, $previous = null) { + + Tlog::getInstance()->addError($message); + + parent::__construct($message, $code, $previous); + } +} diff --git a/core/lib/Thelia/Exception/NotImplementedException.php b/core/lib/Thelia/Exception/NotImplementedException.php new file mode 100644 index 000000000..991f4d325 --- /dev/null +++ b/core/lib/Thelia/Exception/NotImplementedException.php @@ -0,0 +1,43 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Exception; + +use Symfony\Component\DependencyInjection\Exception\BadMethodCallException; +use Thelia\Log\Tlog; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Thrown when an Abstract method has not been implemented + * + * @package Exception + * @author Guillaume MOREL + * + */ +class NotImplementedException extends BadMethodCallException +{ + +} diff --git a/core/lib/Thelia/Exception/TaxEngineException.php b/core/lib/Thelia/Exception/TaxEngineException.php new file mode 100755 index 000000000..2a2718d4b --- /dev/null +++ b/core/lib/Thelia/Exception/TaxEngineException.php @@ -0,0 +1,44 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Exception; + +use Thelia\Log\Tlog; + +class TaxEngineException extends \RuntimeException +{ + const UNKNOWN_EXCEPTION = 0; + + const UNDEFINED_PRODUCT = 501; + const UNDEFINED_COUNTRY = 502; + const UNDEFINED_TAX_RULES_COLLECTION = 503; + + const BAD_AMOUNT_FORMAT = 601; + + public function __construct($message, $code = null, $previous = null) { + if($code === null) { + $code = self::UNKNOWN_EXCEPTION; + } + parent::__construct($message, $code, $previous); + } +} diff --git a/core/lib/Thelia/Exception/UrlRewritingException.php b/core/lib/Thelia/Exception/UrlRewritingException.php new file mode 100755 index 000000000..0df566a6b --- /dev/null +++ b/core/lib/Thelia/Exception/UrlRewritingException.php @@ -0,0 +1,42 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Exception; + +use Thelia\Log\Tlog; + +class UrlRewritingException extends \Exception +{ + const UNKNOWN_EXCEPTION = 0; + + const URL_NOT_FOUND = 404; + + const RESOLVER_NULL_SEARCH = 800; + + public function __construct($message, $code = null, $previous = null) { + if($code === null) { + $code = self::UNKNOWN_EXCEPTION; + } + parent::__construct($message, $code, $previous); + } +} diff --git a/core/lib/Thelia/Form/AddressCreateForm.php b/core/lib/Thelia/Form/AddressCreateForm.php new file mode 100644 index 000000000..3f953fe38 --- /dev/null +++ b/core/lib/Thelia/Form/AddressCreateForm.php @@ -0,0 +1,133 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Form; +use Symfony\Component\Validator\Constraints\NotBlank; + + +/** + * Class AddressCreateForm + * @package Thelia\Form + * @author Manuel Raynaud + */ +class AddressCreateForm extends BaseForm +{ + + /** + * + * in this function you add all the fields you need for your Form. + * Form this you have to call add method on $this->formBuilder attribute : + * + * $this->formBuilder->add("name", "text") + * ->add("email", "email", array( + * "attr" => array( + * "class" => "field" + * ), + * "label" => "email", + * "constraints" => array( + * new \Symfony\Component\Validator\Constraints\NotBlank() + * ) + * ) + * ) + * ->add('age', 'integer'); + * + * @return null + */ + protected function buildForm() + { + $this->formBuilder + ->add("label", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "address name", + "required" => true + )) + ->add("title", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "title" + )) + ->add("firstname", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "first name" + )) + ->add("lastname", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "last name" + )) + ->add("address1", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "address" + )) + ->add("address2", "text", array( + "label" => "address (line 2)" + )) + ->add("address3", "text", array( + "label" => "address (line 3)" + )) + ->add("zipcode", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "zipcode" + )) + ->add("city", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "city" + )) + ->add("country", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "country" + )) + ->add("phone", "text", array( + "label" => "phone" + )) + ->add("cellphone", "text", array( + "label" => "cellphone" + )) + ->add("company", "text", array( + "label" => "company" + )) + ; + } + + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return "thelia_address_creation"; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Form/AddressUpdateForm.php b/core/lib/Thelia/Form/AddressUpdateForm.php new file mode 100644 index 000000000..aa969831b --- /dev/null +++ b/core/lib/Thelia/Form/AddressUpdateForm.php @@ -0,0 +1,69 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Form; +use Symfony\Component\Validator\Constraints\NotBlank; + + +/** + * Class AddressUpdateForm + * @package Thelia\Form + * @author Manuel Raynaud + */ +class AddressUpdateForm extends AddressCreateForm { + + /** + * + * in this function you add all the fields you need for your Form. + * Form this you have to call add method on $this->formBuilder attribute : + * + * $this->formBuilder->add("name", "text") + * ->add("email", "email", array( + * "attr" => array( + * "class" => "field" + * ), + * "label" => "email", + * "constraints" => array( + * new \Symfony\Component\Validator\Constraints\NotBlank() + * ) + * ) + * ) + * ->add('age', 'integer'); + * + * @return null + */ + protected function buildForm() + { + parent::buildForm(); + + + } + + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return "thelia_address_update"; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Form/BaseForm.php b/core/lib/Thelia/Form/BaseForm.php index ac336f994..0eb6b828b 100755 --- a/core/lib/Thelia/Form/BaseForm.php +++ b/core/lib/Thelia/Form/BaseForm.php @@ -32,6 +32,13 @@ use Symfony\Component\Validator\Validation; use Thelia\Model\ConfigQuery; use Thelia\Tools\URL; +/** + * Base form class for creating form objects + * + * Class BaseForm + * @package Thelia\Form + * @author Manuel Raynaud + */ abstract class BaseForm { /** @@ -128,12 +135,14 @@ abstract class BaseForm $successUrl = $default; } - return URL::absoluteUrl($successUrl); + return URL::getInstance()->absoluteUrl($successUrl); } public function createView() { $this->view = $this->form->createView(); + + return $this; } public function getView() @@ -152,6 +161,8 @@ abstract class BaseForm public function setError($has_error = true) { $this->has_error = $has_error; + + return $this; } /** @@ -173,6 +184,8 @@ abstract class BaseForm { $this->setError(true); $this->error_message = $message; + + return $this; } /** diff --git a/core/lib/Thelia/Form/CartAdd.php b/core/lib/Thelia/Form/CartAdd.php old mode 100644 new mode 100755 index 25ca9ce57..25bde3cdc --- a/core/lib/Thelia/Form/CartAdd.php +++ b/core/lib/Thelia/Form/CartAdd.php @@ -30,6 +30,11 @@ use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\ConfigQuery; use Thelia\Model\ProductQuery; +/** + * Class CartAdd + * @package Thelia\Form + * @author Manuel Raynaud + */ class CartAdd extends BaseForm { @@ -62,6 +67,10 @@ class CartAdd extends BaseForm new Constraints\Callback(array("methods" => array( array($this, "checkProduct") ))) + ), + "label" => "product", + "label_attr" => array( + "for" => "cart_product" ) )) ->add("product_sale_elements_id", "text", array( diff --git a/core/lib/Thelia/Form/CategoryCreationForm.php b/core/lib/Thelia/Form/CategoryCreationForm.php old mode 100644 new mode 100755 index 9935eec19..5dce6a049 --- a/core/lib/Thelia/Form/CategoryCreationForm.php +++ b/core/lib/Thelia/Form/CategoryCreationForm.php @@ -23,6 +23,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Core\Translation\Translator; class CategoryCreationForm extends BaseForm { @@ -32,6 +33,10 @@ class CategoryCreationForm extends BaseForm ->add("title", "text", array( "constraints" => array( new NotBlank() + ), + "label" => Translator::getInstance()->trans("Category title *"), + "label_attr" => array( + "for" => "title" ) )) ->add("parent", "integer", array( diff --git a/core/lib/Thelia/Form/CategoryModificationForm.php b/core/lib/Thelia/Form/CategoryModificationForm.php new file mode 100644 index 000000000..a27389324 --- /dev/null +++ b/core/lib/Thelia/Form/CategoryModificationForm.php @@ -0,0 +1,55 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Model\LangQuery; +use Propel\Runtime\ActiveQuery\Criteria; +use Symfony\Component\Validator\Constraints\GreaterThan; +use Thelia\Core\Translation\Translator; + +class CategoryModificationForm extends CategoryCreationForm +{ + use StandardDescriptionFieldsTrait; + + protected function buildForm() + { + parent::buildForm(true); + + $this->formBuilder + ->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) + + ->add("visible", "checkbox", array( + "label" => Translator::getInstance()->trans("This category is online on the front office.") + )) + ; + + // Add standard description fields + $this->addStandardDescFields(array('title', 'locale')); + } + + public function getName() + { + return "thelia_category_modification"; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Form/ConfigCreationForm.php b/core/lib/Thelia/Form/ConfigCreationForm.php new file mode 100644 index 000000000..b2a0c11bb --- /dev/null +++ b/core/lib/Thelia/Form/ConfigCreationForm.php @@ -0,0 +1,90 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints; +use Thelia\Model\ConfigQuery; +use Symfony\Component\Validator\ExecutionContextInterface; + +class ConfigCreationForm extends BaseForm +{ + protected function buildForm($change_mode = false) + { + $name_constraints = array(new Constraints\NotBlank()); + + if (!$change_mode) { + $name_constraints[] = new Constraints\Callback(array( + "methods" => array(array($this, "checkDuplicateName")) + )); + } + + $this->formBuilder + ->add("name", "text", array( + "constraints" => $name_constraints, + "label" => "Name *", + "label_attr" => array( + "for" => "name" + ) + )) + ->add("title", "text", array( + "constraints" => array( + new Constraints\NotBlank() + ), + "label" => "Purpose *", + "label_attr" => array( + "for" => "purpose" + ) + )) + ->add("locale", "hidden", array( + "constraints" => array( + new Constraints\NotBlank() + ) + )) + ->add("value", "text", array( + "label" => "Value *", + "label_attr" => array( + "for" => "value" + ) + )) + ->add("hidden", "hidden", array()) + ->add("secured", "hidden", array( + "label" => "Prevent variable modification or deletion, except for super-admin" + )) + ; + } + + public function getName() + { + return "thelia_config_creation"; + } + + public function checkDuplicateName($value, ExecutionContextInterface $context) + { + $config = ConfigQuery::create()->findOneByName($value); + + if ($config) { + $context->addViolation(sprintf("A variable with name \"%s\" already exists.", $value)); + } + } + +} diff --git a/core/lib/Thelia/Form/ConfigModificationForm.php b/core/lib/Thelia/Form/ConfigModificationForm.php new file mode 100644 index 000000000..ce508137f --- /dev/null +++ b/core/lib/Thelia/Form/ConfigModificationForm.php @@ -0,0 +1,73 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Model\LangQuery; +use Propel\Runtime\ActiveQuery\Criteria; +use Symfony\Component\Validator\Constraints\GreaterThan; + +class ConfigModificationForm extends BaseForm +{ + use StandardDescriptionFieldsTrait; + + protected function buildForm() + { + $this->formBuilder + ->add("id", "hidden", array( + "constraints" => array( + new GreaterThan( + array('value' => 0) + ) + ) + )) + ->add("name", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "Name", + "label_attr" => array( + "for" => "name" + ) + )) + ->add("value", "text", array( + "label" => "Value", + "label_attr" => array( + "for" => "value" + ) + )) + ->add("hidden", "hidden", array()) + ->add("secured", "hidden", array( + "label" => "Prevent variable modification or deletion, except for super-admin" + )) + ; + + // Add standard description fields + $this->addStandardDescFields(); + } + + public function getName() + { + return "thelia_config_modification"; + } +} diff --git a/core/lib/Thelia/Form/CouponCreationForm.php b/core/lib/Thelia/Form/CouponCreationForm.php new file mode 100755 index 000000000..4761bb28f --- /dev/null +++ b/core/lib/Thelia/Form/CouponCreationForm.php @@ -0,0 +1,160 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints\NotBlank; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/29/13 + * Time: 3:45 PM + * + * Allow to build a form Coupon + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponCreationForm extends BaseForm +{ + /** + * Build Coupon form + * + * @return void + */ + protected function buildForm() + { + $this->formBuilder + ->add( + 'code', + 'text', + array( + 'constraints' => array( + new NotBlank() + ) + ) + ) + ->add( + 'title', + 'text', + array( + 'constraints' => array( + new NotBlank() + ) + ) + ) + ->add( + 'shortDescription', + 'text', + array( + 'invalid_message' => 'test', + 'constraints' => array( + new NotBlank() + ) + ) + ) + ->add( + 'description', + 'textarea', + array( + 'invalid_message' => 'test', + 'constraints' => array( + new NotBlank() + ) + ) + ) + ->add( + 'effect', + 'text', + array( + 'invalid_message' => 'test', + 'constraints' => array( + new NotBlank() + ) + ) + ) + ->add( + 'amount', + 'money', + array() + ) + ->add( + 'isEnabled', + 'checkbox', + array() + ) + ->add( + 'expirationDate', + 'text', + array( + 'constraints' => array( + new NotBlank() + ) + ) + ) + ->add( + 'isCumulative', + 'checkbox', + array() + ) + ->add( + 'isRemovingPostage', + 'checkbox', + array() + ) + ->add( + 'isAvailableOnSpecialOffers', + 'checkbox', + array() + ) + ->add( + 'maxUsage', + 'text', + array( + 'constraints' => array( + new NotBlank() + ) + ) + ) + ->add( + 'locale', + 'hidden', + array( + 'constraints' => array( + new NotBlank() + ) + ) + ); + } + + /** + * Get form name + * + * @return string + */ + public function getName() + { + return 'thelia_coupon_creation'; + } +} diff --git a/core/lib/Thelia/Form/CurrencyCreationForm.php b/core/lib/Thelia/Form/CurrencyCreationForm.php new file mode 100644 index 000000000..3328cd342 --- /dev/null +++ b/core/lib/Thelia/Form/CurrencyCreationForm.php @@ -0,0 +1,101 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints; +use Thelia\Model\CurrencyQuery; +use Symfony\Component\Validator\ExecutionContextInterface; +use Symfony\Component\Validator\Constraints\NotBlank; + +class CurrencyCreationForm extends BaseForm +{ + protected function buildForm($change_mode = false) + { + $code_constraints = array(new Constraints\NotBlank()); + + if (!$change_mode) { + $code_constraints[] = new Constraints\Callback(array( + "methods" => array(array($this, "checkDuplicateCode")) + )); + } + + $this->formBuilder + ->add("name" , "text" , array( + "constraints" => array( + new NotBlank() + ), + "label" => "Name *", + "label_attr" => array( + "for" => "name" + )) + ) + ->add("locale" , "text" , array( + "constraints" => array( + new NotBlank() + )) + ) + ->add("symbol" , "text" , array( + "constraints" => array( + new NotBlank() + ), + "label" => "Symbol *", + "label_attr" => array( + "for" => "symbol" + )) + ) + ->add("rate" , "text" , array( + "constraints" => array( + new NotBlank() + ), + "label" => "Rate from € *", + "label_attr" => array( + "for" => "rate" + )) + ) + ->add("code" , "text" , array( + "constraints" => array( + new NotBlank() + ), + "label" => "ISO 4217 code *", + "label_attr" => array( + "for" => "iso_4217_code" + )) + ) + ; + } + + public function getName() + { + return "thelia_currency_creation"; + } + + public function checkDuplicateCode($value, ExecutionContextInterface $context) + { + $currency = CurrencyQuery::create()->findOneByCode($value); + + if ($currency) { + $context->addViolation(sprintf("A currency with code \"%s\" already exists.", $value)); + } + } + +} diff --git a/core/lib/Thelia/Form/CategoryDeletionForm.php b/core/lib/Thelia/Form/CurrencyModificationForm.php similarity index 84% rename from core/lib/Thelia/Form/CategoryDeletionForm.php rename to core/lib/Thelia/Form/CurrencyModificationForm.php index 47c130fdd..3f0b1f152 100644 --- a/core/lib/Thelia/Form/CategoryDeletionForm.php +++ b/core/lib/Thelia/Form/CurrencyModificationForm.php @@ -23,22 +23,23 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Model\LangQuery; +use Propel\Runtime\ActiveQuery\Criteria; +use Symfony\Component\Validator\Constraints\GreaterThan; -class CategoryDeletionForm extends BaseForm +class CurrencyModificationForm extends CurrencyCreationForm { protected function buildForm() { + parent::buildForm(true); + $this->formBuilder - ->add("category_id", "integer", array( - "constraints" => array( - new NotBlank() - ) - )) + ->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) ; } public function getName() { - return "thelia_category_deletion"; + return "thelia_currency_modification"; } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Form/CustomerCreation.php b/core/lib/Thelia/Form/CustomerCreation.php index 0d7172510..1bc88407b 100755 --- a/core/lib/Thelia/Form/CustomerCreation.php +++ b/core/lib/Thelia/Form/CustomerCreation.php @@ -27,6 +27,11 @@ use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Model\ConfigQuery; use Thelia\Model\CustomerQuery; +/** + * Class CustomerCreation + * @package Thelia\Form + * @author Manuel Raynaud + */ class CustomerCreation extends BaseForm { diff --git a/core/lib/Thelia/Form/CustomerLogin.php b/core/lib/Thelia/Form/CustomerLogin.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Form/CustomerModification.php b/core/lib/Thelia/Form/CustomerModification.php index 8f5167d52..61f1e0834 100755 --- a/core/lib/Thelia/Form/CustomerModification.php +++ b/core/lib/Thelia/Form/CustomerModification.php @@ -25,6 +25,11 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; +/** + * Class CustomerModification + * @package Thelia\Form + * @author Manuel Raynaud + */ class CustomerModification extends BaseForm { /** diff --git a/core/lib/Thelia/Form/Exception/FormValidationException.php b/core/lib/Thelia/Form/Exception/FormValidationException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Form/Exception/ProductNotFoundException.php b/core/lib/Thelia/Form/Exception/ProductNotFoundException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Form/Exception/StockNotFoundException.php b/core/lib/Thelia/Form/Exception/StockNotFoundException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Form/MessageCreationForm.php b/core/lib/Thelia/Form/MessageCreationForm.php new file mode 100644 index 000000000..6ce84cb06 --- /dev/null +++ b/core/lib/Thelia/Form/MessageCreationForm.php @@ -0,0 +1,81 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints; +use Thelia\Model\MessageQuery; +use Symfony\Component\Validator\ExecutionContextInterface; + +class MessageCreationForm extends BaseForm +{ + protected function buildForm($change_mode = false) + { + $name_constraints = array(new Constraints\NotBlank()); + + if (!$change_mode) { + $name_constraints[] = new Constraints\Callback(array( + "methods" => array(array($this, "checkDuplicateName")) + )); + } + + $this->formBuilder + ->add("name", "text", array( + "constraints" => $name_constraints, + "label" => "Name *", + "label_attr" => array( + "for" => "name" + ) + )) + ->add("title", "text", array( + "constraints" => array( + new Constraints\NotBlank() + ), + "label" => "Purpose *", + "label_attr" => array( + "for" => "purpose" + ) + )) + ->add("locale", "hidden", array( + "constraints" => array( + new Constraints\NotBlank() + ) + )) + ->add("secured", "hidden", array()) + ; + } + + public function getName() + { + return "thelia_message_creation"; + } + + public function checkDuplicateName($value, ExecutionContextInterface $context) + { + $message = MessageQuery::create()->findOneByName($value); + + if ($message) { + $context->addViolation(sprintf("A message with name \"%s\" already exists.", $value)); + } + } + +} diff --git a/core/lib/Thelia/Form/MessageModificationForm.php b/core/lib/Thelia/Form/MessageModificationForm.php new file mode 100644 index 000000000..a23f66e28 --- /dev/null +++ b/core/lib/Thelia/Form/MessageModificationForm.php @@ -0,0 +1,80 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Model\LangQuery; +use Propel\Runtime\ActiveQuery\Criteria; +use Symfony\Component\Validator\Constraints\GreaterThan; + +class MessageModificationForm extends BaseForm +{ + protected function buildForm() + { + $this->formBuilder + ->add("id" , "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) + ->add("name" , "text" , array( + "constraints" => array(new NotBlank()), + "label" => "Name *", + "label_attr" => array( + "for" => "name" + ) + )) + ->add("secured" , "text" , array( + "label" => "Prevent mailing template modification or deletion, except for super-admin" + )) + ->add("locale" , "text" , array()) + ->add("title" , "text" , array( + "constraints" => array(new NotBlank()), + "label" => "Title *", + "label_attr" => array( + "for" => "title" + ) + )) + ->add("subject" , "text" , array( + "constraints" => array(new NotBlank()), + "label" => "Message subject *", + "label_attr" => array( + "for" => "subject" + ) + )) + ->add("html_message" , "text" , array( + "label" => "HTML Message", + "label_attr" => array( + "for" => "html_message" + ) + )) + ->add("text_message" , "text" , array( + "label" => "Text Message", + "label_attr" => array( + "for" => "text_message" + ) + )) + ; + } + + public function getName() + { + return "thelia_message_modification"; + } +} diff --git a/core/lib/Thelia/Form/ProductCreationForm.php b/core/lib/Thelia/Form/ProductCreationForm.php new file mode 100644 index 000000000..396f6d0d5 --- /dev/null +++ b/core/lib/Thelia/Form/ProductCreationForm.php @@ -0,0 +1,67 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints\NotBlank; + +class ProductCreationForm extends BaseForm +{ + protected function buildForm() + { + $this->formBuilder + ->add("ref", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "Product reference *", + "label_attr" => array( + "for" => "ref" + ) + )) + ->add("title", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => "Product title *", + "label_attr" => array( + "for" => "title" + ) + )) + ->add("parent", "integer", array( + "constraints" => array( + new NotBlank() + ) + )) + ->add("locale", "text", array( + "constraints" => array( + new NotBlank() + ) + )) + ; + } + + public function getName() + { + return "thelia_product_creation"; + } +} diff --git a/core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php b/core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php new file mode 100644 index 000000000..7c0a51a31 --- /dev/null +++ b/core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php @@ -0,0 +1,92 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints\NotBlank; + +use Thelia\Core\Translation\Translator; + +/** + * A trait to add standard localized description fields to a form. + * + * @author Franck Allimant + */ +trait StandardDescriptionFieldsTrait +{ + /** + * Add standard description fields + locale tot the form + * + * @param array $exclude name of the fields that should not be added to the form + */ + protected function addStandardDescFields($exclude = array()) + { + if (! in_array('locale', $exclude)) + $this->formBuilder + ->add("locale", "hidden", array( + "constraints" => array( + new NotBlank() + ) + ) + ); + + if (! in_array('title', $exclude)) + $this->formBuilder + ->add("title", "text", array( + "constraints" => array( + new NotBlank() + ), + "label" => Translator::getInstance()->trans("Title"), + "label_attr" => array( + "for" => "title" + ) + ) + ); + + if (! in_array('chapo', $exclude)) + $this->formBuilder + ->add("chapo", "text", array( + "label" => Translator::getInstance()->trans("Summary"), + "label_attr" => array( + "for" => "summary" + ) + )); + + if (! in_array('description', $exclude)) + $this->formBuilder + ->add("description", "text", array( + "label" => Translator::getInstance()->trans("Detailed description"), + "label_attr" => array( + "for" => "detailed_description" + ) + )); + + if (! in_array('postscriptum', $exclude)) + $this->formBuilder + ->add("postscriptum", "text", array( + "label" => Translator::getInstance()->trans("Conclusion"), + "label_attr" => array( + "for" => "conclusion" + ) + )); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Install/BaseInstall.php b/core/lib/Thelia/Install/BaseInstall.php new file mode 100644 index 000000000..58c510267 --- /dev/null +++ b/core/lib/Thelia/Install/BaseInstall.php @@ -0,0 +1,46 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Install; +use Thelia\Install\Exception\AlreadyInstallException; + +/** + * Class BaseInstall + * @author Manuel Raynaud + */ +abstract class BaseInstall +{ + /** + * Verify if an installation already exists + */ + public function __construct($verifyInstall = true) + { + if (file_exists(THELIA_ROOT . '/local/config/database.yml') && $verifyInstall) { + throw new AlreadyInstallException("Thelia is already installed"); + } + + + $this->exec(); + } + + abstract public function exec(); +} \ No newline at end of file diff --git a/core/lib/Thelia/Install/CheckPermission.php b/core/lib/Thelia/Install/CheckPermission.php new file mode 100644 index 000000000..db73330cf --- /dev/null +++ b/core/lib/Thelia/Install/CheckPermission.php @@ -0,0 +1,78 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Install; + + +/** + * Class CheckPermission + * @package Thelia\Install + * @author Manuel Raynaud + */ +class CheckPermission extends BaseInstall +{ + const CONF = "const"; + const LOG = "log"; + const CACHE = "cache"; + + private $directories = array(); + private $validation = array(); + private $valid = true; + + public function __construct($verifyInstall = true) + { + + + $this->directories = array( + self::CONF => THELIA_ROOT . "local/config", + self::LOG => THELIA_ROOT . "log", + self::CACHE => THELIA_ROOT . "cache" + ); + + $this->validation = array( + self::CONF => array( + "text" => sprintf("config directory(%s)...", $this->directories[self::CONF]), + "status" => true + ), + self::LOG => array( + "text" => sprintf("cache directory(%s)...", $this->directories[self::LOG]), + "status" => true + ), + self::CACHE => array( + "text" => sprintf("log directory(%s)...", $this->directories[self::CACHE]), + "status" => true + ) + ); + parent::__construct($verifyInstall); + } + + public function exec() + { + foreach ($this->directories as $key => $directory) { + if(is_writable($directory) === false) { + $this->valid = false; + $this->validation[$key]["status"] = false; + } + } + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Install/Database.php b/core/lib/Thelia/Install/Database.php new file mode 100644 index 000000000..34ca97dae --- /dev/null +++ b/core/lib/Thelia/Install/Database.php @@ -0,0 +1,103 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Install; + + +/** + * Class Database + * @package Thelia\Install + * @author Manuel Raynaud + */ +class Database +{ + public $connection; + + public function __construct(\PDO $connection) + { + $this->connection = $connection; + } + + /** + * Insert all sql needed in database + * + * @param $dbName + */ + public function insertSql($dbName = null) + { + 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")) + ); + + for ($i = 0; $i < count($sql); $i ++) { + if (!empty($sql[$i])) { + $this->connection->query($sql[$i]); + } + } + } + + /** + * Separate each sql instruction in an array + * + * @param $sql + * @return array + */ + protected function prepareSql($sql) + { + $sql = str_replace(";',", "-CODE-", $sql); + $sql = trim($sql); + $query = array(); + + $tab = explode(";", $sql); + + for ($i=0; $iconnection->query( + sprintf( + "CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8", + $dbName + ) + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Internal/InternalEvent.php b/core/lib/Thelia/Install/Exception/AlreadyInstallException.php similarity index 87% rename from core/lib/Thelia/Core/Event/Internal/InternalEvent.php rename to core/lib/Thelia/Install/Exception/AlreadyInstallException.php index 49273769f..1409c7cdd 100644 --- a/core/lib/Thelia/Core/Event/Internal/InternalEvent.php +++ b/core/lib/Thelia/Install/Exception/AlreadyInstallException.php @@ -21,16 +21,15 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core\Event\Internal; +namespace Thelia\Install\Exception; -use Symfony\Component\EventDispatcher\Event; /** - * Base class used for internal event like creating new Customer, adding item to cart, etc - * - * Class InternalEvent - * @package Thelia\Core\Event + * Class AlreadyInstallException + * @package Thelia\Install\Exception + * @author Manuel Raynaud */ -abstract class InternalEvent extends Event +class AlreadyInstallException extends InstallException { -} + +} \ No newline at end of file diff --git a/core/lib/Thelia/Install/Exception/InstallException.php b/core/lib/Thelia/Install/Exception/InstallException.php new file mode 100644 index 000000000..6924bcfe5 --- /dev/null +++ b/core/lib/Thelia/Install/Exception/InstallException.php @@ -0,0 +1,32 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Install\Exception; + +/** + * Class InstallException + * @author Manuel Raynaud + */ +class InstallException extends \RuntimeException +{ + +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/Address.php b/core/lib/Thelia/Model/Address.php index 1edd6f4ff..413797eeb 100755 --- a/core/lib/Thelia/Model/Address.php +++ b/core/lib/Thelia/Model/Address.php @@ -2,8 +2,73 @@ namespace Thelia\Model; +use Propel\Runtime\Connection\ConnectionInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Thelia\Core\Event\AddressEvent; +use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Base\Address as BaseAddress; class Address extends BaseAddress { + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CREATEADDRESS, new AddressEvent($this)); + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATEADDRESS, new AddressEvent($this)); + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATEADDRESS, new AddressEvent($this)); + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_UPDATEADDRESS, new AddressEvent($this)); + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETEADDRESS, new AddressEvent($this)); + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETEADDRESS, new AddressEvent($this)); + } } diff --git a/core/lib/Thelia/Model/Admin.php b/core/lib/Thelia/Model/Admin.php index 34dc7fbfd..a6deb7e60 100755 --- a/core/lib/Thelia/Model/Admin.php +++ b/core/lib/Thelia/Model/Admin.php @@ -26,7 +26,7 @@ class Admin extends BaseAdmin implements UserInterface \Thelia\Log\Tlog::getInstance()->debug($password); if ($this->isNew() && ($password === null || trim($password) == "")) { - throw new InvalidArgumentException("customer password is mandatory on creation"); + throw new \InvalidArgumentException("customer password is mandatory on creation"); } if($password !== null && trim($password) != "") { diff --git a/core/lib/Thelia/Model/Base/Accessory.php b/core/lib/Thelia/Model/Base/Accessory.php index f5acd9977..183f59947 100644 --- a/core/lib/Thelia/Model/Base/Accessory.php +++ b/core/lib/Thelia/Model/Base/Accessory.php @@ -266,7 +266,7 @@ abstract class Accessory implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -891,6 +891,10 @@ abstract class Accessory implements ActiveRecordInterface $modifiedColumns = array(); $index = 0; + $this->modifiedColumns[] = AccessoryTableMap::ID; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . AccessoryTableMap::ID . ')'); + } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(AccessoryTableMap::ID)) { @@ -948,6 +952,13 @@ abstract class Accessory 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); } @@ -1224,7 +1235,6 @@ abstract class Accessory implements ActiveRecordInterface */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setId($this->getId()); $copyObj->setProductId($this->getProductId()); $copyObj->setAccessory($this->getAccessory()); $copyObj->setPosition($this->getPosition()); @@ -1232,6 +1242,7 @@ abstract class Accessory implements ActiveRecordInterface $copyObj->setUpdatedAt($this->getUpdatedAt()); 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/Address.php b/core/lib/Thelia/Model/Base/Address.php index 45cad61aa..2dc666a08 100644 --- a/core/lib/Thelia/Model/Base/Address.php +++ b/core/lib/Thelia/Model/Base/Address.php @@ -70,10 +70,10 @@ abstract class Address implements ActiveRecordInterface protected $id; /** - * The value for the name field. + * The value for the label field. * @var string */ - protected $name; + protected $label; /** * The value for the customer_id field. @@ -388,7 +388,7 @@ abstract class Address implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -498,14 +498,14 @@ abstract class Address implements ActiveRecordInterface } /** - * Get the [name] column value. + * Get the [label] column value. * * @return string */ - public function getName() + public function getLabel() { - return $this->name; + return $this->label; } /** @@ -724,25 +724,25 @@ abstract class Address implements ActiveRecordInterface } // setId() /** - * Set the value of [name] column. + * Set the value of [label] column. * * @param string $v new value * @return \Thelia\Model\Address The current object (for fluent API support) */ - public function setName($v) + public function setLabel($v) { if ($v !== null) { $v = (string) $v; } - if ($this->name !== $v) { - $this->name = $v; - $this->modifiedColumns[] = AddressTableMap::NAME; + if ($this->label !== $v) { + $this->label = $v; + $this->modifiedColumns[] = AddressTableMap::LABEL; } return $this; - } // setName() + } // setLabel() /** * Set the value of [customer_id] column. @@ -1136,8 +1136,8 @@ abstract class Address implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AddressTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AddressTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]; - $this->name = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AddressTableMap::translateFieldName('Label', TableMap::TYPE_PHPNAME, $indexType)]; + $this->label = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AddressTableMap::translateFieldName('CustomerId', TableMap::TYPE_PHPNAME, $indexType)]; $this->customer_id = (null !== $col) ? (int) $col : null; @@ -1501,8 +1501,8 @@ abstract class Address implements ActiveRecordInterface if ($this->isColumnModified(AddressTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(AddressTableMap::NAME)) { - $modifiedColumns[':p' . $index++] = 'NAME'; + if ($this->isColumnModified(AddressTableMap::LABEL)) { + $modifiedColumns[':p' . $index++] = 'LABEL'; } if ($this->isColumnModified(AddressTableMap::CUSTOMER_ID)) { $modifiedColumns[':p' . $index++] = 'CUSTOMER_ID'; @@ -1566,8 +1566,8 @@ abstract class Address implements ActiveRecordInterface case 'ID': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'NAME': - $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + case 'LABEL': + $stmt->bindValue($identifier, $this->label, PDO::PARAM_STR); break; case 'CUSTOMER_ID': $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT); @@ -1683,7 +1683,7 @@ abstract class Address implements ActiveRecordInterface return $this->getId(); break; case 1: - return $this->getName(); + return $this->getLabel(); break; case 2: return $this->getCustomerId(); @@ -1763,7 +1763,7 @@ abstract class Address implements ActiveRecordInterface $keys = AddressTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), - $keys[1] => $this->getName(), + $keys[1] => $this->getLabel(), $keys[2] => $this->getCustomerId(), $keys[3] => $this->getTitleId(), $keys[4] => $this->getCompany(), @@ -1841,7 +1841,7 @@ abstract class Address implements ActiveRecordInterface $this->setId($value); break; case 1: - $this->setName($value); + $this->setLabel($value); break; case 2: $this->setCustomerId($value); @@ -1916,7 +1916,7 @@ abstract class Address implements ActiveRecordInterface $keys = AddressTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[1], $arr)) $this->setLabel($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setCustomerId($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setTitleId($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setCompany($arr[$keys[4]]); @@ -1945,7 +1945,7 @@ abstract class Address implements ActiveRecordInterface $criteria = new Criteria(AddressTableMap::DATABASE_NAME); if ($this->isColumnModified(AddressTableMap::ID)) $criteria->add(AddressTableMap::ID, $this->id); - if ($this->isColumnModified(AddressTableMap::NAME)) $criteria->add(AddressTableMap::NAME, $this->name); + if ($this->isColumnModified(AddressTableMap::LABEL)) $criteria->add(AddressTableMap::LABEL, $this->label); if ($this->isColumnModified(AddressTableMap::CUSTOMER_ID)) $criteria->add(AddressTableMap::CUSTOMER_ID, $this->customer_id); if ($this->isColumnModified(AddressTableMap::TITLE_ID)) $criteria->add(AddressTableMap::TITLE_ID, $this->title_id); if ($this->isColumnModified(AddressTableMap::COMPANY)) $criteria->add(AddressTableMap::COMPANY, $this->company); @@ -2025,7 +2025,7 @@ abstract class Address implements ActiveRecordInterface */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setName($this->getName()); + $copyObj->setLabel($this->getLabel()); $copyObj->setCustomerId($this->getCustomerId()); $copyObj->setTitleId($this->getTitleId()); $copyObj->setCompany($this->getCompany()); @@ -2804,7 +2804,7 @@ abstract class Address implements ActiveRecordInterface public function clear() { $this->id = null; - $this->name = null; + $this->label = null; $this->customer_id = null; $this->title_id = null; $this->company = null; diff --git a/core/lib/Thelia/Model/Base/AddressQuery.php b/core/lib/Thelia/Model/Base/AddressQuery.php index c67c79b02..dc6827868 100644 --- a/core/lib/Thelia/Model/Base/AddressQuery.php +++ b/core/lib/Thelia/Model/Base/AddressQuery.php @@ -22,7 +22,7 @@ use Thelia\Model\Map\AddressTableMap; * * * @method ChildAddressQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildAddressQuery orderByName($order = Criteria::ASC) Order by the name column + * @method ChildAddressQuery orderByLabel($order = Criteria::ASC) Order by the label column * @method ChildAddressQuery orderByCustomerId($order = Criteria::ASC) Order by the customer_id column * @method ChildAddressQuery orderByTitleId($order = Criteria::ASC) Order by the title_id column * @method ChildAddressQuery orderByCompany($order = Criteria::ASC) Order by the company column @@ -41,7 +41,7 @@ use Thelia\Model\Map\AddressTableMap; * @method ChildAddressQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildAddressQuery groupById() Group by the id column - * @method ChildAddressQuery groupByName() Group by the name column + * @method ChildAddressQuery groupByLabel() Group by the label column * @method ChildAddressQuery groupByCustomerId() Group by the customer_id column * @method ChildAddressQuery groupByTitleId() Group by the title_id column * @method ChildAddressQuery groupByCompany() Group by the company column @@ -87,7 +87,7 @@ use Thelia\Model\Map\AddressTableMap; * @method ChildAddress findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAddress matching the query, or a new ChildAddress object populated from the query conditions when no match is found * * @method ChildAddress findOneById(int $id) Return the first ChildAddress filtered by the id column - * @method ChildAddress findOneByName(string $name) Return the first ChildAddress filtered by the name column + * @method ChildAddress findOneByLabel(string $label) Return the first ChildAddress filtered by the label column * @method ChildAddress findOneByCustomerId(int $customer_id) Return the first ChildAddress filtered by the customer_id column * @method ChildAddress findOneByTitleId(int $title_id) Return the first ChildAddress filtered by the title_id column * @method ChildAddress findOneByCompany(string $company) Return the first ChildAddress filtered by the company column @@ -106,7 +106,7 @@ use Thelia\Model\Map\AddressTableMap; * @method ChildAddress findOneByUpdatedAt(string $updated_at) Return the first ChildAddress filtered by the updated_at column * * @method array findById(int $id) Return ChildAddress objects filtered by the id column - * @method array findByName(string $name) Return ChildAddress objects filtered by the name column + * @method array findByLabel(string $label) Return ChildAddress objects filtered by the label column * @method array findByCustomerId(int $customer_id) Return ChildAddress objects filtered by the customer_id column * @method array findByTitleId(int $title_id) Return ChildAddress objects filtered by the title_id column * @method array findByCompany(string $company) Return ChildAddress objects filtered by the company column @@ -211,7 +211,7 @@ abstract class AddressQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, NAME, CUSTOMER_ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0'; + $sql = 'SELECT ID, LABEL, CUSTOMER_ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -342,32 +342,32 @@ abstract class AddressQuery extends ModelCriteria } /** - * Filter the query on the name column + * Filter the query on the label column * * Example usage: * - * $query->filterByName('fooValue'); // WHERE name = 'fooValue' - * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' + * $query->filterByLabel('fooValue'); // WHERE label = 'fooValue' + * $query->filterByLabel('%fooValue%'); // WHERE label LIKE '%fooValue%' * * - * @param string $name The value to use as filter. + * @param string $label The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildAddressQuery The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByLabel($label = null, $comparison = null) { if (null === $comparison) { - if (is_array($name)) { + if (is_array($label)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $name)) { - $name = str_replace('*', '%', $name); + } elseif (preg_match('/[\%\*]/', $label)) { + $label = str_replace('*', '%', $label); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(AddressTableMap::NAME, $name, $comparison); + return $this->addUsingAlias(AddressTableMap::LABEL, $label, $comparison); } /** diff --git a/core/lib/Thelia/Model/Base/Admin.php b/core/lib/Thelia/Model/Base/Admin.php index b1241473e..6110aee7a 100644 --- a/core/lib/Thelia/Model/Base/Admin.php +++ b/core/lib/Thelia/Model/Base/Admin.php @@ -300,7 +300,7 @@ abstract class Admin implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/AdminGroup.php b/core/lib/Thelia/Model/Base/AdminGroup.php index 60141e3f8..9eadbb107 100644 --- a/core/lib/Thelia/Model/Base/AdminGroup.php +++ b/core/lib/Thelia/Model/Base/AdminGroup.php @@ -262,7 +262,7 @@ abstract class AdminGroup implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/AdminLog.php b/core/lib/Thelia/Model/Base/AdminLog.php index c83be20ee..ae828e4bb 100644 --- a/core/lib/Thelia/Model/Base/AdminLog.php +++ b/core/lib/Thelia/Model/Base/AdminLog.php @@ -266,7 +266,7 @@ abstract class AdminLog implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Area.php b/core/lib/Thelia/Model/Base/Area.php index fbd3199f4..08fc8be42 100644 --- a/core/lib/Thelia/Model/Base/Area.php +++ b/core/lib/Thelia/Model/Base/Area.php @@ -277,7 +277,7 @@ abstract class Area implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Attribute.php b/core/lib/Thelia/Model/Base/Attribute.php index efe4a631d..3c754c3b5 100644 --- a/core/lib/Thelia/Model/Base/Attribute.php +++ b/core/lib/Thelia/Model/Base/Attribute.php @@ -326,7 +326,7 @@ abstract class Attribute implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/AttributeAv.php b/core/lib/Thelia/Model/Base/AttributeAv.php index 43a1be294..b94288753 100644 --- a/core/lib/Thelia/Model/Base/AttributeAv.php +++ b/core/lib/Thelia/Model/Base/AttributeAv.php @@ -298,7 +298,7 @@ abstract class AttributeAv implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/AttributeAvI18n.php b/core/lib/Thelia/Model/Base/AttributeAvI18n.php index 3e7b9afcd..ec6f8811f 100644 --- a/core/lib/Thelia/Model/Base/AttributeAvI18n.php +++ b/core/lib/Thelia/Model/Base/AttributeAvI18n.php @@ -272,7 +272,7 @@ abstract class AttributeAvI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/AttributeCategory.php b/core/lib/Thelia/Model/Base/AttributeCategory.php index 691fa43ad..da702559a 100644 --- a/core/lib/Thelia/Model/Base/AttributeCategory.php +++ b/core/lib/Thelia/Model/Base/AttributeCategory.php @@ -262,7 +262,7 @@ abstract class AttributeCategory implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/AttributeCombination.php b/core/lib/Thelia/Model/Base/AttributeCombination.php index ea2ade03c..ef840a5a1 100644 --- a/core/lib/Thelia/Model/Base/AttributeCombination.php +++ b/core/lib/Thelia/Model/Base/AttributeCombination.php @@ -269,7 +269,7 @@ abstract class AttributeCombination implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/AttributeI18n.php b/core/lib/Thelia/Model/Base/AttributeI18n.php index 0e4a1db8f..d75c24412 100644 --- a/core/lib/Thelia/Model/Base/AttributeI18n.php +++ b/core/lib/Thelia/Model/Base/AttributeI18n.php @@ -272,7 +272,7 @@ abstract class AttributeI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Cart.php b/core/lib/Thelia/Model/Base/Cart.php index 910bdf0e0..20a2d9a5c 100644 --- a/core/lib/Thelia/Model/Base/Cart.php +++ b/core/lib/Thelia/Model/Base/Cart.php @@ -307,7 +307,7 @@ abstract class Cart implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CartItem.php b/core/lib/Thelia/Model/Base/CartItem.php index 3c5711022..827a4c5ec 100644 --- a/core/lib/Thelia/Model/Base/CartItem.php +++ b/core/lib/Thelia/Model/Base/CartItem.php @@ -313,7 +313,7 @@ abstract class CartItem implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Category.php b/core/lib/Thelia/Model/Base/Category.php index 85a77a061..ee56670a1 100644 --- a/core/lib/Thelia/Model/Base/Category.php +++ b/core/lib/Thelia/Model/Base/Category.php @@ -22,6 +22,8 @@ use Thelia\Model\AttributeCategory as ChildAttributeCategory; use Thelia\Model\AttributeCategoryQuery as ChildAttributeCategoryQuery; use Thelia\Model\AttributeQuery as ChildAttributeQuery; use Thelia\Model\Category as ChildCategory; +use Thelia\Model\CategoryAssociatedContent as ChildCategoryAssociatedContent; +use Thelia\Model\CategoryAssociatedContentQuery as ChildCategoryAssociatedContentQuery; use Thelia\Model\CategoryDocument as ChildCategoryDocument; use Thelia\Model\CategoryDocumentQuery as ChildCategoryDocumentQuery; use Thelia\Model\CategoryI18n as ChildCategoryI18n; @@ -31,8 +33,6 @@ use Thelia\Model\CategoryImageQuery as ChildCategoryImageQuery; use Thelia\Model\CategoryQuery as ChildCategoryQuery; use Thelia\Model\CategoryVersion as ChildCategoryVersion; use Thelia\Model\CategoryVersionQuery as ChildCategoryVersionQuery; -use Thelia\Model\ContentAssoc as ChildContentAssoc; -use Thelia\Model\ContentAssocQuery as ChildContentAssocQuery; use Thelia\Model\Feature as ChildFeature; use Thelia\Model\FeatureCategory as ChildFeatureCategory; use Thelia\Model\FeatureCategoryQuery as ChildFeatureCategoryQuery; @@ -41,8 +41,6 @@ use Thelia\Model\Product as ChildProduct; use Thelia\Model\ProductCategory as ChildProductCategory; use Thelia\Model\ProductCategoryQuery as ChildProductCategoryQuery; use Thelia\Model\ProductQuery as ChildProductQuery; -use Thelia\Model\Rewriting as ChildRewriting; -use Thelia\Model\RewritingQuery as ChildRewritingQuery; use Thelia\Model\Map\CategoryTableMap; use Thelia\Model\Map\CategoryVersionTableMap; @@ -153,18 +151,6 @@ abstract class Category implements ActiveRecordInterface protected $collAttributeCategories; protected $collAttributeCategoriesPartial; - /** - * @var ObjectCollection|ChildContentAssoc[] Collection to store aggregation of ChildContentAssoc objects. - */ - protected $collContentAssocs; - protected $collContentAssocsPartial; - - /** - * @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects. - */ - protected $collRewritings; - protected $collRewritingsPartial; - /** * @var ObjectCollection|ChildCategoryImage[] Collection to store aggregation of ChildCategoryImage objects. */ @@ -177,6 +163,12 @@ abstract class Category implements ActiveRecordInterface protected $collCategoryDocuments; protected $collCategoryDocumentsPartial; + /** + * @var ObjectCollection|ChildCategoryAssociatedContent[] Collection to store aggregation of ChildCategoryAssociatedContent objects. + */ + protected $collCategoryAssociatedContents; + protected $collCategoryAssociatedContentsPartial; + /** * @var ObjectCollection|ChildCategoryI18n[] Collection to store aggregation of ChildCategoryI18n objects. */ @@ -270,18 +262,6 @@ abstract class Category implements ActiveRecordInterface */ protected $attributeCategoriesScheduledForDeletion = null; - /** - * An array of objects scheduled for deletion. - * @var ObjectCollection - */ - protected $contentAssocsScheduledForDeletion = null; - - /** - * An array of objects scheduled for deletion. - * @var ObjectCollection - */ - protected $rewritingsScheduledForDeletion = null; - /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -294,6 +274,12 @@ abstract class Category implements ActiveRecordInterface */ protected $categoryDocumentsScheduledForDeletion = null; + /** + * An array of objects scheduled for deletion. + * @var ObjectCollection + */ + protected $categoryAssociatedContentsScheduledForDeletion = null; + /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -475,7 +461,7 @@ abstract class Category implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -1039,14 +1025,12 @@ abstract class Category implements ActiveRecordInterface $this->collAttributeCategories = null; - $this->collContentAssocs = null; - - $this->collRewritings = null; - $this->collCategoryImages = null; $this->collCategoryDocuments = null; + $this->collCategoryAssociatedContents = null; + $this->collCategoryI18ns = null; $this->collCategoryVersions = null; @@ -1331,40 +1315,6 @@ abstract class Category implements ActiveRecordInterface } } - if ($this->contentAssocsScheduledForDeletion !== null) { - if (!$this->contentAssocsScheduledForDeletion->isEmpty()) { - \Thelia\Model\ContentAssocQuery::create() - ->filterByPrimaryKeys($this->contentAssocsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->contentAssocsScheduledForDeletion = null; - } - } - - if ($this->collContentAssocs !== null) { - foreach ($this->collContentAssocs as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - - if ($this->rewritingsScheduledForDeletion !== null) { - if (!$this->rewritingsScheduledForDeletion->isEmpty()) { - \Thelia\Model\RewritingQuery::create() - ->filterByPrimaryKeys($this->rewritingsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->rewritingsScheduledForDeletion = null; - } - } - - if ($this->collRewritings !== null) { - foreach ($this->collRewritings as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - if ($this->categoryImagesScheduledForDeletion !== null) { if (!$this->categoryImagesScheduledForDeletion->isEmpty()) { \Thelia\Model\CategoryImageQuery::create() @@ -1399,6 +1349,23 @@ abstract class Category implements ActiveRecordInterface } } + if ($this->categoryAssociatedContentsScheduledForDeletion !== null) { + if (!$this->categoryAssociatedContentsScheduledForDeletion->isEmpty()) { + \Thelia\Model\CategoryAssociatedContentQuery::create() + ->filterByPrimaryKeys($this->categoryAssociatedContentsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->categoryAssociatedContentsScheduledForDeletion = null; + } + } + + if ($this->collCategoryAssociatedContents !== null) { + foreach ($this->collCategoryAssociatedContents as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + if ($this->categoryI18nsScheduledForDeletion !== null) { if (!$this->categoryI18nsScheduledForDeletion->isEmpty()) { \Thelia\Model\CategoryI18nQuery::create() @@ -1668,18 +1635,15 @@ abstract class Category implements ActiveRecordInterface if (null !== $this->collAttributeCategories) { $result['AttributeCategories'] = $this->collAttributeCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } - if (null !== $this->collContentAssocs) { - $result['ContentAssocs'] = $this->collContentAssocs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } - if (null !== $this->collRewritings) { - $result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } if (null !== $this->collCategoryImages) { $result['CategoryImages'] = $this->collCategoryImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collCategoryDocuments) { $result['CategoryDocuments'] = $this->collCategoryDocuments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } + if (null !== $this->collCategoryAssociatedContents) { + $result['CategoryAssociatedContents'] = $this->collCategoryAssociatedContents->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } if (null !== $this->collCategoryI18ns) { $result['CategoryI18ns'] = $this->collCategoryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1895,18 +1859,6 @@ abstract class Category implements ActiveRecordInterface } } - foreach ($this->getContentAssocs() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addContentAssoc($relObj->copy($deepCopy)); - } - } - - foreach ($this->getRewritings() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addRewriting($relObj->copy($deepCopy)); - } - } - foreach ($this->getCategoryImages() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCategoryImage($relObj->copy($deepCopy)); @@ -1919,6 +1871,12 @@ abstract class Category implements ActiveRecordInterface } } + foreach ($this->getCategoryAssociatedContents() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCategoryAssociatedContent($relObj->copy($deepCopy)); + } + } + foreach ($this->getCategoryI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCategoryI18n($relObj->copy($deepCopy)); @@ -1981,18 +1939,15 @@ abstract class Category implements ActiveRecordInterface if ('AttributeCategory' == $relationName) { return $this->initAttributeCategories(); } - if ('ContentAssoc' == $relationName) { - return $this->initContentAssocs(); - } - if ('Rewriting' == $relationName) { - return $this->initRewritings(); - } if ('CategoryImage' == $relationName) { return $this->initCategoryImages(); } if ('CategoryDocument' == $relationName) { return $this->initCategoryDocuments(); } + if ('CategoryAssociatedContent' == $relationName) { + return $this->initCategoryAssociatedContents(); + } if ('CategoryI18n' == $relationName) { return $this->initCategoryI18ns(); } @@ -2733,567 +2688,6 @@ abstract class Category implements ActiveRecordInterface return $this->getAttributeCategories($query, $con); } - /** - * Clears out the collContentAssocs collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addContentAssocs() - */ - public function clearContentAssocs() - { - $this->collContentAssocs = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Reset is the collContentAssocs collection loaded partially. - */ - public function resetPartialContentAssocs($v = true) - { - $this->collContentAssocsPartial = $v; - } - - /** - * Initializes the collContentAssocs collection. - * - * By default this just sets the collContentAssocs collection to an empty array (like clearcollContentAssocs()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initContentAssocs($overrideExisting = true) - { - if (null !== $this->collContentAssocs && !$overrideExisting) { - return; - } - $this->collContentAssocs = new ObjectCollection(); - $this->collContentAssocs->setModel('\Thelia\Model\ContentAssoc'); - } - - /** - * Gets an array of ChildContentAssoc objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this ChildCategory is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects - * @throws PropelException - */ - public function getContentAssocs($criteria = null, ConnectionInterface $con = null) - { - $partial = $this->collContentAssocsPartial && !$this->isNew(); - if (null === $this->collContentAssocs || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collContentAssocs) { - // return empty collection - $this->initContentAssocs(); - } else { - $collContentAssocs = ChildContentAssocQuery::create(null, $criteria) - ->filterByCategory($this) - ->find($con); - - if (null !== $criteria) { - if (false !== $this->collContentAssocsPartial && count($collContentAssocs)) { - $this->initContentAssocs(false); - - foreach ($collContentAssocs as $obj) { - if (false == $this->collContentAssocs->contains($obj)) { - $this->collContentAssocs->append($obj); - } - } - - $this->collContentAssocsPartial = true; - } - - $collContentAssocs->getInternalIterator()->rewind(); - - return $collContentAssocs; - } - - if ($partial && $this->collContentAssocs) { - foreach ($this->collContentAssocs as $obj) { - if ($obj->isNew()) { - $collContentAssocs[] = $obj; - } - } - } - - $this->collContentAssocs = $collContentAssocs; - $this->collContentAssocsPartial = false; - } - } - - return $this->collContentAssocs; - } - - /** - * Sets a collection of ContentAssoc objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param Collection $contentAssocs A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return ChildCategory The current object (for fluent API support) - */ - public function setContentAssocs(Collection $contentAssocs, ConnectionInterface $con = null) - { - $contentAssocsToDelete = $this->getContentAssocs(new Criteria(), $con)->diff($contentAssocs); - - - $this->contentAssocsScheduledForDeletion = $contentAssocsToDelete; - - foreach ($contentAssocsToDelete as $contentAssocRemoved) { - $contentAssocRemoved->setCategory(null); - } - - $this->collContentAssocs = null; - foreach ($contentAssocs as $contentAssoc) { - $this->addContentAssoc($contentAssoc); - } - - $this->collContentAssocs = $contentAssocs; - $this->collContentAssocsPartial = false; - - return $this; - } - - /** - * Returns the number of related ContentAssoc objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related ContentAssoc objects. - * @throws PropelException - */ - public function countContentAssocs(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) - { - $partial = $this->collContentAssocsPartial && !$this->isNew(); - if (null === $this->collContentAssocs || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collContentAssocs) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getContentAssocs()); - } - - $query = ChildContentAssocQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByCategory($this) - ->count($con); - } - - return count($this->collContentAssocs); - } - - /** - * Method called to associate a ChildContentAssoc object to this object - * through the ChildContentAssoc foreign key attribute. - * - * @param ChildContentAssoc $l ChildContentAssoc - * @return \Thelia\Model\Category The current object (for fluent API support) - */ - public function addContentAssoc(ChildContentAssoc $l) - { - if ($this->collContentAssocs === null) { - $this->initContentAssocs(); - $this->collContentAssocsPartial = true; - } - - if (!in_array($l, $this->collContentAssocs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddContentAssoc($l); - } - - return $this; - } - - /** - * @param ContentAssoc $contentAssoc The contentAssoc object to add. - */ - protected function doAddContentAssoc($contentAssoc) - { - $this->collContentAssocs[]= $contentAssoc; - $contentAssoc->setCategory($this); - } - - /** - * @param ContentAssoc $contentAssoc The contentAssoc object to remove. - * @return ChildCategory The current object (for fluent API support) - */ - public function removeContentAssoc($contentAssoc) - { - if ($this->getContentAssocs()->contains($contentAssoc)) { - $this->collContentAssocs->remove($this->collContentAssocs->search($contentAssoc)); - if (null === $this->contentAssocsScheduledForDeletion) { - $this->contentAssocsScheduledForDeletion = clone $this->collContentAssocs; - $this->contentAssocsScheduledForDeletion->clear(); - } - $this->contentAssocsScheduledForDeletion[]= $contentAssoc; - $contentAssoc->setCategory(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Category is new, it will return - * an empty collection; or if this Category has previously - * been saved, it will retrieve related ContentAssocs from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Category. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects - */ - public function getContentAssocsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildContentAssocQuery::create(null, $criteria); - $query->joinWith('Product', $joinBehavior); - - return $this->getContentAssocs($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Category is new, it will return - * an empty collection; or if this Category has previously - * been saved, it will retrieve related ContentAssocs from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Category. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects - */ - public function getContentAssocsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildContentAssocQuery::create(null, $criteria); - $query->joinWith('Content', $joinBehavior); - - return $this->getContentAssocs($query, $con); - } - - /** - * Clears out the collRewritings collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addRewritings() - */ - public function clearRewritings() - { - $this->collRewritings = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Reset is the collRewritings collection loaded partially. - */ - public function resetPartialRewritings($v = true) - { - $this->collRewritingsPartial = $v; - } - - /** - * Initializes the collRewritings collection. - * - * By default this just sets the collRewritings collection to an empty array (like clearcollRewritings()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initRewritings($overrideExisting = true) - { - if (null !== $this->collRewritings && !$overrideExisting) { - return; - } - $this->collRewritings = new ObjectCollection(); - $this->collRewritings->setModel('\Thelia\Model\Rewriting'); - } - - /** - * Gets an array of ChildRewriting objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this ChildCategory is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @return Collection|ChildRewriting[] List of ChildRewriting objects - * @throws PropelException - */ - public function getRewritings($criteria = null, ConnectionInterface $con = null) - { - $partial = $this->collRewritingsPartial && !$this->isNew(); - if (null === $this->collRewritings || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collRewritings) { - // return empty collection - $this->initRewritings(); - } else { - $collRewritings = ChildRewritingQuery::create(null, $criteria) - ->filterByCategory($this) - ->find($con); - - if (null !== $criteria) { - if (false !== $this->collRewritingsPartial && count($collRewritings)) { - $this->initRewritings(false); - - foreach ($collRewritings as $obj) { - if (false == $this->collRewritings->contains($obj)) { - $this->collRewritings->append($obj); - } - } - - $this->collRewritingsPartial = true; - } - - $collRewritings->getInternalIterator()->rewind(); - - return $collRewritings; - } - - if ($partial && $this->collRewritings) { - foreach ($this->collRewritings as $obj) { - if ($obj->isNew()) { - $collRewritings[] = $obj; - } - } - } - - $this->collRewritings = $collRewritings; - $this->collRewritingsPartial = false; - } - } - - return $this->collRewritings; - } - - /** - * Sets a collection of Rewriting objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param Collection $rewritings A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return ChildCategory The current object (for fluent API support) - */ - public function setRewritings(Collection $rewritings, ConnectionInterface $con = null) - { - $rewritingsToDelete = $this->getRewritings(new Criteria(), $con)->diff($rewritings); - - - $this->rewritingsScheduledForDeletion = $rewritingsToDelete; - - foreach ($rewritingsToDelete as $rewritingRemoved) { - $rewritingRemoved->setCategory(null); - } - - $this->collRewritings = null; - foreach ($rewritings as $rewriting) { - $this->addRewriting($rewriting); - } - - $this->collRewritings = $rewritings; - $this->collRewritingsPartial = false; - - return $this; - } - - /** - * Returns the number of related Rewriting objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Rewriting objects. - * @throws PropelException - */ - public function countRewritings(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) - { - $partial = $this->collRewritingsPartial && !$this->isNew(); - if (null === $this->collRewritings || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collRewritings) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getRewritings()); - } - - $query = ChildRewritingQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByCategory($this) - ->count($con); - } - - return count($this->collRewritings); - } - - /** - * Method called to associate a ChildRewriting object to this object - * through the ChildRewriting foreign key attribute. - * - * @param ChildRewriting $l ChildRewriting - * @return \Thelia\Model\Category The current object (for fluent API support) - */ - public function addRewriting(ChildRewriting $l) - { - if ($this->collRewritings === null) { - $this->initRewritings(); - $this->collRewritingsPartial = true; - } - - if (!in_array($l, $this->collRewritings->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddRewriting($l); - } - - return $this; - } - - /** - * @param Rewriting $rewriting The rewriting object to add. - */ - protected function doAddRewriting($rewriting) - { - $this->collRewritings[]= $rewriting; - $rewriting->setCategory($this); - } - - /** - * @param Rewriting $rewriting The rewriting object to remove. - * @return ChildCategory The current object (for fluent API support) - */ - public function removeRewriting($rewriting) - { - if ($this->getRewritings()->contains($rewriting)) { - $this->collRewritings->remove($this->collRewritings->search($rewriting)); - if (null === $this->rewritingsScheduledForDeletion) { - $this->rewritingsScheduledForDeletion = clone $this->collRewritings; - $this->rewritingsScheduledForDeletion->clear(); - } - $this->rewritingsScheduledForDeletion[]= $rewriting; - $rewriting->setCategory(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Category is new, it will return - * an empty collection; or if this Category has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Category. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Product', $joinBehavior); - - return $this->getRewritings($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Category is new, it will return - * an empty collection; or if this Category has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Category. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinFolder($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Folder', $joinBehavior); - - return $this->getRewritings($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Category is new, it will return - * an empty collection; or if this Category has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Category. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Content', $joinBehavior); - - return $this->getRewritings($query, $con); - } - /** * Clears out the collCategoryImages collection * @@ -3730,6 +3124,249 @@ abstract class Category implements ActiveRecordInterface return $this; } + /** + * Clears out the collCategoryAssociatedContents collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addCategoryAssociatedContents() + */ + public function clearCategoryAssociatedContents() + { + $this->collCategoryAssociatedContents = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collCategoryAssociatedContents collection loaded partially. + */ + public function resetPartialCategoryAssociatedContents($v = true) + { + $this->collCategoryAssociatedContentsPartial = $v; + } + + /** + * Initializes the collCategoryAssociatedContents collection. + * + * By default this just sets the collCategoryAssociatedContents collection to an empty array (like clearcollCategoryAssociatedContents()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @param boolean $overrideExisting If set to true, the method call initializes + * the collection even if it is not empty + * + * @return void + */ + public function initCategoryAssociatedContents($overrideExisting = true) + { + if (null !== $this->collCategoryAssociatedContents && !$overrideExisting) { + return; + } + $this->collCategoryAssociatedContents = new ObjectCollection(); + $this->collCategoryAssociatedContents->setModel('\Thelia\Model\CategoryAssociatedContent'); + } + + /** + * Gets an array of ChildCategoryAssociatedContent objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this ChildCategory is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @return Collection|ChildCategoryAssociatedContent[] List of ChildCategoryAssociatedContent objects + * @throws PropelException + */ + public function getCategoryAssociatedContents($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collCategoryAssociatedContentsPartial && !$this->isNew(); + if (null === $this->collCategoryAssociatedContents || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collCategoryAssociatedContents) { + // return empty collection + $this->initCategoryAssociatedContents(); + } else { + $collCategoryAssociatedContents = ChildCategoryAssociatedContentQuery::create(null, $criteria) + ->filterByCategory($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collCategoryAssociatedContentsPartial && count($collCategoryAssociatedContents)) { + $this->initCategoryAssociatedContents(false); + + foreach ($collCategoryAssociatedContents as $obj) { + if (false == $this->collCategoryAssociatedContents->contains($obj)) { + $this->collCategoryAssociatedContents->append($obj); + } + } + + $this->collCategoryAssociatedContentsPartial = true; + } + + $collCategoryAssociatedContents->getInternalIterator()->rewind(); + + return $collCategoryAssociatedContents; + } + + if ($partial && $this->collCategoryAssociatedContents) { + foreach ($this->collCategoryAssociatedContents as $obj) { + if ($obj->isNew()) { + $collCategoryAssociatedContents[] = $obj; + } + } + } + + $this->collCategoryAssociatedContents = $collCategoryAssociatedContents; + $this->collCategoryAssociatedContentsPartial = false; + } + } + + return $this->collCategoryAssociatedContents; + } + + /** + * Sets a collection of CategoryAssociatedContent objects related by a one-to-many relationship + * to the current object. + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) + * and new objects from the given Propel collection. + * + * @param Collection $categoryAssociatedContents A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildCategory The current object (for fluent API support) + */ + public function setCategoryAssociatedContents(Collection $categoryAssociatedContents, ConnectionInterface $con = null) + { + $categoryAssociatedContentsToDelete = $this->getCategoryAssociatedContents(new Criteria(), $con)->diff($categoryAssociatedContents); + + + $this->categoryAssociatedContentsScheduledForDeletion = $categoryAssociatedContentsToDelete; + + foreach ($categoryAssociatedContentsToDelete as $categoryAssociatedContentRemoved) { + $categoryAssociatedContentRemoved->setCategory(null); + } + + $this->collCategoryAssociatedContents = null; + foreach ($categoryAssociatedContents as $categoryAssociatedContent) { + $this->addCategoryAssociatedContent($categoryAssociatedContent); + } + + $this->collCategoryAssociatedContents = $categoryAssociatedContents; + $this->collCategoryAssociatedContentsPartial = false; + + return $this; + } + + /** + * Returns the number of related CategoryAssociatedContent objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related CategoryAssociatedContent objects. + * @throws PropelException + */ + public function countCategoryAssociatedContents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collCategoryAssociatedContentsPartial && !$this->isNew(); + if (null === $this->collCategoryAssociatedContents || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collCategoryAssociatedContents) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getCategoryAssociatedContents()); + } + + $query = ChildCategoryAssociatedContentQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByCategory($this) + ->count($con); + } + + return count($this->collCategoryAssociatedContents); + } + + /** + * Method called to associate a ChildCategoryAssociatedContent object to this object + * through the ChildCategoryAssociatedContent foreign key attribute. + * + * @param ChildCategoryAssociatedContent $l ChildCategoryAssociatedContent + * @return \Thelia\Model\Category The current object (for fluent API support) + */ + public function addCategoryAssociatedContent(ChildCategoryAssociatedContent $l) + { + if ($this->collCategoryAssociatedContents === null) { + $this->initCategoryAssociatedContents(); + $this->collCategoryAssociatedContentsPartial = true; + } + + if (!in_array($l, $this->collCategoryAssociatedContents->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddCategoryAssociatedContent($l); + } + + return $this; + } + + /** + * @param CategoryAssociatedContent $categoryAssociatedContent The categoryAssociatedContent object to add. + */ + protected function doAddCategoryAssociatedContent($categoryAssociatedContent) + { + $this->collCategoryAssociatedContents[]= $categoryAssociatedContent; + $categoryAssociatedContent->setCategory($this); + } + + /** + * @param CategoryAssociatedContent $categoryAssociatedContent The categoryAssociatedContent object to remove. + * @return ChildCategory The current object (for fluent API support) + */ + public function removeCategoryAssociatedContent($categoryAssociatedContent) + { + if ($this->getCategoryAssociatedContents()->contains($categoryAssociatedContent)) { + $this->collCategoryAssociatedContents->remove($this->collCategoryAssociatedContents->search($categoryAssociatedContent)); + if (null === $this->categoryAssociatedContentsScheduledForDeletion) { + $this->categoryAssociatedContentsScheduledForDeletion = clone $this->collCategoryAssociatedContents; + $this->categoryAssociatedContentsScheduledForDeletion->clear(); + } + $this->categoryAssociatedContentsScheduledForDeletion[]= clone $categoryAssociatedContent; + $categoryAssociatedContent->setCategory(null); + } + + return $this; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Category is new, it will return + * an empty collection; or if this Category has previously + * been saved, it will retrieve related CategoryAssociatedContents from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Category. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildCategoryAssociatedContent[] List of ChildCategoryAssociatedContent objects + */ + public function getCategoryAssociatedContentsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildCategoryAssociatedContentQuery::create(null, $criteria); + $query->joinWith('Content', $joinBehavior); + + return $this->getCategoryAssociatedContents($query, $con); + } + /** * Clears out the collCategoryI18ns collection * @@ -4774,16 +4411,6 @@ abstract class Category implements ActiveRecordInterface $o->clearAllReferences($deep); } } - if ($this->collContentAssocs) { - foreach ($this->collContentAssocs as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collRewritings) { - foreach ($this->collRewritings as $o) { - $o->clearAllReferences($deep); - } - } if ($this->collCategoryImages) { foreach ($this->collCategoryImages as $o) { $o->clearAllReferences($deep); @@ -4794,6 +4421,11 @@ abstract class Category implements ActiveRecordInterface $o->clearAllReferences($deep); } } + if ($this->collCategoryAssociatedContents) { + foreach ($this->collCategoryAssociatedContents as $o) { + $o->clearAllReferences($deep); + } + } if ($this->collCategoryI18ns) { foreach ($this->collCategoryI18ns as $o) { $o->clearAllReferences($deep); @@ -4837,14 +4469,6 @@ abstract class Category implements ActiveRecordInterface $this->collAttributeCategories->clearIterator(); } $this->collAttributeCategories = null; - if ($this->collContentAssocs instanceof Collection) { - $this->collContentAssocs->clearIterator(); - } - $this->collContentAssocs = null; - if ($this->collRewritings instanceof Collection) { - $this->collRewritings->clearIterator(); - } - $this->collRewritings = null; if ($this->collCategoryImages instanceof Collection) { $this->collCategoryImages->clearIterator(); } @@ -4853,6 +4477,10 @@ abstract class Category implements ActiveRecordInterface $this->collCategoryDocuments->clearIterator(); } $this->collCategoryDocuments = null; + if ($this->collCategoryAssociatedContents instanceof Collection) { + $this->collCategoryAssociatedContents->clearIterator(); + } + $this->collCategoryAssociatedContents = null; if ($this->collCategoryI18ns instanceof Collection) { $this->collCategoryI18ns->clearIterator(); } diff --git a/core/lib/Thelia/Model/Base/ContentAssoc.php b/core/lib/Thelia/Model/Base/CategoryAssociatedContent.php similarity index 80% rename from core/lib/Thelia/Model/Base/ContentAssoc.php rename to core/lib/Thelia/Model/Base/CategoryAssociatedContent.php index eaa1cb9b7..142ab543f 100644 --- a/core/lib/Thelia/Model/Base/ContentAssoc.php +++ b/core/lib/Thelia/Model/Base/CategoryAssociatedContent.php @@ -17,21 +17,19 @@ use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; use Thelia\Model\Category as ChildCategory; +use Thelia\Model\CategoryAssociatedContent as ChildCategoryAssociatedContent; +use Thelia\Model\CategoryAssociatedContentQuery as ChildCategoryAssociatedContentQuery; use Thelia\Model\CategoryQuery as ChildCategoryQuery; use Thelia\Model\Content as ChildContent; -use Thelia\Model\ContentAssoc as ChildContentAssoc; -use Thelia\Model\ContentAssocQuery as ChildContentAssocQuery; use Thelia\Model\ContentQuery as ChildContentQuery; -use Thelia\Model\Product as ChildProduct; -use Thelia\Model\ProductQuery as ChildProductQuery; -use Thelia\Model\Map\ContentAssocTableMap; +use Thelia\Model\Map\CategoryAssociatedContentTableMap; -abstract class ContentAssoc implements ActiveRecordInterface +abstract class CategoryAssociatedContent implements ActiveRecordInterface { /** * TableMap class name */ - const TABLE_MAP = '\\Thelia\\Model\\Map\\ContentAssocTableMap'; + const TABLE_MAP = '\\Thelia\\Model\\Map\\CategoryAssociatedContentTableMap'; /** @@ -72,12 +70,6 @@ abstract class ContentAssoc implements ActiveRecordInterface */ protected $category_id; - /** - * The value for the product_id field. - * @var int - */ - protected $product_id; - /** * The value for the content_id field. * @var int @@ -107,11 +99,6 @@ abstract class ContentAssoc implements ActiveRecordInterface */ protected $aCategory; - /** - * @var Product - */ - protected $aProduct; - /** * @var Content */ @@ -126,7 +113,7 @@ abstract class ContentAssoc implements ActiveRecordInterface protected $alreadyInSave = false; /** - * Initializes internal state of Thelia\Model\Base\ContentAssoc object. + * Initializes internal state of Thelia\Model\Base\CategoryAssociatedContent object. */ public function __construct() { @@ -221,9 +208,9 @@ abstract class ContentAssoc implements ActiveRecordInterface } /** - * Compares this with another ContentAssoc instance. If - * obj is an instance of ContentAssoc, delegates to - * equals(ContentAssoc). Otherwise, returns false. + * Compares this with another CategoryAssociatedContent instance. If + * 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. @@ -281,7 +268,7 @@ abstract class ContentAssoc implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -304,7 +291,7 @@ abstract class ContentAssoc implements ActiveRecordInterface * @param string $name The virtual column name * @param mixed $value The value to give to the virtual column * - * @return ContentAssoc The current object, for fluid interface + * @return CategoryAssociatedContent The current object, for fluid interface */ public function setVirtualColumn($name, $value) { @@ -336,7 +323,7 @@ abstract class ContentAssoc implements ActiveRecordInterface * or a format name ('XML', 'YAML', 'JSON', 'CSV') * @param string $data The source data to import from * - * @return ContentAssoc The current object, for fluid interface + * @return CategoryAssociatedContent The current object, for fluid interface */ public function importFrom($parser, $data) { @@ -401,17 +388,6 @@ abstract class ContentAssoc implements ActiveRecordInterface return $this->category_id; } - /** - * Get the [product_id] column value. - * - * @return int - */ - public function getProductId() - { - - return $this->product_id; - } - /** * Get the [content_id] column value. * @@ -478,7 +454,7 @@ abstract class ContentAssoc implements ActiveRecordInterface * Set the value of [id] column. * * @param int $v new value - * @return \Thelia\Model\ContentAssoc The current object (for fluent API support) + * @return \Thelia\Model\CategoryAssociatedContent The current object (for fluent API support) */ public function setId($v) { @@ -488,7 +464,7 @@ abstract class ContentAssoc implements ActiveRecordInterface if ($this->id !== $v) { $this->id = $v; - $this->modifiedColumns[] = ContentAssocTableMap::ID; + $this->modifiedColumns[] = CategoryAssociatedContentTableMap::ID; } @@ -499,7 +475,7 @@ abstract class ContentAssoc implements ActiveRecordInterface * Set the value of [category_id] column. * * @param int $v new value - * @return \Thelia\Model\ContentAssoc The current object (for fluent API support) + * @return \Thelia\Model\CategoryAssociatedContent The current object (for fluent API support) */ public function setCategoryId($v) { @@ -509,7 +485,7 @@ abstract class ContentAssoc implements ActiveRecordInterface if ($this->category_id !== $v) { $this->category_id = $v; - $this->modifiedColumns[] = ContentAssocTableMap::CATEGORY_ID; + $this->modifiedColumns[] = CategoryAssociatedContentTableMap::CATEGORY_ID; } if ($this->aCategory !== null && $this->aCategory->getId() !== $v) { @@ -520,36 +496,11 @@ abstract class ContentAssoc implements ActiveRecordInterface return $this; } // setCategoryId() - /** - * Set the value of [product_id] column. - * - * @param int $v new value - * @return \Thelia\Model\ContentAssoc The current object (for fluent API support) - */ - public function setProductId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->product_id !== $v) { - $this->product_id = $v; - $this->modifiedColumns[] = ContentAssocTableMap::PRODUCT_ID; - } - - if ($this->aProduct !== null && $this->aProduct->getId() !== $v) { - $this->aProduct = null; - } - - - return $this; - } // setProductId() - /** * Set the value of [content_id] column. * * @param int $v new value - * @return \Thelia\Model\ContentAssoc The current object (for fluent API support) + * @return \Thelia\Model\CategoryAssociatedContent The current object (for fluent API support) */ public function setContentId($v) { @@ -559,7 +510,7 @@ abstract class ContentAssoc implements ActiveRecordInterface if ($this->content_id !== $v) { $this->content_id = $v; - $this->modifiedColumns[] = ContentAssocTableMap::CONTENT_ID; + $this->modifiedColumns[] = CategoryAssociatedContentTableMap::CONTENT_ID; } if ($this->aContent !== null && $this->aContent->getId() !== $v) { @@ -574,7 +525,7 @@ abstract class ContentAssoc implements ActiveRecordInterface * Set the value of [position] column. * * @param int $v new value - * @return \Thelia\Model\ContentAssoc The current object (for fluent API support) + * @return \Thelia\Model\CategoryAssociatedContent The current object (for fluent API support) */ public function setPosition($v) { @@ -584,7 +535,7 @@ abstract class ContentAssoc implements ActiveRecordInterface if ($this->position !== $v) { $this->position = $v; - $this->modifiedColumns[] = ContentAssocTableMap::POSITION; + $this->modifiedColumns[] = CategoryAssociatedContentTableMap::POSITION; } @@ -596,7 +547,7 @@ abstract class ContentAssoc implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\ContentAssoc The current object (for fluent API support) + * @return \Thelia\Model\CategoryAssociatedContent The current object (for fluent API support) */ public function setCreatedAt($v) { @@ -604,7 +555,7 @@ abstract class ContentAssoc implements ActiveRecordInterface if ($this->created_at !== null || $dt !== null) { if ($dt !== $this->created_at) { $this->created_at = $dt; - $this->modifiedColumns[] = ContentAssocTableMap::CREATED_AT; + $this->modifiedColumns[] = CategoryAssociatedContentTableMap::CREATED_AT; } } // if either are not null @@ -617,7 +568,7 @@ abstract class ContentAssoc implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\ContentAssoc The current object (for fluent API support) + * @return \Thelia\Model\CategoryAssociatedContent The current object (for fluent API support) */ public function setUpdatedAt($v) { @@ -625,7 +576,7 @@ abstract class ContentAssoc implements ActiveRecordInterface if ($this->updated_at !== null || $dt !== null) { if ($dt !== $this->updated_at) { $this->updated_at = $dt; - $this->modifiedColumns[] = ContentAssocTableMap::UPDATED_AT; + $this->modifiedColumns[] = CategoryAssociatedContentTableMap::UPDATED_AT; } } // if either are not null @@ -670,28 +621,25 @@ abstract class ContentAssoc implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ContentAssocTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : CategoryAssociatedContentTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ContentAssocTableMap::translateFieldName('CategoryId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CategoryAssociatedContentTableMap::translateFieldName('CategoryId', TableMap::TYPE_PHPNAME, $indexType)]; $this->category_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ContentAssocTableMap::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)]; - $this->product_id = (null !== $col) ? (int) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ContentAssocTableMap::translateFieldName('ContentId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CategoryAssociatedContentTableMap::translateFieldName('ContentId', TableMap::TYPE_PHPNAME, $indexType)]; $this->content_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ContentAssocTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CategoryAssociatedContentTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; $this->position = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ContentAssocTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CategoryAssociatedContentTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ContentAssocTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CategoryAssociatedContentTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -704,10 +652,10 @@ abstract class ContentAssoc implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 7; // 7 = ContentAssocTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = CategoryAssociatedContentTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException("Error populating \Thelia\Model\ContentAssoc object", 0, $e); + throw new PropelException("Error populating \Thelia\Model\CategoryAssociatedContent object", 0, $e); } } @@ -729,9 +677,6 @@ abstract class ContentAssoc implements ActiveRecordInterface if ($this->aCategory !== null && $this->category_id !== $this->aCategory->getId()) { $this->aCategory = null; } - if ($this->aProduct !== null && $this->product_id !== $this->aProduct->getId()) { - $this->aProduct = null; - } if ($this->aContent !== null && $this->content_id !== $this->aContent->getId()) { $this->aContent = null; } @@ -758,13 +703,13 @@ abstract class ContentAssoc implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ContentAssocTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(CategoryAssociatedContentTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. - $dataFetcher = ChildContentAssocQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $dataFetcher = ChildCategoryAssociatedContentQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { @@ -775,7 +720,6 @@ abstract class ContentAssoc implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? $this->aCategory = null; - $this->aProduct = null; $this->aContent = null; } // if (deep) } @@ -786,8 +730,8 @@ abstract class ContentAssoc implements ActiveRecordInterface * @param ConnectionInterface $con * @return void * @throws PropelException - * @see ContentAssoc::setDeleted() - * @see ContentAssoc::isDeleted() + * @see CategoryAssociatedContent::setDeleted() + * @see CategoryAssociatedContent::isDeleted() */ public function delete(ConnectionInterface $con = null) { @@ -796,12 +740,12 @@ abstract class ContentAssoc implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ContentAssocTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(CategoryAssociatedContentTableMap::DATABASE_NAME); } $con->beginTransaction(); try { - $deleteQuery = ChildContentAssocQuery::create() + $deleteQuery = ChildCategoryAssociatedContentQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { @@ -838,7 +782,7 @@ abstract class ContentAssoc implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ContentAssocTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(CategoryAssociatedContentTableMap::DATABASE_NAME); } $con->beginTransaction(); @@ -848,16 +792,16 @@ abstract class ContentAssoc implements ActiveRecordInterface if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - if (!$this->isColumnModified(ContentAssocTableMap::CREATED_AT)) { + if (!$this->isColumnModified(CategoryAssociatedContentTableMap::CREATED_AT)) { $this->setCreatedAt(time()); } - if (!$this->isColumnModified(ContentAssocTableMap::UPDATED_AT)) { + if (!$this->isColumnModified(CategoryAssociatedContentTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } else { $ret = $ret && $this->preUpdate($con); // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ContentAssocTableMap::UPDATED_AT)) { + if ($this->isModified() && !$this->isColumnModified(CategoryAssociatedContentTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } @@ -869,7 +813,7 @@ abstract class ContentAssoc implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - ContentAssocTableMap::addInstanceToPool($this); + CategoryAssociatedContentTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -911,13 +855,6 @@ abstract class ContentAssoc implements ActiveRecordInterface $this->setCategory($this->aCategory); } - if ($this->aProduct !== null) { - if ($this->aProduct->isModified() || $this->aProduct->isNew()) { - $affectedRows += $this->aProduct->save($con); - } - $this->setProduct($this->aProduct); - } - if ($this->aContent !== null) { if ($this->aContent->isModified() || $this->aContent->isNew()) { $affectedRows += $this->aContent->save($con); @@ -956,36 +893,33 @@ abstract class ContentAssoc implements ActiveRecordInterface $modifiedColumns = array(); $index = 0; - $this->modifiedColumns[] = ContentAssocTableMap::ID; + $this->modifiedColumns[] = CategoryAssociatedContentTableMap::ID; if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ContentAssocTableMap::ID . ')'); + throw new PropelException('Cannot insert a value for auto-increment primary key (' . CategoryAssociatedContentTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ContentAssocTableMap::ID)) { + if ($this->isColumnModified(CategoryAssociatedContentTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(ContentAssocTableMap::CATEGORY_ID)) { + if ($this->isColumnModified(CategoryAssociatedContentTableMap::CATEGORY_ID)) { $modifiedColumns[':p' . $index++] = 'CATEGORY_ID'; } - if ($this->isColumnModified(ContentAssocTableMap::PRODUCT_ID)) { - $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; - } - if ($this->isColumnModified(ContentAssocTableMap::CONTENT_ID)) { + if ($this->isColumnModified(CategoryAssociatedContentTableMap::CONTENT_ID)) { $modifiedColumns[':p' . $index++] = 'CONTENT_ID'; } - if ($this->isColumnModified(ContentAssocTableMap::POSITION)) { + if ($this->isColumnModified(CategoryAssociatedContentTableMap::POSITION)) { $modifiedColumns[':p' . $index++] = 'POSITION'; } - if ($this->isColumnModified(ContentAssocTableMap::CREATED_AT)) { + if ($this->isColumnModified(CategoryAssociatedContentTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } - if ($this->isColumnModified(ContentAssocTableMap::UPDATED_AT)) { + if ($this->isColumnModified(CategoryAssociatedContentTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; } $sql = sprintf( - 'INSERT INTO content_assoc (%s) VALUES (%s)', + 'INSERT INTO category_associated_content (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1000,9 +934,6 @@ abstract class ContentAssoc implements ActiveRecordInterface case 'CATEGORY_ID': $stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); break; - case 'PRODUCT_ID': - $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); - break; case 'CONTENT_ID': $stmt->bindValue($identifier, $this->content_id, PDO::PARAM_INT); break; @@ -1061,7 +992,7 @@ abstract class ContentAssoc implements ActiveRecordInterface */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { - $pos = ContentAssocTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = CategoryAssociatedContentTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); return $field; @@ -1084,18 +1015,15 @@ abstract class ContentAssoc implements ActiveRecordInterface return $this->getCategoryId(); break; case 2: - return $this->getProductId(); - break; - case 3: return $this->getContentId(); break; - case 4: + case 3: return $this->getPosition(); break; - case 5: + case 4: return $this->getCreatedAt(); break; - case 6: + case 5: return $this->getUpdatedAt(); break; default: @@ -1121,19 +1049,18 @@ abstract class ContentAssoc implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['ContentAssoc'][$this->getPrimaryKey()])) { + if (isset($alreadyDumpedObjects['CategoryAssociatedContent'][$this->getPrimaryKey()])) { return '*RECURSION*'; } - $alreadyDumpedObjects['ContentAssoc'][$this->getPrimaryKey()] = true; - $keys = ContentAssocTableMap::getFieldNames($keyType); + $alreadyDumpedObjects['CategoryAssociatedContent'][$this->getPrimaryKey()] = true; + $keys = CategoryAssociatedContentTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getCategoryId(), - $keys[2] => $this->getProductId(), - $keys[3] => $this->getContentId(), - $keys[4] => $this->getPosition(), - $keys[5] => $this->getCreatedAt(), - $keys[6] => $this->getUpdatedAt(), + $keys[2] => $this->getContentId(), + $keys[3] => $this->getPosition(), + $keys[4] => $this->getCreatedAt(), + $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1145,9 +1072,6 @@ abstract class ContentAssoc implements ActiveRecordInterface if (null !== $this->aCategory) { $result['Category'] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } - if (null !== $this->aProduct) { - $result['Product'] = $this->aProduct->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } if (null !== $this->aContent) { $result['Content'] = $this->aContent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } @@ -1169,7 +1093,7 @@ abstract class ContentAssoc implements ActiveRecordInterface */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) { - $pos = ContentAssocTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = CategoryAssociatedContentTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); return $this->setByPosition($pos, $value); } @@ -1192,18 +1116,15 @@ abstract class ContentAssoc implements ActiveRecordInterface $this->setCategoryId($value); break; case 2: - $this->setProductId($value); - break; - case 3: $this->setContentId($value); break; - case 4: + case 3: $this->setPosition($value); break; - case 5: + case 4: $this->setCreatedAt($value); break; - case 6: + case 5: $this->setUpdatedAt($value); break; } // switch() @@ -1228,15 +1149,14 @@ abstract class ContentAssoc implements ActiveRecordInterface */ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { - $keys = ContentAssocTableMap::getFieldNames($keyType); + $keys = CategoryAssociatedContentTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setCategoryId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setProductId($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setContentId($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]); + if (array_key_exists($keys[2], $arr)) $this->setContentId($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); } /** @@ -1246,15 +1166,14 @@ abstract class ContentAssoc implements ActiveRecordInterface */ public function buildCriteria() { - $criteria = new Criteria(ContentAssocTableMap::DATABASE_NAME); + $criteria = new Criteria(CategoryAssociatedContentTableMap::DATABASE_NAME); - if ($this->isColumnModified(ContentAssocTableMap::ID)) $criteria->add(ContentAssocTableMap::ID, $this->id); - if ($this->isColumnModified(ContentAssocTableMap::CATEGORY_ID)) $criteria->add(ContentAssocTableMap::CATEGORY_ID, $this->category_id); - if ($this->isColumnModified(ContentAssocTableMap::PRODUCT_ID)) $criteria->add(ContentAssocTableMap::PRODUCT_ID, $this->product_id); - if ($this->isColumnModified(ContentAssocTableMap::CONTENT_ID)) $criteria->add(ContentAssocTableMap::CONTENT_ID, $this->content_id); - if ($this->isColumnModified(ContentAssocTableMap::POSITION)) $criteria->add(ContentAssocTableMap::POSITION, $this->position); - if ($this->isColumnModified(ContentAssocTableMap::CREATED_AT)) $criteria->add(ContentAssocTableMap::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ContentAssocTableMap::UPDATED_AT)) $criteria->add(ContentAssocTableMap::UPDATED_AT, $this->updated_at); + if ($this->isColumnModified(CategoryAssociatedContentTableMap::ID)) $criteria->add(CategoryAssociatedContentTableMap::ID, $this->id); + if ($this->isColumnModified(CategoryAssociatedContentTableMap::CATEGORY_ID)) $criteria->add(CategoryAssociatedContentTableMap::CATEGORY_ID, $this->category_id); + if ($this->isColumnModified(CategoryAssociatedContentTableMap::CONTENT_ID)) $criteria->add(CategoryAssociatedContentTableMap::CONTENT_ID, $this->content_id); + if ($this->isColumnModified(CategoryAssociatedContentTableMap::POSITION)) $criteria->add(CategoryAssociatedContentTableMap::POSITION, $this->position); + if ($this->isColumnModified(CategoryAssociatedContentTableMap::CREATED_AT)) $criteria->add(CategoryAssociatedContentTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(CategoryAssociatedContentTableMap::UPDATED_AT)) $criteria->add(CategoryAssociatedContentTableMap::UPDATED_AT, $this->updated_at); return $criteria; } @@ -1269,8 +1188,8 @@ abstract class ContentAssoc implements ActiveRecordInterface */ public function buildPkeyCriteria() { - $criteria = new Criteria(ContentAssocTableMap::DATABASE_NAME); - $criteria->add(ContentAssocTableMap::ID, $this->id); + $criteria = new Criteria(CategoryAssociatedContentTableMap::DATABASE_NAME); + $criteria->add(CategoryAssociatedContentTableMap::ID, $this->id); return $criteria; } @@ -1311,7 +1230,7 @@ abstract class ContentAssoc implements ActiveRecordInterface * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \Thelia\Model\ContentAssoc (or compatible) type. + * @param object $copyObj An object of \Thelia\Model\CategoryAssociatedContent (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException @@ -1319,7 +1238,6 @@ abstract class ContentAssoc implements ActiveRecordInterface public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setCategoryId($this->getCategoryId()); - $copyObj->setProductId($this->getProductId()); $copyObj->setContentId($this->getContentId()); $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); @@ -1339,7 +1257,7 @@ abstract class ContentAssoc implements ActiveRecordInterface * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return \Thelia\Model\ContentAssoc Clone of current object. + * @return \Thelia\Model\CategoryAssociatedContent Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) @@ -1356,7 +1274,7 @@ abstract class ContentAssoc implements ActiveRecordInterface * Declares an association between this object and a ChildCategory object. * * @param ChildCategory $v - * @return \Thelia\Model\ContentAssoc The current object (for fluent API support) + * @return \Thelia\Model\CategoryAssociatedContent The current object (for fluent API support) * @throws PropelException */ public function setCategory(ChildCategory $v = null) @@ -1372,7 +1290,7 @@ abstract class ContentAssoc implements ActiveRecordInterface // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildCategory object, it will not be re-added. if ($v !== null) { - $v->addContentAssoc($this); + $v->addCategoryAssociatedContent($this); } @@ -1396,69 +1314,18 @@ abstract class ContentAssoc implements ActiveRecordInterface to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. - $this->aCategory->addContentAssocs($this); + $this->aCategory->addCategoryAssociatedContents($this); */ } return $this->aCategory; } - /** - * Declares an association between this object and a ChildProduct object. - * - * @param ChildProduct $v - * @return \Thelia\Model\ContentAssoc The current object (for fluent API support) - * @throws PropelException - */ - public function setProduct(ChildProduct $v = null) - { - if ($v === null) { - $this->setProductId(NULL); - } else { - $this->setProductId($v->getId()); - } - - $this->aProduct = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the ChildProduct object, it will not be re-added. - if ($v !== null) { - $v->addContentAssoc($this); - } - - - return $this; - } - - - /** - * Get the associated ChildProduct object - * - * @param ConnectionInterface $con Optional Connection object. - * @return ChildProduct The associated ChildProduct object. - * @throws PropelException - */ - public function getProduct(ConnectionInterface $con = null) - { - if ($this->aProduct === null && ($this->product_id !== null)) { - $this->aProduct = ChildProductQuery::create()->findPk($this->product_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aProduct->addContentAssocs($this); - */ - } - - return $this->aProduct; - } - /** * Declares an association between this object and a ChildContent object. * * @param ChildContent $v - * @return \Thelia\Model\ContentAssoc The current object (for fluent API support) + * @return \Thelia\Model\CategoryAssociatedContent The current object (for fluent API support) * @throws PropelException */ public function setContent(ChildContent $v = null) @@ -1474,7 +1341,7 @@ abstract class ContentAssoc implements ActiveRecordInterface // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildContent object, it will not be re-added. if ($v !== null) { - $v->addContentAssoc($this); + $v->addCategoryAssociatedContent($this); } @@ -1498,7 +1365,7 @@ abstract class ContentAssoc implements ActiveRecordInterface to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. - $this->aContent->addContentAssocs($this); + $this->aContent->addCategoryAssociatedContents($this); */ } @@ -1512,7 +1379,6 @@ abstract class ContentAssoc implements ActiveRecordInterface { $this->id = null; $this->category_id = null; - $this->product_id = null; $this->content_id = null; $this->position = null; $this->created_at = null; @@ -1539,7 +1405,6 @@ abstract class ContentAssoc implements ActiveRecordInterface } // if ($deep) $this->aCategory = null; - $this->aProduct = null; $this->aContent = null; } @@ -1550,7 +1415,7 @@ abstract class ContentAssoc implements ActiveRecordInterface */ public function __toString() { - return (string) $this->exportTo(ContentAssocTableMap::DEFAULT_STRING_FORMAT); + return (string) $this->exportTo(CategoryAssociatedContentTableMap::DEFAULT_STRING_FORMAT); } // timestampable behavior @@ -1558,11 +1423,11 @@ abstract class ContentAssoc implements ActiveRecordInterface /** * Mark the current object so that the update date doesn't get updated during next save * - * @return ChildContentAssoc The current object (for fluent API support) + * @return ChildCategoryAssociatedContent The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { - $this->modifiedColumns[] = ContentAssocTableMap::UPDATED_AT; + $this->modifiedColumns[] = CategoryAssociatedContentTableMap::UPDATED_AT; return $this; } diff --git a/core/lib/Thelia/Model/Base/ContentAssocQuery.php b/core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php similarity index 57% rename from core/lib/Thelia/Model/Base/ContentAssocQuery.php rename to core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php index 630af8065..bb03306f4 100644 --- a/core/lib/Thelia/Model/Base/ContentAssocQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryAssociatedContentQuery.php @@ -12,96 +12,88 @@ use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; -use Thelia\Model\ContentAssoc as ChildContentAssoc; -use Thelia\Model\ContentAssocQuery as ChildContentAssocQuery; -use Thelia\Model\Map\ContentAssocTableMap; +use Thelia\Model\CategoryAssociatedContent as ChildCategoryAssociatedContent; +use Thelia\Model\CategoryAssociatedContentQuery as ChildCategoryAssociatedContentQuery; +use Thelia\Model\Map\CategoryAssociatedContentTableMap; /** - * Base class that represents a query for the 'content_assoc' table. + * Base class that represents a query for the 'category_associated_content' table. * * * - * @method ChildContentAssocQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildContentAssocQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column - * @method ChildContentAssocQuery orderByProductId($order = Criteria::ASC) Order by the product_id column - * @method ChildContentAssocQuery orderByContentId($order = Criteria::ASC) Order by the content_id column - * @method ChildContentAssocQuery orderByPosition($order = Criteria::ASC) Order by the position column - * @method ChildContentAssocQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column - * @method ChildContentAssocQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column + * @method ChildCategoryAssociatedContentQuery orderById($order = Criteria::ASC) Order by the id column + * @method ChildCategoryAssociatedContentQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column + * @method ChildCategoryAssociatedContentQuery orderByContentId($order = Criteria::ASC) Order by the content_id column + * @method ChildCategoryAssociatedContentQuery orderByPosition($order = Criteria::ASC) Order by the position column + * @method ChildCategoryAssociatedContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column + * @method ChildCategoryAssociatedContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * - * @method ChildContentAssocQuery groupById() Group by the id column - * @method ChildContentAssocQuery groupByCategoryId() Group by the category_id column - * @method ChildContentAssocQuery groupByProductId() Group by the product_id column - * @method ChildContentAssocQuery groupByContentId() Group by the content_id column - * @method ChildContentAssocQuery groupByPosition() Group by the position column - * @method ChildContentAssocQuery groupByCreatedAt() Group by the created_at column - * @method ChildContentAssocQuery groupByUpdatedAt() Group by the updated_at column + * @method ChildCategoryAssociatedContentQuery groupById() Group by the id column + * @method ChildCategoryAssociatedContentQuery groupByCategoryId() Group by the category_id column + * @method ChildCategoryAssociatedContentQuery groupByContentId() Group by the content_id column + * @method ChildCategoryAssociatedContentQuery groupByPosition() Group by the position column + * @method ChildCategoryAssociatedContentQuery groupByCreatedAt() Group by the created_at column + * @method ChildCategoryAssociatedContentQuery groupByUpdatedAt() Group by the updated_at column * - * @method ChildContentAssocQuery leftJoin($relation) Adds a LEFT JOIN clause to the query - * @method ChildContentAssocQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query - * @method ChildContentAssocQuery innerJoin($relation) Adds a INNER JOIN clause to the query + * @method ChildCategoryAssociatedContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query + * @method ChildCategoryAssociatedContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query + * @method ChildCategoryAssociatedContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildContentAssocQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation - * @method ChildContentAssocQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation - * @method ChildContentAssocQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation + * @method ChildCategoryAssociatedContentQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation + * @method ChildCategoryAssociatedContentQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation + * @method ChildCategoryAssociatedContentQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation * - * @method ChildContentAssocQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation - * @method ChildContentAssocQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation - * @method ChildContentAssocQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation + * @method ChildCategoryAssociatedContentQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation + * @method ChildCategoryAssociatedContentQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation + * @method ChildCategoryAssociatedContentQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation * - * @method ChildContentAssocQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation - * @method ChildContentAssocQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation - * @method ChildContentAssocQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation + * @method ChildCategoryAssociatedContent findOne(ConnectionInterface $con = null) Return the first ChildCategoryAssociatedContent matching the query + * @method ChildCategoryAssociatedContent findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCategoryAssociatedContent matching the query, or a new ChildCategoryAssociatedContent object populated from the query conditions when no match is found * - * @method ChildContentAssoc findOne(ConnectionInterface $con = null) Return the first ChildContentAssoc matching the query - * @method ChildContentAssoc findOneOrCreate(ConnectionInterface $con = null) Return the first ChildContentAssoc matching the query, or a new ChildContentAssoc object populated from the query conditions when no match is found + * @method ChildCategoryAssociatedContent findOneById(int $id) Return the first ChildCategoryAssociatedContent filtered by the id column + * @method ChildCategoryAssociatedContent findOneByCategoryId(int $category_id) Return the first ChildCategoryAssociatedContent filtered by the category_id column + * @method ChildCategoryAssociatedContent findOneByContentId(int $content_id) Return the first ChildCategoryAssociatedContent filtered by the content_id column + * @method ChildCategoryAssociatedContent findOneByPosition(int $position) Return the first ChildCategoryAssociatedContent filtered by the position column + * @method ChildCategoryAssociatedContent findOneByCreatedAt(string $created_at) Return the first ChildCategoryAssociatedContent filtered by the created_at column + * @method ChildCategoryAssociatedContent findOneByUpdatedAt(string $updated_at) Return the first ChildCategoryAssociatedContent filtered by the updated_at column * - * @method ChildContentAssoc findOneById(int $id) Return the first ChildContentAssoc filtered by the id column - * @method ChildContentAssoc findOneByCategoryId(int $category_id) Return the first ChildContentAssoc filtered by the category_id column - * @method ChildContentAssoc findOneByProductId(int $product_id) Return the first ChildContentAssoc filtered by the product_id column - * @method ChildContentAssoc findOneByContentId(int $content_id) Return the first ChildContentAssoc filtered by the content_id column - * @method ChildContentAssoc findOneByPosition(int $position) Return the first ChildContentAssoc filtered by the position column - * @method ChildContentAssoc findOneByCreatedAt(string $created_at) Return the first ChildContentAssoc filtered by the created_at column - * @method ChildContentAssoc findOneByUpdatedAt(string $updated_at) Return the first ChildContentAssoc filtered by the updated_at column - * - * @method array findById(int $id) Return ChildContentAssoc objects filtered by the id column - * @method array findByCategoryId(int $category_id) Return ChildContentAssoc objects filtered by the category_id column - * @method array findByProductId(int $product_id) Return ChildContentAssoc objects filtered by the product_id column - * @method array findByContentId(int $content_id) Return ChildContentAssoc objects filtered by the content_id column - * @method array findByPosition(int $position) Return ChildContentAssoc objects filtered by the position column - * @method array findByCreatedAt(string $created_at) Return ChildContentAssoc objects filtered by the created_at column - * @method array findByUpdatedAt(string $updated_at) Return ChildContentAssoc objects filtered by the updated_at column + * @method array findById(int $id) Return ChildCategoryAssociatedContent objects filtered by the id column + * @method array findByCategoryId(int $category_id) Return ChildCategoryAssociatedContent objects filtered by the category_id column + * @method array findByContentId(int $content_id) Return ChildCategoryAssociatedContent objects filtered by the content_id column + * @method array findByPosition(int $position) Return ChildCategoryAssociatedContent objects filtered by the position column + * @method array findByCreatedAt(string $created_at) Return ChildCategoryAssociatedContent objects filtered by the created_at column + * @method array findByUpdatedAt(string $updated_at) Return ChildCategoryAssociatedContent objects filtered by the updated_at column * */ -abstract class ContentAssocQuery extends ModelCriteria +abstract class CategoryAssociatedContentQuery extends ModelCriteria { /** - * Initializes internal state of \Thelia\Model\Base\ContentAssocQuery object. + * Initializes internal state of \Thelia\Model\Base\CategoryAssociatedContentQuery object. * * @param string $dbName The database name * @param string $modelName The phpName of a model, e.g. 'Book' * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ - public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ContentAssoc', $modelAlias = null) + public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\CategoryAssociatedContent', $modelAlias = null) { parent::__construct($dbName, $modelName, $modelAlias); } /** - * Returns a new ChildContentAssocQuery object. + * Returns a new ChildCategoryAssociatedContentQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * - * @return ChildContentAssocQuery + * @return ChildCategoryAssociatedContentQuery */ public static function create($modelAlias = null, $criteria = null) { - if ($criteria instanceof \Thelia\Model\ContentAssocQuery) { + if ($criteria instanceof \Thelia\Model\CategoryAssociatedContentQuery) { return $criteria; } - $query = new \Thelia\Model\ContentAssocQuery(); + $query = new \Thelia\Model\CategoryAssociatedContentQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } @@ -124,19 +116,19 @@ abstract class ContentAssocQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con an optional connection object * - * @return ChildContentAssoc|array|mixed the result, formatted by the current formatter + * @return ChildCategoryAssociatedContent|array|mixed the result, formatted by the current formatter */ public function findPk($key, $con = null) { if ($key === null) { return null; } - if ((null !== ($obj = ContentAssocTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + if ((null !== ($obj = CategoryAssociatedContentTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { // the object is already in the instance pool return $obj; } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ContentAssocTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(CategoryAssociatedContentTableMap::DATABASE_NAME); } $this->basePreSelect($con); if ($this->formatter || $this->modelAlias || $this->with || $this->select @@ -155,11 +147,11 @@ abstract class ContentAssocQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildContentAssoc A model object, or null if the key is not found + * @return ChildCategoryAssociatedContent A model object, or null if the key is not found */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CATEGORY_ID, PRODUCT_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM content_assoc WHERE ID = :p0'; + $sql = 'SELECT ID, CATEGORY_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM category_associated_content WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -170,9 +162,9 @@ abstract class ContentAssocQuery extends ModelCriteria } $obj = null; if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new ChildContentAssoc(); + $obj = new ChildCategoryAssociatedContent(); $obj->hydrate($row); - ContentAssocTableMap::addInstanceToPool($obj, (string) $key); + CategoryAssociatedContentTableMap::addInstanceToPool($obj, (string) $key); } $stmt->closeCursor(); @@ -185,7 +177,7 @@ abstract class ContentAssocQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildContentAssoc|array|mixed the result, formatted by the current formatter + * @return ChildCategoryAssociatedContent|array|mixed the result, formatted by the current formatter */ protected function findPkComplex($key, $con) { @@ -227,12 +219,12 @@ abstract class ContentAssocQuery extends ModelCriteria * * @param mixed $key Primary key to use for the query * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(ContentAssocTableMap::ID, $key, Criteria::EQUAL); + return $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $key, Criteria::EQUAL); } /** @@ -240,12 +232,12 @@ abstract class ContentAssocQuery extends ModelCriteria * * @param array $keys The list of primary key to use for the query * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(ContentAssocTableMap::ID, $keys, Criteria::IN); + return $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $keys, Criteria::IN); } /** @@ -264,18 +256,18 @@ abstract class ContentAssocQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function filterById($id = null, $comparison = null) { if (is_array($id)) { $useMinMax = false; if (isset($id['min'])) { - $this->addUsingAlias(ContentAssocTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($id['max'])) { - $this->addUsingAlias(ContentAssocTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -286,7 +278,7 @@ abstract class ContentAssocQuery extends ModelCriteria } } - return $this->addUsingAlias(ContentAssocTableMap::ID, $id, $comparison); + return $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $id, $comparison); } /** @@ -307,18 +299,18 @@ abstract class ContentAssocQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function filterByCategoryId($categoryId = null, $comparison = null) { if (is_array($categoryId)) { $useMinMax = false; if (isset($categoryId['min'])) { - $this->addUsingAlias(ContentAssocTableMap::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($categoryId['max'])) { - $this->addUsingAlias(ContentAssocTableMap::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -329,50 +321,7 @@ abstract class ContentAssocQuery extends ModelCriteria } } - return $this->addUsingAlias(ContentAssocTableMap::CATEGORY_ID, $categoryId, $comparison); - } - - /** - * Filter the query on the product_id column - * - * Example usage: - * - * $query->filterByProductId(1234); // WHERE product_id = 1234 - * $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34) - * $query->filterByProductId(array('min' => 12)); // WHERE product_id > 12 - * - * - * @see filterByProduct() - * - * @param mixed $productId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildContentAssocQuery The current query, for fluid interface - */ - public function filterByProductId($productId = null, $comparison = null) - { - if (is_array($productId)) { - $useMinMax = false; - if (isset($productId['min'])) { - $this->addUsingAlias(ContentAssocTableMap::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($productId['max'])) { - $this->addUsingAlias(ContentAssocTableMap::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(ContentAssocTableMap::PRODUCT_ID, $productId, $comparison); + return $this->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $categoryId, $comparison); } /** @@ -393,18 +342,18 @@ abstract class ContentAssocQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function filterByContentId($contentId = null, $comparison = null) { if (is_array($contentId)) { $useMinMax = false; if (isset($contentId['min'])) { - $this->addUsingAlias(ContentAssocTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($contentId['max'])) { - $this->addUsingAlias(ContentAssocTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -415,7 +364,7 @@ abstract class ContentAssocQuery extends ModelCriteria } } - return $this->addUsingAlias(ContentAssocTableMap::CONTENT_ID, $contentId, $comparison); + return $this->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $contentId, $comparison); } /** @@ -434,18 +383,18 @@ abstract class ContentAssocQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function filterByPosition($position = null, $comparison = null) { if (is_array($position)) { $useMinMax = false; if (isset($position['min'])) { - $this->addUsingAlias(ContentAssocTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($position['max'])) { - $this->addUsingAlias(ContentAssocTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -456,7 +405,7 @@ abstract class ContentAssocQuery extends ModelCriteria } } - return $this->addUsingAlias(ContentAssocTableMap::POSITION, $position, $comparison); + return $this->addUsingAlias(CategoryAssociatedContentTableMap::POSITION, $position, $comparison); } /** @@ -477,18 +426,18 @@ abstract class ContentAssocQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function filterByCreatedAt($createdAt = null, $comparison = null) { if (is_array($createdAt)) { $useMinMax = false; if (isset($createdAt['min'])) { - $this->addUsingAlias(ContentAssocTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($createdAt['max'])) { - $this->addUsingAlias(ContentAssocTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -499,7 +448,7 @@ abstract class ContentAssocQuery extends ModelCriteria } } - return $this->addUsingAlias(ContentAssocTableMap::CREATED_AT, $createdAt, $comparison); + return $this->addUsingAlias(CategoryAssociatedContentTableMap::CREATED_AT, $createdAt, $comparison); } /** @@ -520,18 +469,18 @@ abstract class ContentAssocQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function filterByUpdatedAt($updatedAt = null, $comparison = null) { if (is_array($updatedAt)) { $useMinMax = false; if (isset($updatedAt['min'])) { - $this->addUsingAlias(ContentAssocTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($updatedAt['max'])) { - $this->addUsingAlias(ContentAssocTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -542,7 +491,7 @@ abstract class ContentAssocQuery extends ModelCriteria } } - return $this->addUsingAlias(ContentAssocTableMap::UPDATED_AT, $updatedAt, $comparison); + return $this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, $updatedAt, $comparison); } /** @@ -551,20 +500,20 @@ abstract class ContentAssocQuery extends ModelCriteria * @param \Thelia\Model\Category|ObjectCollection $category The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function filterByCategory($category, $comparison = null) { if ($category instanceof \Thelia\Model\Category) { return $this - ->addUsingAlias(ContentAssocTableMap::CATEGORY_ID, $category->getId(), $comparison); + ->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $category->getId(), $comparison); } elseif ($category instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this - ->addUsingAlias(ContentAssocTableMap::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison); + ->addUsingAlias(CategoryAssociatedContentTableMap::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByCategory() only accepts arguments of type \Thelia\Model\Category or Collection'); } @@ -576,9 +525,9 @@ abstract class ContentAssocQuery extends ModelCriteria * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ - public function joinCategory($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Category'); @@ -613,108 +562,33 @@ abstract class ContentAssocQuery extends ModelCriteria * * @return \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query */ - public function useCategoryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinCategory($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery'); } - /** - * Filter the query by a related \Thelia\Model\Product object - * - * @param \Thelia\Model\Product|ObjectCollection $product The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildContentAssocQuery The current query, for fluid interface - */ - public function filterByProduct($product, $comparison = null) - { - if ($product instanceof \Thelia\Model\Product) { - return $this - ->addUsingAlias(ContentAssocTableMap::PRODUCT_ID, $product->getId(), $comparison); - } elseif ($product instanceof ObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(ContentAssocTableMap::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Product relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildContentAssocQuery The current query, for fluid interface - */ - public function joinProduct($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Product'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Product'); - } - - return $this; - } - - /** - * Use the Product relation Product object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query - */ - public function useProductQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinProduct($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery'); - } - /** * Filter the query by a related \Thelia\Model\Content object * * @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function filterByContent($content, $comparison = null) { if ($content instanceof \Thelia\Model\Content) { return $this - ->addUsingAlias(ContentAssocTableMap::CONTENT_ID, $content->getId(), $comparison); + ->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $content->getId(), $comparison); } elseif ($content instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this - ->addUsingAlias(ContentAssocTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison); + ->addUsingAlias(CategoryAssociatedContentTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByContent() only accepts arguments of type \Thelia\Model\Content or Collection'); } @@ -726,9 +600,9 @@ abstract class ContentAssocQuery extends ModelCriteria * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ - public function joinContent($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinContent($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Content'); @@ -763,7 +637,7 @@ abstract class ContentAssocQuery extends ModelCriteria * * @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query */ - public function useContentQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinContent($relationAlias, $joinType) @@ -773,21 +647,21 @@ abstract class ContentAssocQuery extends ModelCriteria /** * Exclude object from result * - * @param ChildContentAssoc $contentAssoc Object to remove from the list of results + * @param ChildCategoryAssociatedContent $categoryAssociatedContent Object to remove from the list of results * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ - public function prune($contentAssoc = null) + public function prune($categoryAssociatedContent = null) { - if ($contentAssoc) { - $this->addUsingAlias(ContentAssocTableMap::ID, $contentAssoc->getId(), Criteria::NOT_EQUAL); + if ($categoryAssociatedContent) { + $this->addUsingAlias(CategoryAssociatedContentTableMap::ID, $categoryAssociatedContent->getId(), Criteria::NOT_EQUAL); } return $this; } /** - * Deletes all rows from the content_assoc table. + * Deletes all rows from the category_associated_content table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). @@ -795,7 +669,7 @@ abstract class ContentAssocQuery extends ModelCriteria public function doDeleteAll(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ContentAssocTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(CategoryAssociatedContentTableMap::DATABASE_NAME); } $affectedRows = 0; // initialize var to track total num of affected rows try { @@ -806,8 +680,8 @@ abstract class ContentAssocQuery extends ModelCriteria // Because this db requires some delete cascade/set null emulation, we have to // clear the cached instance *after* the emulation has happened (since // instances get re-added by the select statement contained therein). - ContentAssocTableMap::clearInstancePool(); - ContentAssocTableMap::clearRelatedInstancePool(); + CategoryAssociatedContentTableMap::clearInstancePool(); + CategoryAssociatedContentTableMap::clearRelatedInstancePool(); $con->commit(); } catch (PropelException $e) { @@ -819,9 +693,9 @@ abstract class ContentAssocQuery extends ModelCriteria } /** - * Performs a DELETE on the database, given a ChildContentAssoc or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ChildCategoryAssociatedContent or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ChildContentAssoc object or primary key or array of primary keys + * @param mixed $values Criteria or ChildCategoryAssociatedContent object or primary key or array of primary keys * which is used to create the DELETE statement * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows @@ -832,13 +706,13 @@ abstract class ContentAssocQuery extends ModelCriteria public function delete(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ContentAssocTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(CategoryAssociatedContentTableMap::DATABASE_NAME); } $criteria = $this; // Set the correct dbName - $criteria->setDbName(ContentAssocTableMap::DATABASE_NAME); + $criteria->setDbName(CategoryAssociatedContentTableMap::DATABASE_NAME); $affectedRows = 0; // initialize var to track total num of affected rows @@ -848,10 +722,10 @@ abstract class ContentAssocQuery extends ModelCriteria $con->beginTransaction(); - ContentAssocTableMap::removeInstanceFromPool($criteria); + CategoryAssociatedContentTableMap::removeInstanceFromPool($criteria); $affectedRows += ModelCriteria::delete($con); - ContentAssocTableMap::clearRelatedInstancePool(); + CategoryAssociatedContentTableMap::clearRelatedInstancePool(); $con->commit(); return $affectedRows; @@ -868,11 +742,11 @@ abstract class ContentAssocQuery extends ModelCriteria * * @param int $nbDays Maximum age of the latest update in days * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(ContentAssocTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + return $this->addUsingAlias(CategoryAssociatedContentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); } /** @@ -880,51 +754,51 @@ abstract class ContentAssocQuery extends ModelCriteria * * @param int $nbDays Maximum age of in days * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(ContentAssocTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + return $this->addUsingAlias(CategoryAssociatedContentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); } /** * Order by update date desc * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(ContentAssocTableMap::UPDATED_AT); + return $this->addDescendingOrderByColumn(CategoryAssociatedContentTableMap::UPDATED_AT); } /** * Order by update date asc * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(ContentAssocTableMap::UPDATED_AT); + return $this->addAscendingOrderByColumn(CategoryAssociatedContentTableMap::UPDATED_AT); } /** * Order by create date desc * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(ContentAssocTableMap::CREATED_AT); + return $this->addDescendingOrderByColumn(CategoryAssociatedContentTableMap::CREATED_AT); } /** * Order by create date asc * - * @return ChildContentAssocQuery The current query, for fluid interface + * @return ChildCategoryAssociatedContentQuery The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(ContentAssocTableMap::CREATED_AT); + return $this->addAscendingOrderByColumn(CategoryAssociatedContentTableMap::CREATED_AT); } -} // ContentAssocQuery +} // CategoryAssociatedContentQuery diff --git a/core/lib/Thelia/Model/Base/CategoryDocument.php b/core/lib/Thelia/Model/Base/CategoryDocument.php index 165bfa492..7539312cc 100644 --- a/core/lib/Thelia/Model/Base/CategoryDocument.php +++ b/core/lib/Thelia/Model/Base/CategoryDocument.php @@ -290,7 +290,7 @@ abstract class CategoryDocument implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php b/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php index db3189cc3..4d284b57e 100644 --- a/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryDocumentI18n.php @@ -272,7 +272,7 @@ abstract class CategoryDocumentI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CategoryI18n.php b/core/lib/Thelia/Model/Base/CategoryI18n.php index 83d62572d..9ae8c8cf3 100644 --- a/core/lib/Thelia/Model/Base/CategoryI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryI18n.php @@ -272,7 +272,7 @@ abstract class CategoryI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CategoryImage.php b/core/lib/Thelia/Model/Base/CategoryImage.php index efde7b64a..353c79c4f 100644 --- a/core/lib/Thelia/Model/Base/CategoryImage.php +++ b/core/lib/Thelia/Model/Base/CategoryImage.php @@ -290,7 +290,7 @@ abstract class CategoryImage implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CategoryImageI18n.php b/core/lib/Thelia/Model/Base/CategoryImageI18n.php index ce61e9836..61b4fc413 100644 --- a/core/lib/Thelia/Model/Base/CategoryImageI18n.php +++ b/core/lib/Thelia/Model/Base/CategoryImageI18n.php @@ -272,7 +272,7 @@ abstract class CategoryImageI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CategoryQuery.php b/core/lib/Thelia/Model/Base/CategoryQuery.php index 0b7df33dd..7f0fb8f1c 100644 --- a/core/lib/Thelia/Model/Base/CategoryQuery.php +++ b/core/lib/Thelia/Model/Base/CategoryQuery.php @@ -58,14 +58,6 @@ use Thelia\Model\Map\CategoryTableMap; * @method ChildCategoryQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation * @method ChildCategoryQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation * - * @method ChildCategoryQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation - * @method ChildCategoryQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation - * @method ChildCategoryQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation - * - * @method ChildCategoryQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation - * @method ChildCategoryQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation - * @method ChildCategoryQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation - * * @method ChildCategoryQuery leftJoinCategoryImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryImage relation * @method ChildCategoryQuery rightJoinCategoryImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryImage relation * @method ChildCategoryQuery innerJoinCategoryImage($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryImage relation @@ -74,6 +66,10 @@ use Thelia\Model\Map\CategoryTableMap; * @method ChildCategoryQuery rightJoinCategoryDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryDocument relation * @method ChildCategoryQuery innerJoinCategoryDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryDocument relation * + * @method ChildCategoryQuery leftJoinCategoryAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryAssociatedContent relation + * @method ChildCategoryQuery rightJoinCategoryAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryAssociatedContent relation + * @method ChildCategoryQuery innerJoinCategoryAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryAssociatedContent relation + * * @method ChildCategoryQuery leftJoinCategoryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryI18n relation * @method ChildCategoryQuery rightJoinCategoryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryI18n relation * @method ChildCategoryQuery innerJoinCategoryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryI18n relation @@ -870,152 +866,6 @@ abstract class CategoryQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery'); } - /** - * Filter the query by a related \Thelia\Model\ContentAssoc object - * - * @param \Thelia\Model\ContentAssoc|ObjectCollection $contentAssoc the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCategoryQuery The current query, for fluid interface - */ - public function filterByContentAssoc($contentAssoc, $comparison = null) - { - if ($contentAssoc instanceof \Thelia\Model\ContentAssoc) { - return $this - ->addUsingAlias(CategoryTableMap::ID, $contentAssoc->getCategoryId(), $comparison); - } elseif ($contentAssoc instanceof ObjectCollection) { - return $this - ->useContentAssocQuery() - ->filterByPrimaryKeys($contentAssoc->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByContentAssoc() only accepts arguments of type \Thelia\Model\ContentAssoc or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the ContentAssoc relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildCategoryQuery The current query, for fluid interface - */ - public function joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ContentAssoc'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'ContentAssoc'); - } - - return $this; - } - - /** - * Use the ContentAssoc relation ContentAssoc object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ContentAssocQuery A secondary query class using the current class as primary query - */ - public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinContentAssoc($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery'); - } - - /** - * Filter the query by a related \Thelia\Model\Rewriting object - * - * @param \Thelia\Model\Rewriting|ObjectCollection $rewriting the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCategoryQuery The current query, for fluid interface - */ - public function filterByRewriting($rewriting, $comparison = null) - { - if ($rewriting instanceof \Thelia\Model\Rewriting) { - return $this - ->addUsingAlias(CategoryTableMap::ID, $rewriting->getCategoryId(), $comparison); - } elseif ($rewriting instanceof ObjectCollection) { - return $this - ->useRewritingQuery() - ->filterByPrimaryKeys($rewriting->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByRewriting() only accepts arguments of type \Thelia\Model\Rewriting or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Rewriting relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildCategoryQuery The current query, for fluid interface - */ - public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Rewriting'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Rewriting'); - } - - return $this; - } - - /** - * Use the Rewriting relation Rewriting object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\RewritingQuery A secondary query class using the current class as primary query - */ - public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinRewriting($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery'); - } - /** * Filter the query by a related \Thelia\Model\CategoryImage object * @@ -1162,6 +1012,79 @@ abstract class CategoryQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CategoryDocument', '\Thelia\Model\CategoryDocumentQuery'); } + /** + * Filter the query by a related \Thelia\Model\CategoryAssociatedContent object + * + * @param \Thelia\Model\CategoryAssociatedContent|ObjectCollection $categoryAssociatedContent the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCategoryQuery The current query, for fluid interface + */ + public function filterByCategoryAssociatedContent($categoryAssociatedContent, $comparison = null) + { + if ($categoryAssociatedContent instanceof \Thelia\Model\CategoryAssociatedContent) { + return $this + ->addUsingAlias(CategoryTableMap::ID, $categoryAssociatedContent->getCategoryId(), $comparison); + } elseif ($categoryAssociatedContent instanceof ObjectCollection) { + return $this + ->useCategoryAssociatedContentQuery() + ->filterByPrimaryKeys($categoryAssociatedContent->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByCategoryAssociatedContent() only accepts arguments of type \Thelia\Model\CategoryAssociatedContent or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the CategoryAssociatedContent relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildCategoryQuery The current query, for fluid interface + */ + public function joinCategoryAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CategoryAssociatedContent'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CategoryAssociatedContent'); + } + + return $this; + } + + /** + * Use the CategoryAssociatedContent relation CategoryAssociatedContent object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\CategoryAssociatedContentQuery A secondary query class using the current class as primary query + */ + public function useCategoryAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCategoryAssociatedContent($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CategoryAssociatedContent', '\Thelia\Model\CategoryAssociatedContentQuery'); + } + /** * Filter the query by a related \Thelia\Model\CategoryI18n object * diff --git a/core/lib/Thelia/Model/Base/CategoryVersion.php b/core/lib/Thelia/Model/Base/CategoryVersion.php index d8dfe76e0..416ad95d5 100644 --- a/core/lib/Thelia/Model/Base/CategoryVersion.php +++ b/core/lib/Thelia/Model/Base/CategoryVersion.php @@ -292,7 +292,7 @@ abstract class CategoryVersion implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Config.php b/core/lib/Thelia/Model/Base/Config.php index d687ffefe..9f2080d1f 100644 --- a/core/lib/Thelia/Model/Base/Config.php +++ b/core/lib/Thelia/Model/Base/Config.php @@ -305,7 +305,7 @@ abstract class Config implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ConfigI18n.php b/core/lib/Thelia/Model/Base/ConfigI18n.php index 6247e15d1..71f1d5287 100644 --- a/core/lib/Thelia/Model/Base/ConfigI18n.php +++ b/core/lib/Thelia/Model/Base/ConfigI18n.php @@ -272,7 +272,7 @@ abstract class ConfigI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Content.php b/core/lib/Thelia/Model/Base/Content.php index 96ea69eef..aa53fb9b5 100644 --- a/core/lib/Thelia/Model/Base/Content.php +++ b/core/lib/Thelia/Model/Base/Content.php @@ -17,9 +17,9 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; +use Thelia\Model\CategoryAssociatedContent as ChildCategoryAssociatedContent; +use Thelia\Model\CategoryAssociatedContentQuery as ChildCategoryAssociatedContentQuery; use Thelia\Model\Content as ChildContent; -use Thelia\Model\ContentAssoc as ChildContentAssoc; -use Thelia\Model\ContentAssocQuery as ChildContentAssocQuery; use Thelia\Model\ContentDocument as ChildContentDocument; use Thelia\Model\ContentDocumentQuery as ChildContentDocumentQuery; use Thelia\Model\ContentFolder as ChildContentFolder; @@ -33,8 +33,8 @@ use Thelia\Model\ContentVersion as ChildContentVersion; use Thelia\Model\ContentVersionQuery as ChildContentVersionQuery; use Thelia\Model\Folder as ChildFolder; use Thelia\Model\FolderQuery as ChildFolderQuery; -use Thelia\Model\Rewriting as ChildRewriting; -use Thelia\Model\RewritingQuery as ChildRewritingQuery; +use Thelia\Model\ProductAssociatedContent as ChildProductAssociatedContent; +use Thelia\Model\ProductAssociatedContentQuery as ChildProductAssociatedContentQuery; use Thelia\Model\Map\ContentTableMap; use Thelia\Model\Map\ContentVersionTableMap; @@ -121,18 +121,6 @@ abstract class Content implements ActiveRecordInterface */ protected $version_created_by; - /** - * @var ObjectCollection|ChildContentAssoc[] Collection to store aggregation of ChildContentAssoc objects. - */ - protected $collContentAssocs; - protected $collContentAssocsPartial; - - /** - * @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects. - */ - protected $collRewritings; - protected $collRewritingsPartial; - /** * @var ObjectCollection|ChildContentFolder[] Collection to store aggregation of ChildContentFolder objects. */ @@ -151,6 +139,18 @@ abstract class Content implements ActiveRecordInterface protected $collContentDocuments; protected $collContentDocumentsPartial; + /** + * @var ObjectCollection|ChildProductAssociatedContent[] Collection to store aggregation of ChildProductAssociatedContent objects. + */ + protected $collProductAssociatedContents; + protected $collProductAssociatedContentsPartial; + + /** + * @var ObjectCollection|ChildCategoryAssociatedContent[] Collection to store aggregation of ChildCategoryAssociatedContent objects. + */ + protected $collCategoryAssociatedContents; + protected $collCategoryAssociatedContentsPartial; + /** * @var ObjectCollection|ChildContentI18n[] Collection to store aggregation of ChildContentI18n objects. */ @@ -204,18 +204,6 @@ abstract class Content implements ActiveRecordInterface */ protected $foldersScheduledForDeletion = null; - /** - * An array of objects scheduled for deletion. - * @var ObjectCollection - */ - protected $contentAssocsScheduledForDeletion = null; - - /** - * An array of objects scheduled for deletion. - * @var ObjectCollection - */ - protected $rewritingsScheduledForDeletion = null; - /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -234,6 +222,18 @@ abstract class Content implements ActiveRecordInterface */ protected $contentDocumentsScheduledForDeletion = null; + /** + * An array of objects scheduled for deletion. + * @var ObjectCollection + */ + protected $productAssociatedContentsScheduledForDeletion = null; + + /** + * An array of objects scheduled for deletion. + * @var ObjectCollection + */ + protected $categoryAssociatedContentsScheduledForDeletion = null; + /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -415,7 +415,7 @@ abstract class Content implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -938,16 +938,16 @@ abstract class Content implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->collContentAssocs = null; - - $this->collRewritings = null; - $this->collContentFolders = null; $this->collContentImages = null; $this->collContentDocuments = null; + $this->collProductAssociatedContents = null; + + $this->collCategoryAssociatedContents = null; + $this->collContentI18ns = null; $this->collContentVersions = null; @@ -1125,40 +1125,6 @@ abstract class Content implements ActiveRecordInterface } } - if ($this->contentAssocsScheduledForDeletion !== null) { - if (!$this->contentAssocsScheduledForDeletion->isEmpty()) { - \Thelia\Model\ContentAssocQuery::create() - ->filterByPrimaryKeys($this->contentAssocsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->contentAssocsScheduledForDeletion = null; - } - } - - if ($this->collContentAssocs !== null) { - foreach ($this->collContentAssocs as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - - if ($this->rewritingsScheduledForDeletion !== null) { - if (!$this->rewritingsScheduledForDeletion->isEmpty()) { - \Thelia\Model\RewritingQuery::create() - ->filterByPrimaryKeys($this->rewritingsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->rewritingsScheduledForDeletion = null; - } - } - - if ($this->collRewritings !== null) { - foreach ($this->collRewritings as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - if ($this->contentFoldersScheduledForDeletion !== null) { if (!$this->contentFoldersScheduledForDeletion->isEmpty()) { \Thelia\Model\ContentFolderQuery::create() @@ -1210,6 +1176,40 @@ abstract class Content implements ActiveRecordInterface } } + if ($this->productAssociatedContentsScheduledForDeletion !== null) { + if (!$this->productAssociatedContentsScheduledForDeletion->isEmpty()) { + \Thelia\Model\ProductAssociatedContentQuery::create() + ->filterByPrimaryKeys($this->productAssociatedContentsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->productAssociatedContentsScheduledForDeletion = null; + } + } + + if ($this->collProductAssociatedContents !== null) { + foreach ($this->collProductAssociatedContents as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->categoryAssociatedContentsScheduledForDeletion !== null) { + if (!$this->categoryAssociatedContentsScheduledForDeletion->isEmpty()) { + \Thelia\Model\CategoryAssociatedContentQuery::create() + ->filterByPrimaryKeys($this->categoryAssociatedContentsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->categoryAssociatedContentsScheduledForDeletion = null; + } + } + + if ($this->collCategoryAssociatedContents !== null) { + foreach ($this->collCategoryAssociatedContents as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + if ($this->contentI18nsScheduledForDeletion !== null) { if (!$this->contentI18nsScheduledForDeletion->isEmpty()) { \Thelia\Model\ContentI18nQuery::create() @@ -1460,12 +1460,6 @@ abstract class Content implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->collContentAssocs) { - $result['ContentAssocs'] = $this->collContentAssocs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } - if (null !== $this->collRewritings) { - $result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } if (null !== $this->collContentFolders) { $result['ContentFolders'] = $this->collContentFolders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1475,6 +1469,12 @@ abstract class Content implements ActiveRecordInterface if (null !== $this->collContentDocuments) { $result['ContentDocuments'] = $this->collContentDocuments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } + if (null !== $this->collProductAssociatedContents) { + $result['ProductAssociatedContents'] = $this->collProductAssociatedContents->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } + if (null !== $this->collCategoryAssociatedContents) { + $result['CategoryAssociatedContents'] = $this->collCategoryAssociatedContents->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } if (null !== $this->collContentI18ns) { $result['ContentI18ns'] = $this->collContentI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1666,18 +1666,6 @@ abstract class Content implements ActiveRecordInterface // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getContentAssocs() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addContentAssoc($relObj->copy($deepCopy)); - } - } - - foreach ($this->getRewritings() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addRewriting($relObj->copy($deepCopy)); - } - } - foreach ($this->getContentFolders() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addContentFolder($relObj->copy($deepCopy)); @@ -1696,6 +1684,18 @@ abstract class Content implements ActiveRecordInterface } } + foreach ($this->getProductAssociatedContents() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addProductAssociatedContent($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCategoryAssociatedContents() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCategoryAssociatedContent($relObj->copy($deepCopy)); + } + } + foreach ($this->getContentI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addContentI18n($relObj->copy($deepCopy)); @@ -1749,12 +1749,6 @@ abstract class Content implements ActiveRecordInterface */ public function initRelation($relationName) { - if ('ContentAssoc' == $relationName) { - return $this->initContentAssocs(); - } - if ('Rewriting' == $relationName) { - return $this->initRewritings(); - } if ('ContentFolder' == $relationName) { return $this->initContentFolders(); } @@ -1764,6 +1758,12 @@ abstract class Content implements ActiveRecordInterface if ('ContentDocument' == $relationName) { return $this->initContentDocuments(); } + if ('ProductAssociatedContent' == $relationName) { + return $this->initProductAssociatedContents(); + } + if ('CategoryAssociatedContent' == $relationName) { + return $this->initCategoryAssociatedContents(); + } if ('ContentI18n' == $relationName) { return $this->initContentI18ns(); } @@ -1772,567 +1772,6 @@ abstract class Content implements ActiveRecordInterface } } - /** - * Clears out the collContentAssocs collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addContentAssocs() - */ - public function clearContentAssocs() - { - $this->collContentAssocs = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Reset is the collContentAssocs collection loaded partially. - */ - public function resetPartialContentAssocs($v = true) - { - $this->collContentAssocsPartial = $v; - } - - /** - * Initializes the collContentAssocs collection. - * - * By default this just sets the collContentAssocs collection to an empty array (like clearcollContentAssocs()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initContentAssocs($overrideExisting = true) - { - if (null !== $this->collContentAssocs && !$overrideExisting) { - return; - } - $this->collContentAssocs = new ObjectCollection(); - $this->collContentAssocs->setModel('\Thelia\Model\ContentAssoc'); - } - - /** - * Gets an array of ChildContentAssoc objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this ChildContent is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects - * @throws PropelException - */ - public function getContentAssocs($criteria = null, ConnectionInterface $con = null) - { - $partial = $this->collContentAssocsPartial && !$this->isNew(); - if (null === $this->collContentAssocs || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collContentAssocs) { - // return empty collection - $this->initContentAssocs(); - } else { - $collContentAssocs = ChildContentAssocQuery::create(null, $criteria) - ->filterByContent($this) - ->find($con); - - if (null !== $criteria) { - if (false !== $this->collContentAssocsPartial && count($collContentAssocs)) { - $this->initContentAssocs(false); - - foreach ($collContentAssocs as $obj) { - if (false == $this->collContentAssocs->contains($obj)) { - $this->collContentAssocs->append($obj); - } - } - - $this->collContentAssocsPartial = true; - } - - $collContentAssocs->getInternalIterator()->rewind(); - - return $collContentAssocs; - } - - if ($partial && $this->collContentAssocs) { - foreach ($this->collContentAssocs as $obj) { - if ($obj->isNew()) { - $collContentAssocs[] = $obj; - } - } - } - - $this->collContentAssocs = $collContentAssocs; - $this->collContentAssocsPartial = false; - } - } - - return $this->collContentAssocs; - } - - /** - * Sets a collection of ContentAssoc objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param Collection $contentAssocs A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return ChildContent The current object (for fluent API support) - */ - public function setContentAssocs(Collection $contentAssocs, ConnectionInterface $con = null) - { - $contentAssocsToDelete = $this->getContentAssocs(new Criteria(), $con)->diff($contentAssocs); - - - $this->contentAssocsScheduledForDeletion = $contentAssocsToDelete; - - foreach ($contentAssocsToDelete as $contentAssocRemoved) { - $contentAssocRemoved->setContent(null); - } - - $this->collContentAssocs = null; - foreach ($contentAssocs as $contentAssoc) { - $this->addContentAssoc($contentAssoc); - } - - $this->collContentAssocs = $contentAssocs; - $this->collContentAssocsPartial = false; - - return $this; - } - - /** - * Returns the number of related ContentAssoc objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related ContentAssoc objects. - * @throws PropelException - */ - public function countContentAssocs(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) - { - $partial = $this->collContentAssocsPartial && !$this->isNew(); - if (null === $this->collContentAssocs || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collContentAssocs) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getContentAssocs()); - } - - $query = ChildContentAssocQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByContent($this) - ->count($con); - } - - return count($this->collContentAssocs); - } - - /** - * Method called to associate a ChildContentAssoc object to this object - * through the ChildContentAssoc foreign key attribute. - * - * @param ChildContentAssoc $l ChildContentAssoc - * @return \Thelia\Model\Content The current object (for fluent API support) - */ - public function addContentAssoc(ChildContentAssoc $l) - { - if ($this->collContentAssocs === null) { - $this->initContentAssocs(); - $this->collContentAssocsPartial = true; - } - - if (!in_array($l, $this->collContentAssocs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddContentAssoc($l); - } - - return $this; - } - - /** - * @param ContentAssoc $contentAssoc The contentAssoc object to add. - */ - protected function doAddContentAssoc($contentAssoc) - { - $this->collContentAssocs[]= $contentAssoc; - $contentAssoc->setContent($this); - } - - /** - * @param ContentAssoc $contentAssoc The contentAssoc object to remove. - * @return ChildContent The current object (for fluent API support) - */ - public function removeContentAssoc($contentAssoc) - { - if ($this->getContentAssocs()->contains($contentAssoc)) { - $this->collContentAssocs->remove($this->collContentAssocs->search($contentAssoc)); - if (null === $this->contentAssocsScheduledForDeletion) { - $this->contentAssocsScheduledForDeletion = clone $this->collContentAssocs; - $this->contentAssocsScheduledForDeletion->clear(); - } - $this->contentAssocsScheduledForDeletion[]= $contentAssoc; - $contentAssoc->setContent(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Content is new, it will return - * an empty collection; or if this Content has previously - * been saved, it will retrieve related ContentAssocs from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Content. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects - */ - public function getContentAssocsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildContentAssocQuery::create(null, $criteria); - $query->joinWith('Category', $joinBehavior); - - return $this->getContentAssocs($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Content is new, it will return - * an empty collection; or if this Content has previously - * been saved, it will retrieve related ContentAssocs from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Content. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects - */ - public function getContentAssocsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildContentAssocQuery::create(null, $criteria); - $query->joinWith('Product', $joinBehavior); - - return $this->getContentAssocs($query, $con); - } - - /** - * Clears out the collRewritings collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addRewritings() - */ - public function clearRewritings() - { - $this->collRewritings = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Reset is the collRewritings collection loaded partially. - */ - public function resetPartialRewritings($v = true) - { - $this->collRewritingsPartial = $v; - } - - /** - * Initializes the collRewritings collection. - * - * By default this just sets the collRewritings collection to an empty array (like clearcollRewritings()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initRewritings($overrideExisting = true) - { - if (null !== $this->collRewritings && !$overrideExisting) { - return; - } - $this->collRewritings = new ObjectCollection(); - $this->collRewritings->setModel('\Thelia\Model\Rewriting'); - } - - /** - * Gets an array of ChildRewriting objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this ChildContent is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @return Collection|ChildRewriting[] List of ChildRewriting objects - * @throws PropelException - */ - public function getRewritings($criteria = null, ConnectionInterface $con = null) - { - $partial = $this->collRewritingsPartial && !$this->isNew(); - if (null === $this->collRewritings || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collRewritings) { - // return empty collection - $this->initRewritings(); - } else { - $collRewritings = ChildRewritingQuery::create(null, $criteria) - ->filterByContent($this) - ->find($con); - - if (null !== $criteria) { - if (false !== $this->collRewritingsPartial && count($collRewritings)) { - $this->initRewritings(false); - - foreach ($collRewritings as $obj) { - if (false == $this->collRewritings->contains($obj)) { - $this->collRewritings->append($obj); - } - } - - $this->collRewritingsPartial = true; - } - - $collRewritings->getInternalIterator()->rewind(); - - return $collRewritings; - } - - if ($partial && $this->collRewritings) { - foreach ($this->collRewritings as $obj) { - if ($obj->isNew()) { - $collRewritings[] = $obj; - } - } - } - - $this->collRewritings = $collRewritings; - $this->collRewritingsPartial = false; - } - } - - return $this->collRewritings; - } - - /** - * Sets a collection of Rewriting objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param Collection $rewritings A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return ChildContent The current object (for fluent API support) - */ - public function setRewritings(Collection $rewritings, ConnectionInterface $con = null) - { - $rewritingsToDelete = $this->getRewritings(new Criteria(), $con)->diff($rewritings); - - - $this->rewritingsScheduledForDeletion = $rewritingsToDelete; - - foreach ($rewritingsToDelete as $rewritingRemoved) { - $rewritingRemoved->setContent(null); - } - - $this->collRewritings = null; - foreach ($rewritings as $rewriting) { - $this->addRewriting($rewriting); - } - - $this->collRewritings = $rewritings; - $this->collRewritingsPartial = false; - - return $this; - } - - /** - * Returns the number of related Rewriting objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Rewriting objects. - * @throws PropelException - */ - public function countRewritings(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) - { - $partial = $this->collRewritingsPartial && !$this->isNew(); - if (null === $this->collRewritings || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collRewritings) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getRewritings()); - } - - $query = ChildRewritingQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByContent($this) - ->count($con); - } - - return count($this->collRewritings); - } - - /** - * Method called to associate a ChildRewriting object to this object - * through the ChildRewriting foreign key attribute. - * - * @param ChildRewriting $l ChildRewriting - * @return \Thelia\Model\Content The current object (for fluent API support) - */ - public function addRewriting(ChildRewriting $l) - { - if ($this->collRewritings === null) { - $this->initRewritings(); - $this->collRewritingsPartial = true; - } - - if (!in_array($l, $this->collRewritings->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddRewriting($l); - } - - return $this; - } - - /** - * @param Rewriting $rewriting The rewriting object to add. - */ - protected function doAddRewriting($rewriting) - { - $this->collRewritings[]= $rewriting; - $rewriting->setContent($this); - } - - /** - * @param Rewriting $rewriting The rewriting object to remove. - * @return ChildContent The current object (for fluent API support) - */ - public function removeRewriting($rewriting) - { - if ($this->getRewritings()->contains($rewriting)) { - $this->collRewritings->remove($this->collRewritings->search($rewriting)); - if (null === $this->rewritingsScheduledForDeletion) { - $this->rewritingsScheduledForDeletion = clone $this->collRewritings; - $this->rewritingsScheduledForDeletion->clear(); - } - $this->rewritingsScheduledForDeletion[]= $rewriting; - $rewriting->setContent(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Content is new, it will return - * an empty collection; or if this Content has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Content. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Product', $joinBehavior); - - return $this->getRewritings($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Content is new, it will return - * an empty collection; or if this Content has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Content. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Category', $joinBehavior); - - return $this->getRewritings($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Content is new, it will return - * an empty collection; or if this Content has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Content. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinFolder($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Folder', $joinBehavior); - - return $this->getRewritings($query, $con); - } - /** * Clears out the collContentFolders collection * @@ -3015,6 +2454,492 @@ abstract class Content implements ActiveRecordInterface return $this; } + /** + * Clears out the collProductAssociatedContents collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addProductAssociatedContents() + */ + public function clearProductAssociatedContents() + { + $this->collProductAssociatedContents = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collProductAssociatedContents collection loaded partially. + */ + public function resetPartialProductAssociatedContents($v = true) + { + $this->collProductAssociatedContentsPartial = $v; + } + + /** + * Initializes the collProductAssociatedContents collection. + * + * By default this just sets the collProductAssociatedContents collection to an empty array (like clearcollProductAssociatedContents()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @param boolean $overrideExisting If set to true, the method call initializes + * the collection even if it is not empty + * + * @return void + */ + public function initProductAssociatedContents($overrideExisting = true) + { + if (null !== $this->collProductAssociatedContents && !$overrideExisting) { + return; + } + $this->collProductAssociatedContents = new ObjectCollection(); + $this->collProductAssociatedContents->setModel('\Thelia\Model\ProductAssociatedContent'); + } + + /** + * Gets an array of ChildProductAssociatedContent objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this ChildContent is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @return Collection|ChildProductAssociatedContent[] List of ChildProductAssociatedContent objects + * @throws PropelException + */ + public function getProductAssociatedContents($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collProductAssociatedContentsPartial && !$this->isNew(); + if (null === $this->collProductAssociatedContents || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collProductAssociatedContents) { + // return empty collection + $this->initProductAssociatedContents(); + } else { + $collProductAssociatedContents = ChildProductAssociatedContentQuery::create(null, $criteria) + ->filterByContent($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collProductAssociatedContentsPartial && count($collProductAssociatedContents)) { + $this->initProductAssociatedContents(false); + + foreach ($collProductAssociatedContents as $obj) { + if (false == $this->collProductAssociatedContents->contains($obj)) { + $this->collProductAssociatedContents->append($obj); + } + } + + $this->collProductAssociatedContentsPartial = true; + } + + $collProductAssociatedContents->getInternalIterator()->rewind(); + + return $collProductAssociatedContents; + } + + if ($partial && $this->collProductAssociatedContents) { + foreach ($this->collProductAssociatedContents as $obj) { + if ($obj->isNew()) { + $collProductAssociatedContents[] = $obj; + } + } + } + + $this->collProductAssociatedContents = $collProductAssociatedContents; + $this->collProductAssociatedContentsPartial = false; + } + } + + return $this->collProductAssociatedContents; + } + + /** + * Sets a collection of ProductAssociatedContent objects related by a one-to-many relationship + * to the current object. + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) + * and new objects from the given Propel collection. + * + * @param Collection $productAssociatedContents A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildContent The current object (for fluent API support) + */ + public function setProductAssociatedContents(Collection $productAssociatedContents, ConnectionInterface $con = null) + { + $productAssociatedContentsToDelete = $this->getProductAssociatedContents(new Criteria(), $con)->diff($productAssociatedContents); + + + $this->productAssociatedContentsScheduledForDeletion = $productAssociatedContentsToDelete; + + foreach ($productAssociatedContentsToDelete as $productAssociatedContentRemoved) { + $productAssociatedContentRemoved->setContent(null); + } + + $this->collProductAssociatedContents = null; + foreach ($productAssociatedContents as $productAssociatedContent) { + $this->addProductAssociatedContent($productAssociatedContent); + } + + $this->collProductAssociatedContents = $productAssociatedContents; + $this->collProductAssociatedContentsPartial = false; + + return $this; + } + + /** + * Returns the number of related ProductAssociatedContent objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related ProductAssociatedContent objects. + * @throws PropelException + */ + public function countProductAssociatedContents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collProductAssociatedContentsPartial && !$this->isNew(); + if (null === $this->collProductAssociatedContents || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collProductAssociatedContents) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getProductAssociatedContents()); + } + + $query = ChildProductAssociatedContentQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByContent($this) + ->count($con); + } + + return count($this->collProductAssociatedContents); + } + + /** + * Method called to associate a ChildProductAssociatedContent object to this object + * through the ChildProductAssociatedContent foreign key attribute. + * + * @param ChildProductAssociatedContent $l ChildProductAssociatedContent + * @return \Thelia\Model\Content The current object (for fluent API support) + */ + public function addProductAssociatedContent(ChildProductAssociatedContent $l) + { + if ($this->collProductAssociatedContents === null) { + $this->initProductAssociatedContents(); + $this->collProductAssociatedContentsPartial = true; + } + + if (!in_array($l, $this->collProductAssociatedContents->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddProductAssociatedContent($l); + } + + return $this; + } + + /** + * @param ProductAssociatedContent $productAssociatedContent The productAssociatedContent object to add. + */ + protected function doAddProductAssociatedContent($productAssociatedContent) + { + $this->collProductAssociatedContents[]= $productAssociatedContent; + $productAssociatedContent->setContent($this); + } + + /** + * @param ProductAssociatedContent $productAssociatedContent The productAssociatedContent object to remove. + * @return ChildContent The current object (for fluent API support) + */ + public function removeProductAssociatedContent($productAssociatedContent) + { + if ($this->getProductAssociatedContents()->contains($productAssociatedContent)) { + $this->collProductAssociatedContents->remove($this->collProductAssociatedContents->search($productAssociatedContent)); + if (null === $this->productAssociatedContentsScheduledForDeletion) { + $this->productAssociatedContentsScheduledForDeletion = clone $this->collProductAssociatedContents; + $this->productAssociatedContentsScheduledForDeletion->clear(); + } + $this->productAssociatedContentsScheduledForDeletion[]= clone $productAssociatedContent; + $productAssociatedContent->setContent(null); + } + + return $this; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Content is new, it will return + * an empty collection; or if this Content has previously + * been saved, it will retrieve related ProductAssociatedContents from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Content. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildProductAssociatedContent[] List of ChildProductAssociatedContent objects + */ + public function getProductAssociatedContentsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildProductAssociatedContentQuery::create(null, $criteria); + $query->joinWith('Product', $joinBehavior); + + return $this->getProductAssociatedContents($query, $con); + } + + /** + * Clears out the collCategoryAssociatedContents collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addCategoryAssociatedContents() + */ + public function clearCategoryAssociatedContents() + { + $this->collCategoryAssociatedContents = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collCategoryAssociatedContents collection loaded partially. + */ + public function resetPartialCategoryAssociatedContents($v = true) + { + $this->collCategoryAssociatedContentsPartial = $v; + } + + /** + * Initializes the collCategoryAssociatedContents collection. + * + * By default this just sets the collCategoryAssociatedContents collection to an empty array (like clearcollCategoryAssociatedContents()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @param boolean $overrideExisting If set to true, the method call initializes + * the collection even if it is not empty + * + * @return void + */ + public function initCategoryAssociatedContents($overrideExisting = true) + { + if (null !== $this->collCategoryAssociatedContents && !$overrideExisting) { + return; + } + $this->collCategoryAssociatedContents = new ObjectCollection(); + $this->collCategoryAssociatedContents->setModel('\Thelia\Model\CategoryAssociatedContent'); + } + + /** + * Gets an array of ChildCategoryAssociatedContent objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this ChildContent is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @return Collection|ChildCategoryAssociatedContent[] List of ChildCategoryAssociatedContent objects + * @throws PropelException + */ + public function getCategoryAssociatedContents($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collCategoryAssociatedContentsPartial && !$this->isNew(); + if (null === $this->collCategoryAssociatedContents || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collCategoryAssociatedContents) { + // return empty collection + $this->initCategoryAssociatedContents(); + } else { + $collCategoryAssociatedContents = ChildCategoryAssociatedContentQuery::create(null, $criteria) + ->filterByContent($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collCategoryAssociatedContentsPartial && count($collCategoryAssociatedContents)) { + $this->initCategoryAssociatedContents(false); + + foreach ($collCategoryAssociatedContents as $obj) { + if (false == $this->collCategoryAssociatedContents->contains($obj)) { + $this->collCategoryAssociatedContents->append($obj); + } + } + + $this->collCategoryAssociatedContentsPartial = true; + } + + $collCategoryAssociatedContents->getInternalIterator()->rewind(); + + return $collCategoryAssociatedContents; + } + + if ($partial && $this->collCategoryAssociatedContents) { + foreach ($this->collCategoryAssociatedContents as $obj) { + if ($obj->isNew()) { + $collCategoryAssociatedContents[] = $obj; + } + } + } + + $this->collCategoryAssociatedContents = $collCategoryAssociatedContents; + $this->collCategoryAssociatedContentsPartial = false; + } + } + + return $this->collCategoryAssociatedContents; + } + + /** + * Sets a collection of CategoryAssociatedContent objects related by a one-to-many relationship + * to the current object. + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) + * and new objects from the given Propel collection. + * + * @param Collection $categoryAssociatedContents A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildContent The current object (for fluent API support) + */ + public function setCategoryAssociatedContents(Collection $categoryAssociatedContents, ConnectionInterface $con = null) + { + $categoryAssociatedContentsToDelete = $this->getCategoryAssociatedContents(new Criteria(), $con)->diff($categoryAssociatedContents); + + + $this->categoryAssociatedContentsScheduledForDeletion = $categoryAssociatedContentsToDelete; + + foreach ($categoryAssociatedContentsToDelete as $categoryAssociatedContentRemoved) { + $categoryAssociatedContentRemoved->setContent(null); + } + + $this->collCategoryAssociatedContents = null; + foreach ($categoryAssociatedContents as $categoryAssociatedContent) { + $this->addCategoryAssociatedContent($categoryAssociatedContent); + } + + $this->collCategoryAssociatedContents = $categoryAssociatedContents; + $this->collCategoryAssociatedContentsPartial = false; + + return $this; + } + + /** + * Returns the number of related CategoryAssociatedContent objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related CategoryAssociatedContent objects. + * @throws PropelException + */ + public function countCategoryAssociatedContents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collCategoryAssociatedContentsPartial && !$this->isNew(); + if (null === $this->collCategoryAssociatedContents || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collCategoryAssociatedContents) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getCategoryAssociatedContents()); + } + + $query = ChildCategoryAssociatedContentQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByContent($this) + ->count($con); + } + + return count($this->collCategoryAssociatedContents); + } + + /** + * Method called to associate a ChildCategoryAssociatedContent object to this object + * through the ChildCategoryAssociatedContent foreign key attribute. + * + * @param ChildCategoryAssociatedContent $l ChildCategoryAssociatedContent + * @return \Thelia\Model\Content The current object (for fluent API support) + */ + public function addCategoryAssociatedContent(ChildCategoryAssociatedContent $l) + { + if ($this->collCategoryAssociatedContents === null) { + $this->initCategoryAssociatedContents(); + $this->collCategoryAssociatedContentsPartial = true; + } + + if (!in_array($l, $this->collCategoryAssociatedContents->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddCategoryAssociatedContent($l); + } + + return $this; + } + + /** + * @param CategoryAssociatedContent $categoryAssociatedContent The categoryAssociatedContent object to add. + */ + protected function doAddCategoryAssociatedContent($categoryAssociatedContent) + { + $this->collCategoryAssociatedContents[]= $categoryAssociatedContent; + $categoryAssociatedContent->setContent($this); + } + + /** + * @param CategoryAssociatedContent $categoryAssociatedContent The categoryAssociatedContent object to remove. + * @return ChildContent The current object (for fluent API support) + */ + public function removeCategoryAssociatedContent($categoryAssociatedContent) + { + if ($this->getCategoryAssociatedContents()->contains($categoryAssociatedContent)) { + $this->collCategoryAssociatedContents->remove($this->collCategoryAssociatedContents->search($categoryAssociatedContent)); + if (null === $this->categoryAssociatedContentsScheduledForDeletion) { + $this->categoryAssociatedContentsScheduledForDeletion = clone $this->collCategoryAssociatedContents; + $this->categoryAssociatedContentsScheduledForDeletion->clear(); + } + $this->categoryAssociatedContentsScheduledForDeletion[]= clone $categoryAssociatedContent; + $categoryAssociatedContent->setContent(null); + } + + return $this; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Content is new, it will return + * an empty collection; or if this Content has previously + * been saved, it will retrieve related CategoryAssociatedContents from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Content. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildCategoryAssociatedContent[] List of ChildCategoryAssociatedContent objects + */ + public function getCategoryAssociatedContentsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildCategoryAssociatedContentQuery::create(null, $criteria); + $query->joinWith('Category', $joinBehavior); + + return $this->getCategoryAssociatedContents($query, $con); + } + /** * Clears out the collContentI18ns collection * @@ -3677,16 +3602,6 @@ abstract class Content implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collContentAssocs) { - foreach ($this->collContentAssocs as $o) { - $o->clearAllReferences($deep); - } - } - if ($this->collRewritings) { - foreach ($this->collRewritings as $o) { - $o->clearAllReferences($deep); - } - } if ($this->collContentFolders) { foreach ($this->collContentFolders as $o) { $o->clearAllReferences($deep); @@ -3702,6 +3617,16 @@ abstract class Content implements ActiveRecordInterface $o->clearAllReferences($deep); } } + if ($this->collProductAssociatedContents) { + foreach ($this->collProductAssociatedContents as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCategoryAssociatedContents) { + foreach ($this->collCategoryAssociatedContents as $o) { + $o->clearAllReferences($deep); + } + } if ($this->collContentI18ns) { foreach ($this->collContentI18ns as $o) { $o->clearAllReferences($deep); @@ -3723,14 +3648,6 @@ abstract class Content implements ActiveRecordInterface $this->currentLocale = 'en_US'; $this->currentTranslations = null; - if ($this->collContentAssocs instanceof Collection) { - $this->collContentAssocs->clearIterator(); - } - $this->collContentAssocs = null; - if ($this->collRewritings instanceof Collection) { - $this->collRewritings->clearIterator(); - } - $this->collRewritings = null; if ($this->collContentFolders instanceof Collection) { $this->collContentFolders->clearIterator(); } @@ -3743,6 +3660,14 @@ abstract class Content implements ActiveRecordInterface $this->collContentDocuments->clearIterator(); } $this->collContentDocuments = null; + if ($this->collProductAssociatedContents instanceof Collection) { + $this->collProductAssociatedContents->clearIterator(); + } + $this->collProductAssociatedContents = null; + if ($this->collCategoryAssociatedContents instanceof Collection) { + $this->collCategoryAssociatedContents->clearIterator(); + } + $this->collCategoryAssociatedContents = null; if ($this->collContentI18ns instanceof Collection) { $this->collContentI18ns->clearIterator(); } diff --git a/core/lib/Thelia/Model/Base/ContentDocument.php b/core/lib/Thelia/Model/Base/ContentDocument.php index 990fc4a9f..a8207bb14 100644 --- a/core/lib/Thelia/Model/Base/ContentDocument.php +++ b/core/lib/Thelia/Model/Base/ContentDocument.php @@ -290,7 +290,7 @@ abstract class ContentDocument implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ContentDocumentI18n.php b/core/lib/Thelia/Model/Base/ContentDocumentI18n.php index 2cfc367b0..1e1f1bd52 100644 --- a/core/lib/Thelia/Model/Base/ContentDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/ContentDocumentI18n.php @@ -272,7 +272,7 @@ abstract class ContentDocumentI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ContentFolder.php b/core/lib/Thelia/Model/Base/ContentFolder.php index 52f5fa88a..51d72b974 100644 --- a/core/lib/Thelia/Model/Base/ContentFolder.php +++ b/core/lib/Thelia/Model/Base/ContentFolder.php @@ -256,7 +256,7 @@ abstract class ContentFolder implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ContentI18n.php b/core/lib/Thelia/Model/Base/ContentI18n.php index d3974522b..6ffc1d4bf 100644 --- a/core/lib/Thelia/Model/Base/ContentI18n.php +++ b/core/lib/Thelia/Model/Base/ContentI18n.php @@ -272,7 +272,7 @@ abstract class ContentI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ContentImage.php b/core/lib/Thelia/Model/Base/ContentImage.php index 22c4bed10..8a0a5a77c 100644 --- a/core/lib/Thelia/Model/Base/ContentImage.php +++ b/core/lib/Thelia/Model/Base/ContentImage.php @@ -290,7 +290,7 @@ abstract class ContentImage implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ContentImageI18n.php b/core/lib/Thelia/Model/Base/ContentImageI18n.php index d655dec53..54016f0df 100644 --- a/core/lib/Thelia/Model/Base/ContentImageI18n.php +++ b/core/lib/Thelia/Model/Base/ContentImageI18n.php @@ -272,7 +272,7 @@ abstract class ContentImageI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ContentQuery.php b/core/lib/Thelia/Model/Base/ContentQuery.php index 2cbbe109b..0dc2f57a4 100644 --- a/core/lib/Thelia/Model/Base/ContentQuery.php +++ b/core/lib/Thelia/Model/Base/ContentQuery.php @@ -44,14 +44,6 @@ use Thelia\Model\Map\ContentTableMap; * @method ChildContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildContentQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation - * @method ChildContentQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation - * @method ChildContentQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation - * - * @method ChildContentQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation - * @method ChildContentQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation - * @method ChildContentQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation - * * @method ChildContentQuery leftJoinContentFolder($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentFolder relation * @method ChildContentQuery rightJoinContentFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentFolder relation * @method ChildContentQuery innerJoinContentFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentFolder relation @@ -64,6 +56,14 @@ use Thelia\Model\Map\ContentTableMap; * @method ChildContentQuery rightJoinContentDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentDocument relation * @method ChildContentQuery innerJoinContentDocument($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentDocument relation * + * @method ChildContentQuery leftJoinProductAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductAssociatedContent relation + * @method ChildContentQuery rightJoinProductAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductAssociatedContent relation + * @method ChildContentQuery innerJoinProductAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductAssociatedContent relation + * + * @method ChildContentQuery leftJoinCategoryAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryAssociatedContent relation + * @method ChildContentQuery rightJoinCategoryAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryAssociatedContent relation + * @method ChildContentQuery innerJoinCategoryAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryAssociatedContent relation + * * @method ChildContentQuery leftJoinContentI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentI18n relation * @method ChildContentQuery rightJoinContentI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentI18n relation * @method ChildContentQuery innerJoinContentI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentI18n relation @@ -598,152 +598,6 @@ abstract class ContentQuery extends ModelCriteria return $this->addUsingAlias(ContentTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison); } - /** - * Filter the query by a related \Thelia\Model\ContentAssoc object - * - * @param \Thelia\Model\ContentAssoc|ObjectCollection $contentAssoc the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildContentQuery The current query, for fluid interface - */ - public function filterByContentAssoc($contentAssoc, $comparison = null) - { - if ($contentAssoc instanceof \Thelia\Model\ContentAssoc) { - return $this - ->addUsingAlias(ContentTableMap::ID, $contentAssoc->getContentId(), $comparison); - } elseif ($contentAssoc instanceof ObjectCollection) { - return $this - ->useContentAssocQuery() - ->filterByPrimaryKeys($contentAssoc->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByContentAssoc() only accepts arguments of type \Thelia\Model\ContentAssoc or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the ContentAssoc relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildContentQuery The current query, for fluid interface - */ - public function joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ContentAssoc'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'ContentAssoc'); - } - - return $this; - } - - /** - * Use the ContentAssoc relation ContentAssoc object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ContentAssocQuery A secondary query class using the current class as primary query - */ - public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinContentAssoc($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery'); - } - - /** - * Filter the query by a related \Thelia\Model\Rewriting object - * - * @param \Thelia\Model\Rewriting|ObjectCollection $rewriting the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildContentQuery The current query, for fluid interface - */ - public function filterByRewriting($rewriting, $comparison = null) - { - if ($rewriting instanceof \Thelia\Model\Rewriting) { - return $this - ->addUsingAlias(ContentTableMap::ID, $rewriting->getContentId(), $comparison); - } elseif ($rewriting instanceof ObjectCollection) { - return $this - ->useRewritingQuery() - ->filterByPrimaryKeys($rewriting->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByRewriting() only accepts arguments of type \Thelia\Model\Rewriting or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Rewriting relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildContentQuery The current query, for fluid interface - */ - public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Rewriting'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Rewriting'); - } - - return $this; - } - - /** - * Use the Rewriting relation Rewriting object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\RewritingQuery A secondary query class using the current class as primary query - */ - public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinRewriting($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery'); - } - /** * Filter the query by a related \Thelia\Model\ContentFolder object * @@ -963,6 +817,152 @@ abstract class ContentQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'ContentDocument', '\Thelia\Model\ContentDocumentQuery'); } + /** + * Filter the query by a related \Thelia\Model\ProductAssociatedContent object + * + * @param \Thelia\Model\ProductAssociatedContent|ObjectCollection $productAssociatedContent the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildContentQuery The current query, for fluid interface + */ + public function filterByProductAssociatedContent($productAssociatedContent, $comparison = null) + { + if ($productAssociatedContent instanceof \Thelia\Model\ProductAssociatedContent) { + return $this + ->addUsingAlias(ContentTableMap::ID, $productAssociatedContent->getContentId(), $comparison); + } elseif ($productAssociatedContent instanceof ObjectCollection) { + return $this + ->useProductAssociatedContentQuery() + ->filterByPrimaryKeys($productAssociatedContent->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByProductAssociatedContent() only accepts arguments of type \Thelia\Model\ProductAssociatedContent or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the ProductAssociatedContent relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildContentQuery The current query, for fluid interface + */ + public function joinProductAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('ProductAssociatedContent'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'ProductAssociatedContent'); + } + + return $this; + } + + /** + * Use the ProductAssociatedContent relation ProductAssociatedContent object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\ProductAssociatedContentQuery A secondary query class using the current class as primary query + */ + public function useProductAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinProductAssociatedContent($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ProductAssociatedContent', '\Thelia\Model\ProductAssociatedContentQuery'); + } + + /** + * Filter the query by a related \Thelia\Model\CategoryAssociatedContent object + * + * @param \Thelia\Model\CategoryAssociatedContent|ObjectCollection $categoryAssociatedContent the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildContentQuery The current query, for fluid interface + */ + public function filterByCategoryAssociatedContent($categoryAssociatedContent, $comparison = null) + { + if ($categoryAssociatedContent instanceof \Thelia\Model\CategoryAssociatedContent) { + return $this + ->addUsingAlias(ContentTableMap::ID, $categoryAssociatedContent->getContentId(), $comparison); + } elseif ($categoryAssociatedContent instanceof ObjectCollection) { + return $this + ->useCategoryAssociatedContentQuery() + ->filterByPrimaryKeys($categoryAssociatedContent->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByCategoryAssociatedContent() only accepts arguments of type \Thelia\Model\CategoryAssociatedContent or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the CategoryAssociatedContent relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildContentQuery The current query, for fluid interface + */ + public function joinCategoryAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CategoryAssociatedContent'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CategoryAssociatedContent'); + } + + return $this; + } + + /** + * Use the CategoryAssociatedContent relation CategoryAssociatedContent object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\CategoryAssociatedContentQuery A secondary query class using the current class as primary query + */ + public function useCategoryAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCategoryAssociatedContent($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CategoryAssociatedContent', '\Thelia\Model\CategoryAssociatedContentQuery'); + } + /** * Filter the query by a related \Thelia\Model\ContentI18n object * diff --git a/core/lib/Thelia/Model/Base/ContentVersion.php b/core/lib/Thelia/Model/Base/ContentVersion.php index ca9189608..ef2897030 100644 --- a/core/lib/Thelia/Model/Base/ContentVersion.php +++ b/core/lib/Thelia/Model/Base/ContentVersion.php @@ -286,7 +286,7 @@ abstract class ContentVersion implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Country.php b/core/lib/Thelia/Model/Base/Country.php index 704375de2..90fd48880 100644 --- a/core/lib/Thelia/Model/Base/Country.php +++ b/core/lib/Thelia/Model/Base/Country.php @@ -324,7 +324,7 @@ abstract class Country implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -1631,7 +1631,10 @@ abstract class Country implements ActiveRecordInterface $taxRuleCountriesToDelete = $this->getTaxRuleCountries(new Criteria(), $con)->diff($taxRuleCountries); - $this->taxRuleCountriesScheduledForDeletion = $taxRuleCountriesToDelete; + //since at least one column in the foreign key is at the same time a PK + //we can not just set a PK to NULL in the lines below. We have to store + //a backup of all values, so we are able to manipulate these items based on the onDelete value later. + $this->taxRuleCountriesScheduledForDeletion = clone $taxRuleCountriesToDelete; foreach ($taxRuleCountriesToDelete as $taxRuleCountryRemoved) { $taxRuleCountryRemoved->setCountry(null); @@ -1724,7 +1727,7 @@ abstract class Country implements ActiveRecordInterface $this->taxRuleCountriesScheduledForDeletion = clone $this->collTaxRuleCountries; $this->taxRuleCountriesScheduledForDeletion->clear(); } - $this->taxRuleCountriesScheduledForDeletion[]= $taxRuleCountry; + $this->taxRuleCountriesScheduledForDeletion[]= clone $taxRuleCountry; $taxRuleCountry->setCountry(null); } diff --git a/core/lib/Thelia/Model/Base/CountryI18n.php b/core/lib/Thelia/Model/Base/CountryI18n.php index be63955ca..3e3e314cb 100644 --- a/core/lib/Thelia/Model/Base/CountryI18n.php +++ b/core/lib/Thelia/Model/Base/CountryI18n.php @@ -272,7 +272,7 @@ abstract class CountryI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CountryQuery.php b/core/lib/Thelia/Model/Base/CountryQuery.php index 6c3a1c950..1e565e9c0 100644 --- a/core/lib/Thelia/Model/Base/CountryQuery.php +++ b/core/lib/Thelia/Model/Base/CountryQuery.php @@ -616,7 +616,7 @@ abstract class CountryQuery extends ModelCriteria * * @return ChildCountryQuery The current query, for fluid interface */ - public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('TaxRuleCountry'); @@ -651,7 +651,7 @@ abstract class CountryQuery extends ModelCriteria * * @return \Thelia\Model\TaxRuleCountryQuery A secondary query class using the current class as primary query */ - public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinTaxRuleCountry($relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/Coupon.php b/core/lib/Thelia/Model/Base/Coupon.php index 2c3dae5c9..4c5dcd917 100644 --- a/core/lib/Thelia/Model/Base/Coupon.php +++ b/core/lib/Thelia/Model/Base/Coupon.php @@ -18,10 +18,13 @@ use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; use Thelia\Model\Coupon as ChildCoupon; +use Thelia\Model\CouponI18n as ChildCouponI18n; +use Thelia\Model\CouponI18nQuery as ChildCouponI18nQuery; use Thelia\Model\CouponQuery as ChildCouponQuery; -use Thelia\Model\CouponRule as ChildCouponRule; -use Thelia\Model\CouponRuleQuery as ChildCouponRuleQuery; +use Thelia\Model\CouponVersion as ChildCouponVersion; +use Thelia\Model\CouponVersionQuery as ChildCouponVersionQuery; use Thelia\Model\Map\CouponTableMap; +use Thelia\Model\Map\CouponVersionTableMap; abstract class Coupon implements ActiveRecordInterface { @@ -70,40 +73,64 @@ abstract class Coupon implements ActiveRecordInterface protected $code; /** - * The value for the action field. + * The value for the type field. * @var string */ - protected $action; + protected $type; /** - * The value for the value field. + * The value for the amount field. * @var double */ - protected $value; + protected $amount; /** - * The value for the used field. + * The value for the is_used field. * @var int */ - protected $used; + protected $is_used; /** - * The value for the available_since field. - * @var string - */ - protected $available_since; - - /** - * The value for the date_limit field. - * @var string - */ - protected $date_limit; - - /** - * The value for the activate field. + * The value for the is_enabled field. * @var int */ - protected $activate; + protected $is_enabled; + + /** + * The value for the expiration_date field. + * @var string + */ + protected $expiration_date; + + /** + * The value for the serialized_rules field. + * @var string + */ + protected $serialized_rules; + + /** + * The value for the is_cumulative field. + * @var int + */ + protected $is_cumulative; + + /** + * The value for the is_removing_postage field. + * @var int + */ + protected $is_removing_postage; + + /** + * The value for the max_usage field. + * @var int + */ + protected $max_usage; + + /** + * The value for the is_available_on_special_offers field. + * @var boolean + */ + protected $is_available_on_special_offers; /** * The value for the created_at field. @@ -118,10 +145,23 @@ abstract class Coupon implements ActiveRecordInterface protected $updated_at; /** - * @var ObjectCollection|ChildCouponRule[] Collection to store aggregation of ChildCouponRule objects. + * The value for the version field. + * Note: this column has a database default value of: 0 + * @var int */ - protected $collCouponRules; - protected $collCouponRulesPartial; + protected $version; + + /** + * @var ObjectCollection|ChildCouponI18n[] Collection to store aggregation of ChildCouponI18n objects. + */ + protected $collCouponI18ns; + protected $collCouponI18nsPartial; + + /** + * @var ObjectCollection|ChildCouponVersion[] Collection to store aggregation of ChildCouponVersion objects. + */ + protected $collCouponVersions; + protected $collCouponVersionsPartial; /** * Flag to prevent endless save loop, if this object is referenced @@ -131,17 +171,58 @@ abstract class Coupon implements ActiveRecordInterface */ protected $alreadyInSave = false; + // i18n behavior + + /** + * Current locale + * @var string + */ + protected $currentLocale = 'en_US'; + + /** + * Current translation objects + * @var array[ChildCouponI18n] + */ + protected $currentTranslations; + + // versionable behavior + + + /** + * @var bool + */ + protected $enforceVersion = false; + /** * An array of objects scheduled for deletion. * @var ObjectCollection */ - protected $couponRulesScheduledForDeletion = null; + protected $couponI18nsScheduledForDeletion = null; + + /** + * An array of objects scheduled for deletion. + * @var ObjectCollection + */ + protected $couponVersionsScheduledForDeletion = null; + + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + $this->version = 0; + } /** * Initializes internal state of Thelia\Model\Base\Coupon object. + * @see applyDefaults() */ public function __construct() { + $this->applyDefaultValues(); } /** @@ -293,7 +374,7 @@ abstract class Coupon implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -414,40 +495,51 @@ abstract class Coupon implements ActiveRecordInterface } /** - * Get the [action] column value. + * Get the [type] column value. * * @return string */ - public function getAction() + public function getType() { - return $this->action; + return $this->type; } /** - * Get the [value] column value. + * Get the [amount] column value. * * @return double */ - public function getValue() + public function getAmount() { - return $this->value; + return $this->amount; } /** - * Get the [used] column value. + * Get the [is_used] column value. * * @return int */ - public function getUsed() + public function getIsUsed() { - return $this->used; + return $this->is_used; } /** - * Get the [optionally formatted] temporal [available_since] column value. + * Get the [is_enabled] column value. + * + * @return int + */ + public function getIsEnabled() + { + + return $this->is_enabled; + } + + /** + * Get the [optionally formatted] temporal [expiration_date] column value. * * * @param string $format The date/time format string (either date()-style or strftime()-style). @@ -457,44 +549,68 @@ abstract class Coupon implements ActiveRecordInterface * * @throws PropelException - if unable to parse/validate the date/time value. */ - public function getAvailableSince($format = NULL) + public function getExpirationDate($format = NULL) { if ($format === null) { - return $this->available_since; + return $this->expiration_date; } else { - return $this->available_since !== null ? $this->available_since->format($format) : null; + return $this->expiration_date !== null ? $this->expiration_date->format($format) : null; } } /** - * Get the [optionally formatted] temporal [date_limit] column value. + * Get the [serialized_rules] column value. * - * - * @param string $format The date/time format string (either date()-style or strftime()-style). - * If format is NULL, then the raw \DateTime object will be returned. - * - * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 - * - * @throws PropelException - if unable to parse/validate the date/time value. + * @return string */ - public function getDateLimit($format = NULL) + public function getSerializedRules() { - if ($format === null) { - return $this->date_limit; - } else { - return $this->date_limit !== null ? $this->date_limit->format($format) : null; - } + + return $this->serialized_rules; } /** - * Get the [activate] column value. + * Get the [is_cumulative] column value. * * @return int */ - public function getActivate() + public function getIsCumulative() { - return $this->activate; + return $this->is_cumulative; + } + + /** + * Get the [is_removing_postage] column value. + * + * @return int + */ + public function getIsRemovingPostage() + { + + return $this->is_removing_postage; + } + + /** + * Get the [max_usage] column value. + * + * @return int + */ + public function getMaxUsage() + { + + return $this->max_usage; + } + + /** + * Get the [is_available_on_special_offers] column value. + * + * @return boolean + */ + public function getIsAvailableOnSpecialOffers() + { + + return $this->is_available_on_special_offers; } /** @@ -537,6 +653,17 @@ abstract class Coupon implements ActiveRecordInterface } } + /** + * Get the [version] column value. + * + * @return int + */ + public function getVersion() + { + + return $this->version; + } + /** * Set the value of [id] column. * @@ -580,130 +707,222 @@ abstract class Coupon implements ActiveRecordInterface } // setCode() /** - * Set the value of [action] column. + * Set the value of [type] column. * * @param string $v new value * @return \Thelia\Model\Coupon The current object (for fluent API support) */ - public function setAction($v) + public function setType($v) { if ($v !== null) { $v = (string) $v; } - if ($this->action !== $v) { - $this->action = $v; - $this->modifiedColumns[] = CouponTableMap::ACTION; + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = CouponTableMap::TYPE; } return $this; - } // setAction() + } // setType() /** - * Set the value of [value] column. + * Set the value of [amount] column. * * @param double $v new value * @return \Thelia\Model\Coupon The current object (for fluent API support) */ - public function setValue($v) + public function setAmount($v) { if ($v !== null) { $v = (double) $v; } - if ($this->value !== $v) { - $this->value = $v; - $this->modifiedColumns[] = CouponTableMap::VALUE; + if ($this->amount !== $v) { + $this->amount = $v; + $this->modifiedColumns[] = CouponTableMap::AMOUNT; } return $this; - } // setValue() + } // setAmount() /** - * Set the value of [used] column. + * Set the value of [is_used] column. * * @param int $v new value * @return \Thelia\Model\Coupon The current object (for fluent API support) */ - public function setUsed($v) + public function setIsUsed($v) { if ($v !== null) { $v = (int) $v; } - if ($this->used !== $v) { - $this->used = $v; - $this->modifiedColumns[] = CouponTableMap::USED; + if ($this->is_used !== $v) { + $this->is_used = $v; + $this->modifiedColumns[] = CouponTableMap::IS_USED; } return $this; - } // setUsed() + } // setIsUsed() /** - * Sets the value of [available_since] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or \DateTime value. - * Empty strings are treated as NULL. - * @return \Thelia\Model\Coupon The current object (for fluent API support) - */ - public function setAvailableSince($v) - { - $dt = PropelDateTime::newInstance($v, null, '\DateTime'); - if ($this->available_since !== null || $dt !== null) { - if ($dt !== $this->available_since) { - $this->available_since = $dt; - $this->modifiedColumns[] = CouponTableMap::AVAILABLE_SINCE; - } - } // if either are not null - - - return $this; - } // setAvailableSince() - - /** - * Sets the value of [date_limit] column to a normalized version of the date/time value specified. - * - * @param mixed $v string, integer (timestamp), or \DateTime value. - * Empty strings are treated as NULL. - * @return \Thelia\Model\Coupon The current object (for fluent API support) - */ - public function setDateLimit($v) - { - $dt = PropelDateTime::newInstance($v, null, '\DateTime'); - if ($this->date_limit !== null || $dt !== null) { - if ($dt !== $this->date_limit) { - $this->date_limit = $dt; - $this->modifiedColumns[] = CouponTableMap::DATE_LIMIT; - } - } // if either are not null - - - return $this; - } // setDateLimit() - - /** - * Set the value of [activate] column. + * Set the value of [is_enabled] column. * * @param int $v new value * @return \Thelia\Model\Coupon The current object (for fluent API support) */ - public function setActivate($v) + public function setIsEnabled($v) { if ($v !== null) { $v = (int) $v; } - if ($this->activate !== $v) { - $this->activate = $v; - $this->modifiedColumns[] = CouponTableMap::ACTIVATE; + if ($this->is_enabled !== $v) { + $this->is_enabled = $v; + $this->modifiedColumns[] = CouponTableMap::IS_ENABLED; } return $this; - } // setActivate() + } // setIsEnabled() + + /** + * Sets the value of [expiration_date] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or \DateTime value. + * Empty strings are treated as NULL. + * @return \Thelia\Model\Coupon The current object (for fluent API support) + */ + public function setExpirationDate($v) + { + $dt = PropelDateTime::newInstance($v, null, '\DateTime'); + if ($this->expiration_date !== null || $dt !== null) { + if ($dt !== $this->expiration_date) { + $this->expiration_date = $dt; + $this->modifiedColumns[] = CouponTableMap::EXPIRATION_DATE; + } + } // if either are not null + + + return $this; + } // setExpirationDate() + + /** + * Set the value of [serialized_rules] column. + * + * @param string $v new value + * @return \Thelia\Model\Coupon The current object (for fluent API support) + */ + public function setSerializedRules($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->serialized_rules !== $v) { + $this->serialized_rules = $v; + $this->modifiedColumns[] = CouponTableMap::SERIALIZED_RULES; + } + + + return $this; + } // setSerializedRules() + + /** + * Set the value of [is_cumulative] column. + * + * @param int $v new value + * @return \Thelia\Model\Coupon The current object (for fluent API support) + */ + public function setIsCumulative($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->is_cumulative !== $v) { + $this->is_cumulative = $v; + $this->modifiedColumns[] = CouponTableMap::IS_CUMULATIVE; + } + + + return $this; + } // setIsCumulative() + + /** + * Set the value of [is_removing_postage] column. + * + * @param int $v new value + * @return \Thelia\Model\Coupon The current object (for fluent API support) + */ + public function setIsRemovingPostage($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->is_removing_postage !== $v) { + $this->is_removing_postage = $v; + $this->modifiedColumns[] = CouponTableMap::IS_REMOVING_POSTAGE; + } + + + return $this; + } // setIsRemovingPostage() + + /** + * Set the value of [max_usage] column. + * + * @param int $v new value + * @return \Thelia\Model\Coupon The current object (for fluent API support) + */ + public function setMaxUsage($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->max_usage !== $v) { + $this->max_usage = $v; + $this->modifiedColumns[] = CouponTableMap::MAX_USAGE; + } + + + return $this; + } // setMaxUsage() + + /** + * Sets the value of the [is_available_on_special_offers] column. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * + * @param boolean|integer|string $v The new value + * @return \Thelia\Model\Coupon The current object (for fluent API support) + */ + public function setIsAvailableOnSpecialOffers($v) + { + if ($v !== null) { + if (is_string($v)) { + $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } else { + $v = (boolean) $v; + } + } + + if ($this->is_available_on_special_offers !== $v) { + $this->is_available_on_special_offers = $v; + $this->modifiedColumns[] = CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS; + } + + + return $this; + } // setIsAvailableOnSpecialOffers() /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. @@ -747,6 +966,27 @@ abstract class Coupon implements ActiveRecordInterface return $this; } // setUpdatedAt() + /** + * Set the value of [version] column. + * + * @param int $v new value + * @return \Thelia\Model\Coupon The current object (for fluent API support) + */ + public function setVersion($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->version !== $v) { + $this->version = $v; + $this->modifiedColumns[] = CouponTableMap::VERSION; + } + + + return $this; + } // setVersion() + /** * Indicates whether the columns in this object are only set to default values. * @@ -757,6 +997,10 @@ abstract class Coupon implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { + if ($this->version !== 0) { + return false; + } + // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -790,41 +1034,53 @@ abstract class Coupon implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; $this->code = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponTableMap::translateFieldName('Action', TableMap::TYPE_PHPNAME, $indexType)]; - $this->action = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)]; + $this->type = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)]; - $this->value = (null !== $col) ? (double) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; + $this->amount = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponTableMap::translateFieldName('Used', TableMap::TYPE_PHPNAME, $indexType)]; - $this->used = (null !== $col) ? (int) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_used = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponTableMap::translateFieldName('AvailableSince', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_enabled = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } - $this->available_since = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + $this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponTableMap::translateFieldName('DateLimit', TableMap::TYPE_PHPNAME, $indexType)]; - if ($col === '0000-00-00 00:00:00') { - $col = null; - } - $this->date_limit = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)]; + $this->serialized_rules = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponTableMap::translateFieldName('Activate', TableMap::TYPE_PHPNAME, $indexType)]; - $this->activate = (null !== $col) ? (int) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_cumulative = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_removing_postage = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->max_usage = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_available_on_special_offers = (null !== $col) ? (boolean) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $this->version = (null !== $col) ? (int) $col : null; $this->resetModified(); $this->setNew(false); @@ -833,7 +1089,7 @@ abstract class Coupon implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 10; // 10 = CouponTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 15; // 15 = CouponTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Coupon object", 0, $e); @@ -894,7 +1150,9 @@ abstract class Coupon implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->collCouponRules = null; + $this->collCouponI18ns = null; + + $this->collCouponVersions = null; } // if (deep) } @@ -964,6 +1222,11 @@ abstract class Coupon implements ActiveRecordInterface $isInsert = $this->isNew(); try { $ret = $this->preSave($con); + // versionable behavior + if ($this->isVersioningNecessary()) { + $this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1); + $createVersion = true; // for postSave hook + } if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior @@ -988,6 +1251,10 @@ abstract class Coupon implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); + // versionable behavior + if (isset($createVersion)) { + $this->addVersion($con); + } CouponTableMap::addInstanceToPool($this); } else { $affectedRows = 0; @@ -1029,17 +1296,34 @@ abstract class Coupon implements ActiveRecordInterface $this->resetModified(); } - if ($this->couponRulesScheduledForDeletion !== null) { - if (!$this->couponRulesScheduledForDeletion->isEmpty()) { - \Thelia\Model\CouponRuleQuery::create() - ->filterByPrimaryKeys($this->couponRulesScheduledForDeletion->getPrimaryKeys(false)) + if ($this->couponI18nsScheduledForDeletion !== null) { + if (!$this->couponI18nsScheduledForDeletion->isEmpty()) { + \Thelia\Model\CouponI18nQuery::create() + ->filterByPrimaryKeys($this->couponI18nsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); - $this->couponRulesScheduledForDeletion = null; + $this->couponI18nsScheduledForDeletion = null; } } - if ($this->collCouponRules !== null) { - foreach ($this->collCouponRules as $referrerFK) { + if ($this->collCouponI18ns !== null) { + foreach ($this->collCouponI18ns as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->couponVersionsScheduledForDeletion !== null) { + if (!$this->couponVersionsScheduledForDeletion->isEmpty()) { + \Thelia\Model\CouponVersionQuery::create() + ->filterByPrimaryKeys($this->couponVersionsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->couponVersionsScheduledForDeletion = null; + } + } + + if ($this->collCouponVersions !== null) { + foreach ($this->collCouponVersions as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } @@ -1078,23 +1362,35 @@ abstract class Coupon implements ActiveRecordInterface if ($this->isColumnModified(CouponTableMap::CODE)) { $modifiedColumns[':p' . $index++] = 'CODE'; } - if ($this->isColumnModified(CouponTableMap::ACTION)) { - $modifiedColumns[':p' . $index++] = 'ACTION'; + if ($this->isColumnModified(CouponTableMap::TYPE)) { + $modifiedColumns[':p' . $index++] = 'TYPE'; } - if ($this->isColumnModified(CouponTableMap::VALUE)) { - $modifiedColumns[':p' . $index++] = 'VALUE'; + if ($this->isColumnModified(CouponTableMap::AMOUNT)) { + $modifiedColumns[':p' . $index++] = 'AMOUNT'; } - if ($this->isColumnModified(CouponTableMap::USED)) { - $modifiedColumns[':p' . $index++] = 'USED'; + if ($this->isColumnModified(CouponTableMap::IS_USED)) { + $modifiedColumns[':p' . $index++] = 'IS_USED'; } - if ($this->isColumnModified(CouponTableMap::AVAILABLE_SINCE)) { - $modifiedColumns[':p' . $index++] = 'AVAILABLE_SINCE'; + if ($this->isColumnModified(CouponTableMap::IS_ENABLED)) { + $modifiedColumns[':p' . $index++] = 'IS_ENABLED'; } - if ($this->isColumnModified(CouponTableMap::DATE_LIMIT)) { - $modifiedColumns[':p' . $index++] = 'DATE_LIMIT'; + if ($this->isColumnModified(CouponTableMap::EXPIRATION_DATE)) { + $modifiedColumns[':p' . $index++] = 'EXPIRATION_DATE'; } - if ($this->isColumnModified(CouponTableMap::ACTIVATE)) { - $modifiedColumns[':p' . $index++] = 'ACTIVATE'; + if ($this->isColumnModified(CouponTableMap::SERIALIZED_RULES)) { + $modifiedColumns[':p' . $index++] = 'SERIALIZED_RULES'; + } + if ($this->isColumnModified(CouponTableMap::IS_CUMULATIVE)) { + $modifiedColumns[':p' . $index++] = 'IS_CUMULATIVE'; + } + if ($this->isColumnModified(CouponTableMap::IS_REMOVING_POSTAGE)) { + $modifiedColumns[':p' . $index++] = 'IS_REMOVING_POSTAGE'; + } + if ($this->isColumnModified(CouponTableMap::MAX_USAGE)) { + $modifiedColumns[':p' . $index++] = 'MAX_USAGE'; + } + if ($this->isColumnModified(CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) { + $modifiedColumns[':p' . $index++] = 'IS_AVAILABLE_ON_SPECIAL_OFFERS'; } if ($this->isColumnModified(CouponTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; @@ -1102,6 +1398,9 @@ abstract class Coupon implements ActiveRecordInterface if ($this->isColumnModified(CouponTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; } + if ($this->isColumnModified(CouponTableMap::VERSION)) { + $modifiedColumns[':p' . $index++] = 'VERSION'; + } $sql = sprintf( 'INSERT INTO coupon (%s) VALUES (%s)', @@ -1119,23 +1418,35 @@ abstract class Coupon implements ActiveRecordInterface case 'CODE': $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); break; - case 'ACTION': - $stmt->bindValue($identifier, $this->action, PDO::PARAM_STR); + case 'TYPE': + $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); break; - case 'VALUE': - $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR); + case 'AMOUNT': + $stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR); break; - case 'USED': - $stmt->bindValue($identifier, $this->used, PDO::PARAM_INT); + case 'IS_USED': + $stmt->bindValue($identifier, $this->is_used, PDO::PARAM_INT); break; - case 'AVAILABLE_SINCE': - $stmt->bindValue($identifier, $this->available_since ? $this->available_since->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); + case 'IS_ENABLED': + $stmt->bindValue($identifier, $this->is_enabled, PDO::PARAM_INT); break; - case 'DATE_LIMIT': - $stmt->bindValue($identifier, $this->date_limit ? $this->date_limit->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); + case 'EXPIRATION_DATE': + $stmt->bindValue($identifier, $this->expiration_date ? $this->expiration_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; - case 'ACTIVATE': - $stmt->bindValue($identifier, $this->activate, PDO::PARAM_INT); + case 'SERIALIZED_RULES': + $stmt->bindValue($identifier, $this->serialized_rules, PDO::PARAM_STR); + break; + case 'IS_CUMULATIVE': + $stmt->bindValue($identifier, $this->is_cumulative, PDO::PARAM_INT); + break; + case 'IS_REMOVING_POSTAGE': + $stmt->bindValue($identifier, $this->is_removing_postage, PDO::PARAM_INT); + break; + case 'MAX_USAGE': + $stmt->bindValue($identifier, $this->max_usage, PDO::PARAM_INT); + break; + case 'IS_AVAILABLE_ON_SPECIAL_OFFERS': + $stmt->bindValue($identifier, (int) $this->is_available_on_special_offers, PDO::PARAM_INT); break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); @@ -1143,6 +1454,9 @@ abstract class Coupon implements ActiveRecordInterface case 'UPDATED_AT': $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; + case 'VERSION': + $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); + break; } } $stmt->execute(); @@ -1212,29 +1526,44 @@ abstract class Coupon implements ActiveRecordInterface return $this->getCode(); break; case 2: - return $this->getAction(); + return $this->getType(); break; case 3: - return $this->getValue(); + return $this->getAmount(); break; case 4: - return $this->getUsed(); + return $this->getIsUsed(); break; case 5: - return $this->getAvailableSince(); + return $this->getIsEnabled(); break; case 6: - return $this->getDateLimit(); + return $this->getExpirationDate(); break; case 7: - return $this->getActivate(); + return $this->getSerializedRules(); break; case 8: - return $this->getCreatedAt(); + return $this->getIsCumulative(); break; case 9: + return $this->getIsRemovingPostage(); + break; + case 10: + return $this->getMaxUsage(); + break; + case 11: + return $this->getIsAvailableOnSpecialOffers(); + break; + case 12: + return $this->getCreatedAt(); + break; + case 13: return $this->getUpdatedAt(); break; + case 14: + return $this->getVersion(); + break; default: return null; break; @@ -1266,14 +1595,19 @@ abstract class Coupon implements ActiveRecordInterface $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getCode(), - $keys[2] => $this->getAction(), - $keys[3] => $this->getValue(), - $keys[4] => $this->getUsed(), - $keys[5] => $this->getAvailableSince(), - $keys[6] => $this->getDateLimit(), - $keys[7] => $this->getActivate(), - $keys[8] => $this->getCreatedAt(), - $keys[9] => $this->getUpdatedAt(), + $keys[2] => $this->getType(), + $keys[3] => $this->getAmount(), + $keys[4] => $this->getIsUsed(), + $keys[5] => $this->getIsEnabled(), + $keys[6] => $this->getExpirationDate(), + $keys[7] => $this->getSerializedRules(), + $keys[8] => $this->getIsCumulative(), + $keys[9] => $this->getIsRemovingPostage(), + $keys[10] => $this->getMaxUsage(), + $keys[11] => $this->getIsAvailableOnSpecialOffers(), + $keys[12] => $this->getCreatedAt(), + $keys[13] => $this->getUpdatedAt(), + $keys[14] => $this->getVersion(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1282,8 +1616,11 @@ abstract class Coupon implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->collCouponRules) { - $result['CouponRules'] = $this->collCouponRules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + if (null !== $this->collCouponI18ns) { + $result['CouponI18ns'] = $this->collCouponI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } + if (null !== $this->collCouponVersions) { + $result['CouponVersions'] = $this->collCouponVersions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } @@ -1326,29 +1663,44 @@ abstract class Coupon implements ActiveRecordInterface $this->setCode($value); break; case 2: - $this->setAction($value); + $this->setType($value); break; case 3: - $this->setValue($value); + $this->setAmount($value); break; case 4: - $this->setUsed($value); + $this->setIsUsed($value); break; case 5: - $this->setAvailableSince($value); + $this->setIsEnabled($value); break; case 6: - $this->setDateLimit($value); + $this->setExpirationDate($value); break; case 7: - $this->setActivate($value); + $this->setSerializedRules($value); break; case 8: - $this->setCreatedAt($value); + $this->setIsCumulative($value); break; case 9: + $this->setIsRemovingPostage($value); + break; + case 10: + $this->setMaxUsage($value); + break; + case 11: + $this->setIsAvailableOnSpecialOffers($value); + break; + case 12: + $this->setCreatedAt($value); + break; + case 13: $this->setUpdatedAt($value); break; + case 14: + $this->setVersion($value); + break; } // switch() } @@ -1375,14 +1727,19 @@ abstract class Coupon implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setAction($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setValue($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setUsed($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setAvailableSince($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setDateLimit($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setActivate($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setCreatedAt($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setUpdatedAt($arr[$keys[9]]); + if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setIsUsed($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setIsEnabled($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setExpirationDate($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setSerializedRules($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setIsCumulative($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setIsRemovingPostage($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setMaxUsage($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]); } /** @@ -1396,14 +1753,19 @@ abstract class Coupon implements ActiveRecordInterface if ($this->isColumnModified(CouponTableMap::ID)) $criteria->add(CouponTableMap::ID, $this->id); if ($this->isColumnModified(CouponTableMap::CODE)) $criteria->add(CouponTableMap::CODE, $this->code); - if ($this->isColumnModified(CouponTableMap::ACTION)) $criteria->add(CouponTableMap::ACTION, $this->action); - if ($this->isColumnModified(CouponTableMap::VALUE)) $criteria->add(CouponTableMap::VALUE, $this->value); - if ($this->isColumnModified(CouponTableMap::USED)) $criteria->add(CouponTableMap::USED, $this->used); - if ($this->isColumnModified(CouponTableMap::AVAILABLE_SINCE)) $criteria->add(CouponTableMap::AVAILABLE_SINCE, $this->available_since); - if ($this->isColumnModified(CouponTableMap::DATE_LIMIT)) $criteria->add(CouponTableMap::DATE_LIMIT, $this->date_limit); - if ($this->isColumnModified(CouponTableMap::ACTIVATE)) $criteria->add(CouponTableMap::ACTIVATE, $this->activate); + if ($this->isColumnModified(CouponTableMap::TYPE)) $criteria->add(CouponTableMap::TYPE, $this->type); + if ($this->isColumnModified(CouponTableMap::AMOUNT)) $criteria->add(CouponTableMap::AMOUNT, $this->amount); + if ($this->isColumnModified(CouponTableMap::IS_USED)) $criteria->add(CouponTableMap::IS_USED, $this->is_used); + if ($this->isColumnModified(CouponTableMap::IS_ENABLED)) $criteria->add(CouponTableMap::IS_ENABLED, $this->is_enabled); + if ($this->isColumnModified(CouponTableMap::EXPIRATION_DATE)) $criteria->add(CouponTableMap::EXPIRATION_DATE, $this->expiration_date); + if ($this->isColumnModified(CouponTableMap::SERIALIZED_RULES)) $criteria->add(CouponTableMap::SERIALIZED_RULES, $this->serialized_rules); + if ($this->isColumnModified(CouponTableMap::IS_CUMULATIVE)) $criteria->add(CouponTableMap::IS_CUMULATIVE, $this->is_cumulative); + if ($this->isColumnModified(CouponTableMap::IS_REMOVING_POSTAGE)) $criteria->add(CouponTableMap::IS_REMOVING_POSTAGE, $this->is_removing_postage); + if ($this->isColumnModified(CouponTableMap::MAX_USAGE)) $criteria->add(CouponTableMap::MAX_USAGE, $this->max_usage); + if ($this->isColumnModified(CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) $criteria->add(CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, $this->is_available_on_special_offers); if ($this->isColumnModified(CouponTableMap::CREATED_AT)) $criteria->add(CouponTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(CouponTableMap::UPDATED_AT)) $criteria->add(CouponTableMap::UPDATED_AT, $this->updated_at); + if ($this->isColumnModified(CouponTableMap::VERSION)) $criteria->add(CouponTableMap::VERSION, $this->version); return $criteria; } @@ -1468,23 +1830,34 @@ abstract class Coupon implements ActiveRecordInterface public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setCode($this->getCode()); - $copyObj->setAction($this->getAction()); - $copyObj->setValue($this->getValue()); - $copyObj->setUsed($this->getUsed()); - $copyObj->setAvailableSince($this->getAvailableSince()); - $copyObj->setDateLimit($this->getDateLimit()); - $copyObj->setActivate($this->getActivate()); + $copyObj->setType($this->getType()); + $copyObj->setAmount($this->getAmount()); + $copyObj->setIsUsed($this->getIsUsed()); + $copyObj->setIsEnabled($this->getIsEnabled()); + $copyObj->setExpirationDate($this->getExpirationDate()); + $copyObj->setSerializedRules($this->getSerializedRules()); + $copyObj->setIsCumulative($this->getIsCumulative()); + $copyObj->setIsRemovingPostage($this->getIsRemovingPostage()); + $copyObj->setMaxUsage($this->getMaxUsage()); + $copyObj->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); + $copyObj->setVersion($this->getVersion()); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getCouponRules() as $relObj) { + foreach ($this->getCouponI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCouponRule($relObj->copy($deepCopy)); + $copyObj->addCouponI18n($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCouponVersions() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCouponVersion($relObj->copy($deepCopy)); } } @@ -1529,37 +1902,40 @@ abstract class Coupon implements ActiveRecordInterface */ public function initRelation($relationName) { - if ('CouponRule' == $relationName) { - return $this->initCouponRules(); + if ('CouponI18n' == $relationName) { + return $this->initCouponI18ns(); + } + if ('CouponVersion' == $relationName) { + return $this->initCouponVersions(); } } /** - * Clears out the collCouponRules collection + * Clears out the collCouponI18ns collection * * This does not modify the database; however, it will remove any associated objects, causing * them to be refetched by subsequent calls to accessor method. * * @return void - * @see addCouponRules() + * @see addCouponI18ns() */ - public function clearCouponRules() + public function clearCouponI18ns() { - $this->collCouponRules = null; // important to set this to NULL since that means it is uninitialized + $this->collCouponI18ns = null; // important to set this to NULL since that means it is uninitialized } /** - * Reset is the collCouponRules collection loaded partially. + * Reset is the collCouponI18ns collection loaded partially. */ - public function resetPartialCouponRules($v = true) + public function resetPartialCouponI18ns($v = true) { - $this->collCouponRulesPartial = $v; + $this->collCouponI18nsPartial = $v; } /** - * Initializes the collCouponRules collection. + * Initializes the collCouponI18ns collection. * - * By default this just sets the collCouponRules collection to an empty array (like clearcollCouponRules()); + * By default this just sets the collCouponI18ns collection to an empty array (like clearcollCouponI18ns()); * however, you may wish to override this method in your stub class to provide setting appropriate * to your application -- for example, setting the initial array to the values stored in database. * @@ -1568,17 +1944,17 @@ abstract class Coupon implements ActiveRecordInterface * * @return void */ - public function initCouponRules($overrideExisting = true) + public function initCouponI18ns($overrideExisting = true) { - if (null !== $this->collCouponRules && !$overrideExisting) { + if (null !== $this->collCouponI18ns && !$overrideExisting) { return; } - $this->collCouponRules = new ObjectCollection(); - $this->collCouponRules->setModel('\Thelia\Model\CouponRule'); + $this->collCouponI18ns = new ObjectCollection(); + $this->collCouponI18ns->setModel('\Thelia\Model\CouponI18n'); } /** - * Gets an array of ChildCouponRule objects which contain a foreign key that references this object. + * Gets an array of ChildCouponI18n objects which contain a foreign key that references this object. * * If the $criteria is not null, it is used to always fetch the results from the database. * Otherwise the results are fetched from the database the first time, then cached. @@ -1588,109 +1964,112 @@ abstract class Coupon implements ActiveRecordInterface * * @param Criteria $criteria optional Criteria object to narrow the query * @param ConnectionInterface $con optional connection object - * @return Collection|ChildCouponRule[] List of ChildCouponRule objects + * @return Collection|ChildCouponI18n[] List of ChildCouponI18n objects * @throws PropelException */ - public function getCouponRules($criteria = null, ConnectionInterface $con = null) + public function getCouponI18ns($criteria = null, ConnectionInterface $con = null) { - $partial = $this->collCouponRulesPartial && !$this->isNew(); - if (null === $this->collCouponRules || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCouponRules) { + $partial = $this->collCouponI18nsPartial && !$this->isNew(); + if (null === $this->collCouponI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collCouponI18ns) { // return empty collection - $this->initCouponRules(); + $this->initCouponI18ns(); } else { - $collCouponRules = ChildCouponRuleQuery::create(null, $criteria) + $collCouponI18ns = ChildCouponI18nQuery::create(null, $criteria) ->filterByCoupon($this) ->find($con); if (null !== $criteria) { - if (false !== $this->collCouponRulesPartial && count($collCouponRules)) { - $this->initCouponRules(false); + if (false !== $this->collCouponI18nsPartial && count($collCouponI18ns)) { + $this->initCouponI18ns(false); - foreach ($collCouponRules as $obj) { - if (false == $this->collCouponRules->contains($obj)) { - $this->collCouponRules->append($obj); + foreach ($collCouponI18ns as $obj) { + if (false == $this->collCouponI18ns->contains($obj)) { + $this->collCouponI18ns->append($obj); } } - $this->collCouponRulesPartial = true; + $this->collCouponI18nsPartial = true; } - $collCouponRules->getInternalIterator()->rewind(); + $collCouponI18ns->getInternalIterator()->rewind(); - return $collCouponRules; + return $collCouponI18ns; } - if ($partial && $this->collCouponRules) { - foreach ($this->collCouponRules as $obj) { + if ($partial && $this->collCouponI18ns) { + foreach ($this->collCouponI18ns as $obj) { if ($obj->isNew()) { - $collCouponRules[] = $obj; + $collCouponI18ns[] = $obj; } } } - $this->collCouponRules = $collCouponRules; - $this->collCouponRulesPartial = false; + $this->collCouponI18ns = $collCouponI18ns; + $this->collCouponI18nsPartial = false; } } - return $this->collCouponRules; + return $this->collCouponI18ns; } /** - * Sets a collection of CouponRule objects related by a one-to-many relationship + * Sets a collection of CouponI18n objects related by a one-to-many relationship * to the current object. * It will also schedule objects for deletion based on a diff between old objects (aka persisted) * and new objects from the given Propel collection. * - * @param Collection $couponRules A Propel collection. + * @param Collection $couponI18ns A Propel collection. * @param ConnectionInterface $con Optional connection object * @return ChildCoupon The current object (for fluent API support) */ - public function setCouponRules(Collection $couponRules, ConnectionInterface $con = null) + public function setCouponI18ns(Collection $couponI18ns, ConnectionInterface $con = null) { - $couponRulesToDelete = $this->getCouponRules(new Criteria(), $con)->diff($couponRules); + $couponI18nsToDelete = $this->getCouponI18ns(new Criteria(), $con)->diff($couponI18ns); - $this->couponRulesScheduledForDeletion = $couponRulesToDelete; + //since at least one column in the foreign key is at the same time a PK + //we can not just set a PK to NULL in the lines below. We have to store + //a backup of all values, so we are able to manipulate these items based on the onDelete value later. + $this->couponI18nsScheduledForDeletion = clone $couponI18nsToDelete; - foreach ($couponRulesToDelete as $couponRuleRemoved) { - $couponRuleRemoved->setCoupon(null); + foreach ($couponI18nsToDelete as $couponI18nRemoved) { + $couponI18nRemoved->setCoupon(null); } - $this->collCouponRules = null; - foreach ($couponRules as $couponRule) { - $this->addCouponRule($couponRule); + $this->collCouponI18ns = null; + foreach ($couponI18ns as $couponI18n) { + $this->addCouponI18n($couponI18n); } - $this->collCouponRules = $couponRules; - $this->collCouponRulesPartial = false; + $this->collCouponI18ns = $couponI18ns; + $this->collCouponI18nsPartial = false; return $this; } /** - * Returns the number of related CouponRule objects. + * Returns the number of related CouponI18n objects. * * @param Criteria $criteria * @param boolean $distinct * @param ConnectionInterface $con - * @return int Count of related CouponRule objects. + * @return int Count of related CouponI18n objects. * @throws PropelException */ - public function countCouponRules(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countCouponI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { - $partial = $this->collCouponRulesPartial && !$this->isNew(); - if (null === $this->collCouponRules || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCouponRules) { + $partial = $this->collCouponI18nsPartial && !$this->isNew(); + if (null === $this->collCouponI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collCouponI18ns) { return 0; } if ($partial && !$criteria) { - return count($this->getCouponRules()); + return count($this->getCouponI18ns()); } - $query = ChildCouponRuleQuery::create(null, $criteria); + $query = ChildCouponI18nQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } @@ -1700,53 +2079,278 @@ abstract class Coupon implements ActiveRecordInterface ->count($con); } - return count($this->collCouponRules); + return count($this->collCouponI18ns); } /** - * Method called to associate a ChildCouponRule object to this object - * through the ChildCouponRule foreign key attribute. + * Method called to associate a ChildCouponI18n object to this object + * through the ChildCouponI18n foreign key attribute. * - * @param ChildCouponRule $l ChildCouponRule + * @param ChildCouponI18n $l ChildCouponI18n * @return \Thelia\Model\Coupon The current object (for fluent API support) */ - public function addCouponRule(ChildCouponRule $l) + public function addCouponI18n(ChildCouponI18n $l) { - if ($this->collCouponRules === null) { - $this->initCouponRules(); - $this->collCouponRulesPartial = true; + if ($l && $locale = $l->getLocale()) { + $this->setLocale($locale); + $this->currentTranslations[$locale] = $l; + } + if ($this->collCouponI18ns === null) { + $this->initCouponI18ns(); + $this->collCouponI18nsPartial = true; } - if (!in_array($l, $this->collCouponRules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddCouponRule($l); + if (!in_array($l, $this->collCouponI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddCouponI18n($l); } return $this; } /** - * @param CouponRule $couponRule The couponRule object to add. + * @param CouponI18n $couponI18n The couponI18n object to add. */ - protected function doAddCouponRule($couponRule) + protected function doAddCouponI18n($couponI18n) { - $this->collCouponRules[]= $couponRule; - $couponRule->setCoupon($this); + $this->collCouponI18ns[]= $couponI18n; + $couponI18n->setCoupon($this); } /** - * @param CouponRule $couponRule The couponRule object to remove. + * @param CouponI18n $couponI18n The couponI18n object to remove. * @return ChildCoupon The current object (for fluent API support) */ - public function removeCouponRule($couponRule) + public function removeCouponI18n($couponI18n) { - if ($this->getCouponRules()->contains($couponRule)) { - $this->collCouponRules->remove($this->collCouponRules->search($couponRule)); - if (null === $this->couponRulesScheduledForDeletion) { - $this->couponRulesScheduledForDeletion = clone $this->collCouponRules; - $this->couponRulesScheduledForDeletion->clear(); + if ($this->getCouponI18ns()->contains($couponI18n)) { + $this->collCouponI18ns->remove($this->collCouponI18ns->search($couponI18n)); + if (null === $this->couponI18nsScheduledForDeletion) { + $this->couponI18nsScheduledForDeletion = clone $this->collCouponI18ns; + $this->couponI18nsScheduledForDeletion->clear(); } - $this->couponRulesScheduledForDeletion[]= clone $couponRule; - $couponRule->setCoupon(null); + $this->couponI18nsScheduledForDeletion[]= clone $couponI18n; + $couponI18n->setCoupon(null); + } + + return $this; + } + + /** + * Clears out the collCouponVersions collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addCouponVersions() + */ + public function clearCouponVersions() + { + $this->collCouponVersions = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collCouponVersions collection loaded partially. + */ + public function resetPartialCouponVersions($v = true) + { + $this->collCouponVersionsPartial = $v; + } + + /** + * Initializes the collCouponVersions collection. + * + * By default this just sets the collCouponVersions collection to an empty array (like clearcollCouponVersions()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @param boolean $overrideExisting If set to true, the method call initializes + * the collection even if it is not empty + * + * @return void + */ + public function initCouponVersions($overrideExisting = true) + { + if (null !== $this->collCouponVersions && !$overrideExisting) { + return; + } + $this->collCouponVersions = new ObjectCollection(); + $this->collCouponVersions->setModel('\Thelia\Model\CouponVersion'); + } + + /** + * Gets an array of ChildCouponVersion objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this ChildCoupon is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @return Collection|ChildCouponVersion[] List of ChildCouponVersion objects + * @throws PropelException + */ + public function getCouponVersions($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collCouponVersionsPartial && !$this->isNew(); + if (null === $this->collCouponVersions || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collCouponVersions) { + // return empty collection + $this->initCouponVersions(); + } else { + $collCouponVersions = ChildCouponVersionQuery::create(null, $criteria) + ->filterByCoupon($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collCouponVersionsPartial && count($collCouponVersions)) { + $this->initCouponVersions(false); + + foreach ($collCouponVersions as $obj) { + if (false == $this->collCouponVersions->contains($obj)) { + $this->collCouponVersions->append($obj); + } + } + + $this->collCouponVersionsPartial = true; + } + + $collCouponVersions->getInternalIterator()->rewind(); + + return $collCouponVersions; + } + + if ($partial && $this->collCouponVersions) { + foreach ($this->collCouponVersions as $obj) { + if ($obj->isNew()) { + $collCouponVersions[] = $obj; + } + } + } + + $this->collCouponVersions = $collCouponVersions; + $this->collCouponVersionsPartial = false; + } + } + + return $this->collCouponVersions; + } + + /** + * Sets a collection of CouponVersion objects related by a one-to-many relationship + * to the current object. + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) + * and new objects from the given Propel collection. + * + * @param Collection $couponVersions A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildCoupon The current object (for fluent API support) + */ + public function setCouponVersions(Collection $couponVersions, ConnectionInterface $con = null) + { + $couponVersionsToDelete = $this->getCouponVersions(new Criteria(), $con)->diff($couponVersions); + + + //since at least one column in the foreign key is at the same time a PK + //we can not just set a PK to NULL in the lines below. We have to store + //a backup of all values, so we are able to manipulate these items based on the onDelete value later. + $this->couponVersionsScheduledForDeletion = clone $couponVersionsToDelete; + + foreach ($couponVersionsToDelete as $couponVersionRemoved) { + $couponVersionRemoved->setCoupon(null); + } + + $this->collCouponVersions = null; + foreach ($couponVersions as $couponVersion) { + $this->addCouponVersion($couponVersion); + } + + $this->collCouponVersions = $couponVersions; + $this->collCouponVersionsPartial = false; + + return $this; + } + + /** + * Returns the number of related CouponVersion objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related CouponVersion objects. + * @throws PropelException + */ + public function countCouponVersions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collCouponVersionsPartial && !$this->isNew(); + if (null === $this->collCouponVersions || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collCouponVersions) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getCouponVersions()); + } + + $query = ChildCouponVersionQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByCoupon($this) + ->count($con); + } + + return count($this->collCouponVersions); + } + + /** + * Method called to associate a ChildCouponVersion object to this object + * through the ChildCouponVersion foreign key attribute. + * + * @param ChildCouponVersion $l ChildCouponVersion + * @return \Thelia\Model\Coupon The current object (for fluent API support) + */ + public function addCouponVersion(ChildCouponVersion $l) + { + if ($this->collCouponVersions === null) { + $this->initCouponVersions(); + $this->collCouponVersionsPartial = true; + } + + if (!in_array($l, $this->collCouponVersions->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddCouponVersion($l); + } + + return $this; + } + + /** + * @param CouponVersion $couponVersion The couponVersion object to add. + */ + protected function doAddCouponVersion($couponVersion) + { + $this->collCouponVersions[]= $couponVersion; + $couponVersion->setCoupon($this); + } + + /** + * @param CouponVersion $couponVersion The couponVersion object to remove. + * @return ChildCoupon The current object (for fluent API support) + */ + public function removeCouponVersion($couponVersion) + { + if ($this->getCouponVersions()->contains($couponVersion)) { + $this->collCouponVersions->remove($this->collCouponVersions->search($couponVersion)); + if (null === $this->couponVersionsScheduledForDeletion) { + $this->couponVersionsScheduledForDeletion = clone $this->collCouponVersions; + $this->couponVersionsScheduledForDeletion->clear(); + } + $this->couponVersionsScheduledForDeletion[]= clone $couponVersion; + $couponVersion->setCoupon(null); } return $this; @@ -1759,16 +2363,22 @@ abstract class Coupon implements ActiveRecordInterface { $this->id = null; $this->code = null; - $this->action = null; - $this->value = null; - $this->used = null; - $this->available_since = null; - $this->date_limit = null; - $this->activate = null; + $this->type = null; + $this->amount = null; + $this->is_used = null; + $this->is_enabled = null; + $this->expiration_date = null; + $this->serialized_rules = null; + $this->is_cumulative = null; + $this->is_removing_postage = null; + $this->max_usage = null; + $this->is_available_on_special_offers = null; $this->created_at = null; $this->updated_at = null; + $this->version = null; $this->alreadyInSave = false; $this->clearAllReferences(); + $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); @@ -1786,17 +2396,30 @@ abstract class Coupon implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collCouponRules) { - foreach ($this->collCouponRules as $o) { + if ($this->collCouponI18ns) { + foreach ($this->collCouponI18ns as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCouponVersions) { + foreach ($this->collCouponVersions as $o) { $o->clearAllReferences($deep); } } } // if ($deep) - if ($this->collCouponRules instanceof Collection) { - $this->collCouponRules->clearIterator(); + // i18n behavior + $this->currentLocale = 'en_US'; + $this->currentTranslations = null; + + if ($this->collCouponI18ns instanceof Collection) { + $this->collCouponI18ns->clearIterator(); } - $this->collCouponRules = null; + $this->collCouponI18ns = null; + if ($this->collCouponVersions instanceof Collection) { + $this->collCouponVersions->clearIterator(); + } + $this->collCouponVersions = null; } /** @@ -1823,6 +2446,471 @@ abstract class Coupon implements ActiveRecordInterface return $this; } + // i18n behavior + + /** + * Sets the locale for translations + * + * @param string $locale Locale to use for the translation, e.g. 'fr_FR' + * + * @return ChildCoupon The current object (for fluent API support) + */ + public function setLocale($locale = 'en_US') + { + $this->currentLocale = $locale; + + return $this; + } + + /** + * Gets the locale for translations + * + * @return string $locale Locale to use for the translation, e.g. 'fr_FR' + */ + public function getLocale() + { + return $this->currentLocale; + } + + /** + * Returns the current translation for a given locale + * + * @param string $locale Locale to use for the translation, e.g. 'fr_FR' + * @param ConnectionInterface $con an optional connection object + * + * @return ChildCouponI18n */ + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) + { + if (!isset($this->currentTranslations[$locale])) { + if (null !== $this->collCouponI18ns) { + foreach ($this->collCouponI18ns as $translation) { + if ($translation->getLocale() == $locale) { + $this->currentTranslations[$locale] = $translation; + + return $translation; + } + } + } + if ($this->isNew()) { + $translation = new ChildCouponI18n(); + $translation->setLocale($locale); + } else { + $translation = ChildCouponI18nQuery::create() + ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) + ->findOneOrCreate($con); + $this->currentTranslations[$locale] = $translation; + } + $this->addCouponI18n($translation); + } + + return $this->currentTranslations[$locale]; + } + + /** + * Remove the translation for a given locale + * + * @param string $locale Locale to use for the translation, e.g. 'fr_FR' + * @param ConnectionInterface $con an optional connection object + * + * @return ChildCoupon The current object (for fluent API support) + */ + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) + { + if (!$this->isNew()) { + ChildCouponI18nQuery::create() + ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) + ->delete($con); + } + if (isset($this->currentTranslations[$locale])) { + unset($this->currentTranslations[$locale]); + } + foreach ($this->collCouponI18ns as $key => $translation) { + if ($translation->getLocale() == $locale) { + unset($this->collCouponI18ns[$key]); + break; + } + } + + return $this; + } + + /** + * Returns the current translation + * + * @param ConnectionInterface $con an optional connection object + * + * @return ChildCouponI18n */ + public function getCurrentTranslation(ConnectionInterface $con = null) + { + return $this->getTranslation($this->getLocale(), $con); + } + + + /** + * Get the [title] column value. + * + * @return string + */ + public function getTitle() + { + return $this->getCurrentTranslation()->getTitle(); + } + + + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setTitle($v) + { $this->getCurrentTranslation()->setTitle($v); + + return $this; + } + + + /** + * Get the [short_description] column value. + * + * @return string + */ + public function getShortDescription() + { + return $this->getCurrentTranslation()->getShortDescription(); + } + + + /** + * Set the value of [short_description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setShortDescription($v) + { $this->getCurrentTranslation()->setShortDescription($v); + + return $this; + } + + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->getCurrentTranslation()->getDescription(); + } + + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setDescription($v) + { $this->getCurrentTranslation()->setDescription($v); + + return $this; + } + + // versionable behavior + + /** + * Enforce a new Version of this object upon next save. + * + * @return \Thelia\Model\Coupon + */ + public function enforceVersioning() + { + $this->enforceVersion = true; + + return $this; + } + + /** + * Checks whether the current state must be recorded as a version + * + * @return boolean + */ + public function isVersioningNecessary($con = null) + { + if ($this->alreadyInSave) { + return false; + } + + if ($this->enforceVersion) { + return true; + } + + if (ChildCouponQuery::isVersioningEnabled() && ($this->isNew() || $this->isModified()) || $this->isDeleted()) { + return true; + } + + return false; + } + + /** + * Creates a version of the current object and saves it. + * + * @param ConnectionInterface $con the connection to use + * + * @return ChildCouponVersion A version object + */ + public function addVersion($con = null) + { + $this->enforceVersion = false; + + $version = new ChildCouponVersion(); + $version->setId($this->getId()); + $version->setCode($this->getCode()); + $version->setType($this->getType()); + $version->setAmount($this->getAmount()); + $version->setIsUsed($this->getIsUsed()); + $version->setIsEnabled($this->getIsEnabled()); + $version->setExpirationDate($this->getExpirationDate()); + $version->setSerializedRules($this->getSerializedRules()); + $version->setIsCumulative($this->getIsCumulative()); + $version->setIsRemovingPostage($this->getIsRemovingPostage()); + $version->setMaxUsage($this->getMaxUsage()); + $version->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers()); + $version->setCreatedAt($this->getCreatedAt()); + $version->setUpdatedAt($this->getUpdatedAt()); + $version->setVersion($this->getVersion()); + $version->setCoupon($this); + $version->save($con); + + return $version; + } + + /** + * Sets the properties of the current object to the value they had at a specific version + * + * @param integer $versionNumber The version number to read + * @param ConnectionInterface $con The connection to use + * + * @return ChildCoupon The current object (for fluent API support) + */ + public function toVersion($versionNumber, $con = null) + { + $version = $this->getOneVersion($versionNumber, $con); + if (!$version) { + throw new PropelException(sprintf('No ChildCoupon object found with version %d', $version)); + } + $this->populateFromVersion($version, $con); + + return $this; + } + + /** + * Sets the properties of the current object to the value they had at a specific version + * + * @param ChildCouponVersion $version The version object to use + * @param ConnectionInterface $con the connection to use + * @param array $loadedObjects objects that been loaded in a chain of populateFromVersion calls on referrer or fk objects. + * + * @return ChildCoupon The current object (for fluent API support) + */ + public function populateFromVersion($version, $con = null, &$loadedObjects = array()) + { + $loadedObjects['ChildCoupon'][$version->getId()][$version->getVersion()] = $this; + $this->setId($version->getId()); + $this->setCode($version->getCode()); + $this->setType($version->getType()); + $this->setAmount($version->getAmount()); + $this->setIsUsed($version->getIsUsed()); + $this->setIsEnabled($version->getIsEnabled()); + $this->setExpirationDate($version->getExpirationDate()); + $this->setSerializedRules($version->getSerializedRules()); + $this->setIsCumulative($version->getIsCumulative()); + $this->setIsRemovingPostage($version->getIsRemovingPostage()); + $this->setMaxUsage($version->getMaxUsage()); + $this->setIsAvailableOnSpecialOffers($version->getIsAvailableOnSpecialOffers()); + $this->setCreatedAt($version->getCreatedAt()); + $this->setUpdatedAt($version->getUpdatedAt()); + $this->setVersion($version->getVersion()); + + return $this; + } + + /** + * Gets the latest persisted version number for the current object + * + * @param ConnectionInterface $con the connection to use + * + * @return integer + */ + public function getLastVersionNumber($con = null) + { + $v = ChildCouponVersionQuery::create() + ->filterByCoupon($this) + ->orderByVersion('desc') + ->findOne($con); + if (!$v) { + return 0; + } + + return $v->getVersion(); + } + + /** + * Checks whether the current object is the latest one + * + * @param ConnectionInterface $con the connection to use + * + * @return Boolean + */ + public function isLastVersion($con = null) + { + return $this->getLastVersionNumber($con) == $this->getVersion(); + } + + /** + * Retrieves a version object for this entity and a version number + * + * @param integer $versionNumber The version number to read + * @param ConnectionInterface $con the connection to use + * + * @return ChildCouponVersion A version object + */ + public function getOneVersion($versionNumber, $con = null) + { + return ChildCouponVersionQuery::create() + ->filterByCoupon($this) + ->filterByVersion($versionNumber) + ->findOne($con); + } + + /** + * Gets all the versions of this object, in incremental order + * + * @param ConnectionInterface $con the connection to use + * + * @return ObjectCollection A list of ChildCouponVersion objects + */ + public function getAllVersions($con = null) + { + $criteria = new Criteria(); + $criteria->addAscendingOrderByColumn(CouponVersionTableMap::VERSION); + + return $this->getCouponVersions($criteria, $con); + } + + /** + * Compares the current object with another of its version. + * + * print_r($book->compareVersion(1)); + * => array( + * '1' => array('Title' => 'Book title at version 1'), + * '2' => array('Title' => 'Book title at version 2') + * ); + * + * + * @param integer $versionNumber + * @param string $keys Main key used for the result diff (versions|columns) + * @param ConnectionInterface $con the connection to use + * @param array $ignoredColumns The columns to exclude from the diff. + * + * @return array A list of differences + */ + public function compareVersion($versionNumber, $keys = 'columns', $con = null, $ignoredColumns = array()) + { + $fromVersion = $this->toArray(); + $toVersion = $this->getOneVersion($versionNumber, $con)->toArray(); + + return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns); + } + + /** + * Compares two versions of the current object. + * + * print_r($book->compareVersions(1, 2)); + * => array( + * '1' => array('Title' => 'Book title at version 1'), + * '2' => array('Title' => 'Book title at version 2') + * ); + * + * + * @param integer $fromVersionNumber + * @param integer $toVersionNumber + * @param string $keys Main key used for the result diff (versions|columns) + * @param ConnectionInterface $con the connection to use + * @param array $ignoredColumns The columns to exclude from the diff. + * + * @return array A list of differences + */ + public function compareVersions($fromVersionNumber, $toVersionNumber, $keys = 'columns', $con = null, $ignoredColumns = array()) + { + $fromVersion = $this->getOneVersion($fromVersionNumber, $con)->toArray(); + $toVersion = $this->getOneVersion($toVersionNumber, $con)->toArray(); + + return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns); + } + + /** + * Computes the diff between two versions. + * + * print_r($book->computeDiff(1, 2)); + * => array( + * '1' => array('Title' => 'Book title at version 1'), + * '2' => array('Title' => 'Book title at version 2') + * ); + * + * + * @param array $fromVersion An array representing the original version. + * @param array $toVersion An array representing the destination version. + * @param string $keys Main key used for the result diff (versions|columns). + * @param array $ignoredColumns The columns to exclude from the diff. + * + * @return array A list of differences + */ + protected function computeDiff($fromVersion, $toVersion, $keys = 'columns', $ignoredColumns = array()) + { + $fromVersionNumber = $fromVersion['Version']; + $toVersionNumber = $toVersion['Version']; + $ignoredColumns = array_merge(array( + 'Version', + ), $ignoredColumns); + $diff = array(); + foreach ($fromVersion as $key => $value) { + if (in_array($key, $ignoredColumns)) { + continue; + } + if ($toVersion[$key] != $value) { + switch ($keys) { + case 'versions': + $diff[$fromVersionNumber][$key] = $value; + $diff[$toVersionNumber][$key] = $toVersion[$key]; + break; + default: + $diff[$key] = array( + $fromVersionNumber => $value, + $toVersionNumber => $toVersion[$key], + ); + break; + } + } + } + + return $diff; + } + /** + * retrieve the last $number versions. + * + * @param Integer $number the number of record to return. + * @return PropelCollection|array \Thelia\Model\CouponVersion[] List of \Thelia\Model\CouponVersion objects + */ + public function getLastVersions($number = 10, $criteria = null, $con = null) + { + $criteria = ChildCouponVersionQuery::create(null, $criteria); + $criteria->addDescendingOrderByColumn(CouponVersionTableMap::VERSION); + $criteria->limit($number); + + return $this->getCouponVersions($criteria, $con); + } /** * Code to be run before persisting the object * @param ConnectionInterface $con diff --git a/core/lib/Thelia/Model/Base/CouponI18n.php b/core/lib/Thelia/Model/Base/CouponI18n.php new file mode 100644 index 000000000..0ea9027b6 --- /dev/null +++ b/core/lib/Thelia/Model/Base/CouponI18n.php @@ -0,0 +1,1381 @@ +locale = 'en_US'; + } + + /** + * Initializes internal state of Thelia\Model\Base\CouponI18n object. + * @see applyDefaults() + */ + public function __construct() + { + $this->applyDefaultValues(); + } + + /** + * Returns whether the object has been modified. + * + * @return boolean True if the object has been modified. + */ + public function isModified() + { + return !empty($this->modifiedColumns); + } + + /** + * Has specified column been modified? + * + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return boolean True if $col has been modified. + */ + public function isColumnModified($col) + { + return in_array($col, $this->modifiedColumns); + } + + /** + * Get the columns that have been modified in this object. + * @return array A unique list of the modified column names for this object. + */ + public function getModifiedColumns() + { + return array_unique($this->modifiedColumns); + } + + /** + * Returns whether the object has ever been saved. This will + * be false, if the object was retrieved from storage or was created + * and then saved. + * + * @return true, if the object has never been persisted. + */ + public function isNew() + { + return $this->new; + } + + /** + * Setter for the isNew attribute. This method will be called + * by Propel-generated children and objects. + * + * @param boolean $b the state of the object. + */ + public function setNew($b) + { + $this->new = (Boolean) $b; + } + + /** + * Whether this object has been deleted. + * @return boolean The deleted state of this object. + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Specify whether this object has been deleted. + * @param boolean $b The deleted state of this object. + * @return void + */ + public function setDeleted($b) + { + $this->deleted = (Boolean) $b; + } + + /** + * Sets the modified state for the object to be false. + * @param string $col If supplied, only the specified column is reset. + * @return void + */ + public function resetModified($col = null) + { + if (null !== $col) { + while (false !== ($offset = array_search($col, $this->modifiedColumns))) { + array_splice($this->modifiedColumns, $offset, 1); + } + } else { + $this->modifiedColumns = array(); + } + } + + /** + * Compares this with another CouponI18n instance. If + * 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. + */ + public function equals($obj) + { + $thisclazz = get_class($this); + if (!is_object($obj) || !($obj instanceof $thisclazz)) { + return false; + } + + if ($this === $obj) { + return true; + } + + if (null === $this->getPrimaryKey() + || null === $obj->getPrimaryKey()) { + return false; + } + + return $this->getPrimaryKey() === $obj->getPrimaryKey(); + } + + /** + * If the primary key is not null, return the hashcode of the + * primary key. Otherwise, return the hash code of the object. + * + * @return int Hashcode + */ + public function hashCode() + { + if (null !== $this->getPrimaryKey()) { + return crc32(serialize($this->getPrimaryKey())); + } + + return crc32(serialize(clone $this)); + } + + /** + * Get the associative array of the virtual columns in this object + * + * @param string $name The virtual column name + * + * @return array + */ + public function getVirtualColumns() + { + return $this->virtualColumns; + } + + /** + * Checks the existence of a virtual column in this object + * + * @return boolean + */ + public function hasVirtualColumn($name) + { + return array_key_exists($name, $this->virtualColumns); + } + + /** + * Get the value of a virtual column in this object + * + * @return mixed + */ + public function getVirtualColumn($name) + { + if (!$this->hasVirtualColumn($name)) { + throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + } + + return $this->virtualColumns[$name]; + } + + /** + * Set the value of a virtual column in this object + * + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column + * + * @return CouponI18n The current object, for fluid interface + */ + public function setVirtualColumn($name, $value) + { + $this->virtualColumns[$name] = $value; + + return $this; + } + + /** + * Logs a message using Propel::log(). + * + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return boolean + */ + protected function log($msg, $priority = Propel::LOG_INFO) + { + return Propel::log(get_class($this) . ': ' . $msg, $priority); + } + + /** + * Populate the current object from a string, using a given parser format + * + * $book = new Book(); + * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, + * or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param string $data The source data to import from + * + * @return CouponI18n The current object, for fluid interface + */ + public function importFrom($parser, $data) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + } + + /** + * Export the current object properties to a string, using a given parser format + * + * $book = BookQuery::create()->findPk(9012); + * echo $book->exportTo('JSON'); + * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @return string The exported data + */ + public function exportTo($parser, $includeLazyLoadColumns = true) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + } + + /** + * Clean up internal collections prior to serializing + * Avoids recursive loops that turn into segmentation faults when serializing + */ + public function __sleep() + { + $this->clearAllReferences(); + + return array_keys(get_object_vars($this)); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + + return $this->id; + } + + /** + * Get the [locale] column value. + * + * @return string + */ + public function getLocale() + { + + return $this->locale; + } + + /** + * Get the [title] column value. + * + * @return string + */ + public function getTitle() + { + + return $this->title; + } + + /** + * Get the [short_description] column value. + * + * @return string + */ + public function getShortDescription() + { + + return $this->short_description; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + + return $this->description; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CouponI18nTableMap::ID; + } + + if ($this->aCoupon !== null && $this->aCoupon->getId() !== $v) { + $this->aCoupon = null; + } + + + return $this; + } // setId() + + /** + * Set the value of [locale] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setLocale($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->locale !== $v) { + $this->locale = $v; + $this->modifiedColumns[] = CouponI18nTableMap::LOCALE; + } + + + return $this; + } // setLocale() + + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setTitle($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->title !== $v) { + $this->title = $v; + $this->modifiedColumns[] = CouponI18nTableMap::TITLE; + } + + + return $this; + } // setTitle() + + /** + * Set the value of [short_description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setShortDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->short_description !== $v) { + $this->short_description = $v; + $this->modifiedColumns[] = CouponI18nTableMap::SHORT_DESCRIPTION; + } + + + return $this; + } // setShortDescription() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = CouponI18nTableMap::DESCRIPTION; + } + + + return $this; + } // setDescription() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->locale !== 'en_US') { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + { + try { + + + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : CouponI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; + $this->locale = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $this->title = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponI18nTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)]; + $this->short_description = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; + $this->description = (null !== $col) ? (string) $col : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 5; // 5 = CouponI18nTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \Thelia\Model\CouponI18n object", 0, $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + if ($this->aCoupon !== null && $this->id !== $this->aCoupon->getId()) { + $this->aCoupon = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(CouponI18nTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildCouponI18nQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $row = $dataFetcher->fetch(); + $dataFetcher->close(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCoupon = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see CouponI18n::setDeleted() + * @see CouponI18n::isDeleted() + */ + public function delete(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildCouponI18nQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CouponI18nTableMap::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(ConnectionInterface $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCoupon !== null) { + if ($this->aCoupon->isModified() || $this->aCoupon->isNew()) { + $affectedRows += $this->aCoupon->save($con); + } + $this->setCoupon($this->aCoupon); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param ConnectionInterface $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(ConnectionInterface $con) + { + $modifiedColumns = array(); + $index = 0; + + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(CouponI18nTableMap::ID)) { + $modifiedColumns[':p' . $index++] = 'ID'; + } + if ($this->isColumnModified(CouponI18nTableMap::LOCALE)) { + $modifiedColumns[':p' . $index++] = 'LOCALE'; + } + if ($this->isColumnModified(CouponI18nTableMap::TITLE)) { + $modifiedColumns[':p' . $index++] = 'TITLE'; + } + if ($this->isColumnModified(CouponI18nTableMap::SHORT_DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION'; + } + if ($this->isColumnModified(CouponI18nTableMap::DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + } + + $sql = sprintf( + 'INSERT INTO coupon_i18n (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case 'ID': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; + case 'LOCALE': + $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); + break; + case 'TITLE': + $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); + break; + case 'SHORT_DESCRIPTION': + $stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR); + break; + case 'DESCRIPTION': + $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); + } + + $this->setNew(false); + } + + /** + * Update the row in the database. + * + * @param ConnectionInterface $con + * + * @return Integer Number of updated rows + * @see doSave() + */ + protected function doUpdate(ConnectionInterface $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + + return $selectCriteria->doUpdate($valuesCriteria, $con); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return mixed Value of field. + */ + public function getByName($name, $type = TableMap::TYPE_PHPNAME) + { + $pos = CouponI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getLocale(); + break; + case 2: + return $this->getTitle(); + break; + case 3: + return $this->getShortDescription(); + break; + case 4: + return $this->getDescription(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + if (isset($alreadyDumpedObjects['CouponI18n'][serialize($this->getPrimaryKey())])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['CouponI18n'][serialize($this->getPrimaryKey())] = true; + $keys = CouponI18nTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getLocale(), + $keys[2] => $this->getTitle(), + $keys[3] => $this->getShortDescription(), + $keys[4] => $this->getDescription(), + ); + $virtualColumns = $this->virtualColumns; + foreach($virtualColumns as $key => $virtualColumn) + { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aCoupon) { + $result['Coupon'] = $this->aCoupon->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + } + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return void + */ + public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + { + $pos = CouponI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setLocale($value); + break; + case 2: + $this->setTitle($value); + break; + case 3: + $this->setShortDescription($value); + break; + case 4: + $this->setDescription($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * The default key type is the column's TableMap::TYPE_PHPNAME. + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + { + $keys = CouponI18nTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setShortDescription($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CouponI18nTableMap::DATABASE_NAME); + + if ($this->isColumnModified(CouponI18nTableMap::ID)) $criteria->add(CouponI18nTableMap::ID, $this->id); + if ($this->isColumnModified(CouponI18nTableMap::LOCALE)) $criteria->add(CouponI18nTableMap::LOCALE, $this->locale); + if ($this->isColumnModified(CouponI18nTableMap::TITLE)) $criteria->add(CouponI18nTableMap::TITLE, $this->title); + if ($this->isColumnModified(CouponI18nTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponI18nTableMap::SHORT_DESCRIPTION, $this->short_description); + if ($this->isColumnModified(CouponI18nTableMap::DESCRIPTION)) $criteria->add(CouponI18nTableMap::DESCRIPTION, $this->description); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CouponI18nTableMap::DATABASE_NAME); + $criteria->add(CouponI18nTableMap::ID, $this->id); + $criteria->add(CouponI18nTableMap::LOCALE, $this->locale); + + return $criteria; + } + + /** + * Returns the composite primary key for this object. + * The array elements will be in same order as specified in XML. + * @return array + */ + public function getPrimaryKey() + { + $pks = array(); + $pks[0] = $this->getId(); + $pks[1] = $this->getLocale(); + + return $pks; + } + + /** + * Set the [composite] primary key. + * + * @param array $keys The elements of the composite key (order must match the order in XML file). + * @return void + */ + public function setPrimaryKey($keys) + { + $this->setId($keys[0]); + $this->setLocale($keys[1]); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return (null === $this->getId()) && (null === $this->getLocale()); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of \Thelia\Model\CouponI18n (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->setId($this->getId()); + $copyObj->setLocale($this->getLocale()); + $copyObj->setTitle($this->getTitle()); + $copyObj->setShortDescription($this->getShortDescription()); + $copyObj->setDescription($this->getDescription()); + if ($makeNew) { + $copyObj->setNew(true); + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return \Thelia\Model\CouponI18n Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Declares an association between this object and a ChildCoupon object. + * + * @param ChildCoupon $v + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + * @throws PropelException + */ + public function setCoupon(ChildCoupon $v = null) + { + if ($v === null) { + $this->setId(NULL); + } else { + $this->setId($v->getId()); + } + + $this->aCoupon = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildCoupon object, it will not be re-added. + if ($v !== null) { + $v->addCouponI18n($this); + } + + + return $this; + } + + + /** + * Get the associated ChildCoupon object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildCoupon The associated ChildCoupon object. + * @throws PropelException + */ + public function getCoupon(ConnectionInterface $con = null) + { + if ($this->aCoupon === null && ($this->id !== null)) { + $this->aCoupon = ChildCouponQuery::create()->findPk($this->id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCoupon->addCouponI18ns($this); + */ + } + + return $this->aCoupon; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->locale = null; + $this->title = null; + $this->short_description = null; + $this->description = null; + $this->alreadyInSave = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCoupon = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(CouponI18nTableMap::DEFAULT_STRING_FORMAT); + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/core/lib/Thelia/Model/Base/CouponI18nQuery.php b/core/lib/Thelia/Model/Base/CouponI18nQuery.php new file mode 100644 index 000000000..5dfbdbcdc --- /dev/null +++ b/core/lib/Thelia/Model/Base/CouponI18nQuery.php @@ -0,0 +1,574 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + + return $query; + } + + /** + * Find object by primary key. + * Propel uses the instance pool to skip the database if the object exists. + * Go fast if the query is untouched. + * + * + * $obj = $c->findPk(array(12, 34), $con); + * + * + * @param array[$id, $locale] $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildCouponI18n|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = CouponI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(CouponI18nTableMap::DATABASE_NAME); + } + $this->basePreSelect($con); + if ($this->formatter || $this->modelAlias || $this->with || $this->select + || $this->selectColumns || $this->asColumns || $this->selectModifiers + || $this->map || $this->having || $this->joins) { + return $this->findPkComplex($key, $con); + } else { + return $this->findPkSimple($key, $con); + } + } + + /** + * Find object by primary key using raw SQL to go fast. + * Bypass doSelect() and the object formatter by using generated code. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildCouponI18n A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT ID, LOCALE, TITLE, SHORT_DESCRIPTION, DESCRIPTION FROM coupon_i18n WHERE ID = :p0 AND LOCALE = :p1'; + try { + $stmt = $con->prepare($sql); + $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); + $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR); + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); + } + $obj = null; + if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { + $obj = new ChildCouponI18n(); + $obj->hydrate($row); + CouponI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); + } + $stmt->closeCursor(); + + return $obj; + } + + /** + * Find object by primary key. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildCouponI18n|array|mixed the result, formatted by the current formatter + */ + protected function findPkComplex($key, $con) + { + // As the query uses a PK condition, no limit(1) is necessary. + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKey($key) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); + * + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); + } + $this->basePreSelect($con); + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKeys($keys) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->format($dataFetcher); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + $this->addUsingAlias(CouponI18nTableMap::ID, $key[0], Criteria::EQUAL); + $this->addUsingAlias(CouponI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); + + return $this; + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + if (empty($keys)) { + return $this->add(null, '1<>1', Criteria::CUSTOM); + } + foreach ($keys as $key) { + $cton0 = $this->getNewCriterion(CouponI18nTableMap::ID, $key[0], Criteria::EQUAL); + $cton1 = $this->getNewCriterion(CouponI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); + $cton0->addAnd($cton1); + $this->addOr($cton0); + } + + return $this; + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @see filterByCoupon() + * + * @param mixed $id The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id)) { + $useMinMax = false; + if (isset($id['min'])) { + $this->addUsingAlias(CouponI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(CouponI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponI18nTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the locale column + * + * Example usage: + * + * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue' + * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%' + * + * + * @param string $locale The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByLocale($locale = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($locale)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $locale)) { + $locale = str_replace('*', '%', $locale); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponI18nTableMap::LOCALE, $locale, $comparison); + } + + /** + * Filter the query on the title column + * + * Example usage: + * + * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' + * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' + * + * + * @param string $title The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByTitle($title = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($title)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $title)) { + $title = str_replace('*', '%', $title); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponI18nTableMap::TITLE, $title, $comparison); + } + + /** + * Filter the query on the short_description column + * + * Example usage: + * + * $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue' + * $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%' + * + * + * @param string $shortDescription The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByShortDescription($shortDescription = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($shortDescription)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $shortDescription)) { + $shortDescription = str_replace('*', '%', $shortDescription); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponI18nTableMap::SHORT_DESCRIPTION, $shortDescription, $comparison); + } + + /** + * Filter the query on the description column + * + * Example usage: + * + * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' + * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' + * + * + * @param string $description The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByDescription($description = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($description)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $description)) { + $description = str_replace('*', '%', $description); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponI18nTableMap::DESCRIPTION, $description, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\Coupon object + * + * @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByCoupon($coupon, $comparison = null) + { + if ($coupon instanceof \Thelia\Model\Coupon) { + return $this + ->addUsingAlias(CouponI18nTableMap::ID, $coupon->getId(), $comparison); + } elseif ($coupon instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(CouponI18nTableMap::ID, $coupon->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Coupon relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function joinCoupon($relationAlias = null, $joinType = 'LEFT JOIN') + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Coupon'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'Coupon'); + } + + return $this; + } + + /** + * Use the Coupon relation Coupon object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\CouponQuery A secondary query class using the current class as primary query + */ + public function useCouponQuery($relationAlias = null, $joinType = 'LEFT JOIN') + { + return $this + ->joinCoupon($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery'); + } + + /** + * Exclude object from result + * + * @param ChildCouponI18n $couponI18n Object to remove from the list of results + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function prune($couponI18n = null) + { + if ($couponI18n) { + $this->addCond('pruneCond0', $this->getAliasedColName(CouponI18nTableMap::ID), $couponI18n->getId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond1', $this->getAliasedColName(CouponI18nTableMap::LOCALE), $couponI18n->getLocale(), Criteria::NOT_EQUAL); + $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); + } + + return $this; + } + + /** + * Deletes all rows from the coupon_i18n table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public function doDeleteAll(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += parent::doDeleteAll($con); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CouponI18nTableMap::clearInstancePool(); + CouponI18nTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildCouponI18n or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildCouponI18n object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public function delete(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(CouponI18nTableMap::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + + CouponI18nTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + CouponI18nTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + +} // CouponI18nQuery diff --git a/core/lib/Thelia/Model/Base/CouponOrder.php b/core/lib/Thelia/Model/Base/CouponOrder.php index 32ae68fde..b2685ea74 100644 --- a/core/lib/Thelia/Model/Base/CouponOrder.php +++ b/core/lib/Thelia/Model/Base/CouponOrder.php @@ -68,12 +68,6 @@ abstract class CouponOrder implements ActiveRecordInterface */ protected $order_id; - /** - * The value for the code field. - * @var string - */ - protected $code; - /** * The value for the value field. * @var double @@ -261,7 +255,7 @@ abstract class CouponOrder implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -381,17 +375,6 @@ abstract class CouponOrder implements ActiveRecordInterface return $this->order_id; } - /** - * Get the [code] column value. - * - * @return string - */ - public function getCode() - { - - return $this->code; - } - /** * Get the [value] column value. * @@ -489,27 +472,6 @@ abstract class CouponOrder implements ActiveRecordInterface return $this; } // setOrderId() - /** - * Set the value of [code] column. - * - * @param string $v new value - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) - */ - public function setCode($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->code !== $v) { - $this->code = $v; - $this->modifiedColumns[] = CouponOrderTableMap::CODE; - } - - - return $this; - } // setCode() - /** * Set the value of [value] column. * @@ -616,19 +578,16 @@ abstract class CouponOrder implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponOrderTableMap::translateFieldName('OrderId', TableMap::TYPE_PHPNAME, $indexType)]; $this->order_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponOrderTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; - $this->code = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponOrderTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponOrderTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)]; $this->value = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponOrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponOrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponOrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponOrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -641,7 +600,7 @@ abstract class CouponOrder implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 6; // 6 = CouponOrderTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 5; // 5 = CouponOrderTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\CouponOrder object", 0, $e); @@ -883,9 +842,6 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->isColumnModified(CouponOrderTableMap::ORDER_ID)) { $modifiedColumns[':p' . $index++] = 'ORDER_ID'; } - if ($this->isColumnModified(CouponOrderTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; - } if ($this->isColumnModified(CouponOrderTableMap::VALUE)) { $modifiedColumns[':p' . $index++] = 'VALUE'; } @@ -912,9 +868,6 @@ abstract class CouponOrder implements ActiveRecordInterface case 'ORDER_ID': $stmt->bindValue($identifier, $this->order_id, PDO::PARAM_INT); break; - case 'CODE': - $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); - break; case 'VALUE': $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR); break; @@ -993,15 +946,12 @@ abstract class CouponOrder implements ActiveRecordInterface return $this->getOrderId(); break; case 2: - return $this->getCode(); - break; - case 3: return $this->getValue(); break; - case 4: + case 3: return $this->getCreatedAt(); break; - case 5: + case 4: return $this->getUpdatedAt(); break; default: @@ -1035,10 +985,9 @@ abstract class CouponOrder implements ActiveRecordInterface $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getOrderId(), - $keys[2] => $this->getCode(), - $keys[3] => $this->getValue(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), + $keys[2] => $this->getValue(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1091,15 +1040,12 @@ abstract class CouponOrder implements ActiveRecordInterface $this->setOrderId($value); break; case 2: - $this->setCode($value); - break; - case 3: $this->setValue($value); break; - case 4: + case 3: $this->setCreatedAt($value); break; - case 5: + case 4: $this->setUpdatedAt($value); break; } // switch() @@ -1128,10 +1074,9 @@ abstract class CouponOrder implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setOrderId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setValue($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); + if (array_key_exists($keys[2], $arr)) $this->setValue($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); } /** @@ -1145,7 +1090,6 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->isColumnModified(CouponOrderTableMap::ID)) $criteria->add(CouponOrderTableMap::ID, $this->id); if ($this->isColumnModified(CouponOrderTableMap::ORDER_ID)) $criteria->add(CouponOrderTableMap::ORDER_ID, $this->order_id); - if ($this->isColumnModified(CouponOrderTableMap::CODE)) $criteria->add(CouponOrderTableMap::CODE, $this->code); if ($this->isColumnModified(CouponOrderTableMap::VALUE)) $criteria->add(CouponOrderTableMap::VALUE, $this->value); if ($this->isColumnModified(CouponOrderTableMap::CREATED_AT)) $criteria->add(CouponOrderTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(CouponOrderTableMap::UPDATED_AT)) $criteria->add(CouponOrderTableMap::UPDATED_AT, $this->updated_at); @@ -1213,7 +1157,6 @@ abstract class CouponOrder implements ActiveRecordInterface public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setOrderId($this->getOrderId()); - $copyObj->setCode($this->getCode()); $copyObj->setValue($this->getValue()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1303,7 +1246,6 @@ abstract class CouponOrder implements ActiveRecordInterface { $this->id = null; $this->order_id = null; - $this->code = null; $this->value = null; $this->created_at = null; $this->updated_at = null; diff --git a/core/lib/Thelia/Model/Base/CouponOrderQuery.php b/core/lib/Thelia/Model/Base/CouponOrderQuery.php index 6897f56dd..255d69504 100644 --- a/core/lib/Thelia/Model/Base/CouponOrderQuery.php +++ b/core/lib/Thelia/Model/Base/CouponOrderQuery.php @@ -23,14 +23,12 @@ use Thelia\Model\Map\CouponOrderTableMap; * * @method ChildCouponOrderQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCouponOrderQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column - * @method ChildCouponOrderQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildCouponOrderQuery orderByValue($order = Criteria::ASC) Order by the value column * @method ChildCouponOrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildCouponOrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildCouponOrderQuery groupById() Group by the id column * @method ChildCouponOrderQuery groupByOrderId() Group by the order_id column - * @method ChildCouponOrderQuery groupByCode() Group by the code column * @method ChildCouponOrderQuery groupByValue() Group by the value column * @method ChildCouponOrderQuery groupByCreatedAt() Group by the created_at column * @method ChildCouponOrderQuery groupByUpdatedAt() Group by the updated_at column @@ -48,14 +46,12 @@ use Thelia\Model\Map\CouponOrderTableMap; * * @method ChildCouponOrder findOneById(int $id) Return the first ChildCouponOrder filtered by the id column * @method ChildCouponOrder findOneByOrderId(int $order_id) Return the first ChildCouponOrder filtered by the order_id column - * @method ChildCouponOrder findOneByCode(string $code) Return the first ChildCouponOrder filtered by the code column * @method ChildCouponOrder findOneByValue(double $value) Return the first ChildCouponOrder filtered by the value column * @method ChildCouponOrder findOneByCreatedAt(string $created_at) Return the first ChildCouponOrder filtered by the created_at column * @method ChildCouponOrder findOneByUpdatedAt(string $updated_at) Return the first ChildCouponOrder filtered by the updated_at column * * @method array findById(int $id) Return ChildCouponOrder objects filtered by the id column * @method array findByOrderId(int $order_id) Return ChildCouponOrder objects filtered by the order_id column - * @method array findByCode(string $code) Return ChildCouponOrder objects filtered by the code column * @method array findByValue(double $value) Return ChildCouponOrder objects filtered by the value column * @method array findByCreatedAt(string $created_at) Return ChildCouponOrder objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildCouponOrder objects filtered by the updated_at column @@ -147,7 +143,7 @@ abstract class CouponOrderQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ORDER_ID, CODE, VALUE, CREATED_AT, UPDATED_AT FROM coupon_order WHERE ID = :p0'; + $sql = 'SELECT ID, ORDER_ID, VALUE, CREATED_AT, UPDATED_AT FROM coupon_order WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -320,35 +316,6 @@ abstract class CouponOrderQuery extends ModelCriteria return $this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId, $comparison); } - /** - * Filter the query on the code column - * - * Example usage: - * - * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' - * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' - * - * - * @param string $code The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByCode($code = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($code)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $code)) { - $code = str_replace('*', '%', $code); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponOrderTableMap::CODE, $code, $comparison); - } - /** * Filter the query on the value column * diff --git a/core/lib/Thelia/Model/Base/CouponQuery.php b/core/lib/Thelia/Model/Base/CouponQuery.php index 23fdd2e4c..e92380879 100644 --- a/core/lib/Thelia/Model/Base/CouponQuery.php +++ b/core/lib/Thelia/Model/Base/CouponQuery.php @@ -13,6 +13,7 @@ use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; use Thelia\Model\Coupon as ChildCoupon; +use Thelia\Model\CouponI18nQuery as ChildCouponI18nQuery; use Thelia\Model\CouponQuery as ChildCouponQuery; use Thelia\Model\Map\CouponTableMap; @@ -23,63 +24,94 @@ use Thelia\Model\Map\CouponTableMap; * * @method ChildCouponQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCouponQuery orderByCode($order = Criteria::ASC) Order by the code column - * @method ChildCouponQuery orderByAction($order = Criteria::ASC) Order by the action column - * @method ChildCouponQuery orderByValue($order = Criteria::ASC) Order by the value column - * @method ChildCouponQuery orderByUsed($order = Criteria::ASC) Order by the used column - * @method ChildCouponQuery orderByAvailableSince($order = Criteria::ASC) Order by the available_since column - * @method ChildCouponQuery orderByDateLimit($order = Criteria::ASC) Order by the date_limit column - * @method ChildCouponQuery orderByActivate($order = Criteria::ASC) Order by the activate column + * @method ChildCouponQuery orderByType($order = Criteria::ASC) Order by the type column + * @method ChildCouponQuery orderByAmount($order = Criteria::ASC) Order by the amount column + * @method ChildCouponQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column + * @method ChildCouponQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column + * @method ChildCouponQuery orderByExpirationDate($order = Criteria::ASC) Order by the expiration_date column + * @method ChildCouponQuery orderBySerializedRules($order = Criteria::ASC) Order by the serialized_rules column + * @method ChildCouponQuery orderByIsCumulative($order = Criteria::ASC) Order by the is_cumulative column + * @method ChildCouponQuery orderByIsRemovingPostage($order = Criteria::ASC) Order by the is_removing_postage column + * @method ChildCouponQuery orderByMaxUsage($order = Criteria::ASC) Order by the max_usage column + * @method ChildCouponQuery orderByIsAvailableOnSpecialOffers($order = Criteria::ASC) Order by the is_available_on_special_offers column * @method ChildCouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildCouponQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column + * @method ChildCouponQuery orderByVersion($order = Criteria::ASC) Order by the version column * * @method ChildCouponQuery groupById() Group by the id column * @method ChildCouponQuery groupByCode() Group by the code column - * @method ChildCouponQuery groupByAction() Group by the action column - * @method ChildCouponQuery groupByValue() Group by the value column - * @method ChildCouponQuery groupByUsed() Group by the used column - * @method ChildCouponQuery groupByAvailableSince() Group by the available_since column - * @method ChildCouponQuery groupByDateLimit() Group by the date_limit column - * @method ChildCouponQuery groupByActivate() Group by the activate column + * @method ChildCouponQuery groupByType() Group by the type column + * @method ChildCouponQuery groupByAmount() Group by the amount column + * @method ChildCouponQuery groupByIsUsed() Group by the is_used column + * @method ChildCouponQuery groupByIsEnabled() Group by the is_enabled column + * @method ChildCouponQuery groupByExpirationDate() Group by the expiration_date column + * @method ChildCouponQuery groupBySerializedRules() Group by the serialized_rules column + * @method ChildCouponQuery groupByIsCumulative() Group by the is_cumulative column + * @method ChildCouponQuery groupByIsRemovingPostage() Group by the is_removing_postage column + * @method ChildCouponQuery groupByMaxUsage() Group by the max_usage column + * @method ChildCouponQuery groupByIsAvailableOnSpecialOffers() Group by the is_available_on_special_offers column * @method ChildCouponQuery groupByCreatedAt() Group by the created_at column * @method ChildCouponQuery groupByUpdatedAt() Group by the updated_at column + * @method ChildCouponQuery groupByVersion() Group by the version column * * @method ChildCouponQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildCouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildCouponQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildCouponQuery leftJoinCouponRule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponRule relation - * @method ChildCouponQuery rightJoinCouponRule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponRule relation - * @method ChildCouponQuery innerJoinCouponRule($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponRule relation + * @method ChildCouponQuery leftJoinCouponI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponI18n relation + * @method ChildCouponQuery rightJoinCouponI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponI18n relation + * @method ChildCouponQuery innerJoinCouponI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponI18n relation + * + * @method ChildCouponQuery leftJoinCouponVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponVersion relation + * @method ChildCouponQuery rightJoinCouponVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponVersion relation + * @method ChildCouponQuery innerJoinCouponVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponVersion relation * * @method ChildCoupon findOne(ConnectionInterface $con = null) Return the first ChildCoupon matching the query * @method ChildCoupon findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCoupon matching the query, or a new ChildCoupon object populated from the query conditions when no match is found * * @method ChildCoupon findOneById(int $id) Return the first ChildCoupon filtered by the id column * @method ChildCoupon findOneByCode(string $code) Return the first ChildCoupon filtered by the code column - * @method ChildCoupon findOneByAction(string $action) Return the first ChildCoupon filtered by the action column - * @method ChildCoupon findOneByValue(double $value) Return the first ChildCoupon filtered by the value column - * @method ChildCoupon findOneByUsed(int $used) Return the first ChildCoupon filtered by the used column - * @method ChildCoupon findOneByAvailableSince(string $available_since) Return the first ChildCoupon filtered by the available_since column - * @method ChildCoupon findOneByDateLimit(string $date_limit) Return the first ChildCoupon filtered by the date_limit column - * @method ChildCoupon findOneByActivate(int $activate) Return the first ChildCoupon filtered by the activate column + * @method ChildCoupon findOneByType(string $type) Return the first ChildCoupon filtered by the type column + * @method ChildCoupon findOneByAmount(double $amount) Return the first ChildCoupon filtered by the amount column + * @method ChildCoupon findOneByIsUsed(int $is_used) Return the first ChildCoupon filtered by the is_used column + * @method ChildCoupon findOneByIsEnabled(int $is_enabled) Return the first ChildCoupon filtered by the is_enabled column + * @method ChildCoupon findOneByExpirationDate(string $expiration_date) Return the first ChildCoupon filtered by the expiration_date column + * @method ChildCoupon findOneBySerializedRules(string $serialized_rules) Return the first ChildCoupon filtered by the serialized_rules column + * @method ChildCoupon findOneByIsCumulative(int $is_cumulative) Return the first ChildCoupon filtered by the is_cumulative column + * @method ChildCoupon findOneByIsRemovingPostage(int $is_removing_postage) Return the first ChildCoupon filtered by the is_removing_postage column + * @method ChildCoupon findOneByMaxUsage(int $max_usage) Return the first ChildCoupon filtered by the max_usage column + * @method ChildCoupon findOneByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return the first ChildCoupon filtered by the is_available_on_special_offers column * @method ChildCoupon findOneByCreatedAt(string $created_at) Return the first ChildCoupon filtered by the created_at column * @method ChildCoupon findOneByUpdatedAt(string $updated_at) Return the first ChildCoupon filtered by the updated_at column + * @method ChildCoupon findOneByVersion(int $version) Return the first ChildCoupon filtered by the version column * * @method array findById(int $id) Return ChildCoupon objects filtered by the id column * @method array findByCode(string $code) Return ChildCoupon objects filtered by the code column - * @method array findByAction(string $action) Return ChildCoupon objects filtered by the action column - * @method array findByValue(double $value) Return ChildCoupon objects filtered by the value column - * @method array findByUsed(int $used) Return ChildCoupon objects filtered by the used column - * @method array findByAvailableSince(string $available_since) Return ChildCoupon objects filtered by the available_since column - * @method array findByDateLimit(string $date_limit) Return ChildCoupon objects filtered by the date_limit column - * @method array findByActivate(int $activate) Return ChildCoupon objects filtered by the activate column + * @method array findByType(string $type) Return ChildCoupon objects filtered by the type column + * @method array findByAmount(double $amount) Return ChildCoupon objects filtered by the amount column + * @method array findByIsUsed(int $is_used) Return ChildCoupon objects filtered by the is_used column + * @method array findByIsEnabled(int $is_enabled) Return ChildCoupon objects filtered by the is_enabled column + * @method array findByExpirationDate(string $expiration_date) Return ChildCoupon objects filtered by the expiration_date column + * @method array findBySerializedRules(string $serialized_rules) Return ChildCoupon objects filtered by the serialized_rules column + * @method array findByIsCumulative(int $is_cumulative) Return ChildCoupon objects filtered by the is_cumulative column + * @method array findByIsRemovingPostage(int $is_removing_postage) Return ChildCoupon objects filtered by the is_removing_postage column + * @method array findByMaxUsage(int $max_usage) Return ChildCoupon objects filtered by the max_usage column + * @method array findByIsAvailableOnSpecialOffers(boolean $is_available_on_special_offers) Return ChildCoupon objects filtered by the is_available_on_special_offers column * @method array findByCreatedAt(string $created_at) Return ChildCoupon objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildCoupon objects filtered by the updated_at column + * @method array findByVersion(int $version) Return ChildCoupon objects filtered by the version column * */ abstract class CouponQuery extends ModelCriteria { + // versionable behavior + + /** + * Whether the versioning is enabled + */ + static $isVersioningEnabled = true; + /** * Initializes internal state of \Thelia\Model\Base\CouponQuery object. * @@ -163,7 +195,7 @@ abstract class CouponQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, ACTION, VALUE, USED, AVAILABLE_SINCE, DATE_LIMIT, ACTIVATE, CREATED_AT, UPDATED_AT FROM coupon WHERE ID = :p0'; + $sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -323,45 +355,45 @@ abstract class CouponQuery extends ModelCriteria } /** - * Filter the query on the action column + * Filter the query on the type column * * Example usage: * - * $query->filterByAction('fooValue'); // WHERE action = 'fooValue' - * $query->filterByAction('%fooValue%'); // WHERE action LIKE '%fooValue%' + * $query->filterByType('fooValue'); // WHERE type = 'fooValue' + * $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%' * * - * @param string $action The value to use as filter. + * @param string $type The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildCouponQuery The current query, for fluid interface */ - public function filterByAction($action = null, $comparison = null) + public function filterByType($type = null, $comparison = null) { if (null === $comparison) { - if (is_array($action)) { + if (is_array($type)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $action)) { - $action = str_replace('*', '%', $action); + } elseif (preg_match('/[\%\*]/', $type)) { + $type = str_replace('*', '%', $type); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(CouponTableMap::ACTION, $action, $comparison); + return $this->addUsingAlias(CouponTableMap::TYPE, $type, $comparison); } /** - * Filter the query on the value column + * Filter the query on the amount column * * Example usage: * - * $query->filterByValue(1234); // WHERE value = 1234 - * $query->filterByValue(array(12, 34)); // WHERE value IN (12, 34) - * $query->filterByValue(array('min' => 12)); // WHERE value > 12 + * $query->filterByAmount(1234); // WHERE amount = 1234 + * $query->filterByAmount(array(12, 34)); // WHERE amount IN (12, 34) + * $query->filterByAmount(array('min' => 12)); // WHERE amount > 12 * * - * @param mixed $value The value to use as filter. + * @param mixed $amount The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @@ -369,16 +401,16 @@ abstract class CouponQuery extends ModelCriteria * * @return ChildCouponQuery The current query, for fluid interface */ - public function filterByValue($value = null, $comparison = null) + public function filterByAmount($amount = null, $comparison = null) { - if (is_array($value)) { + if (is_array($amount)) { $useMinMax = false; - if (isset($value['min'])) { - $this->addUsingAlias(CouponTableMap::VALUE, $value['min'], Criteria::GREATER_EQUAL); + if (isset($amount['min'])) { + $this->addUsingAlias(CouponTableMap::AMOUNT, $amount['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($value['max'])) { - $this->addUsingAlias(CouponTableMap::VALUE, $value['max'], Criteria::LESS_EQUAL); + if (isset($amount['max'])) { + $this->addUsingAlias(CouponTableMap::AMOUNT, $amount['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -389,20 +421,20 @@ abstract class CouponQuery extends ModelCriteria } } - return $this->addUsingAlias(CouponTableMap::VALUE, $value, $comparison); + return $this->addUsingAlias(CouponTableMap::AMOUNT, $amount, $comparison); } /** - * Filter the query on the used column + * Filter the query on the is_used column * * Example usage: * - * $query->filterByUsed(1234); // WHERE used = 1234 - * $query->filterByUsed(array(12, 34)); // WHERE used IN (12, 34) - * $query->filterByUsed(array('min' => 12)); // WHERE used > 12 + * $query->filterByIsUsed(1234); // WHERE is_used = 1234 + * $query->filterByIsUsed(array(12, 34)); // WHERE is_used IN (12, 34) + * $query->filterByIsUsed(array('min' => 12)); // WHERE is_used > 12 * * - * @param mixed $used The value to use as filter. + * @param mixed $isUsed The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @@ -410,16 +442,16 @@ abstract class CouponQuery extends ModelCriteria * * @return ChildCouponQuery The current query, for fluid interface */ - public function filterByUsed($used = null, $comparison = null) + public function filterByIsUsed($isUsed = null, $comparison = null) { - if (is_array($used)) { + if (is_array($isUsed)) { $useMinMax = false; - if (isset($used['min'])) { - $this->addUsingAlias(CouponTableMap::USED, $used['min'], Criteria::GREATER_EQUAL); + if (isset($isUsed['min'])) { + $this->addUsingAlias(CouponTableMap::IS_USED, $isUsed['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($used['max'])) { - $this->addUsingAlias(CouponTableMap::USED, $used['max'], Criteria::LESS_EQUAL); + if (isset($isUsed['max'])) { + $this->addUsingAlias(CouponTableMap::IS_USED, $isUsed['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -430,20 +462,61 @@ abstract class CouponQuery extends ModelCriteria } } - return $this->addUsingAlias(CouponTableMap::USED, $used, $comparison); + return $this->addUsingAlias(CouponTableMap::IS_USED, $isUsed, $comparison); } /** - * Filter the query on the available_since column + * Filter the query on the is_enabled column * * Example usage: * - * $query->filterByAvailableSince('2011-03-14'); // WHERE available_since = '2011-03-14' - * $query->filterByAvailableSince('now'); // WHERE available_since = '2011-03-14' - * $query->filterByAvailableSince(array('max' => 'yesterday')); // WHERE available_since > '2011-03-13' + * $query->filterByIsEnabled(1234); // WHERE is_enabled = 1234 + * $query->filterByIsEnabled(array(12, 34)); // WHERE is_enabled IN (12, 34) + * $query->filterByIsEnabled(array('min' => 12)); // WHERE is_enabled > 12 * * - * @param mixed $availableSince The value to use as filter. + * @param mixed $isEnabled The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponQuery The current query, for fluid interface + */ + public function filterByIsEnabled($isEnabled = null, $comparison = null) + { + if (is_array($isEnabled)) { + $useMinMax = false; + if (isset($isEnabled['min'])) { + $this->addUsingAlias(CouponTableMap::IS_ENABLED, $isEnabled['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($isEnabled['max'])) { + $this->addUsingAlias(CouponTableMap::IS_ENABLED, $isEnabled['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponTableMap::IS_ENABLED, $isEnabled, $comparison); + } + + /** + * Filter the query on the expiration_date column + * + * Example usage: + * + * $query->filterByExpirationDate('2011-03-14'); // WHERE expiration_date = '2011-03-14' + * $query->filterByExpirationDate('now'); // WHERE expiration_date = '2011-03-14' + * $query->filterByExpirationDate(array('max' => 'yesterday')); // WHERE expiration_date > '2011-03-13' + * + * + * @param mixed $expirationDate The value to use as filter. * Values can be integers (unix timestamps), DateTime objects, or strings. * Empty strings are treated as NULL. * Use scalar values for equality. @@ -453,16 +526,16 @@ abstract class CouponQuery extends ModelCriteria * * @return ChildCouponQuery The current query, for fluid interface */ - public function filterByAvailableSince($availableSince = null, $comparison = null) + public function filterByExpirationDate($expirationDate = null, $comparison = null) { - if (is_array($availableSince)) { + if (is_array($expirationDate)) { $useMinMax = false; - if (isset($availableSince['min'])) { - $this->addUsingAlias(CouponTableMap::AVAILABLE_SINCE, $availableSince['min'], Criteria::GREATER_EQUAL); + if (isset($expirationDate['min'])) { + $this->addUsingAlias(CouponTableMap::EXPIRATION_DATE, $expirationDate['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($availableSince['max'])) { - $this->addUsingAlias(CouponTableMap::AVAILABLE_SINCE, $availableSince['max'], Criteria::LESS_EQUAL); + if (isset($expirationDate['max'])) { + $this->addUsingAlias(CouponTableMap::EXPIRATION_DATE, $expirationDate['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -473,22 +546,49 @@ abstract class CouponQuery extends ModelCriteria } } - return $this->addUsingAlias(CouponTableMap::AVAILABLE_SINCE, $availableSince, $comparison); + return $this->addUsingAlias(CouponTableMap::EXPIRATION_DATE, $expirationDate, $comparison); } /** - * Filter the query on the date_limit column + * Filter the query on the serialized_rules column * * Example usage: * - * $query->filterByDateLimit('2011-03-14'); // WHERE date_limit = '2011-03-14' - * $query->filterByDateLimit('now'); // WHERE date_limit = '2011-03-14' - * $query->filterByDateLimit(array('max' => 'yesterday')); // WHERE date_limit > '2011-03-13' + * $query->filterBySerializedRules('fooValue'); // WHERE serialized_rules = 'fooValue' + * $query->filterBySerializedRules('%fooValue%'); // WHERE serialized_rules LIKE '%fooValue%' * * - * @param mixed $dateLimit The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. + * @param string $serializedRules The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponQuery The current query, for fluid interface + */ + public function filterBySerializedRules($serializedRules = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($serializedRules)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $serializedRules)) { + $serializedRules = str_replace('*', '%', $serializedRules); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponTableMap::SERIALIZED_RULES, $serializedRules, $comparison); + } + + /** + * Filter the query on the is_cumulative column + * + * Example usage: + * + * $query->filterByIsCumulative(1234); // WHERE is_cumulative = 1234 + * $query->filterByIsCumulative(array(12, 34)); // WHERE is_cumulative IN (12, 34) + * $query->filterByIsCumulative(array('min' => 12)); // WHERE is_cumulative > 12 + * + * + * @param mixed $isCumulative The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @@ -496,16 +596,16 @@ abstract class CouponQuery extends ModelCriteria * * @return ChildCouponQuery The current query, for fluid interface */ - public function filterByDateLimit($dateLimit = null, $comparison = null) + public function filterByIsCumulative($isCumulative = null, $comparison = null) { - if (is_array($dateLimit)) { + if (is_array($isCumulative)) { $useMinMax = false; - if (isset($dateLimit['min'])) { - $this->addUsingAlias(CouponTableMap::DATE_LIMIT, $dateLimit['min'], Criteria::GREATER_EQUAL); + if (isset($isCumulative['min'])) { + $this->addUsingAlias(CouponTableMap::IS_CUMULATIVE, $isCumulative['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($dateLimit['max'])) { - $this->addUsingAlias(CouponTableMap::DATE_LIMIT, $dateLimit['max'], Criteria::LESS_EQUAL); + if (isset($isCumulative['max'])) { + $this->addUsingAlias(CouponTableMap::IS_CUMULATIVE, $isCumulative['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -516,20 +616,20 @@ abstract class CouponQuery extends ModelCriteria } } - return $this->addUsingAlias(CouponTableMap::DATE_LIMIT, $dateLimit, $comparison); + return $this->addUsingAlias(CouponTableMap::IS_CUMULATIVE, $isCumulative, $comparison); } /** - * Filter the query on the activate column + * Filter the query on the is_removing_postage column * * Example usage: * - * $query->filterByActivate(1234); // WHERE activate = 1234 - * $query->filterByActivate(array(12, 34)); // WHERE activate IN (12, 34) - * $query->filterByActivate(array('min' => 12)); // WHERE activate > 12 + * $query->filterByIsRemovingPostage(1234); // WHERE is_removing_postage = 1234 + * $query->filterByIsRemovingPostage(array(12, 34)); // WHERE is_removing_postage IN (12, 34) + * $query->filterByIsRemovingPostage(array('min' => 12)); // WHERE is_removing_postage > 12 * * - * @param mixed $activate The value to use as filter. + * @param mixed $isRemovingPostage The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @@ -537,16 +637,16 @@ abstract class CouponQuery extends ModelCriteria * * @return ChildCouponQuery The current query, for fluid interface */ - public function filterByActivate($activate = null, $comparison = null) + public function filterByIsRemovingPostage($isRemovingPostage = null, $comparison = null) { - if (is_array($activate)) { + if (is_array($isRemovingPostage)) { $useMinMax = false; - if (isset($activate['min'])) { - $this->addUsingAlias(CouponTableMap::ACTIVATE, $activate['min'], Criteria::GREATER_EQUAL); + if (isset($isRemovingPostage['min'])) { + $this->addUsingAlias(CouponTableMap::IS_REMOVING_POSTAGE, $isRemovingPostage['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($activate['max'])) { - $this->addUsingAlias(CouponTableMap::ACTIVATE, $activate['max'], Criteria::LESS_EQUAL); + if (isset($isRemovingPostage['max'])) { + $this->addUsingAlias(CouponTableMap::IS_REMOVING_POSTAGE, $isRemovingPostage['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -557,7 +657,75 @@ abstract class CouponQuery extends ModelCriteria } } - return $this->addUsingAlias(CouponTableMap::ACTIVATE, $activate, $comparison); + return $this->addUsingAlias(CouponTableMap::IS_REMOVING_POSTAGE, $isRemovingPostage, $comparison); + } + + /** + * Filter the query on the max_usage column + * + * Example usage: + * + * $query->filterByMaxUsage(1234); // WHERE max_usage = 1234 + * $query->filterByMaxUsage(array(12, 34)); // WHERE max_usage IN (12, 34) + * $query->filterByMaxUsage(array('min' => 12)); // WHERE max_usage > 12 + * + * + * @param mixed $maxUsage The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponQuery The current query, for fluid interface + */ + public function filterByMaxUsage($maxUsage = null, $comparison = null) + { + if (is_array($maxUsage)) { + $useMinMax = false; + if (isset($maxUsage['min'])) { + $this->addUsingAlias(CouponTableMap::MAX_USAGE, $maxUsage['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($maxUsage['max'])) { + $this->addUsingAlias(CouponTableMap::MAX_USAGE, $maxUsage['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponTableMap::MAX_USAGE, $maxUsage, $comparison); + } + + /** + * Filter the query on the is_available_on_special_offers column + * + * Example usage: + * + * $query->filterByIsAvailableOnSpecialOffers(true); // WHERE is_available_on_special_offers = true + * $query->filterByIsAvailableOnSpecialOffers('yes'); // WHERE is_available_on_special_offers = true + * + * + * @param boolean|string $isAvailableOnSpecialOffers The value to use as filter. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponQuery The current query, for fluid interface + */ + public function filterByIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers = null, $comparison = null) + { + if (is_string($isAvailableOnSpecialOffers)) { + $is_available_on_special_offers = in_array(strtolower($isAvailableOnSpecialOffers), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } + + return $this->addUsingAlias(CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, $isAvailableOnSpecialOffers, $comparison); } /** @@ -647,40 +815,81 @@ abstract class CouponQuery extends ModelCriteria } /** - * Filter the query by a related \Thelia\Model\CouponRule object + * Filter the query on the version column * - * @param \Thelia\Model\CouponRule|ObjectCollection $couponRule the related object to use as filter + * Example usage: + * + * $query->filterByVersion(1234); // WHERE version = 1234 + * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34) + * $query->filterByVersion(array('min' => 12)); // WHERE version > 12 + * + * + * @param mixed $version The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponQuery The current query, for fluid interface + */ + public function filterByVersion($version = null, $comparison = null) + { + if (is_array($version)) { + $useMinMax = false; + if (isset($version['min'])) { + $this->addUsingAlias(CouponTableMap::VERSION, $version['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($version['max'])) { + $this->addUsingAlias(CouponTableMap::VERSION, $version['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponTableMap::VERSION, $version, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\CouponI18n object + * + * @param \Thelia\Model\CouponI18n|ObjectCollection $couponI18n the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildCouponQuery The current query, for fluid interface */ - public function filterByCouponRule($couponRule, $comparison = null) + public function filterByCouponI18n($couponI18n, $comparison = null) { - if ($couponRule instanceof \Thelia\Model\CouponRule) { + if ($couponI18n instanceof \Thelia\Model\CouponI18n) { return $this - ->addUsingAlias(CouponTableMap::ID, $couponRule->getCouponId(), $comparison); - } elseif ($couponRule instanceof ObjectCollection) { + ->addUsingAlias(CouponTableMap::ID, $couponI18n->getId(), $comparison); + } elseif ($couponI18n instanceof ObjectCollection) { return $this - ->useCouponRuleQuery() - ->filterByPrimaryKeys($couponRule->getPrimaryKeys()) + ->useCouponI18nQuery() + ->filterByPrimaryKeys($couponI18n->getPrimaryKeys()) ->endUse(); } else { - throw new PropelException('filterByCouponRule() only accepts arguments of type \Thelia\Model\CouponRule or Collection'); + throw new PropelException('filterByCouponI18n() only accepts arguments of type \Thelia\Model\CouponI18n or Collection'); } } /** - * Adds a JOIN clause to the query using the CouponRule relation + * Adds a JOIN clause to the query using the CouponI18n relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * * @return ChildCouponQuery The current query, for fluid interface */ - public function joinCouponRule($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinCouponI18n($relationAlias = null, $joinType = 'LEFT JOIN') { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CouponRule'); + $relationMap = $tableMap->getRelation('CouponI18n'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -695,14 +904,14 @@ abstract class CouponQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'CouponRule'); + $this->addJoinObject($join, 'CouponI18n'); } return $this; } /** - * Use the CouponRule relation CouponRule object + * Use the CouponI18n relation CouponI18n object * * @see useQuery() * @@ -710,13 +919,86 @@ abstract class CouponQuery extends ModelCriteria * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return \Thelia\Model\CouponRuleQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\CouponI18nQuery A secondary query class using the current class as primary query */ - public function useCouponRuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function useCouponI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') { return $this - ->joinCouponRule($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CouponRule', '\Thelia\Model\CouponRuleQuery'); + ->joinCouponI18n($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CouponI18n', '\Thelia\Model\CouponI18nQuery'); + } + + /** + * Filter the query by a related \Thelia\Model\CouponVersion object + * + * @param \Thelia\Model\CouponVersion|ObjectCollection $couponVersion the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponQuery The current query, for fluid interface + */ + public function filterByCouponVersion($couponVersion, $comparison = null) + { + if ($couponVersion instanceof \Thelia\Model\CouponVersion) { + return $this + ->addUsingAlias(CouponTableMap::ID, $couponVersion->getId(), $comparison); + } elseif ($couponVersion instanceof ObjectCollection) { + return $this + ->useCouponVersionQuery() + ->filterByPrimaryKeys($couponVersion->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByCouponVersion() only accepts arguments of type \Thelia\Model\CouponVersion or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the CouponVersion relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildCouponQuery The current query, for fluid interface + */ + public function joinCouponVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CouponVersion'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CouponVersion'); + } + + return $this; + } + + /** + * Use the CouponVersion relation CouponVersion object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\CouponVersionQuery A secondary query class using the current class as primary query + */ + public function useCouponVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCouponVersion($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CouponVersion', '\Thelia\Model\CouponVersionQuery'); } /** @@ -876,4 +1158,89 @@ abstract class CouponQuery extends ModelCriteria return $this->addAscendingOrderByColumn(CouponTableMap::CREATED_AT); } + // i18n behavior + + /** + * Adds a JOIN clause to the query using the i18n relation + * + * @param string $locale Locale to use for the join condition, e.g. 'fr_FR' + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join. + * + * @return ChildCouponQuery The current query, for fluid interface + */ + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $relationName = $relationAlias ? $relationAlias : 'CouponI18n'; + + return $this + ->joinCouponI18n($relationAlias, $joinType) + ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale); + } + + /** + * Adds a JOIN clause to the query and hydrates the related I18n object. + * Shortcut for $c->joinI18n($locale)->with() + * + * @param string $locale Locale to use for the join condition, e.g. 'fr_FR' + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join. + * + * @return ChildCouponQuery The current query, for fluid interface + */ + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) + { + $this + ->joinI18n($locale, null, $joinType) + ->with('CouponI18n'); + $this->with['CouponI18n']->setIsWithOneToMany(false); + + return $this; + } + + /** + * Use the I18n relation query object + * + * @see useQuery() + * + * @param string $locale Locale to use for the join condition, e.g. 'fr_FR' + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join. + * + * @return ChildCouponI18nQuery A secondary query class using the current class as primary query + */ + public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinI18n($locale, $relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CouponI18n', '\Thelia\Model\CouponI18nQuery'); + } + + // versionable behavior + + /** + * Checks whether versioning is enabled + * + * @return boolean + */ + static public function isVersioningEnabled() + { + return self::$isVersioningEnabled; + } + + /** + * Enables versioning + */ + static public function enableVersioning() + { + self::$isVersioningEnabled = true; + } + + /** + * Disables versioning + */ + static public function disableVersioning() + { + self::$isVersioningEnabled = false; + } + } // CouponQuery diff --git a/core/lib/Thelia/Model/Base/CouponRuleQuery.php b/core/lib/Thelia/Model/Base/CouponRuleQuery.php deleted file mode 100644 index 0789f84d6..000000000 --- a/core/lib/Thelia/Model/Base/CouponRuleQuery.php +++ /dev/null @@ -1,744 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con an optional connection object - * - * @return ChildCouponRule|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = CouponRuleTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is already in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(CouponRuleTableMap::DATABASE_NAME); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object - * - * @return ChildCouponRule A model object, or null if the key is not found - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT ID, COUPON_ID, CONTROLLER, OPERATION, VALUE, CREATED_AT, UPDATED_AT FROM coupon_rule WHERE ID = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); - } - $obj = null; - if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new ChildCouponRule(); - $obj->hydrate($row); - CouponRuleTableMap::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object - * - * @return ChildCouponRule|array|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $dataFetcher = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object - * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if (null === $con) { - $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $dataFetcher = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($dataFetcher); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(CouponRuleTableMap::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(CouponRuleTableMap::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id)) { - $useMinMax = false; - if (isset($id['min'])) { - $this->addUsingAlias(CouponRuleTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($id['max'])) { - $this->addUsingAlias(CouponRuleTableMap::ID, $id['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CouponRuleTableMap::ID, $id, $comparison); - } - - /** - * Filter the query on the coupon_id column - * - * Example usage: - * - * $query->filterByCouponId(1234); // WHERE coupon_id = 1234 - * $query->filterByCouponId(array(12, 34)); // WHERE coupon_id IN (12, 34) - * $query->filterByCouponId(array('min' => 12)); // WHERE coupon_id > 12 - * - * - * @see filterByCoupon() - * - * @param mixed $couponId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function filterByCouponId($couponId = null, $comparison = null) - { - if (is_array($couponId)) { - $useMinMax = false; - if (isset($couponId['min'])) { - $this->addUsingAlias(CouponRuleTableMap::COUPON_ID, $couponId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($couponId['max'])) { - $this->addUsingAlias(CouponRuleTableMap::COUPON_ID, $couponId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CouponRuleTableMap::COUPON_ID, $couponId, $comparison); - } - - /** - * Filter the query on the controller column - * - * Example usage: - * - * $query->filterByController('fooValue'); // WHERE controller = 'fooValue' - * $query->filterByController('%fooValue%'); // WHERE controller LIKE '%fooValue%' - * - * - * @param string $controller The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function filterByController($controller = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($controller)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $controller)) { - $controller = str_replace('*', '%', $controller); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponRuleTableMap::CONTROLLER, $controller, $comparison); - } - - /** - * Filter the query on the operation column - * - * Example usage: - * - * $query->filterByOperation('fooValue'); // WHERE operation = 'fooValue' - * $query->filterByOperation('%fooValue%'); // WHERE operation LIKE '%fooValue%' - * - * - * @param string $operation The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function filterByOperation($operation = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($operation)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $operation)) { - $operation = str_replace('*', '%', $operation); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponRuleTableMap::OPERATION, $operation, $comparison); - } - - /** - * Filter the query on the value column - * - * Example usage: - * - * $query->filterByValue(1234); // WHERE value = 1234 - * $query->filterByValue(array(12, 34)); // WHERE value IN (12, 34) - * $query->filterByValue(array('min' => 12)); // WHERE value > 12 - * - * - * @param mixed $value The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function filterByValue($value = null, $comparison = null) - { - if (is_array($value)) { - $useMinMax = false; - if (isset($value['min'])) { - $this->addUsingAlias(CouponRuleTableMap::VALUE, $value['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($value['max'])) { - $this->addUsingAlias(CouponRuleTableMap::VALUE, $value['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CouponRuleTableMap::VALUE, $value, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(CouponRuleTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(CouponRuleTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CouponRuleTableMap::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(CouponRuleTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(CouponRuleTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(CouponRuleTableMap::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related \Thelia\Model\Coupon object - * - * @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function filterByCoupon($coupon, $comparison = null) - { - if ($coupon instanceof \Thelia\Model\Coupon) { - return $this - ->addUsingAlias(CouponRuleTableMap::COUPON_ID, $coupon->getId(), $comparison); - } elseif ($coupon instanceof ObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(CouponRuleTableMap::COUPON_ID, $coupon->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Coupon relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function joinCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Coupon'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Coupon'); - } - - return $this; - } - - /** - * Use the Coupon relation Coupon object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\CouponQuery A secondary query class using the current class as primary query - */ - public function useCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinCoupon($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery'); - } - - /** - * Exclude object from result - * - * @param ChildCouponRule $couponRule Object to remove from the list of results - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function prune($couponRule = null) - { - if ($couponRule) { - $this->addUsingAlias(CouponRuleTableMap::ID, $couponRule->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - /** - * Deletes all rows from the coupon_rule table. - * - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - */ - public function doDeleteAll(ConnectionInterface $con = null) - { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponRuleTableMap::DATABASE_NAME); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += parent::doDeleteAll($con); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - CouponRuleTableMap::clearInstancePool(); - CouponRuleTableMap::clearRelatedInstancePool(); - - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $affectedRows; - } - - /** - * Performs a DELETE on the database, given a ChildCouponRule or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or ChildCouponRule object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public function delete(ConnectionInterface $con = null) - { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponRuleTableMap::DATABASE_NAME); - } - - $criteria = $this; - - // Set the correct dbName - $criteria->setDbName(CouponRuleTableMap::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - - CouponRuleTableMap::removeInstanceFromPool($criteria); - - $affectedRows += ModelCriteria::delete($con); - CouponRuleTableMap::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(CouponRuleTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(CouponRuleTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(CouponRuleTableMap::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(CouponRuleTableMap::UPDATED_AT); - } - - /** - * Order by create date desc - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(CouponRuleTableMap::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return ChildCouponRuleQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(CouponRuleTableMap::CREATED_AT); - } - -} // CouponRuleQuery diff --git a/core/lib/Thelia/Model/Base/CouponVersion.php b/core/lib/Thelia/Model/Base/CouponVersion.php new file mode 100644 index 000000000..efa4898f4 --- /dev/null +++ b/core/lib/Thelia/Model/Base/CouponVersion.php @@ -0,0 +1,2007 @@ +version = 0; + } + + /** + * Initializes internal state of Thelia\Model\Base\CouponVersion object. + * @see applyDefaults() + */ + public function __construct() + { + $this->applyDefaultValues(); + } + + /** + * Returns whether the object has been modified. + * + * @return boolean True if the object has been modified. + */ + public function isModified() + { + return !empty($this->modifiedColumns); + } + + /** + * Has specified column been modified? + * + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return boolean True if $col has been modified. + */ + public function isColumnModified($col) + { + return in_array($col, $this->modifiedColumns); + } + + /** + * Get the columns that have been modified in this object. + * @return array A unique list of the modified column names for this object. + */ + public function getModifiedColumns() + { + return array_unique($this->modifiedColumns); + } + + /** + * Returns whether the object has ever been saved. This will + * be false, if the object was retrieved from storage or was created + * and then saved. + * + * @return true, if the object has never been persisted. + */ + public function isNew() + { + return $this->new; + } + + /** + * Setter for the isNew attribute. This method will be called + * by Propel-generated children and objects. + * + * @param boolean $b the state of the object. + */ + public function setNew($b) + { + $this->new = (Boolean) $b; + } + + /** + * Whether this object has been deleted. + * @return boolean The deleted state of this object. + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Specify whether this object has been deleted. + * @param boolean $b The deleted state of this object. + * @return void + */ + public function setDeleted($b) + { + $this->deleted = (Boolean) $b; + } + + /** + * Sets the modified state for the object to be false. + * @param string $col If supplied, only the specified column is reset. + * @return void + */ + public function resetModified($col = null) + { + if (null !== $col) { + while (false !== ($offset = array_search($col, $this->modifiedColumns))) { + array_splice($this->modifiedColumns, $offset, 1); + } + } else { + $this->modifiedColumns = array(); + } + } + + /** + * Compares this with another CouponVersion instance. If + * 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. + */ + public function equals($obj) + { + $thisclazz = get_class($this); + if (!is_object($obj) || !($obj instanceof $thisclazz)) { + return false; + } + + if ($this === $obj) { + return true; + } + + if (null === $this->getPrimaryKey() + || null === $obj->getPrimaryKey()) { + return false; + } + + return $this->getPrimaryKey() === $obj->getPrimaryKey(); + } + + /** + * If the primary key is not null, return the hashcode of the + * primary key. Otherwise, return the hash code of the object. + * + * @return int Hashcode + */ + public function hashCode() + { + if (null !== $this->getPrimaryKey()) { + return crc32(serialize($this->getPrimaryKey())); + } + + return crc32(serialize(clone $this)); + } + + /** + * Get the associative array of the virtual columns in this object + * + * @param string $name The virtual column name + * + * @return array + */ + public function getVirtualColumns() + { + return $this->virtualColumns; + } + + /** + * Checks the existence of a virtual column in this object + * + * @return boolean + */ + public function hasVirtualColumn($name) + { + return array_key_exists($name, $this->virtualColumns); + } + + /** + * Get the value of a virtual column in this object + * + * @return mixed + */ + public function getVirtualColumn($name) + { + if (!$this->hasVirtualColumn($name)) { + throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + } + + return $this->virtualColumns[$name]; + } + + /** + * Set the value of a virtual column in this object + * + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column + * + * @return CouponVersion The current object, for fluid interface + */ + public function setVirtualColumn($name, $value) + { + $this->virtualColumns[$name] = $value; + + return $this; + } + + /** + * Logs a message using Propel::log(). + * + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return boolean + */ + protected function log($msg, $priority = Propel::LOG_INFO) + { + return Propel::log(get_class($this) . ': ' . $msg, $priority); + } + + /** + * Populate the current object from a string, using a given parser format + * + * $book = new Book(); + * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, + * or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param string $data The source data to import from + * + * @return CouponVersion The current object, for fluid interface + */ + public function importFrom($parser, $data) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + } + + /** + * Export the current object properties to a string, using a given parser format + * + * $book = BookQuery::create()->findPk(9012); + * echo $book->exportTo('JSON'); + * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @return string The exported data + */ + public function exportTo($parser, $includeLazyLoadColumns = true) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + } + + /** + * Clean up internal collections prior to serializing + * Avoids recursive loops that turn into segmentation faults when serializing + */ + public function __sleep() + { + $this->clearAllReferences(); + + return array_keys(get_object_vars($this)); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + + return $this->id; + } + + /** + * Get the [code] column value. + * + * @return string + */ + public function getCode() + { + + return $this->code; + } + + /** + * Get the [type] column value. + * + * @return string + */ + public function getType() + { + + return $this->type; + } + + /** + * Get the [amount] column value. + * + * @return double + */ + public function getAmount() + { + + return $this->amount; + } + + /** + * Get the [is_used] column value. + * + * @return int + */ + public function getIsUsed() + { + + return $this->is_used; + } + + /** + * Get the [is_enabled] column value. + * + * @return int + */ + public function getIsEnabled() + { + + return $this->is_enabled; + } + + /** + * Get the [optionally formatted] temporal [expiration_date] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw \DateTime object will be returned. + * + * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getExpirationDate($format = NULL) + { + if ($format === null) { + return $this->expiration_date; + } else { + return $this->expiration_date !== null ? $this->expiration_date->format($format) : null; + } + } + + /** + * Get the [serialized_rules] column value. + * + * @return string + */ + public function getSerializedRules() + { + + return $this->serialized_rules; + } + + /** + * Get the [is_cumulative] column value. + * + * @return int + */ + public function getIsCumulative() + { + + return $this->is_cumulative; + } + + /** + * Get the [is_removing_postage] column value. + * + * @return int + */ + public function getIsRemovingPostage() + { + + return $this->is_removing_postage; + } + + /** + * Get the [max_usage] column value. + * + * @return int + */ + public function getMaxUsage() + { + + return $this->max_usage; + } + + /** + * Get the [is_available_on_special_offers] column value. + * + * @return boolean + */ + public function getIsAvailableOnSpecialOffers() + { + + return $this->is_available_on_special_offers; + } + + /** + * Get the [optionally formatted] temporal [created_at] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw \DateTime object will be returned. + * + * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getCreatedAt($format = NULL) + { + if ($format === null) { + return $this->created_at; + } else { + return $this->created_at !== null ? $this->created_at->format($format) : null; + } + } + + /** + * Get the [optionally formatted] temporal [updated_at] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw \DateTime object will be returned. + * + * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getUpdatedAt($format = NULL) + { + if ($format === null) { + return $this->updated_at; + } else { + return $this->updated_at !== null ? $this->updated_at->format($format) : null; + } + } + + /** + * Get the [version] column value. + * + * @return int + */ + public function getVersion() + { + + return $this->version; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CouponVersionTableMap::ID; + } + + if ($this->aCoupon !== null && $this->aCoupon->getId() !== $v) { + $this->aCoupon = null; + } + + + return $this; + } // setId() + + /** + * Set the value of [code] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setCode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->code !== $v) { + $this->code = $v; + $this->modifiedColumns[] = CouponVersionTableMap::CODE; + } + + + return $this; + } // setCode() + + /** + * Set the value of [type] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = CouponVersionTableMap::TYPE; + } + + + return $this; + } // setType() + + /** + * Set the value of [amount] column. + * + * @param double $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setAmount($v) + { + if ($v !== null) { + $v = (double) $v; + } + + if ($this->amount !== $v) { + $this->amount = $v; + $this->modifiedColumns[] = CouponVersionTableMap::AMOUNT; + } + + + return $this; + } // setAmount() + + /** + * Set the value of [is_used] column. + * + * @param int $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setIsUsed($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->is_used !== $v) { + $this->is_used = $v; + $this->modifiedColumns[] = CouponVersionTableMap::IS_USED; + } + + + return $this; + } // setIsUsed() + + /** + * Set the value of [is_enabled] column. + * + * @param int $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setIsEnabled($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->is_enabled !== $v) { + $this->is_enabled = $v; + $this->modifiedColumns[] = CouponVersionTableMap::IS_ENABLED; + } + + + return $this; + } // setIsEnabled() + + /** + * Sets the value of [expiration_date] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or \DateTime value. + * Empty strings are treated as NULL. + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setExpirationDate($v) + { + $dt = PropelDateTime::newInstance($v, null, '\DateTime'); + if ($this->expiration_date !== null || $dt !== null) { + if ($dt !== $this->expiration_date) { + $this->expiration_date = $dt; + $this->modifiedColumns[] = CouponVersionTableMap::EXPIRATION_DATE; + } + } // if either are not null + + + return $this; + } // setExpirationDate() + + /** + * Set the value of [serialized_rules] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setSerializedRules($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->serialized_rules !== $v) { + $this->serialized_rules = $v; + $this->modifiedColumns[] = CouponVersionTableMap::SERIALIZED_RULES; + } + + + return $this; + } // setSerializedRules() + + /** + * Set the value of [is_cumulative] column. + * + * @param int $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setIsCumulative($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->is_cumulative !== $v) { + $this->is_cumulative = $v; + $this->modifiedColumns[] = CouponVersionTableMap::IS_CUMULATIVE; + } + + + return $this; + } // setIsCumulative() + + /** + * Set the value of [is_removing_postage] column. + * + * @param int $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setIsRemovingPostage($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->is_removing_postage !== $v) { + $this->is_removing_postage = $v; + $this->modifiedColumns[] = CouponVersionTableMap::IS_REMOVING_POSTAGE; + } + + + return $this; + } // setIsRemovingPostage() + + /** + * Set the value of [max_usage] column. + * + * @param int $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setMaxUsage($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->max_usage !== $v) { + $this->max_usage = $v; + $this->modifiedColumns[] = CouponVersionTableMap::MAX_USAGE; + } + + + return $this; + } // setMaxUsage() + + /** + * Sets the value of the [is_available_on_special_offers] column. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * + * @param boolean|integer|string $v The new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setIsAvailableOnSpecialOffers($v) + { + if ($v !== null) { + if (is_string($v)) { + $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } else { + $v = (boolean) $v; + } + } + + if ($this->is_available_on_special_offers !== $v) { + $this->is_available_on_special_offers = $v; + $this->modifiedColumns[] = CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS; + } + + + return $this; + } // setIsAvailableOnSpecialOffers() + + /** + * Sets the value of [created_at] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or \DateTime value. + * Empty strings are treated as NULL. + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setCreatedAt($v) + { + $dt = PropelDateTime::newInstance($v, null, '\DateTime'); + if ($this->created_at !== null || $dt !== null) { + if ($dt !== $this->created_at) { + $this->created_at = $dt; + $this->modifiedColumns[] = CouponVersionTableMap::CREATED_AT; + } + } // if either are not null + + + return $this; + } // setCreatedAt() + + /** + * Sets the value of [updated_at] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or \DateTime value. + * Empty strings are treated as NULL. + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setUpdatedAt($v) + { + $dt = PropelDateTime::newInstance($v, null, '\DateTime'); + if ($this->updated_at !== null || $dt !== null) { + if ($dt !== $this->updated_at) { + $this->updated_at = $dt; + $this->modifiedColumns[] = CouponVersionTableMap::UPDATED_AT; + } + } // if either are not null + + + return $this; + } // setUpdatedAt() + + /** + * Set the value of [version] column. + * + * @param int $v new value + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + */ + public function setVersion($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->version !== $v) { + $this->version = $v; + $this->modifiedColumns[] = CouponVersionTableMap::VERSION; + } + + + return $this; + } // setVersion() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->version !== 0) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + { + try { + + + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : CouponVersionTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponVersionTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; + $this->code = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponVersionTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)]; + $this->type = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponVersionTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; + $this->amount = (null !== $col) ? (double) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponVersionTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_used = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponVersionTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_enabled = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponVersionTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; + if ($col === '0000-00-00 00:00:00') { + $col = null; + } + $this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponVersionTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)]; + $this->serialized_rules = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponVersionTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_cumulative = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponVersionTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_removing_postage = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponVersionTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->max_usage = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponVersionTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_available_on_special_offers = (null !== $col) ? (boolean) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + if ($col === '0000-00-00 00:00:00') { + $col = null; + } + $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + if ($col === '0000-00-00 00:00:00') { + $col = null; + } + $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $this->version = (null !== $col) ? (int) $col : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 15; // 15 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \Thelia\Model\CouponVersion object", 0, $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + if ($this->aCoupon !== null && $this->id !== $this->aCoupon->getId()) { + $this->aCoupon = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(CouponVersionTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildCouponVersionQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $row = $dataFetcher->fetch(); + $dataFetcher->close(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCoupon = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see CouponVersion::setDeleted() + * @see CouponVersion::isDeleted() + */ + public function delete(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponVersionTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildCouponVersionQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponVersionTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CouponVersionTableMap::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(ConnectionInterface $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCoupon !== null) { + if ($this->aCoupon->isModified() || $this->aCoupon->isNew()) { + $affectedRows += $this->aCoupon->save($con); + } + $this->setCoupon($this->aCoupon); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param ConnectionInterface $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(ConnectionInterface $con) + { + $modifiedColumns = array(); + $index = 0; + + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(CouponVersionTableMap::ID)) { + $modifiedColumns[':p' . $index++] = 'ID'; + } + if ($this->isColumnModified(CouponVersionTableMap::CODE)) { + $modifiedColumns[':p' . $index++] = 'CODE'; + } + if ($this->isColumnModified(CouponVersionTableMap::TYPE)) { + $modifiedColumns[':p' . $index++] = 'TYPE'; + } + if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) { + $modifiedColumns[':p' . $index++] = 'AMOUNT'; + } + if ($this->isColumnModified(CouponVersionTableMap::IS_USED)) { + $modifiedColumns[':p' . $index++] = 'IS_USED'; + } + if ($this->isColumnModified(CouponVersionTableMap::IS_ENABLED)) { + $modifiedColumns[':p' . $index++] = 'IS_ENABLED'; + } + if ($this->isColumnModified(CouponVersionTableMap::EXPIRATION_DATE)) { + $modifiedColumns[':p' . $index++] = 'EXPIRATION_DATE'; + } + if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_RULES)) { + $modifiedColumns[':p' . $index++] = 'SERIALIZED_RULES'; + } + if ($this->isColumnModified(CouponVersionTableMap::IS_CUMULATIVE)) { + $modifiedColumns[':p' . $index++] = 'IS_CUMULATIVE'; + } + if ($this->isColumnModified(CouponVersionTableMap::IS_REMOVING_POSTAGE)) { + $modifiedColumns[':p' . $index++] = 'IS_REMOVING_POSTAGE'; + } + if ($this->isColumnModified(CouponVersionTableMap::MAX_USAGE)) { + $modifiedColumns[':p' . $index++] = 'MAX_USAGE'; + } + if ($this->isColumnModified(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) { + $modifiedColumns[':p' . $index++] = 'IS_AVAILABLE_ON_SPECIAL_OFFERS'; + } + if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) { + $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + } + if ($this->isColumnModified(CouponVersionTableMap::UPDATED_AT)) { + $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + } + if ($this->isColumnModified(CouponVersionTableMap::VERSION)) { + $modifiedColumns[':p' . $index++] = 'VERSION'; + } + + $sql = sprintf( + 'INSERT INTO coupon_version (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case 'ID': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; + case 'CODE': + $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); + break; + case 'TYPE': + $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); + break; + case 'AMOUNT': + $stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR); + break; + case 'IS_USED': + $stmt->bindValue($identifier, $this->is_used, PDO::PARAM_INT); + break; + case 'IS_ENABLED': + $stmt->bindValue($identifier, $this->is_enabled, PDO::PARAM_INT); + break; + case 'EXPIRATION_DATE': + $stmt->bindValue($identifier, $this->expiration_date ? $this->expiration_date->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); + break; + case 'SERIALIZED_RULES': + $stmt->bindValue($identifier, $this->serialized_rules, PDO::PARAM_STR); + break; + case 'IS_CUMULATIVE': + $stmt->bindValue($identifier, $this->is_cumulative, PDO::PARAM_INT); + break; + case 'IS_REMOVING_POSTAGE': + $stmt->bindValue($identifier, $this->is_removing_postage, PDO::PARAM_INT); + break; + case 'MAX_USAGE': + $stmt->bindValue($identifier, $this->max_usage, PDO::PARAM_INT); + break; + case 'IS_AVAILABLE_ON_SPECIAL_OFFERS': + $stmt->bindValue($identifier, (int) $this->is_available_on_special_offers, PDO::PARAM_INT); + break; + case 'CREATED_AT': + $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); + break; + case 'UPDATED_AT': + $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); + break; + case 'VERSION': + $stmt->bindValue($identifier, $this->version, PDO::PARAM_INT); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); + } + + $this->setNew(false); + } + + /** + * Update the row in the database. + * + * @param ConnectionInterface $con + * + * @return Integer Number of updated rows + * @see doSave() + */ + protected function doUpdate(ConnectionInterface $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + + return $selectCriteria->doUpdate($valuesCriteria, $con); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return mixed Value of field. + */ + public function getByName($name, $type = TableMap::TYPE_PHPNAME) + { + $pos = CouponVersionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getCode(); + break; + case 2: + return $this->getType(); + break; + case 3: + return $this->getAmount(); + break; + case 4: + return $this->getIsUsed(); + break; + case 5: + return $this->getIsEnabled(); + break; + case 6: + return $this->getExpirationDate(); + break; + case 7: + return $this->getSerializedRules(); + break; + case 8: + return $this->getIsCumulative(); + break; + case 9: + return $this->getIsRemovingPostage(); + break; + case 10: + return $this->getMaxUsage(); + break; + case 11: + return $this->getIsAvailableOnSpecialOffers(); + break; + case 12: + return $this->getCreatedAt(); + break; + case 13: + return $this->getUpdatedAt(); + break; + case 14: + return $this->getVersion(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + if (isset($alreadyDumpedObjects['CouponVersion'][serialize($this->getPrimaryKey())])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['CouponVersion'][serialize($this->getPrimaryKey())] = true; + $keys = CouponVersionTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getCode(), + $keys[2] => $this->getType(), + $keys[3] => $this->getAmount(), + $keys[4] => $this->getIsUsed(), + $keys[5] => $this->getIsEnabled(), + $keys[6] => $this->getExpirationDate(), + $keys[7] => $this->getSerializedRules(), + $keys[8] => $this->getIsCumulative(), + $keys[9] => $this->getIsRemovingPostage(), + $keys[10] => $this->getMaxUsage(), + $keys[11] => $this->getIsAvailableOnSpecialOffers(), + $keys[12] => $this->getCreatedAt(), + $keys[13] => $this->getUpdatedAt(), + $keys[14] => $this->getVersion(), + ); + $virtualColumns = $this->virtualColumns; + foreach($virtualColumns as $key => $virtualColumn) + { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aCoupon) { + $result['Coupon'] = $this->aCoupon->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + } + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return void + */ + public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + { + $pos = CouponVersionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setCode($value); + break; + case 2: + $this->setType($value); + break; + case 3: + $this->setAmount($value); + break; + case 4: + $this->setIsUsed($value); + break; + case 5: + $this->setIsEnabled($value); + break; + case 6: + $this->setExpirationDate($value); + break; + case 7: + $this->setSerializedRules($value); + break; + case 8: + $this->setIsCumulative($value); + break; + case 9: + $this->setIsRemovingPostage($value); + break; + case 10: + $this->setMaxUsage($value); + break; + case 11: + $this->setIsAvailableOnSpecialOffers($value); + break; + case 12: + $this->setCreatedAt($value); + break; + case 13: + $this->setUpdatedAt($value); + break; + case 14: + $this->setVersion($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * The default key type is the column's TableMap::TYPE_PHPNAME. + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + { + $keys = CouponVersionTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setIsUsed($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setIsEnabled($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setExpirationDate($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setSerializedRules($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setIsCumulative($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setIsRemovingPostage($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setMaxUsage($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CouponVersionTableMap::DATABASE_NAME); + + if ($this->isColumnModified(CouponVersionTableMap::ID)) $criteria->add(CouponVersionTableMap::ID, $this->id); + if ($this->isColumnModified(CouponVersionTableMap::CODE)) $criteria->add(CouponVersionTableMap::CODE, $this->code); + if ($this->isColumnModified(CouponVersionTableMap::TYPE)) $criteria->add(CouponVersionTableMap::TYPE, $this->type); + if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) $criteria->add(CouponVersionTableMap::AMOUNT, $this->amount); + if ($this->isColumnModified(CouponVersionTableMap::IS_USED)) $criteria->add(CouponVersionTableMap::IS_USED, $this->is_used); + if ($this->isColumnModified(CouponVersionTableMap::IS_ENABLED)) $criteria->add(CouponVersionTableMap::IS_ENABLED, $this->is_enabled); + if ($this->isColumnModified(CouponVersionTableMap::EXPIRATION_DATE)) $criteria->add(CouponVersionTableMap::EXPIRATION_DATE, $this->expiration_date); + if ($this->isColumnModified(CouponVersionTableMap::SERIALIZED_RULES)) $criteria->add(CouponVersionTableMap::SERIALIZED_RULES, $this->serialized_rules); + if ($this->isColumnModified(CouponVersionTableMap::IS_CUMULATIVE)) $criteria->add(CouponVersionTableMap::IS_CUMULATIVE, $this->is_cumulative); + if ($this->isColumnModified(CouponVersionTableMap::IS_REMOVING_POSTAGE)) $criteria->add(CouponVersionTableMap::IS_REMOVING_POSTAGE, $this->is_removing_postage); + if ($this->isColumnModified(CouponVersionTableMap::MAX_USAGE)) $criteria->add(CouponVersionTableMap::MAX_USAGE, $this->max_usage); + if ($this->isColumnModified(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS)) $criteria->add(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, $this->is_available_on_special_offers); + if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) $criteria->add(CouponVersionTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(CouponVersionTableMap::UPDATED_AT)) $criteria->add(CouponVersionTableMap::UPDATED_AT, $this->updated_at); + if ($this->isColumnModified(CouponVersionTableMap::VERSION)) $criteria->add(CouponVersionTableMap::VERSION, $this->version); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CouponVersionTableMap::DATABASE_NAME); + $criteria->add(CouponVersionTableMap::ID, $this->id); + $criteria->add(CouponVersionTableMap::VERSION, $this->version); + + return $criteria; + } + + /** + * Returns the composite primary key for this object. + * The array elements will be in same order as specified in XML. + * @return array + */ + public function getPrimaryKey() + { + $pks = array(); + $pks[0] = $this->getId(); + $pks[1] = $this->getVersion(); + + return $pks; + } + + /** + * Set the [composite] primary key. + * + * @param array $keys The elements of the composite key (order must match the order in XML file). + * @return void + */ + public function setPrimaryKey($keys) + { + $this->setId($keys[0]); + $this->setVersion($keys[1]); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return (null === $this->getId()) && (null === $this->getVersion()); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of \Thelia\Model\CouponVersion (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->setId($this->getId()); + $copyObj->setCode($this->getCode()); + $copyObj->setType($this->getType()); + $copyObj->setAmount($this->getAmount()); + $copyObj->setIsUsed($this->getIsUsed()); + $copyObj->setIsEnabled($this->getIsEnabled()); + $copyObj->setExpirationDate($this->getExpirationDate()); + $copyObj->setSerializedRules($this->getSerializedRules()); + $copyObj->setIsCumulative($this->getIsCumulative()); + $copyObj->setIsRemovingPostage($this->getIsRemovingPostage()); + $copyObj->setMaxUsage($this->getMaxUsage()); + $copyObj->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers()); + $copyObj->setCreatedAt($this->getCreatedAt()); + $copyObj->setUpdatedAt($this->getUpdatedAt()); + $copyObj->setVersion($this->getVersion()); + if ($makeNew) { + $copyObj->setNew(true); + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return \Thelia\Model\CouponVersion Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Declares an association between this object and a ChildCoupon object. + * + * @param ChildCoupon $v + * @return \Thelia\Model\CouponVersion The current object (for fluent API support) + * @throws PropelException + */ + public function setCoupon(ChildCoupon $v = null) + { + if ($v === null) { + $this->setId(NULL); + } else { + $this->setId($v->getId()); + } + + $this->aCoupon = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildCoupon object, it will not be re-added. + if ($v !== null) { + $v->addCouponVersion($this); + } + + + return $this; + } + + + /** + * Get the associated ChildCoupon object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildCoupon The associated ChildCoupon object. + * @throws PropelException + */ + public function getCoupon(ConnectionInterface $con = null) + { + if ($this->aCoupon === null && ($this->id !== null)) { + $this->aCoupon = ChildCouponQuery::create()->findPk($this->id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCoupon->addCouponVersions($this); + */ + } + + return $this->aCoupon; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->code = null; + $this->type = null; + $this->amount = null; + $this->is_used = null; + $this->is_enabled = null; + $this->expiration_date = null; + $this->serialized_rules = null; + $this->is_cumulative = null; + $this->is_removing_postage = null; + $this->max_usage = null; + $this->is_available_on_special_offers = null; + $this->created_at = null; + $this->updated_at = null; + $this->version = null; + $this->alreadyInSave = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCoupon = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(CouponVersionTableMap::DEFAULT_STRING_FORMAT); + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/core/lib/Thelia/Model/Base/CouponVersionQuery.php b/core/lib/Thelia/Model/Base/CouponVersionQuery.php new file mode 100644 index 000000000..ed7e587e7 --- /dev/null +++ b/core/lib/Thelia/Model/Base/CouponVersionQuery.php @@ -0,0 +1,1028 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + + return $query; + } + + /** + * Find object by primary key. + * Propel uses the instance pool to skip the database if the object exists. + * Go fast if the query is untouched. + * + * + * $obj = $c->findPk(array(12, 34), $con); + * + * + * @param array[$id, $version] $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildCouponVersion|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = CouponVersionTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(CouponVersionTableMap::DATABASE_NAME); + } + $this->basePreSelect($con); + if ($this->formatter || $this->modelAlias || $this->with || $this->select + || $this->selectColumns || $this->asColumns || $this->selectModifiers + || $this->map || $this->having || $this->joins) { + return $this->findPkComplex($key, $con); + } else { + return $this->findPkSimple($key, $con); + } + } + + /** + * Find object by primary key using raw SQL to go fast. + * Bypass doSelect() and the object formatter by using generated code. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildCouponVersion A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon_version WHERE ID = :p0 AND VERSION = :p1'; + try { + $stmt = $con->prepare($sql); + $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); + $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT); + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); + } + $obj = null; + if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { + $obj = new ChildCouponVersion(); + $obj->hydrate($row); + CouponVersionTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); + } + $stmt->closeCursor(); + + return $obj; + } + + /** + * Find object by primary key. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildCouponVersion|array|mixed the result, formatted by the current formatter + */ + protected function findPkComplex($key, $con) + { + // As the query uses a PK condition, no limit(1) is necessary. + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKey($key) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); + * + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); + } + $this->basePreSelect($con); + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKeys($keys) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->format($dataFetcher); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + $this->addUsingAlias(CouponVersionTableMap::ID, $key[0], Criteria::EQUAL); + $this->addUsingAlias(CouponVersionTableMap::VERSION, $key[1], Criteria::EQUAL); + + return $this; + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + if (empty($keys)) { + return $this->add(null, '1<>1', Criteria::CUSTOM); + } + foreach ($keys as $key) { + $cton0 = $this->getNewCriterion(CouponVersionTableMap::ID, $key[0], Criteria::EQUAL); + $cton1 = $this->getNewCriterion(CouponVersionTableMap::VERSION, $key[1], Criteria::EQUAL); + $cton0->addAnd($cton1); + $this->addOr($cton0); + } + + return $this; + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @see filterByCoupon() + * + * @param mixed $id The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id)) { + $useMinMax = false; + if (isset($id['min'])) { + $this->addUsingAlias(CouponVersionTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(CouponVersionTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the code column + * + * Example usage: + * + * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' + * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' + * + * + * @param string $code The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByCode($code = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($code)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $code)) { + $code = str_replace('*', '%', $code); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::CODE, $code, $comparison); + } + + /** + * Filter the query on the type column + * + * Example usage: + * + * $query->filterByType('fooValue'); // WHERE type = 'fooValue' + * $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%' + * + * + * @param string $type The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByType($type = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($type)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $type)) { + $type = str_replace('*', '%', $type); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::TYPE, $type, $comparison); + } + + /** + * Filter the query on the amount column + * + * Example usage: + * + * $query->filterByAmount(1234); // WHERE amount = 1234 + * $query->filterByAmount(array(12, 34)); // WHERE amount IN (12, 34) + * $query->filterByAmount(array('min' => 12)); // WHERE amount > 12 + * + * + * @param mixed $amount The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByAmount($amount = null, $comparison = null) + { + if (is_array($amount)) { + $useMinMax = false; + if (isset($amount['min'])) { + $this->addUsingAlias(CouponVersionTableMap::AMOUNT, $amount['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($amount['max'])) { + $this->addUsingAlias(CouponVersionTableMap::AMOUNT, $amount['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::AMOUNT, $amount, $comparison); + } + + /** + * Filter the query on the is_used column + * + * Example usage: + * + * $query->filterByIsUsed(1234); // WHERE is_used = 1234 + * $query->filterByIsUsed(array(12, 34)); // WHERE is_used IN (12, 34) + * $query->filterByIsUsed(array('min' => 12)); // WHERE is_used > 12 + * + * + * @param mixed $isUsed The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByIsUsed($isUsed = null, $comparison = null) + { + if (is_array($isUsed)) { + $useMinMax = false; + if (isset($isUsed['min'])) { + $this->addUsingAlias(CouponVersionTableMap::IS_USED, $isUsed['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($isUsed['max'])) { + $this->addUsingAlias(CouponVersionTableMap::IS_USED, $isUsed['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::IS_USED, $isUsed, $comparison); + } + + /** + * Filter the query on the is_enabled column + * + * Example usage: + * + * $query->filterByIsEnabled(1234); // WHERE is_enabled = 1234 + * $query->filterByIsEnabled(array(12, 34)); // WHERE is_enabled IN (12, 34) + * $query->filterByIsEnabled(array('min' => 12)); // WHERE is_enabled > 12 + * + * + * @param mixed $isEnabled The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByIsEnabled($isEnabled = null, $comparison = null) + { + if (is_array($isEnabled)) { + $useMinMax = false; + if (isset($isEnabled['min'])) { + $this->addUsingAlias(CouponVersionTableMap::IS_ENABLED, $isEnabled['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($isEnabled['max'])) { + $this->addUsingAlias(CouponVersionTableMap::IS_ENABLED, $isEnabled['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::IS_ENABLED, $isEnabled, $comparison); + } + + /** + * Filter the query on the expiration_date column + * + * Example usage: + * + * $query->filterByExpirationDate('2011-03-14'); // WHERE expiration_date = '2011-03-14' + * $query->filterByExpirationDate('now'); // WHERE expiration_date = '2011-03-14' + * $query->filterByExpirationDate(array('max' => 'yesterday')); // WHERE expiration_date > '2011-03-13' + * + * + * @param mixed $expirationDate The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByExpirationDate($expirationDate = null, $comparison = null) + { + if (is_array($expirationDate)) { + $useMinMax = false; + if (isset($expirationDate['min'])) { + $this->addUsingAlias(CouponVersionTableMap::EXPIRATION_DATE, $expirationDate['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($expirationDate['max'])) { + $this->addUsingAlias(CouponVersionTableMap::EXPIRATION_DATE, $expirationDate['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::EXPIRATION_DATE, $expirationDate, $comparison); + } + + /** + * Filter the query on the serialized_rules column + * + * Example usage: + * + * $query->filterBySerializedRules('fooValue'); // WHERE serialized_rules = 'fooValue' + * $query->filterBySerializedRules('%fooValue%'); // WHERE serialized_rules LIKE '%fooValue%' + * + * + * @param string $serializedRules The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterBySerializedRules($serializedRules = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($serializedRules)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $serializedRules)) { + $serializedRules = str_replace('*', '%', $serializedRules); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::SERIALIZED_RULES, $serializedRules, $comparison); + } + + /** + * Filter the query on the is_cumulative column + * + * Example usage: + * + * $query->filterByIsCumulative(1234); // WHERE is_cumulative = 1234 + * $query->filterByIsCumulative(array(12, 34)); // WHERE is_cumulative IN (12, 34) + * $query->filterByIsCumulative(array('min' => 12)); // WHERE is_cumulative > 12 + * + * + * @param mixed $isCumulative The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByIsCumulative($isCumulative = null, $comparison = null) + { + if (is_array($isCumulative)) { + $useMinMax = false; + if (isset($isCumulative['min'])) { + $this->addUsingAlias(CouponVersionTableMap::IS_CUMULATIVE, $isCumulative['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($isCumulative['max'])) { + $this->addUsingAlias(CouponVersionTableMap::IS_CUMULATIVE, $isCumulative['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::IS_CUMULATIVE, $isCumulative, $comparison); + } + + /** + * Filter the query on the is_removing_postage column + * + * Example usage: + * + * $query->filterByIsRemovingPostage(1234); // WHERE is_removing_postage = 1234 + * $query->filterByIsRemovingPostage(array(12, 34)); // WHERE is_removing_postage IN (12, 34) + * $query->filterByIsRemovingPostage(array('min' => 12)); // WHERE is_removing_postage > 12 + * + * + * @param mixed $isRemovingPostage The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByIsRemovingPostage($isRemovingPostage = null, $comparison = null) + { + if (is_array($isRemovingPostage)) { + $useMinMax = false; + if (isset($isRemovingPostage['min'])) { + $this->addUsingAlias(CouponVersionTableMap::IS_REMOVING_POSTAGE, $isRemovingPostage['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($isRemovingPostage['max'])) { + $this->addUsingAlias(CouponVersionTableMap::IS_REMOVING_POSTAGE, $isRemovingPostage['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::IS_REMOVING_POSTAGE, $isRemovingPostage, $comparison); + } + + /** + * Filter the query on the max_usage column + * + * Example usage: + * + * $query->filterByMaxUsage(1234); // WHERE max_usage = 1234 + * $query->filterByMaxUsage(array(12, 34)); // WHERE max_usage IN (12, 34) + * $query->filterByMaxUsage(array('min' => 12)); // WHERE max_usage > 12 + * + * + * @param mixed $maxUsage The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByMaxUsage($maxUsage = null, $comparison = null) + { + if (is_array($maxUsage)) { + $useMinMax = false; + if (isset($maxUsage['min'])) { + $this->addUsingAlias(CouponVersionTableMap::MAX_USAGE, $maxUsage['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($maxUsage['max'])) { + $this->addUsingAlias(CouponVersionTableMap::MAX_USAGE, $maxUsage['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::MAX_USAGE, $maxUsage, $comparison); + } + + /** + * Filter the query on the is_available_on_special_offers column + * + * Example usage: + * + * $query->filterByIsAvailableOnSpecialOffers(true); // WHERE is_available_on_special_offers = true + * $query->filterByIsAvailableOnSpecialOffers('yes'); // WHERE is_available_on_special_offers = true + * + * + * @param boolean|string $isAvailableOnSpecialOffers The value to use as filter. + * Non-boolean arguments are converted using the following rules: + * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true + * * 0, '0', 'false', 'off', and 'no' are converted to boolean false + * Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers = null, $comparison = null) + { + if (is_string($isAvailableOnSpecialOffers)) { + $is_available_on_special_offers = in_array(strtolower($isAvailableOnSpecialOffers), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } + + return $this->addUsingAlias(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, $isAvailableOnSpecialOffers, $comparison); + } + + /** + * Filter the query on the created_at column + * + * Example usage: + * + * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' + * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' + * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' + * + * + * @param mixed $createdAt The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByCreatedAt($createdAt = null, $comparison = null) + { + if (is_array($createdAt)) { + $useMinMax = false; + if (isset($createdAt['min'])) { + $this->addUsingAlias(CouponVersionTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($createdAt['max'])) { + $this->addUsingAlias(CouponVersionTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::CREATED_AT, $createdAt, $comparison); + } + + /** + * Filter the query on the updated_at column + * + * Example usage: + * + * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' + * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' + * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' + * + * + * @param mixed $updatedAt The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByUpdatedAt($updatedAt = null, $comparison = null) + { + if (is_array($updatedAt)) { + $useMinMax = false; + if (isset($updatedAt['min'])) { + $this->addUsingAlias(CouponVersionTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($updatedAt['max'])) { + $this->addUsingAlias(CouponVersionTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::UPDATED_AT, $updatedAt, $comparison); + } + + /** + * Filter the query on the version column + * + * Example usage: + * + * $query->filterByVersion(1234); // WHERE version = 1234 + * $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34) + * $query->filterByVersion(array('min' => 12)); // WHERE version > 12 + * + * + * @param mixed $version The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByVersion($version = null, $comparison = null) + { + if (is_array($version)) { + $useMinMax = false; + if (isset($version['min'])) { + $this->addUsingAlias(CouponVersionTableMap::VERSION, $version['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($version['max'])) { + $this->addUsingAlias(CouponVersionTableMap::VERSION, $version['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CouponVersionTableMap::VERSION, $version, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\Coupon object + * + * @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function filterByCoupon($coupon, $comparison = null) + { + if ($coupon instanceof \Thelia\Model\Coupon) { + return $this + ->addUsingAlias(CouponVersionTableMap::ID, $coupon->getId(), $comparison); + } elseif ($coupon instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(CouponVersionTableMap::ID, $coupon->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Coupon relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function joinCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Coupon'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'Coupon'); + } + + return $this; + } + + /** + * Use the Coupon relation Coupon object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\CouponQuery A secondary query class using the current class as primary query + */ + public function useCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCoupon($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery'); + } + + /** + * Exclude object from result + * + * @param ChildCouponVersion $couponVersion Object to remove from the list of results + * + * @return ChildCouponVersionQuery The current query, for fluid interface + */ + public function prune($couponVersion = null) + { + if ($couponVersion) { + $this->addCond('pruneCond0', $this->getAliasedColName(CouponVersionTableMap::ID), $couponVersion->getId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond1', $this->getAliasedColName(CouponVersionTableMap::VERSION), $couponVersion->getVersion(), Criteria::NOT_EQUAL); + $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); + } + + return $this; + } + + /** + * Deletes all rows from the coupon_version table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public function doDeleteAll(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponVersionTableMap::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += parent::doDeleteAll($con); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CouponVersionTableMap::clearInstancePool(); + CouponVersionTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildCouponVersion or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildCouponVersion object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public function delete(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponVersionTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(CouponVersionTableMap::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + + CouponVersionTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + CouponVersionTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + +} // CouponVersionQuery diff --git a/core/lib/Thelia/Model/Base/Currency.php b/core/lib/Thelia/Model/Base/Currency.php index 77718992f..767e2dc37 100644 --- a/core/lib/Thelia/Model/Base/Currency.php +++ b/core/lib/Thelia/Model/Base/Currency.php @@ -337,7 +337,7 @@ abstract class Currency implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CurrencyI18n.php b/core/lib/Thelia/Model/Base/CurrencyI18n.php index eb86a87c4..df5ff7240 100644 --- a/core/lib/Thelia/Model/Base/CurrencyI18n.php +++ b/core/lib/Thelia/Model/Base/CurrencyI18n.php @@ -254,7 +254,7 @@ abstract class CurrencyI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Customer.php b/core/lib/Thelia/Model/Base/Customer.php index c3315ac6f..3d87f3e28 100644 --- a/core/lib/Thelia/Model/Base/Customer.php +++ b/core/lib/Thelia/Model/Base/Customer.php @@ -352,7 +352,7 @@ abstract class Customer implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CustomerTitle.php b/core/lib/Thelia/Model/Base/CustomerTitle.php index 5f8b11dd9..6b1295d2b 100644 --- a/core/lib/Thelia/Model/Base/CustomerTitle.php +++ b/core/lib/Thelia/Model/Base/CustomerTitle.php @@ -319,7 +319,7 @@ abstract class CustomerTitle implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CustomerTitleI18n.php b/core/lib/Thelia/Model/Base/CustomerTitleI18n.php index c68b87123..b384210b1 100644 --- a/core/lib/Thelia/Model/Base/CustomerTitleI18n.php +++ b/core/lib/Thelia/Model/Base/CustomerTitleI18n.php @@ -260,7 +260,7 @@ abstract class CustomerTitleI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Delivzone.php b/core/lib/Thelia/Model/Base/Delivzone.php index 08125044e..deb21997e 100644 --- a/core/lib/Thelia/Model/Base/Delivzone.php +++ b/core/lib/Thelia/Model/Base/Delivzone.php @@ -255,7 +255,7 @@ abstract class Delivzone implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Feature.php b/core/lib/Thelia/Model/Base/Feature.php index 0dddd14e0..2860a4155 100644 --- a/core/lib/Thelia/Model/Base/Feature.php +++ b/core/lib/Thelia/Model/Base/Feature.php @@ -346,7 +346,7 @@ abstract class Feature implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/FeatureAv.php b/core/lib/Thelia/Model/Base/FeatureAv.php index b09a27cec..bf1bfc41e 100644 --- a/core/lib/Thelia/Model/Base/FeatureAv.php +++ b/core/lib/Thelia/Model/Base/FeatureAv.php @@ -298,7 +298,7 @@ abstract class FeatureAv implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/FeatureAvI18n.php b/core/lib/Thelia/Model/Base/FeatureAvI18n.php index 7cbca8129..44e7893a2 100644 --- a/core/lib/Thelia/Model/Base/FeatureAvI18n.php +++ b/core/lib/Thelia/Model/Base/FeatureAvI18n.php @@ -272,7 +272,7 @@ abstract class FeatureAvI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/FeatureCategory.php b/core/lib/Thelia/Model/Base/FeatureCategory.php index f3ce14349..035e077d2 100644 --- a/core/lib/Thelia/Model/Base/FeatureCategory.php +++ b/core/lib/Thelia/Model/Base/FeatureCategory.php @@ -262,7 +262,7 @@ abstract class FeatureCategory implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/FeatureI18n.php b/core/lib/Thelia/Model/Base/FeatureI18n.php index 0ede8eddb..57c7a0b30 100644 --- a/core/lib/Thelia/Model/Base/FeatureI18n.php +++ b/core/lib/Thelia/Model/Base/FeatureI18n.php @@ -272,7 +272,7 @@ abstract class FeatureI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/FeatureProduct.php b/core/lib/Thelia/Model/Base/FeatureProduct.php index b68f4acd2..4af200d51 100644 --- a/core/lib/Thelia/Model/Base/FeatureProduct.php +++ b/core/lib/Thelia/Model/Base/FeatureProduct.php @@ -287,7 +287,7 @@ abstract class FeatureProduct implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Folder.php b/core/lib/Thelia/Model/Base/Folder.php index 6ee28e7ff..4457c5042 100644 --- a/core/lib/Thelia/Model/Base/Folder.php +++ b/core/lib/Thelia/Model/Base/Folder.php @@ -31,8 +31,6 @@ use Thelia\Model\FolderImageQuery as ChildFolderImageQuery; use Thelia\Model\FolderQuery as ChildFolderQuery; use Thelia\Model\FolderVersion as ChildFolderVersion; use Thelia\Model\FolderVersionQuery as ChildFolderVersionQuery; -use Thelia\Model\Rewriting as ChildRewriting; -use Thelia\Model\RewritingQuery as ChildRewritingQuery; use Thelia\Model\Map\FolderTableMap; use Thelia\Model\Map\FolderVersionTableMap; @@ -125,12 +123,6 @@ abstract class Folder implements ActiveRecordInterface */ protected $version_created_by; - /** - * @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects. - */ - protected $collRewritings; - protected $collRewritingsPartial; - /** * @var ObjectCollection|ChildContentFolder[] Collection to store aggregation of ChildContentFolder objects. */ @@ -202,12 +194,6 @@ abstract class Folder implements ActiveRecordInterface */ protected $contentsScheduledForDeletion = null; - /** - * An array of objects scheduled for deletion. - * @var ObjectCollection - */ - protected $rewritingsScheduledForDeletion = null; - /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -407,7 +393,7 @@ abstract class Folder implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -965,8 +951,6 @@ abstract class Folder implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->collRewritings = null; - $this->collContentFolders = null; $this->collFolderImages = null; @@ -1150,23 +1134,6 @@ abstract class Folder implements ActiveRecordInterface } } - if ($this->rewritingsScheduledForDeletion !== null) { - if (!$this->rewritingsScheduledForDeletion->isEmpty()) { - \Thelia\Model\RewritingQuery::create() - ->filterByPrimaryKeys($this->rewritingsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->rewritingsScheduledForDeletion = null; - } - } - - if ($this->collRewritings !== null) { - foreach ($this->collRewritings as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - if ($this->contentFoldersScheduledForDeletion !== null) { if (!$this->contentFoldersScheduledForDeletion->isEmpty()) { \Thelia\Model\ContentFolderQuery::create() @@ -1478,9 +1445,6 @@ abstract class Folder implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->collRewritings) { - $result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } if (null !== $this->collContentFolders) { $result['ContentFolders'] = $this->collContentFolders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1687,12 +1651,6 @@ abstract class Folder implements ActiveRecordInterface // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getRewritings() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addRewriting($relObj->copy($deepCopy)); - } - } - foreach ($this->getContentFolders() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addContentFolder($relObj->copy($deepCopy)); @@ -1764,9 +1722,6 @@ abstract class Folder implements ActiveRecordInterface */ public function initRelation($relationName) { - if ('Rewriting' == $relationName) { - return $this->initRewritings(); - } if ('ContentFolder' == $relationName) { return $this->initContentFolders(); } @@ -1784,299 +1739,6 @@ abstract class Folder implements ActiveRecordInterface } } - /** - * Clears out the collRewritings collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addRewritings() - */ - public function clearRewritings() - { - $this->collRewritings = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Reset is the collRewritings collection loaded partially. - */ - public function resetPartialRewritings($v = true) - { - $this->collRewritingsPartial = $v; - } - - /** - * Initializes the collRewritings collection. - * - * By default this just sets the collRewritings collection to an empty array (like clearcollRewritings()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initRewritings($overrideExisting = true) - { - if (null !== $this->collRewritings && !$overrideExisting) { - return; - } - $this->collRewritings = new ObjectCollection(); - $this->collRewritings->setModel('\Thelia\Model\Rewriting'); - } - - /** - * Gets an array of ChildRewriting objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this ChildFolder is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @return Collection|ChildRewriting[] List of ChildRewriting objects - * @throws PropelException - */ - public function getRewritings($criteria = null, ConnectionInterface $con = null) - { - $partial = $this->collRewritingsPartial && !$this->isNew(); - if (null === $this->collRewritings || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collRewritings) { - // return empty collection - $this->initRewritings(); - } else { - $collRewritings = ChildRewritingQuery::create(null, $criteria) - ->filterByFolder($this) - ->find($con); - - if (null !== $criteria) { - if (false !== $this->collRewritingsPartial && count($collRewritings)) { - $this->initRewritings(false); - - foreach ($collRewritings as $obj) { - if (false == $this->collRewritings->contains($obj)) { - $this->collRewritings->append($obj); - } - } - - $this->collRewritingsPartial = true; - } - - $collRewritings->getInternalIterator()->rewind(); - - return $collRewritings; - } - - if ($partial && $this->collRewritings) { - foreach ($this->collRewritings as $obj) { - if ($obj->isNew()) { - $collRewritings[] = $obj; - } - } - } - - $this->collRewritings = $collRewritings; - $this->collRewritingsPartial = false; - } - } - - return $this->collRewritings; - } - - /** - * Sets a collection of Rewriting objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param Collection $rewritings A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return ChildFolder The current object (for fluent API support) - */ - public function setRewritings(Collection $rewritings, ConnectionInterface $con = null) - { - $rewritingsToDelete = $this->getRewritings(new Criteria(), $con)->diff($rewritings); - - - $this->rewritingsScheduledForDeletion = $rewritingsToDelete; - - foreach ($rewritingsToDelete as $rewritingRemoved) { - $rewritingRemoved->setFolder(null); - } - - $this->collRewritings = null; - foreach ($rewritings as $rewriting) { - $this->addRewriting($rewriting); - } - - $this->collRewritings = $rewritings; - $this->collRewritingsPartial = false; - - return $this; - } - - /** - * Returns the number of related Rewriting objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Rewriting objects. - * @throws PropelException - */ - public function countRewritings(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) - { - $partial = $this->collRewritingsPartial && !$this->isNew(); - if (null === $this->collRewritings || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collRewritings) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getRewritings()); - } - - $query = ChildRewritingQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByFolder($this) - ->count($con); - } - - return count($this->collRewritings); - } - - /** - * Method called to associate a ChildRewriting object to this object - * through the ChildRewriting foreign key attribute. - * - * @param ChildRewriting $l ChildRewriting - * @return \Thelia\Model\Folder The current object (for fluent API support) - */ - public function addRewriting(ChildRewriting $l) - { - if ($this->collRewritings === null) { - $this->initRewritings(); - $this->collRewritingsPartial = true; - } - - if (!in_array($l, $this->collRewritings->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddRewriting($l); - } - - return $this; - } - - /** - * @param Rewriting $rewriting The rewriting object to add. - */ - protected function doAddRewriting($rewriting) - { - $this->collRewritings[]= $rewriting; - $rewriting->setFolder($this); - } - - /** - * @param Rewriting $rewriting The rewriting object to remove. - * @return ChildFolder The current object (for fluent API support) - */ - public function removeRewriting($rewriting) - { - if ($this->getRewritings()->contains($rewriting)) { - $this->collRewritings->remove($this->collRewritings->search($rewriting)); - if (null === $this->rewritingsScheduledForDeletion) { - $this->rewritingsScheduledForDeletion = clone $this->collRewritings; - $this->rewritingsScheduledForDeletion->clear(); - } - $this->rewritingsScheduledForDeletion[]= $rewriting; - $rewriting->setFolder(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Folder is new, it will return - * an empty collection; or if this Folder has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Folder. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinProduct($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Product', $joinBehavior); - - return $this->getRewritings($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Folder is new, it will return - * an empty collection; or if this Folder has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Folder. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Category', $joinBehavior); - - return $this->getRewritings($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Folder is new, it will return - * an empty collection; or if this Folder has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Folder. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Content', $joinBehavior); - - return $this->getRewritings($query, $con); - } - /** * Clears out the collContentFolders collection * @@ -3422,11 +3084,6 @@ abstract class Folder implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collRewritings) { - foreach ($this->collRewritings as $o) { - $o->clearAllReferences($deep); - } - } if ($this->collContentFolders) { foreach ($this->collContentFolders as $o) { $o->clearAllReferences($deep); @@ -3463,10 +3120,6 @@ abstract class Folder implements ActiveRecordInterface $this->currentLocale = 'en_US'; $this->currentTranslations = null; - if ($this->collRewritings instanceof Collection) { - $this->collRewritings->clearIterator(); - } - $this->collRewritings = null; if ($this->collContentFolders instanceof Collection) { $this->collContentFolders->clearIterator(); } diff --git a/core/lib/Thelia/Model/Base/FolderDocument.php b/core/lib/Thelia/Model/Base/FolderDocument.php index 31e7c57a6..8e24ee9d4 100644 --- a/core/lib/Thelia/Model/Base/FolderDocument.php +++ b/core/lib/Thelia/Model/Base/FolderDocument.php @@ -290,7 +290,7 @@ abstract class FolderDocument implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/FolderDocumentI18n.php b/core/lib/Thelia/Model/Base/FolderDocumentI18n.php index d39a49af7..b68c8ce9d 100644 --- a/core/lib/Thelia/Model/Base/FolderDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/FolderDocumentI18n.php @@ -272,7 +272,7 @@ abstract class FolderDocumentI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/FolderI18n.php b/core/lib/Thelia/Model/Base/FolderI18n.php index fcdc66705..976c6b041 100644 --- a/core/lib/Thelia/Model/Base/FolderI18n.php +++ b/core/lib/Thelia/Model/Base/FolderI18n.php @@ -272,7 +272,7 @@ abstract class FolderI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/FolderImage.php b/core/lib/Thelia/Model/Base/FolderImage.php index 46c39060d..525dc9d48 100644 --- a/core/lib/Thelia/Model/Base/FolderImage.php +++ b/core/lib/Thelia/Model/Base/FolderImage.php @@ -290,7 +290,7 @@ abstract class FolderImage implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/FolderImageI18n.php b/core/lib/Thelia/Model/Base/FolderImageI18n.php index d5cc004d1..6ac9575e1 100644 --- a/core/lib/Thelia/Model/Base/FolderImageI18n.php +++ b/core/lib/Thelia/Model/Base/FolderImageI18n.php @@ -272,7 +272,7 @@ abstract class FolderImageI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/FolderQuery.php b/core/lib/Thelia/Model/Base/FolderQuery.php index 893bb9819..d7d6794c5 100644 --- a/core/lib/Thelia/Model/Base/FolderQuery.php +++ b/core/lib/Thelia/Model/Base/FolderQuery.php @@ -46,10 +46,6 @@ use Thelia\Model\Map\FolderTableMap; * @method ChildFolderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildFolderQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildFolderQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation - * @method ChildFolderQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation - * @method ChildFolderQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation - * * @method ChildFolderQuery leftJoinContentFolder($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentFolder relation * @method ChildFolderQuery rightJoinContentFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentFolder relation * @method ChildFolderQuery innerJoinContentFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentFolder relation @@ -639,79 +635,6 @@ abstract class FolderQuery extends ModelCriteria return $this->addUsingAlias(FolderTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison); } - /** - * Filter the query by a related \Thelia\Model\Rewriting object - * - * @param \Thelia\Model\Rewriting|ObjectCollection $rewriting the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildFolderQuery The current query, for fluid interface - */ - public function filterByRewriting($rewriting, $comparison = null) - { - if ($rewriting instanceof \Thelia\Model\Rewriting) { - return $this - ->addUsingAlias(FolderTableMap::ID, $rewriting->getFolderId(), $comparison); - } elseif ($rewriting instanceof ObjectCollection) { - return $this - ->useRewritingQuery() - ->filterByPrimaryKeys($rewriting->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByRewriting() only accepts arguments of type \Thelia\Model\Rewriting or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Rewriting relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildFolderQuery The current query, for fluid interface - */ - public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Rewriting'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Rewriting'); - } - - return $this; - } - - /** - * Use the Rewriting relation Rewriting object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\RewritingQuery A secondary query class using the current class as primary query - */ - public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinRewriting($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery'); - } - /** * Filter the query by a related \Thelia\Model\ContentFolder object * diff --git a/core/lib/Thelia/Model/Base/FolderVersion.php b/core/lib/Thelia/Model/Base/FolderVersion.php index 4f6305b7e..ec588dcbd 100644 --- a/core/lib/Thelia/Model/Base/FolderVersion.php +++ b/core/lib/Thelia/Model/Base/FolderVersion.php @@ -292,7 +292,7 @@ abstract class FolderVersion implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Group.php b/core/lib/Thelia/Model/Base/Group.php index 9cfde2bdc..19d41e38c 100644 --- a/core/lib/Thelia/Model/Base/Group.php +++ b/core/lib/Thelia/Model/Base/Group.php @@ -339,7 +339,7 @@ abstract class Group implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/GroupI18n.php b/core/lib/Thelia/Model/Base/GroupI18n.php index 4de63ea63..df8f3f81a 100644 --- a/core/lib/Thelia/Model/Base/GroupI18n.php +++ b/core/lib/Thelia/Model/Base/GroupI18n.php @@ -272,7 +272,7 @@ abstract class GroupI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/GroupModule.php b/core/lib/Thelia/Model/Base/GroupModule.php index 620ca9c91..82d6056f2 100644 --- a/core/lib/Thelia/Model/Base/GroupModule.php +++ b/core/lib/Thelia/Model/Base/GroupModule.php @@ -282,7 +282,7 @@ abstract class GroupModule implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/GroupResource.php b/core/lib/Thelia/Model/Base/GroupResource.php index 84d6006b0..ea6c0ff47 100644 --- a/core/lib/Thelia/Model/Base/GroupResource.php +++ b/core/lib/Thelia/Model/Base/GroupResource.php @@ -290,7 +290,7 @@ abstract class GroupResource implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Lang.php b/core/lib/Thelia/Model/Base/Lang.php index 3379594ef..1c11103af 100644 --- a/core/lib/Thelia/Model/Base/Lang.php +++ b/core/lib/Thelia/Model/Base/Lang.php @@ -85,10 +85,40 @@ abstract class Lang implements ActiveRecordInterface protected $url; /** - * The value for the position field. - * @var int + * The value for the date_format field. + * @var string */ - protected $position; + protected $date_format; + + /** + * The value for the time_format field. + * @var string + */ + protected $time_format; + + /** + * The value for the datetime_format field. + * @var string + */ + protected $datetime_format; + + /** + * The value for the decimal_separator field. + * @var string + */ + protected $decimal_separator; + + /** + * The value for the thousands_separator field. + * @var string + */ + protected $thousands_separator; + + /** + * The value for the decimals field. + * @var string + */ + protected $decimals; /** * The value for the by_default field. @@ -96,6 +126,12 @@ abstract class Lang implements ActiveRecordInterface */ protected $by_default; + /** + * The value for the position field. + * @var int + */ + protected $position; + /** * The value for the created_at field. * @var string @@ -272,7 +308,7 @@ abstract class Lang implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -426,14 +462,69 @@ abstract class Lang implements ActiveRecordInterface } /** - * Get the [position] column value. + * Get the [date_format] column value. * - * @return int + * @return string */ - public function getPosition() + public function getDateFormat() { - return $this->position; + return $this->date_format; + } + + /** + * Get the [time_format] column value. + * + * @return string + */ + public function getTimeFormat() + { + + return $this->time_format; + } + + /** + * Get the [datetime_format] column value. + * + * @return string + */ + public function getDatetimeFormat() + { + + return $this->datetime_format; + } + + /** + * Get the [decimal_separator] column value. + * + * @return string + */ + public function getDecimalSeparator() + { + + return $this->decimal_separator; + } + + /** + * Get the [thousands_separator] column value. + * + * @return string + */ + public function getThousandsSeparator() + { + + return $this->thousands_separator; + } + + /** + * Get the [decimals] column value. + * + * @return string + */ + public function getDecimals() + { + + return $this->decimals; } /** @@ -447,6 +538,17 @@ abstract class Lang implements ActiveRecordInterface return $this->by_default; } + /** + * Get the [position] column value. + * + * @return int + */ + public function getPosition() + { + + return $this->position; + } + /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -593,25 +695,130 @@ abstract class Lang implements ActiveRecordInterface } // setUrl() /** - * Set the value of [position] column. + * Set the value of [date_format] column. * - * @param int $v new value + * @param string $v new value * @return \Thelia\Model\Lang The current object (for fluent API support) */ - public function setPosition($v) + public function setDateFormat($v) { if ($v !== null) { - $v = (int) $v; + $v = (string) $v; } - if ($this->position !== $v) { - $this->position = $v; - $this->modifiedColumns[] = LangTableMap::POSITION; + if ($this->date_format !== $v) { + $this->date_format = $v; + $this->modifiedColumns[] = LangTableMap::DATE_FORMAT; } return $this; - } // setPosition() + } // setDateFormat() + + /** + * Set the value of [time_format] column. + * + * @param string $v new value + * @return \Thelia\Model\Lang The current object (for fluent API support) + */ + public function setTimeFormat($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->time_format !== $v) { + $this->time_format = $v; + $this->modifiedColumns[] = LangTableMap::TIME_FORMAT; + } + + + return $this; + } // setTimeFormat() + + /** + * Set the value of [datetime_format] column. + * + * @param string $v new value + * @return \Thelia\Model\Lang The current object (for fluent API support) + */ + public function setDatetimeFormat($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->datetime_format !== $v) { + $this->datetime_format = $v; + $this->modifiedColumns[] = LangTableMap::DATETIME_FORMAT; + } + + + return $this; + } // setDatetimeFormat() + + /** + * Set the value of [decimal_separator] column. + * + * @param string $v new value + * @return \Thelia\Model\Lang The current object (for fluent API support) + */ + public function setDecimalSeparator($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->decimal_separator !== $v) { + $this->decimal_separator = $v; + $this->modifiedColumns[] = LangTableMap::DECIMAL_SEPARATOR; + } + + + return $this; + } // setDecimalSeparator() + + /** + * Set the value of [thousands_separator] column. + * + * @param string $v new value + * @return \Thelia\Model\Lang The current object (for fluent API support) + */ + public function setThousandsSeparator($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->thousands_separator !== $v) { + $this->thousands_separator = $v; + $this->modifiedColumns[] = LangTableMap::THOUSANDS_SEPARATOR; + } + + + return $this; + } // setThousandsSeparator() + + /** + * Set the value of [decimals] column. + * + * @param string $v new value + * @return \Thelia\Model\Lang The current object (for fluent API support) + */ + public function setDecimals($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->decimals !== $v) { + $this->decimals = $v; + $this->modifiedColumns[] = LangTableMap::DECIMALS; + } + + + return $this; + } // setDecimals() /** * Set the value of [by_default] column. @@ -634,6 +841,27 @@ abstract class Lang implements ActiveRecordInterface return $this; } // setByDefault() + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return \Thelia\Model\Lang The current object (for fluent API support) + */ + public function setPosition($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->position !== $v) { + $this->position = $v; + $this->modifiedColumns[] = LangTableMap::POSITION; + } + + + return $this; + } // setPosition() + /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -728,19 +956,37 @@ abstract class Lang implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : LangTableMap::translateFieldName('Url', TableMap::TYPE_PHPNAME, $indexType)]; $this->url = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : LangTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; - $this->position = (null !== $col) ? (int) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : LangTableMap::translateFieldName('DateFormat', TableMap::TYPE_PHPNAME, $indexType)]; + $this->date_format = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : LangTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : LangTableMap::translateFieldName('TimeFormat', TableMap::TYPE_PHPNAME, $indexType)]; + $this->time_format = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : LangTableMap::translateFieldName('DatetimeFormat', TableMap::TYPE_PHPNAME, $indexType)]; + $this->datetime_format = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : LangTableMap::translateFieldName('DecimalSeparator', TableMap::TYPE_PHPNAME, $indexType)]; + $this->decimal_separator = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : LangTableMap::translateFieldName('ThousandsSeparator', TableMap::TYPE_PHPNAME, $indexType)]; + $this->thousands_separator = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : LangTableMap::translateFieldName('Decimals', TableMap::TYPE_PHPNAME, $indexType)]; + $this->decimals = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : LangTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)]; $this->by_default = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : LangTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : LangTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $this->position = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : LangTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : LangTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : LangTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -753,7 +999,7 @@ abstract class Lang implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 9; // 9 = LangTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 15; // 15 = LangTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Lang object", 0, $e); @@ -988,12 +1234,30 @@ abstract class Lang implements ActiveRecordInterface if ($this->isColumnModified(LangTableMap::URL)) { $modifiedColumns[':p' . $index++] = 'URL'; } - if ($this->isColumnModified(LangTableMap::POSITION)) { - $modifiedColumns[':p' . $index++] = 'POSITION'; + if ($this->isColumnModified(LangTableMap::DATE_FORMAT)) { + $modifiedColumns[':p' . $index++] = 'DATE_FORMAT'; + } + if ($this->isColumnModified(LangTableMap::TIME_FORMAT)) { + $modifiedColumns[':p' . $index++] = 'TIME_FORMAT'; + } + if ($this->isColumnModified(LangTableMap::DATETIME_FORMAT)) { + $modifiedColumns[':p' . $index++] = 'DATETIME_FORMAT'; + } + if ($this->isColumnModified(LangTableMap::DECIMAL_SEPARATOR)) { + $modifiedColumns[':p' . $index++] = 'DECIMAL_SEPARATOR'; + } + if ($this->isColumnModified(LangTableMap::THOUSANDS_SEPARATOR)) { + $modifiedColumns[':p' . $index++] = 'THOUSANDS_SEPARATOR'; + } + if ($this->isColumnModified(LangTableMap::DECIMALS)) { + $modifiedColumns[':p' . $index++] = 'DECIMALS'; } if ($this->isColumnModified(LangTableMap::BY_DEFAULT)) { $modifiedColumns[':p' . $index++] = 'BY_DEFAULT'; } + if ($this->isColumnModified(LangTableMap::POSITION)) { + $modifiedColumns[':p' . $index++] = 'POSITION'; + } if ($this->isColumnModified(LangTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -1026,12 +1290,30 @@ abstract class Lang implements ActiveRecordInterface case 'URL': $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); break; - case 'POSITION': - $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); + case 'DATE_FORMAT': + $stmt->bindValue($identifier, $this->date_format, PDO::PARAM_STR); + break; + case 'TIME_FORMAT': + $stmt->bindValue($identifier, $this->time_format, PDO::PARAM_STR); + break; + case 'DATETIME_FORMAT': + $stmt->bindValue($identifier, $this->datetime_format, PDO::PARAM_STR); + break; + case 'DECIMAL_SEPARATOR': + $stmt->bindValue($identifier, $this->decimal_separator, PDO::PARAM_STR); + break; + case 'THOUSANDS_SEPARATOR': + $stmt->bindValue($identifier, $this->thousands_separator, PDO::PARAM_STR); + break; + case 'DECIMALS': + $stmt->bindValue($identifier, $this->decimals, PDO::PARAM_STR); break; case 'BY_DEFAULT': $stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT); break; + case 'POSITION': + $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); + break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -1116,15 +1398,33 @@ abstract class Lang implements ActiveRecordInterface return $this->getUrl(); break; case 5: - return $this->getPosition(); + return $this->getDateFormat(); break; case 6: - return $this->getByDefault(); + return $this->getTimeFormat(); break; case 7: - return $this->getCreatedAt(); + return $this->getDatetimeFormat(); break; case 8: + return $this->getDecimalSeparator(); + break; + case 9: + return $this->getThousandsSeparator(); + break; + case 10: + return $this->getDecimals(); + break; + case 11: + return $this->getByDefault(); + break; + case 12: + return $this->getPosition(); + break; + case 13: + return $this->getCreatedAt(); + break; + case 14: return $this->getUpdatedAt(); break; default: @@ -1160,10 +1460,16 @@ abstract class Lang implements ActiveRecordInterface $keys[2] => $this->getCode(), $keys[3] => $this->getLocale(), $keys[4] => $this->getUrl(), - $keys[5] => $this->getPosition(), - $keys[6] => $this->getByDefault(), - $keys[7] => $this->getCreatedAt(), - $keys[8] => $this->getUpdatedAt(), + $keys[5] => $this->getDateFormat(), + $keys[6] => $this->getTimeFormat(), + $keys[7] => $this->getDatetimeFormat(), + $keys[8] => $this->getDecimalSeparator(), + $keys[9] => $this->getThousandsSeparator(), + $keys[10] => $this->getDecimals(), + $keys[11] => $this->getByDefault(), + $keys[12] => $this->getPosition(), + $keys[13] => $this->getCreatedAt(), + $keys[14] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1220,15 +1526,33 @@ abstract class Lang implements ActiveRecordInterface $this->setUrl($value); break; case 5: - $this->setPosition($value); + $this->setDateFormat($value); break; case 6: - $this->setByDefault($value); + $this->setTimeFormat($value); break; case 7: - $this->setCreatedAt($value); + $this->setDatetimeFormat($value); break; case 8: + $this->setDecimalSeparator($value); + break; + case 9: + $this->setThousandsSeparator($value); + break; + case 10: + $this->setDecimals($value); + break; + case 11: + $this->setByDefault($value); + break; + case 12: + $this->setPosition($value); + break; + case 13: + $this->setCreatedAt($value); + break; + case 14: $this->setUpdatedAt($value); break; } // switch() @@ -1260,10 +1584,16 @@ abstract class Lang implements ActiveRecordInterface if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setLocale($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setUrl($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setPosition($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setByDefault($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); + if (array_key_exists($keys[5], $arr)) $this->setDateFormat($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setTimeFormat($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDatetimeFormat($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDecimalSeparator($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setThousandsSeparator($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setDecimals($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setByDefault($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setPosition($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]); } /** @@ -1280,8 +1610,14 @@ abstract class Lang implements ActiveRecordInterface if ($this->isColumnModified(LangTableMap::CODE)) $criteria->add(LangTableMap::CODE, $this->code); if ($this->isColumnModified(LangTableMap::LOCALE)) $criteria->add(LangTableMap::LOCALE, $this->locale); if ($this->isColumnModified(LangTableMap::URL)) $criteria->add(LangTableMap::URL, $this->url); - if ($this->isColumnModified(LangTableMap::POSITION)) $criteria->add(LangTableMap::POSITION, $this->position); + if ($this->isColumnModified(LangTableMap::DATE_FORMAT)) $criteria->add(LangTableMap::DATE_FORMAT, $this->date_format); + if ($this->isColumnModified(LangTableMap::TIME_FORMAT)) $criteria->add(LangTableMap::TIME_FORMAT, $this->time_format); + if ($this->isColumnModified(LangTableMap::DATETIME_FORMAT)) $criteria->add(LangTableMap::DATETIME_FORMAT, $this->datetime_format); + if ($this->isColumnModified(LangTableMap::DECIMAL_SEPARATOR)) $criteria->add(LangTableMap::DECIMAL_SEPARATOR, $this->decimal_separator); + if ($this->isColumnModified(LangTableMap::THOUSANDS_SEPARATOR)) $criteria->add(LangTableMap::THOUSANDS_SEPARATOR, $this->thousands_separator); + if ($this->isColumnModified(LangTableMap::DECIMALS)) $criteria->add(LangTableMap::DECIMALS, $this->decimals); if ($this->isColumnModified(LangTableMap::BY_DEFAULT)) $criteria->add(LangTableMap::BY_DEFAULT, $this->by_default); + if ($this->isColumnModified(LangTableMap::POSITION)) $criteria->add(LangTableMap::POSITION, $this->position); if ($this->isColumnModified(LangTableMap::CREATED_AT)) $criteria->add(LangTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(LangTableMap::UPDATED_AT)) $criteria->add(LangTableMap::UPDATED_AT, $this->updated_at); @@ -1351,8 +1687,14 @@ abstract class Lang implements ActiveRecordInterface $copyObj->setCode($this->getCode()); $copyObj->setLocale($this->getLocale()); $copyObj->setUrl($this->getUrl()); - $copyObj->setPosition($this->getPosition()); + $copyObj->setDateFormat($this->getDateFormat()); + $copyObj->setTimeFormat($this->getTimeFormat()); + $copyObj->setDatetimeFormat($this->getDatetimeFormat()); + $copyObj->setDecimalSeparator($this->getDecimalSeparator()); + $copyObj->setThousandsSeparator($this->getThousandsSeparator()); + $copyObj->setDecimals($this->getDecimals()); $copyObj->setByDefault($this->getByDefault()); + $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($makeNew) { @@ -1393,8 +1735,14 @@ abstract class Lang implements ActiveRecordInterface $this->code = null; $this->locale = null; $this->url = null; - $this->position = null; + $this->date_format = null; + $this->time_format = null; + $this->datetime_format = null; + $this->decimal_separator = null; + $this->thousands_separator = null; + $this->decimals = null; $this->by_default = null; + $this->position = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; diff --git a/core/lib/Thelia/Model/Base/LangQuery.php b/core/lib/Thelia/Model/Base/LangQuery.php index a5100c5f8..2fabec9ee 100644 --- a/core/lib/Thelia/Model/Base/LangQuery.php +++ b/core/lib/Thelia/Model/Base/LangQuery.php @@ -23,8 +23,14 @@ use Thelia\Model\Map\LangTableMap; * @method ChildLangQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildLangQuery orderByLocale($order = Criteria::ASC) Order by the locale column * @method ChildLangQuery orderByUrl($order = Criteria::ASC) Order by the url column - * @method ChildLangQuery orderByPosition($order = Criteria::ASC) Order by the position column + * @method ChildLangQuery orderByDateFormat($order = Criteria::ASC) Order by the date_format column + * @method ChildLangQuery orderByTimeFormat($order = Criteria::ASC) Order by the time_format column + * @method ChildLangQuery orderByDatetimeFormat($order = Criteria::ASC) Order by the datetime_format column + * @method ChildLangQuery orderByDecimalSeparator($order = Criteria::ASC) Order by the decimal_separator column + * @method ChildLangQuery orderByThousandsSeparator($order = Criteria::ASC) Order by the thousands_separator column + * @method ChildLangQuery orderByDecimals($order = Criteria::ASC) Order by the decimals column * @method ChildLangQuery orderByByDefault($order = Criteria::ASC) Order by the by_default column + * @method ChildLangQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildLangQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildLangQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @@ -33,8 +39,14 @@ use Thelia\Model\Map\LangTableMap; * @method ChildLangQuery groupByCode() Group by the code column * @method ChildLangQuery groupByLocale() Group by the locale column * @method ChildLangQuery groupByUrl() Group by the url column - * @method ChildLangQuery groupByPosition() Group by the position column + * @method ChildLangQuery groupByDateFormat() Group by the date_format column + * @method ChildLangQuery groupByTimeFormat() Group by the time_format column + * @method ChildLangQuery groupByDatetimeFormat() Group by the datetime_format column + * @method ChildLangQuery groupByDecimalSeparator() Group by the decimal_separator column + * @method ChildLangQuery groupByThousandsSeparator() Group by the thousands_separator column + * @method ChildLangQuery groupByDecimals() Group by the decimals column * @method ChildLangQuery groupByByDefault() Group by the by_default column + * @method ChildLangQuery groupByPosition() Group by the position column * @method ChildLangQuery groupByCreatedAt() Group by the created_at column * @method ChildLangQuery groupByUpdatedAt() Group by the updated_at column * @@ -50,8 +62,14 @@ use Thelia\Model\Map\LangTableMap; * @method ChildLang findOneByCode(string $code) Return the first ChildLang filtered by the code column * @method ChildLang findOneByLocale(string $locale) Return the first ChildLang filtered by the locale column * @method ChildLang findOneByUrl(string $url) Return the first ChildLang filtered by the url column - * @method ChildLang findOneByPosition(int $position) Return the first ChildLang filtered by the position column + * @method ChildLang findOneByDateFormat(string $date_format) Return the first ChildLang filtered by the date_format column + * @method ChildLang findOneByTimeFormat(string $time_format) Return the first ChildLang filtered by the time_format column + * @method ChildLang findOneByDatetimeFormat(string $datetime_format) Return the first ChildLang filtered by the datetime_format column + * @method ChildLang findOneByDecimalSeparator(string $decimal_separator) Return the first ChildLang filtered by the decimal_separator column + * @method ChildLang findOneByThousandsSeparator(string $thousands_separator) Return the first ChildLang filtered by the thousands_separator column + * @method ChildLang findOneByDecimals(string $decimals) Return the first ChildLang filtered by the decimals column * @method ChildLang findOneByByDefault(int $by_default) Return the first ChildLang filtered by the by_default column + * @method ChildLang findOneByPosition(int $position) Return the first ChildLang filtered by the position column * @method ChildLang findOneByCreatedAt(string $created_at) Return the first ChildLang filtered by the created_at column * @method ChildLang findOneByUpdatedAt(string $updated_at) Return the first ChildLang filtered by the updated_at column * @@ -60,8 +78,14 @@ use Thelia\Model\Map\LangTableMap; * @method array findByCode(string $code) Return ChildLang objects filtered by the code column * @method array findByLocale(string $locale) Return ChildLang objects filtered by the locale column * @method array findByUrl(string $url) Return ChildLang objects filtered by the url column - * @method array findByPosition(int $position) Return ChildLang objects filtered by the position column + * @method array findByDateFormat(string $date_format) Return ChildLang objects filtered by the date_format column + * @method array findByTimeFormat(string $time_format) Return ChildLang objects filtered by the time_format column + * @method array findByDatetimeFormat(string $datetime_format) Return ChildLang objects filtered by the datetime_format column + * @method array findByDecimalSeparator(string $decimal_separator) Return ChildLang objects filtered by the decimal_separator column + * @method array findByThousandsSeparator(string $thousands_separator) Return ChildLang objects filtered by the thousands_separator column + * @method array findByDecimals(string $decimals) Return ChildLang objects filtered by the decimals column * @method array findByByDefault(int $by_default) Return ChildLang objects filtered by the by_default column + * @method array findByPosition(int $position) Return ChildLang objects filtered by the position column * @method array findByCreatedAt(string $created_at) Return ChildLang objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildLang objects filtered by the updated_at column * @@ -152,7 +176,7 @@ abstract class LangQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, TITLE, CODE, LOCALE, URL, POSITION, BY_DEFAULT, CREATED_AT, UPDATED_AT FROM lang WHERE ID = :p0'; + $sql = 'SELECT ID, TITLE, CODE, LOCALE, URL, DATE_FORMAT, TIME_FORMAT, DATETIME_FORMAT, DECIMAL_SEPARATOR, THOUSANDS_SEPARATOR, DECIMALS, BY_DEFAULT, POSITION, CREATED_AT, UPDATED_AT FROM lang WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -399,44 +423,177 @@ abstract class LangQuery extends ModelCriteria } /** - * Filter the query on the position column + * Filter the query on the date_format column * * Example usage: * - * $query->filterByPosition(1234); // WHERE position = 1234 - * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34) - * $query->filterByPosition(array('min' => 12)); // WHERE position > 12 + * $query->filterByDateFormat('fooValue'); // WHERE date_format = 'fooValue' + * $query->filterByDateFormat('%fooValue%'); // WHERE date_format LIKE '%fooValue%' * * - * @param mixed $position The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $dateFormat The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildLangQuery The current query, for fluid interface */ - public function filterByPosition($position = null, $comparison = null) + public function filterByDateFormat($dateFormat = null, $comparison = null) { - if (is_array($position)) { - $useMinMax = false; - if (isset($position['min'])) { - $this->addUsingAlias(LangTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($position['max'])) { - $this->addUsingAlias(LangTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { + if (null === $comparison) { + if (is_array($dateFormat)) { $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dateFormat)) { + $dateFormat = str_replace('*', '%', $dateFormat); + $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(LangTableMap::POSITION, $position, $comparison); + return $this->addUsingAlias(LangTableMap::DATE_FORMAT, $dateFormat, $comparison); + } + + /** + * Filter the query on the time_format column + * + * Example usage: + * + * $query->filterByTimeFormat('fooValue'); // WHERE time_format = 'fooValue' + * $query->filterByTimeFormat('%fooValue%'); // WHERE time_format LIKE '%fooValue%' + * + * + * @param string $timeFormat The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildLangQuery The current query, for fluid interface + */ + public function filterByTimeFormat($timeFormat = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($timeFormat)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $timeFormat)) { + $timeFormat = str_replace('*', '%', $timeFormat); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(LangTableMap::TIME_FORMAT, $timeFormat, $comparison); + } + + /** + * Filter the query on the datetime_format column + * + * Example usage: + * + * $query->filterByDatetimeFormat('fooValue'); // WHERE datetime_format = 'fooValue' + * $query->filterByDatetimeFormat('%fooValue%'); // WHERE datetime_format LIKE '%fooValue%' + * + * + * @param string $datetimeFormat The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildLangQuery The current query, for fluid interface + */ + public function filterByDatetimeFormat($datetimeFormat = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($datetimeFormat)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $datetimeFormat)) { + $datetimeFormat = str_replace('*', '%', $datetimeFormat); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(LangTableMap::DATETIME_FORMAT, $datetimeFormat, $comparison); + } + + /** + * Filter the query on the decimal_separator column + * + * Example usage: + * + * $query->filterByDecimalSeparator('fooValue'); // WHERE decimal_separator = 'fooValue' + * $query->filterByDecimalSeparator('%fooValue%'); // WHERE decimal_separator LIKE '%fooValue%' + * + * + * @param string $decimalSeparator The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildLangQuery The current query, for fluid interface + */ + public function filterByDecimalSeparator($decimalSeparator = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($decimalSeparator)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $decimalSeparator)) { + $decimalSeparator = str_replace('*', '%', $decimalSeparator); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(LangTableMap::DECIMAL_SEPARATOR, $decimalSeparator, $comparison); + } + + /** + * Filter the query on the thousands_separator column + * + * Example usage: + * + * $query->filterByThousandsSeparator('fooValue'); // WHERE thousands_separator = 'fooValue' + * $query->filterByThousandsSeparator('%fooValue%'); // WHERE thousands_separator LIKE '%fooValue%' + * + * + * @param string $thousandsSeparator The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildLangQuery The current query, for fluid interface + */ + public function filterByThousandsSeparator($thousandsSeparator = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($thousandsSeparator)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $thousandsSeparator)) { + $thousandsSeparator = str_replace('*', '%', $thousandsSeparator); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(LangTableMap::THOUSANDS_SEPARATOR, $thousandsSeparator, $comparison); + } + + /** + * Filter the query on the decimals column + * + * Example usage: + * + * $query->filterByDecimals('fooValue'); // WHERE decimals = 'fooValue' + * $query->filterByDecimals('%fooValue%'); // WHERE decimals LIKE '%fooValue%' + * + * + * @param string $decimals The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildLangQuery The current query, for fluid interface + */ + public function filterByDecimals($decimals = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($decimals)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $decimals)) { + $decimals = str_replace('*', '%', $decimals); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(LangTableMap::DECIMALS, $decimals, $comparison); } /** @@ -480,6 +637,47 @@ abstract class LangQuery extends ModelCriteria return $this->addUsingAlias(LangTableMap::BY_DEFAULT, $byDefault, $comparison); } + /** + * Filter the query on the position column + * + * Example usage: + * + * $query->filterByPosition(1234); // WHERE position = 1234 + * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34) + * $query->filterByPosition(array('min' => 12)); // WHERE position > 12 + * + * + * @param mixed $position The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildLangQuery The current query, for fluid interface + */ + public function filterByPosition($position = null, $comparison = null) + { + if (is_array($position)) { + $useMinMax = false; + if (isset($position['min'])) { + $this->addUsingAlias(LangTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($position['max'])) { + $this->addUsingAlias(LangTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(LangTableMap::POSITION, $position, $comparison); + } + /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Base/Message.php b/core/lib/Thelia/Model/Base/Message.php index a2327f388..4ee6b4cab 100644 --- a/core/lib/Thelia/Model/Base/Message.php +++ b/core/lib/Thelia/Model/Base/Message.php @@ -67,10 +67,10 @@ abstract class Message implements ActiveRecordInterface protected $id; /** - * The value for the code field. + * The value for the name field. * @var string */ - protected $code; + protected $name; /** * The value for the secured field. @@ -78,12 +78,6 @@ abstract class Message implements ActiveRecordInterface */ protected $secured; - /** - * The value for the ref field. - * @var string - */ - protected $ref; - /** * The value for the created_at field. * @var string @@ -338,7 +332,7 @@ abstract class Message implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -448,14 +442,14 @@ abstract class Message implements ActiveRecordInterface } /** - * Get the [code] column value. + * Get the [name] column value. * * @return string */ - public function getCode() + public function getName() { - return $this->code; + return $this->name; } /** @@ -469,17 +463,6 @@ abstract class Message implements ActiveRecordInterface return $this->secured; } - /** - * Get the [ref] column value. - * - * @return string - */ - public function getRef() - { - - return $this->ref; - } - /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -584,25 +567,25 @@ abstract class Message implements ActiveRecordInterface } // setId() /** - * Set the value of [code] column. + * Set the value of [name] column. * * @param string $v new value * @return \Thelia\Model\Message The current object (for fluent API support) */ - public function setCode($v) + public function setName($v) { if ($v !== null) { $v = (string) $v; } - if ($this->code !== $v) { - $this->code = $v; - $this->modifiedColumns[] = MessageTableMap::CODE; + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = MessageTableMap::NAME; } return $this; - } // setCode() + } // setName() /** * Set the value of [secured] column. @@ -625,27 +608,6 @@ abstract class Message implements ActiveRecordInterface return $this; } // setSecured() - /** - * Set the value of [ref] column. - * - * @param string $v new value - * @return \Thelia\Model\Message The current object (for fluent API support) - */ - public function setRef($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->ref !== $v) { - $this->ref = $v; - $this->modifiedColumns[] = MessageTableMap::REF; - } - - - return $this; - } // setRef() - /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -795,37 +757,34 @@ abstract class Message implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : MessageTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MessageTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; - $this->code = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MessageTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]; + $this->name = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MessageTableMap::translateFieldName('Secured', TableMap::TYPE_PHPNAME, $indexType)]; $this->secured = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageTableMap::translateFieldName('Ref', TableMap::TYPE_PHPNAME, $indexType)]; - $this->ref = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $this->version = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : MessageTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; $this->version_created_by = (null !== $col) ? (string) $col : null; $this->resetModified(); @@ -835,7 +794,7 @@ abstract class Message implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 9; // 9 = MessageTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 8; // 8 = MessageTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Message object", 0, $e); @@ -1108,15 +1067,12 @@ abstract class Message implements ActiveRecordInterface if ($this->isColumnModified(MessageTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(MessageTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + if ($this->isColumnModified(MessageTableMap::NAME)) { + $modifiedColumns[':p' . $index++] = 'NAME'; } if ($this->isColumnModified(MessageTableMap::SECURED)) { $modifiedColumns[':p' . $index++] = 'SECURED'; } - if ($this->isColumnModified(MessageTableMap::REF)) { - $modifiedColumns[':p' . $index++] = 'REF'; - } if ($this->isColumnModified(MessageTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -1146,15 +1102,12 @@ abstract class Message implements ActiveRecordInterface case 'ID': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': - $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); + case 'NAME': + $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; case 'SECURED': $stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT); break; - case 'REF': - $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); - break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -1236,27 +1189,24 @@ abstract class Message implements ActiveRecordInterface return $this->getId(); break; case 1: - return $this->getCode(); + return $this->getName(); break; case 2: return $this->getSecured(); break; case 3: - return $this->getRef(); - break; - case 4: return $this->getCreatedAt(); break; - case 5: + case 4: return $this->getUpdatedAt(); break; - case 6: + case 5: return $this->getVersion(); break; - case 7: + case 6: return $this->getVersionCreatedAt(); break; - case 8: + case 7: return $this->getVersionCreatedBy(); break; default: @@ -1289,14 +1239,13 @@ abstract class Message implements ActiveRecordInterface $keys = MessageTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), - $keys[1] => $this->getCode(), + $keys[1] => $this->getName(), $keys[2] => $this->getSecured(), - $keys[3] => $this->getRef(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), - $keys[6] => $this->getVersion(), - $keys[7] => $this->getVersionCreatedAt(), - $keys[8] => $this->getVersionCreatedBy(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), + $keys[5] => $this->getVersion(), + $keys[6] => $this->getVersionCreatedAt(), + $keys[7] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1349,27 +1298,24 @@ abstract class Message implements ActiveRecordInterface $this->setId($value); break; case 1: - $this->setCode($value); + $this->setName($value); break; case 2: $this->setSecured($value); break; case 3: - $this->setRef($value); - break; - case 4: $this->setCreatedAt($value); break; - case 5: + case 4: $this->setUpdatedAt($value); break; - case 6: + case 5: $this->setVersion($value); break; - case 7: + case 6: $this->setVersionCreatedAt($value); break; - case 8: + case 7: $this->setVersionCreatedBy($value); break; } // switch() @@ -1397,14 +1343,13 @@ abstract class Message implements ActiveRecordInterface $keys = MessageTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setSecured($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setRef($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedBy($arr[$keys[8]]); + if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setVersion($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setVersionCreatedAt($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedBy($arr[$keys[7]]); } /** @@ -1417,9 +1362,8 @@ abstract class Message implements ActiveRecordInterface $criteria = new Criteria(MessageTableMap::DATABASE_NAME); if ($this->isColumnModified(MessageTableMap::ID)) $criteria->add(MessageTableMap::ID, $this->id); - if ($this->isColumnModified(MessageTableMap::CODE)) $criteria->add(MessageTableMap::CODE, $this->code); + if ($this->isColumnModified(MessageTableMap::NAME)) $criteria->add(MessageTableMap::NAME, $this->name); if ($this->isColumnModified(MessageTableMap::SECURED)) $criteria->add(MessageTableMap::SECURED, $this->secured); - if ($this->isColumnModified(MessageTableMap::REF)) $criteria->add(MessageTableMap::REF, $this->ref); if ($this->isColumnModified(MessageTableMap::CREATED_AT)) $criteria->add(MessageTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(MessageTableMap::UPDATED_AT)) $criteria->add(MessageTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(MessageTableMap::VERSION)) $criteria->add(MessageTableMap::VERSION, $this->version); @@ -1488,9 +1432,8 @@ abstract class Message implements ActiveRecordInterface */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setCode($this->getCode()); + $copyObj->setName($this->getName()); $copyObj->setSecured($this->getSecured()); - $copyObj->setRef($this->getRef()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setVersion($this->getVersion()); @@ -2015,9 +1958,8 @@ abstract class Message implements ActiveRecordInterface public function clear() { $this->id = null; - $this->code = null; + $this->name = null; $this->secured = null; - $this->ref = null; $this->created_at = null; $this->updated_at = null; $this->version = null; @@ -2218,48 +2160,72 @@ abstract class Message implements ActiveRecordInterface /** - * Get the [description] column value. + * Get the [subject] column value. * * @return string */ - public function getDescription() + public function getSubject() { - return $this->getCurrentTranslation()->getDescription(); + return $this->getCurrentTranslation()->getSubject(); } /** - * Set the value of [description] column. + * Set the value of [subject] column. * * @param string $v new value * @return \Thelia\Model\MessageI18n The current object (for fluent API support) */ - public function setDescription($v) - { $this->getCurrentTranslation()->setDescription($v); + public function setSubject($v) + { $this->getCurrentTranslation()->setSubject($v); return $this; } /** - * Get the [description_html] column value. + * Get the [text_message] column value. * * @return string */ - public function getDescriptionHtml() + public function getTextMessage() { - return $this->getCurrentTranslation()->getDescriptionHtml(); + return $this->getCurrentTranslation()->getTextMessage(); } /** - * Set the value of [description_html] column. + * Set the value of [text_message] column. * * @param string $v new value * @return \Thelia\Model\MessageI18n The current object (for fluent API support) */ - public function setDescriptionHtml($v) - { $this->getCurrentTranslation()->setDescriptionHtml($v); + public function setTextMessage($v) + { $this->getCurrentTranslation()->setTextMessage($v); + + return $this; + } + + + /** + * Get the [html_message] column value. + * + * @return string + */ + public function getHtmlMessage() + { + return $this->getCurrentTranslation()->getHtmlMessage(); + } + + + /** + * Set the value of [html_message] column. + * + * @param string $v new value + * @return \Thelia\Model\MessageI18n The current object (for fluent API support) + */ + public function setHtmlMessage($v) + { $this->getCurrentTranslation()->setHtmlMessage($v); return $this; } @@ -2313,9 +2279,8 @@ abstract class Message implements ActiveRecordInterface $version = new ChildMessageVersion(); $version->setId($this->getId()); - $version->setCode($this->getCode()); + $version->setName($this->getName()); $version->setSecured($this->getSecured()); - $version->setRef($this->getRef()); $version->setCreatedAt($this->getCreatedAt()); $version->setUpdatedAt($this->getUpdatedAt()); $version->setVersion($this->getVersion()); @@ -2359,9 +2324,8 @@ abstract class Message implements ActiveRecordInterface { $loadedObjects['ChildMessage'][$version->getId()][$version->getVersion()] = $this; $this->setId($version->getId()); - $this->setCode($version->getCode()); + $this->setName($version->getName()); $this->setSecured($version->getSecured()); - $this->setRef($version->getRef()); $this->setCreatedAt($version->getCreatedAt()); $this->setUpdatedAt($version->getUpdatedAt()); $this->setVersion($version->getVersion()); diff --git a/core/lib/Thelia/Model/Base/MessageI18n.php b/core/lib/Thelia/Model/Base/MessageI18n.php index 4d1a532fe..d37682f97 100644 --- a/core/lib/Thelia/Model/Base/MessageI18n.php +++ b/core/lib/Thelia/Model/Base/MessageI18n.php @@ -73,16 +73,22 @@ abstract class MessageI18n implements ActiveRecordInterface protected $title; /** - * The value for the description field. + * The value for the subject field. * @var string */ - protected $description; + protected $subject; /** - * The value for the description_html field. + * The value for the text_message field. * @var string */ - protected $description_html; + protected $text_message; + + /** + * The value for the html_message field. + * @var string + */ + protected $html_message; /** * @var Message @@ -266,7 +272,7 @@ abstract class MessageI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -398,25 +404,36 @@ abstract class MessageI18n implements ActiveRecordInterface } /** - * Get the [description] column value. + * Get the [subject] column value. * * @return string */ - public function getDescription() + public function getSubject() { - return $this->description; + return $this->subject; } /** - * Get the [description_html] column value. + * Get the [text_message] column value. * * @return string */ - public function getDescriptionHtml() + public function getTextMessage() { - return $this->description_html; + return $this->text_message; + } + + /** + * Get the [html_message] column value. + * + * @return string + */ + public function getHtmlMessage() + { + + return $this->html_message; } /** @@ -487,46 +504,67 @@ abstract class MessageI18n implements ActiveRecordInterface } // setTitle() /** - * Set the value of [description] column. + * Set the value of [subject] column. * * @param string $v new value * @return \Thelia\Model\MessageI18n The current object (for fluent API support) */ - public function setDescription($v) + public function setSubject($v) { if ($v !== null) { $v = (string) $v; } - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = MessageI18nTableMap::DESCRIPTION; + if ($this->subject !== $v) { + $this->subject = $v; + $this->modifiedColumns[] = MessageI18nTableMap::SUBJECT; } return $this; - } // setDescription() + } // setSubject() /** - * Set the value of [description_html] column. + * Set the value of [text_message] column. * * @param string $v new value * @return \Thelia\Model\MessageI18n The current object (for fluent API support) */ - public function setDescriptionHtml($v) + public function setTextMessage($v) { if ($v !== null) { $v = (string) $v; } - if ($this->description_html !== $v) { - $this->description_html = $v; - $this->modifiedColumns[] = MessageI18nTableMap::DESCRIPTION_HTML; + if ($this->text_message !== $v) { + $this->text_message = $v; + $this->modifiedColumns[] = MessageI18nTableMap::TEXT_MESSAGE; } return $this; - } // setDescriptionHtml() + } // setTextMessage() + + /** + * Set the value of [html_message] column. + * + * @param string $v new value + * @return \Thelia\Model\MessageI18n The current object (for fluent API support) + */ + public function setHtmlMessage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->html_message !== $v) { + $this->html_message = $v; + $this->modifiedColumns[] = MessageI18nTableMap::HTML_MESSAGE; + } + + + return $this; + } // setHtmlMessage() /** * Indicates whether the columns in this object are only set to default values. @@ -578,11 +616,14 @@ abstract class MessageI18n implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MessageI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; $this->title = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; - $this->description = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageI18nTableMap::translateFieldName('Subject', TableMap::TYPE_PHPNAME, $indexType)]; + $this->subject = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageI18nTableMap::translateFieldName('DescriptionHtml', TableMap::TYPE_PHPNAME, $indexType)]; - $this->description_html = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageI18nTableMap::translateFieldName('TextMessage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->text_message = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageI18nTableMap::translateFieldName('HtmlMessage', TableMap::TYPE_PHPNAME, $indexType)]; + $this->html_message = (null !== $col) ? (string) $col : null; $this->resetModified(); $this->setNew(false); @@ -591,7 +632,7 @@ abstract class MessageI18n implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 5; // 5 = MessageI18nTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = MessageI18nTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\MessageI18n object", 0, $e); @@ -821,11 +862,14 @@ abstract class MessageI18n implements ActiveRecordInterface if ($this->isColumnModified(MessageI18nTableMap::TITLE)) { $modifiedColumns[':p' . $index++] = 'TITLE'; } - if ($this->isColumnModified(MessageI18nTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + if ($this->isColumnModified(MessageI18nTableMap::SUBJECT)) { + $modifiedColumns[':p' . $index++] = 'SUBJECT'; } - if ($this->isColumnModified(MessageI18nTableMap::DESCRIPTION_HTML)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION_HTML'; + if ($this->isColumnModified(MessageI18nTableMap::TEXT_MESSAGE)) { + $modifiedColumns[':p' . $index++] = 'TEXT_MESSAGE'; + } + if ($this->isColumnModified(MessageI18nTableMap::HTML_MESSAGE)) { + $modifiedColumns[':p' . $index++] = 'HTML_MESSAGE'; } $sql = sprintf( @@ -847,11 +891,14 @@ abstract class MessageI18n implements ActiveRecordInterface case 'TITLE': $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); break; - case 'DESCRIPTION': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + case 'SUBJECT': + $stmt->bindValue($identifier, $this->subject, PDO::PARAM_STR); break; - case 'DESCRIPTION_HTML': - $stmt->bindValue($identifier, $this->description_html, PDO::PARAM_STR); + case 'TEXT_MESSAGE': + $stmt->bindValue($identifier, $this->text_message, PDO::PARAM_STR); + break; + case 'HTML_MESSAGE': + $stmt->bindValue($identifier, $this->html_message, PDO::PARAM_STR); break; } } @@ -918,10 +965,13 @@ abstract class MessageI18n implements ActiveRecordInterface return $this->getTitle(); break; case 3: - return $this->getDescription(); + return $this->getSubject(); break; case 4: - return $this->getDescriptionHtml(); + return $this->getTextMessage(); + break; + case 5: + return $this->getHtmlMessage(); break; default: return null; @@ -955,8 +1005,9 @@ abstract class MessageI18n implements ActiveRecordInterface $keys[0] => $this->getId(), $keys[1] => $this->getLocale(), $keys[2] => $this->getTitle(), - $keys[3] => $this->getDescription(), - $keys[4] => $this->getDescriptionHtml(), + $keys[3] => $this->getSubject(), + $keys[4] => $this->getTextMessage(), + $keys[5] => $this->getHtmlMessage(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1012,10 +1063,13 @@ abstract class MessageI18n implements ActiveRecordInterface $this->setTitle($value); break; case 3: - $this->setDescription($value); + $this->setSubject($value); break; case 4: - $this->setDescriptionHtml($value); + $this->setTextMessage($value); + break; + case 5: + $this->setHtmlMessage($value); break; } // switch() } @@ -1044,8 +1098,9 @@ abstract class MessageI18n implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setDescriptionHtml($arr[$keys[4]]); + if (array_key_exists($keys[3], $arr)) $this->setSubject($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setTextMessage($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setHtmlMessage($arr[$keys[5]]); } /** @@ -1060,8 +1115,9 @@ abstract class MessageI18n implements ActiveRecordInterface if ($this->isColumnModified(MessageI18nTableMap::ID)) $criteria->add(MessageI18nTableMap::ID, $this->id); if ($this->isColumnModified(MessageI18nTableMap::LOCALE)) $criteria->add(MessageI18nTableMap::LOCALE, $this->locale); if ($this->isColumnModified(MessageI18nTableMap::TITLE)) $criteria->add(MessageI18nTableMap::TITLE, $this->title); - if ($this->isColumnModified(MessageI18nTableMap::DESCRIPTION)) $criteria->add(MessageI18nTableMap::DESCRIPTION, $this->description); - if ($this->isColumnModified(MessageI18nTableMap::DESCRIPTION_HTML)) $criteria->add(MessageI18nTableMap::DESCRIPTION_HTML, $this->description_html); + if ($this->isColumnModified(MessageI18nTableMap::SUBJECT)) $criteria->add(MessageI18nTableMap::SUBJECT, $this->subject); + if ($this->isColumnModified(MessageI18nTableMap::TEXT_MESSAGE)) $criteria->add(MessageI18nTableMap::TEXT_MESSAGE, $this->text_message); + if ($this->isColumnModified(MessageI18nTableMap::HTML_MESSAGE)) $criteria->add(MessageI18nTableMap::HTML_MESSAGE, $this->html_message); return $criteria; } @@ -1135,8 +1191,9 @@ abstract class MessageI18n implements ActiveRecordInterface $copyObj->setId($this->getId()); $copyObj->setLocale($this->getLocale()); $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); - $copyObj->setDescriptionHtml($this->getDescriptionHtml()); + $copyObj->setSubject($this->getSubject()); + $copyObj->setTextMessage($this->getTextMessage()); + $copyObj->setHtmlMessage($this->getHtmlMessage()); if ($makeNew) { $copyObj->setNew(true); } @@ -1223,8 +1280,9 @@ abstract class MessageI18n implements ActiveRecordInterface $this->id = null; $this->locale = null; $this->title = null; - $this->description = null; - $this->description_html = null; + $this->subject = null; + $this->text_message = null; + $this->html_message = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->applyDefaultValues(); diff --git a/core/lib/Thelia/Model/Base/MessageI18nQuery.php b/core/lib/Thelia/Model/Base/MessageI18nQuery.php index 478c737e8..f63ca675a 100644 --- a/core/lib/Thelia/Model/Base/MessageI18nQuery.php +++ b/core/lib/Thelia/Model/Base/MessageI18nQuery.php @@ -24,14 +24,16 @@ use Thelia\Model\Map\MessageI18nTableMap; * @method ChildMessageI18nQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildMessageI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column * @method ChildMessageI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column - * @method ChildMessageI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column - * @method ChildMessageI18nQuery orderByDescriptionHtml($order = Criteria::ASC) Order by the description_html column + * @method ChildMessageI18nQuery orderBySubject($order = Criteria::ASC) Order by the subject column + * @method ChildMessageI18nQuery orderByTextMessage($order = Criteria::ASC) Order by the text_message column + * @method ChildMessageI18nQuery orderByHtmlMessage($order = Criteria::ASC) Order by the html_message column * * @method ChildMessageI18nQuery groupById() Group by the id column * @method ChildMessageI18nQuery groupByLocale() Group by the locale column * @method ChildMessageI18nQuery groupByTitle() Group by the title column - * @method ChildMessageI18nQuery groupByDescription() Group by the description column - * @method ChildMessageI18nQuery groupByDescriptionHtml() Group by the description_html column + * @method ChildMessageI18nQuery groupBySubject() Group by the subject column + * @method ChildMessageI18nQuery groupByTextMessage() Group by the text_message column + * @method ChildMessageI18nQuery groupByHtmlMessage() Group by the html_message column * * @method ChildMessageI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildMessageI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -47,14 +49,16 @@ use Thelia\Model\Map\MessageI18nTableMap; * @method ChildMessageI18n findOneById(int $id) Return the first ChildMessageI18n filtered by the id column * @method ChildMessageI18n findOneByLocale(string $locale) Return the first ChildMessageI18n filtered by the locale column * @method ChildMessageI18n findOneByTitle(string $title) Return the first ChildMessageI18n filtered by the title column - * @method ChildMessageI18n findOneByDescription(string $description) Return the first ChildMessageI18n filtered by the description column - * @method ChildMessageI18n findOneByDescriptionHtml(string $description_html) Return the first ChildMessageI18n filtered by the description_html column + * @method ChildMessageI18n findOneBySubject(string $subject) Return the first ChildMessageI18n filtered by the subject column + * @method ChildMessageI18n findOneByTextMessage(string $text_message) Return the first ChildMessageI18n filtered by the text_message column + * @method ChildMessageI18n findOneByHtmlMessage(string $html_message) Return the first ChildMessageI18n filtered by the html_message column * * @method array findById(int $id) Return ChildMessageI18n objects filtered by the id column * @method array findByLocale(string $locale) Return ChildMessageI18n objects filtered by the locale column * @method array findByTitle(string $title) Return ChildMessageI18n objects filtered by the title column - * @method array findByDescription(string $description) Return ChildMessageI18n objects filtered by the description column - * @method array findByDescriptionHtml(string $description_html) Return ChildMessageI18n objects filtered by the description_html column + * @method array findBySubject(string $subject) Return ChildMessageI18n objects filtered by the subject column + * @method array findByTextMessage(string $text_message) Return ChildMessageI18n objects filtered by the text_message column + * @method array findByHtmlMessage(string $html_message) Return ChildMessageI18n objects filtered by the html_message column * */ abstract class MessageI18nQuery extends ModelCriteria @@ -143,7 +147,7 @@ abstract class MessageI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, DESCRIPTION_HTML FROM message_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT ID, LOCALE, TITLE, SUBJECT, TEXT_MESSAGE, HTML_MESSAGE FROM message_i18n WHERE ID = :p0 AND LOCALE = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -346,61 +350,90 @@ abstract class MessageI18nQuery extends ModelCriteria } /** - * Filter the query on the description column + * Filter the query on the subject column * * Example usage: * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' + * $query->filterBySubject('fooValue'); // WHERE subject = 'fooValue' + * $query->filterBySubject('%fooValue%'); // WHERE subject LIKE '%fooValue%' * * - * @param string $description The value to use as filter. + * @param string $subject The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildMessageI18nQuery The current query, for fluid interface */ - public function filterByDescription($description = null, $comparison = null) + public function filterBySubject($subject = null, $comparison = null) { if (null === $comparison) { - if (is_array($description)) { + if (is_array($subject)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); + } elseif (preg_match('/[\%\*]/', $subject)) { + $subject = str_replace('*', '%', $subject); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(MessageI18nTableMap::DESCRIPTION, $description, $comparison); + return $this->addUsingAlias(MessageI18nTableMap::SUBJECT, $subject, $comparison); } /** - * Filter the query on the description_html column + * Filter the query on the text_message column * * Example usage: * - * $query->filterByDescriptionHtml('fooValue'); // WHERE description_html = 'fooValue' - * $query->filterByDescriptionHtml('%fooValue%'); // WHERE description_html LIKE '%fooValue%' + * $query->filterByTextMessage('fooValue'); // WHERE text_message = 'fooValue' + * $query->filterByTextMessage('%fooValue%'); // WHERE text_message LIKE '%fooValue%' * * - * @param string $descriptionHtml The value to use as filter. + * @param string $textMessage The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildMessageI18nQuery The current query, for fluid interface */ - public function filterByDescriptionHtml($descriptionHtml = null, $comparison = null) + public function filterByTextMessage($textMessage = null, $comparison = null) { if (null === $comparison) { - if (is_array($descriptionHtml)) { + if (is_array($textMessage)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $descriptionHtml)) { - $descriptionHtml = str_replace('*', '%', $descriptionHtml); + } elseif (preg_match('/[\%\*]/', $textMessage)) { + $textMessage = str_replace('*', '%', $textMessage); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(MessageI18nTableMap::DESCRIPTION_HTML, $descriptionHtml, $comparison); + return $this->addUsingAlias(MessageI18nTableMap::TEXT_MESSAGE, $textMessage, $comparison); + } + + /** + * Filter the query on the html_message column + * + * Example usage: + * + * $query->filterByHtmlMessage('fooValue'); // WHERE html_message = 'fooValue' + * $query->filterByHtmlMessage('%fooValue%'); // WHERE html_message LIKE '%fooValue%' + * + * + * @param string $htmlMessage The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildMessageI18nQuery The current query, for fluid interface + */ + public function filterByHtmlMessage($htmlMessage = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($htmlMessage)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $htmlMessage)) { + $htmlMessage = str_replace('*', '%', $htmlMessage); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(MessageI18nTableMap::HTML_MESSAGE, $htmlMessage, $comparison); } /** diff --git a/core/lib/Thelia/Model/Base/MessageQuery.php b/core/lib/Thelia/Model/Base/MessageQuery.php index cf0155f36..d72dc7bed 100644 --- a/core/lib/Thelia/Model/Base/MessageQuery.php +++ b/core/lib/Thelia/Model/Base/MessageQuery.php @@ -23,9 +23,8 @@ use Thelia\Model\Map\MessageTableMap; * * * @method ChildMessageQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildMessageQuery orderByCode($order = Criteria::ASC) Order by the code column + * @method ChildMessageQuery orderByName($order = Criteria::ASC) Order by the name column * @method ChildMessageQuery orderBySecured($order = Criteria::ASC) Order by the secured column - * @method ChildMessageQuery orderByRef($order = Criteria::ASC) Order by the ref column * @method ChildMessageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildMessageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildMessageQuery orderByVersion($order = Criteria::ASC) Order by the version column @@ -33,9 +32,8 @@ use Thelia\Model\Map\MessageTableMap; * @method ChildMessageQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column * * @method ChildMessageQuery groupById() Group by the id column - * @method ChildMessageQuery groupByCode() Group by the code column + * @method ChildMessageQuery groupByName() Group by the name column * @method ChildMessageQuery groupBySecured() Group by the secured column - * @method ChildMessageQuery groupByRef() Group by the ref column * @method ChildMessageQuery groupByCreatedAt() Group by the created_at column * @method ChildMessageQuery groupByUpdatedAt() Group by the updated_at column * @method ChildMessageQuery groupByVersion() Group by the version column @@ -58,9 +56,8 @@ use Thelia\Model\Map\MessageTableMap; * @method ChildMessage findOneOrCreate(ConnectionInterface $con = null) Return the first ChildMessage matching the query, or a new ChildMessage object populated from the query conditions when no match is found * * @method ChildMessage findOneById(int $id) Return the first ChildMessage filtered by the id column - * @method ChildMessage findOneByCode(string $code) Return the first ChildMessage filtered by the code column + * @method ChildMessage findOneByName(string $name) Return the first ChildMessage filtered by the name column * @method ChildMessage findOneBySecured(int $secured) Return the first ChildMessage filtered by the secured column - * @method ChildMessage findOneByRef(string $ref) Return the first ChildMessage filtered by the ref column * @method ChildMessage findOneByCreatedAt(string $created_at) Return the first ChildMessage filtered by the created_at column * @method ChildMessage findOneByUpdatedAt(string $updated_at) Return the first ChildMessage filtered by the updated_at column * @method ChildMessage findOneByVersion(int $version) Return the first ChildMessage filtered by the version column @@ -68,9 +65,8 @@ use Thelia\Model\Map\MessageTableMap; * @method ChildMessage findOneByVersionCreatedBy(string $version_created_by) Return the first ChildMessage filtered by the version_created_by column * * @method array findById(int $id) Return ChildMessage objects filtered by the id column - * @method array findByCode(string $code) Return ChildMessage objects filtered by the code column + * @method array findByName(string $name) Return ChildMessage objects filtered by the name column * @method array findBySecured(int $secured) Return ChildMessage objects filtered by the secured column - * @method array findByRef(string $ref) Return ChildMessage objects filtered by the ref column * @method array findByCreatedAt(string $created_at) Return ChildMessage objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildMessage objects filtered by the updated_at column * @method array findByVersion(int $version) Return ChildMessage objects filtered by the version column @@ -171,7 +167,7 @@ abstract class MessageQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, SECURED, REF, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message WHERE ID = :p0'; + $sql = 'SELECT ID, NAME, SECURED, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -302,32 +298,32 @@ abstract class MessageQuery extends ModelCriteria } /** - * Filter the query on the code column + * Filter the query on the name column * * Example usage: * - * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' - * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' + * $query->filterByName('fooValue'); // WHERE name = 'fooValue' + * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' * * - * @param string $code The value to use as filter. + * @param string $name The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildMessageQuery The current query, for fluid interface */ - public function filterByCode($code = null, $comparison = null) + public function filterByName($name = null, $comparison = null) { if (null === $comparison) { - if (is_array($code)) { + if (is_array($name)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $code)) { - $code = str_replace('*', '%', $code); + } elseif (preg_match('/[\%\*]/', $name)) { + $name = str_replace('*', '%', $name); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(MessageTableMap::CODE, $code, $comparison); + return $this->addUsingAlias(MessageTableMap::NAME, $name, $comparison); } /** @@ -371,35 +367,6 @@ abstract class MessageQuery extends ModelCriteria return $this->addUsingAlias(MessageTableMap::SECURED, $secured, $comparison); } - /** - * Filter the query on the ref column - * - * Example usage: - * - * $query->filterByRef('fooValue'); // WHERE ref = 'fooValue' - * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%' - * - * - * @param string $ref The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildMessageQuery The current query, for fluid interface - */ - public function filterByRef($ref = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($ref)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $ref)) { - $ref = str_replace('*', '%', $ref); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(MessageTableMap::REF, $ref, $comparison); - } - /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Base/MessageVersion.php b/core/lib/Thelia/Model/Base/MessageVersion.php index 0781a503a..60e12da8d 100644 --- a/core/lib/Thelia/Model/Base/MessageVersion.php +++ b/core/lib/Thelia/Model/Base/MessageVersion.php @@ -62,10 +62,10 @@ abstract class MessageVersion implements ActiveRecordInterface protected $id; /** - * The value for the code field. + * The value for the name field. * @var string */ - protected $code; + protected $name; /** * The value for the secured field. @@ -73,12 +73,6 @@ abstract class MessageVersion implements ActiveRecordInterface */ protected $secured; - /** - * The value for the ref field. - * @var string - */ - protected $ref; - /** * The value for the created_at field. * @var string @@ -292,7 +286,7 @@ abstract class MessageVersion implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -402,14 +396,14 @@ abstract class MessageVersion implements ActiveRecordInterface } /** - * Get the [code] column value. + * Get the [name] column value. * * @return string */ - public function getCode() + public function getName() { - return $this->code; + return $this->name; } /** @@ -423,17 +417,6 @@ abstract class MessageVersion implements ActiveRecordInterface return $this->secured; } - /** - * Get the [ref] column value. - * - * @return string - */ - public function getRef() - { - - return $this->ref; - } - /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -542,25 +525,25 @@ abstract class MessageVersion implements ActiveRecordInterface } // setId() /** - * Set the value of [code] column. + * Set the value of [name] column. * * @param string $v new value * @return \Thelia\Model\MessageVersion The current object (for fluent API support) */ - public function setCode($v) + public function setName($v) { if ($v !== null) { $v = (string) $v; } - if ($this->code !== $v) { - $this->code = $v; - $this->modifiedColumns[] = MessageVersionTableMap::CODE; + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = MessageVersionTableMap::NAME; } return $this; - } // setCode() + } // setName() /** * Set the value of [secured] column. @@ -583,27 +566,6 @@ abstract class MessageVersion implements ActiveRecordInterface return $this; } // setSecured() - /** - * Set the value of [ref] column. - * - * @param string $v new value - * @return \Thelia\Model\MessageVersion The current object (for fluent API support) - */ - public function setRef($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->ref !== $v) { - $this->ref = $v; - $this->modifiedColumns[] = MessageVersionTableMap::REF; - } - - - return $this; - } // setRef() - /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -753,37 +715,34 @@ abstract class MessageVersion implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : MessageVersionTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MessageVersionTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; - $this->code = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : MessageVersionTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]; + $this->name = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MessageVersionTableMap::translateFieldName('Secured', TableMap::TYPE_PHPNAME, $indexType)]; $this->secured = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageVersionTableMap::translateFieldName('Ref', TableMap::TYPE_PHPNAME, $indexType)]; - $this->ref = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $this->version = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; $this->version_created_by = (null !== $col) ? (string) $col : null; $this->resetModified(); @@ -793,7 +752,7 @@ abstract class MessageVersion implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 9; // 9 = MessageVersionTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 8; // 8 = MessageVersionTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\MessageVersion object", 0, $e); @@ -1017,15 +976,12 @@ abstract class MessageVersion implements ActiveRecordInterface if ($this->isColumnModified(MessageVersionTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(MessageVersionTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; + if ($this->isColumnModified(MessageVersionTableMap::NAME)) { + $modifiedColumns[':p' . $index++] = 'NAME'; } if ($this->isColumnModified(MessageVersionTableMap::SECURED)) { $modifiedColumns[':p' . $index++] = 'SECURED'; } - if ($this->isColumnModified(MessageVersionTableMap::REF)) { - $modifiedColumns[':p' . $index++] = 'REF'; - } if ($this->isColumnModified(MessageVersionTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -1055,15 +1011,12 @@ abstract class MessageVersion implements ActiveRecordInterface case 'ID': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': - $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); + case 'NAME': + $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; case 'SECURED': $stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT); break; - case 'REF': - $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR); - break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -1138,27 +1091,24 @@ abstract class MessageVersion implements ActiveRecordInterface return $this->getId(); break; case 1: - return $this->getCode(); + return $this->getName(); break; case 2: return $this->getSecured(); break; case 3: - return $this->getRef(); - break; - case 4: return $this->getCreatedAt(); break; - case 5: + case 4: return $this->getUpdatedAt(); break; - case 6: + case 5: return $this->getVersion(); break; - case 7: + case 6: return $this->getVersionCreatedAt(); break; - case 8: + case 7: return $this->getVersionCreatedBy(); break; default: @@ -1191,14 +1141,13 @@ abstract class MessageVersion implements ActiveRecordInterface $keys = MessageVersionTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), - $keys[1] => $this->getCode(), + $keys[1] => $this->getName(), $keys[2] => $this->getSecured(), - $keys[3] => $this->getRef(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), - $keys[6] => $this->getVersion(), - $keys[7] => $this->getVersionCreatedAt(), - $keys[8] => $this->getVersionCreatedBy(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), + $keys[5] => $this->getVersion(), + $keys[6] => $this->getVersionCreatedAt(), + $keys[7] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1248,27 +1197,24 @@ abstract class MessageVersion implements ActiveRecordInterface $this->setId($value); break; case 1: - $this->setCode($value); + $this->setName($value); break; case 2: $this->setSecured($value); break; case 3: - $this->setRef($value); - break; - case 4: $this->setCreatedAt($value); break; - case 5: + case 4: $this->setUpdatedAt($value); break; - case 6: + case 5: $this->setVersion($value); break; - case 7: + case 6: $this->setVersionCreatedAt($value); break; - case 8: + case 7: $this->setVersionCreatedBy($value); break; } // switch() @@ -1296,14 +1242,13 @@ abstract class MessageVersion implements ActiveRecordInterface $keys = MessageVersionTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); + if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setSecured($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setRef($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedAt($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedBy($arr[$keys[8]]); + if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setVersion($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setVersionCreatedAt($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedBy($arr[$keys[7]]); } /** @@ -1316,9 +1261,8 @@ abstract class MessageVersion implements ActiveRecordInterface $criteria = new Criteria(MessageVersionTableMap::DATABASE_NAME); if ($this->isColumnModified(MessageVersionTableMap::ID)) $criteria->add(MessageVersionTableMap::ID, $this->id); - if ($this->isColumnModified(MessageVersionTableMap::CODE)) $criteria->add(MessageVersionTableMap::CODE, $this->code); + if ($this->isColumnModified(MessageVersionTableMap::NAME)) $criteria->add(MessageVersionTableMap::NAME, $this->name); if ($this->isColumnModified(MessageVersionTableMap::SECURED)) $criteria->add(MessageVersionTableMap::SECURED, $this->secured); - if ($this->isColumnModified(MessageVersionTableMap::REF)) $criteria->add(MessageVersionTableMap::REF, $this->ref); if ($this->isColumnModified(MessageVersionTableMap::CREATED_AT)) $criteria->add(MessageVersionTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(MessageVersionTableMap::UPDATED_AT)) $criteria->add(MessageVersionTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(MessageVersionTableMap::VERSION)) $criteria->add(MessageVersionTableMap::VERSION, $this->version); @@ -1395,9 +1339,8 @@ abstract class MessageVersion implements ActiveRecordInterface public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setId($this->getId()); - $copyObj->setCode($this->getCode()); + $copyObj->setName($this->getName()); $copyObj->setSecured($this->getSecured()); - $copyObj->setRef($this->getRef()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setVersion($this->getVersion()); @@ -1487,9 +1430,8 @@ abstract class MessageVersion implements ActiveRecordInterface public function clear() { $this->id = null; - $this->code = null; + $this->name = null; $this->secured = null; - $this->ref = null; $this->created_at = null; $this->updated_at = null; $this->version = null; diff --git a/core/lib/Thelia/Model/Base/MessageVersionQuery.php b/core/lib/Thelia/Model/Base/MessageVersionQuery.php index ac9b0ece0..088234eb5 100644 --- a/core/lib/Thelia/Model/Base/MessageVersionQuery.php +++ b/core/lib/Thelia/Model/Base/MessageVersionQuery.php @@ -22,9 +22,8 @@ use Thelia\Model\Map\MessageVersionTableMap; * * * @method ChildMessageVersionQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildMessageVersionQuery orderByCode($order = Criteria::ASC) Order by the code column + * @method ChildMessageVersionQuery orderByName($order = Criteria::ASC) Order by the name column * @method ChildMessageVersionQuery orderBySecured($order = Criteria::ASC) Order by the secured column - * @method ChildMessageVersionQuery orderByRef($order = Criteria::ASC) Order by the ref column * @method ChildMessageVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildMessageVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildMessageVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column @@ -32,9 +31,8 @@ use Thelia\Model\Map\MessageVersionTableMap; * @method ChildMessageVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column * * @method ChildMessageVersionQuery groupById() Group by the id column - * @method ChildMessageVersionQuery groupByCode() Group by the code column + * @method ChildMessageVersionQuery groupByName() Group by the name column * @method ChildMessageVersionQuery groupBySecured() Group by the secured column - * @method ChildMessageVersionQuery groupByRef() Group by the ref column * @method ChildMessageVersionQuery groupByCreatedAt() Group by the created_at column * @method ChildMessageVersionQuery groupByUpdatedAt() Group by the updated_at column * @method ChildMessageVersionQuery groupByVersion() Group by the version column @@ -53,9 +51,8 @@ use Thelia\Model\Map\MessageVersionTableMap; * @method ChildMessageVersion findOneOrCreate(ConnectionInterface $con = null) Return the first ChildMessageVersion matching the query, or a new ChildMessageVersion object populated from the query conditions when no match is found * * @method ChildMessageVersion findOneById(int $id) Return the first ChildMessageVersion filtered by the id column - * @method ChildMessageVersion findOneByCode(string $code) Return the first ChildMessageVersion filtered by the code column + * @method ChildMessageVersion findOneByName(string $name) Return the first ChildMessageVersion filtered by the name column * @method ChildMessageVersion findOneBySecured(int $secured) Return the first ChildMessageVersion filtered by the secured column - * @method ChildMessageVersion findOneByRef(string $ref) Return the first ChildMessageVersion filtered by the ref column * @method ChildMessageVersion findOneByCreatedAt(string $created_at) Return the first ChildMessageVersion filtered by the created_at column * @method ChildMessageVersion findOneByUpdatedAt(string $updated_at) Return the first ChildMessageVersion filtered by the updated_at column * @method ChildMessageVersion findOneByVersion(int $version) Return the first ChildMessageVersion filtered by the version column @@ -63,9 +60,8 @@ use Thelia\Model\Map\MessageVersionTableMap; * @method ChildMessageVersion findOneByVersionCreatedBy(string $version_created_by) Return the first ChildMessageVersion filtered by the version_created_by column * * @method array findById(int $id) Return ChildMessageVersion objects filtered by the id column - * @method array findByCode(string $code) Return ChildMessageVersion objects filtered by the code column + * @method array findByName(string $name) Return ChildMessageVersion objects filtered by the name column * @method array findBySecured(int $secured) Return ChildMessageVersion objects filtered by the secured column - * @method array findByRef(string $ref) Return ChildMessageVersion objects filtered by the ref column * @method array findByCreatedAt(string $created_at) Return ChildMessageVersion objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildMessageVersion objects filtered by the updated_at column * @method array findByVersion(int $version) Return ChildMessageVersion objects filtered by the version column @@ -159,7 +155,7 @@ abstract class MessageVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, SECURED, REF, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT ID, NAME, SECURED, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message_version WHERE ID = :p0 AND VERSION = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -304,32 +300,32 @@ abstract class MessageVersionQuery extends ModelCriteria } /** - * Filter the query on the code column + * Filter the query on the name column * * Example usage: * - * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' - * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' + * $query->filterByName('fooValue'); // WHERE name = 'fooValue' + * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' * * - * @param string $code The value to use as filter. + * @param string $name The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildMessageVersionQuery The current query, for fluid interface */ - public function filterByCode($code = null, $comparison = null) + public function filterByName($name = null, $comparison = null) { if (null === $comparison) { - if (is_array($code)) { + if (is_array($name)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $code)) { - $code = str_replace('*', '%', $code); + } elseif (preg_match('/[\%\*]/', $name)) { + $name = str_replace('*', '%', $name); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(MessageVersionTableMap::CODE, $code, $comparison); + return $this->addUsingAlias(MessageVersionTableMap::NAME, $name, $comparison); } /** @@ -373,35 +369,6 @@ abstract class MessageVersionQuery extends ModelCriteria return $this->addUsingAlias(MessageVersionTableMap::SECURED, $secured, $comparison); } - /** - * Filter the query on the ref column - * - * Example usage: - * - * $query->filterByRef('fooValue'); // WHERE ref = 'fooValue' - * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%' - * - * - * @param string $ref The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildMessageVersionQuery The current query, for fluid interface - */ - public function filterByRef($ref = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($ref)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $ref)) { - $ref = str_replace('*', '%', $ref); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(MessageVersionTableMap::REF, $ref, $comparison); - } - /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Base/Module.php b/core/lib/Thelia/Model/Base/Module.php index c1ee2ed8d..9cc89381a 100644 --- a/core/lib/Thelia/Model/Base/Module.php +++ b/core/lib/Thelia/Model/Base/Module.php @@ -89,6 +89,12 @@ abstract class Module implements ActiveRecordInterface */ protected $position; + /** + * The value for the full_namespace field. + * @var string + */ + protected $full_namespace; + /** * The value for the created_at field. * @var string @@ -303,7 +309,7 @@ abstract class Module implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -456,6 +462,17 @@ abstract class Module implements ActiveRecordInterface return $this->position; } + /** + * Get the [full_namespace] column value. + * + * @return string + */ + public function getFullNamespace() + { + + return $this->full_namespace; + } + /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -601,6 +618,27 @@ abstract class Module implements ActiveRecordInterface return $this; } // setPosition() + /** + * Set the value of [full_namespace] column. + * + * @param string $v new value + * @return \Thelia\Model\Module The current object (for fluent API support) + */ + public function setFullNamespace($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->full_namespace !== $v) { + $this->full_namespace = $v; + $this->modifiedColumns[] = ModuleTableMap::FULL_NAMESPACE; + } + + + return $this; + } // setFullNamespace() + /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -695,13 +733,16 @@ abstract class Module implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ModuleTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; $this->position = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ModuleTableMap::translateFieldName('FullNamespace', TableMap::TYPE_PHPNAME, $indexType)]; + $this->full_namespace = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -714,7 +755,7 @@ abstract class Module implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 7; // 7 = ModuleTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 8; // 8 = ModuleTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Module object", 0, $e); @@ -987,6 +1028,9 @@ abstract class Module implements ActiveRecordInterface if ($this->isColumnModified(ModuleTableMap::POSITION)) { $modifiedColumns[':p' . $index++] = 'POSITION'; } + if ($this->isColumnModified(ModuleTableMap::FULL_NAMESPACE)) { + $modifiedColumns[':p' . $index++] = 'FULL_NAMESPACE'; + } if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -1019,6 +1063,9 @@ abstract class Module implements ActiveRecordInterface case 'POSITION': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; + case 'FULL_NAMESPACE': + $stmt->bindValue($identifier, $this->full_namespace, PDO::PARAM_STR); + break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -1103,9 +1150,12 @@ abstract class Module implements ActiveRecordInterface return $this->getPosition(); break; case 5: - return $this->getCreatedAt(); + return $this->getFullNamespace(); break; case 6: + return $this->getCreatedAt(); + break; + case 7: return $this->getUpdatedAt(); break; default: @@ -1142,8 +1192,9 @@ abstract class Module implements ActiveRecordInterface $keys[2] => $this->getType(), $keys[3] => $this->getActivate(), $keys[4] => $this->getPosition(), - $keys[5] => $this->getCreatedAt(), - $keys[6] => $this->getUpdatedAt(), + $keys[5] => $this->getFullNamespace(), + $keys[6] => $this->getCreatedAt(), + $keys[7] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1208,9 +1259,12 @@ abstract class Module implements ActiveRecordInterface $this->setPosition($value); break; case 5: - $this->setCreatedAt($value); + $this->setFullNamespace($value); break; case 6: + $this->setCreatedAt($value); + break; + case 7: $this->setUpdatedAt($value); break; } // switch() @@ -1242,8 +1296,9 @@ abstract class Module implements ActiveRecordInterface if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setActivate($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]); + if (array_key_exists($keys[5], $arr)) $this->setFullNamespace($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); } /** @@ -1260,6 +1315,7 @@ abstract class Module implements ActiveRecordInterface if ($this->isColumnModified(ModuleTableMap::TYPE)) $criteria->add(ModuleTableMap::TYPE, $this->type); if ($this->isColumnModified(ModuleTableMap::ACTIVATE)) $criteria->add(ModuleTableMap::ACTIVATE, $this->activate); if ($this->isColumnModified(ModuleTableMap::POSITION)) $criteria->add(ModuleTableMap::POSITION, $this->position); + if ($this->isColumnModified(ModuleTableMap::FULL_NAMESPACE)) $criteria->add(ModuleTableMap::FULL_NAMESPACE, $this->full_namespace); if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) $criteria->add(ModuleTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(ModuleTableMap::UPDATED_AT)) $criteria->add(ModuleTableMap::UPDATED_AT, $this->updated_at); @@ -1329,6 +1385,7 @@ abstract class Module implements ActiveRecordInterface $copyObj->setType($this->getType()); $copyObj->setActivate($this->getActivate()); $copyObj->setPosition($this->getPosition()); + $copyObj->setFullNamespace($this->getFullNamespace()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1876,6 +1933,7 @@ abstract class Module implements ActiveRecordInterface $this->type = null; $this->activate = null; $this->position = null; + $this->full_namespace = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; diff --git a/core/lib/Thelia/Model/Base/ModuleI18n.php b/core/lib/Thelia/Model/Base/ModuleI18n.php index fbb4293ba..9c7d603d1 100644 --- a/core/lib/Thelia/Model/Base/ModuleI18n.php +++ b/core/lib/Thelia/Model/Base/ModuleI18n.php @@ -272,7 +272,7 @@ abstract class ModuleI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ModuleQuery.php b/core/lib/Thelia/Model/Base/ModuleQuery.php index e1bd9de68..6f8d4b551 100644 --- a/core/lib/Thelia/Model/Base/ModuleQuery.php +++ b/core/lib/Thelia/Model/Base/ModuleQuery.php @@ -27,6 +27,7 @@ use Thelia\Model\Map\ModuleTableMap; * @method ChildModuleQuery orderByType($order = Criteria::ASC) Order by the type column * @method ChildModuleQuery orderByActivate($order = Criteria::ASC) Order by the activate column * @method ChildModuleQuery orderByPosition($order = Criteria::ASC) Order by the position column + * @method ChildModuleQuery orderByFullNamespace($order = Criteria::ASC) Order by the full_namespace column * @method ChildModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @@ -35,6 +36,7 @@ use Thelia\Model\Map\ModuleTableMap; * @method ChildModuleQuery groupByType() Group by the type column * @method ChildModuleQuery groupByActivate() Group by the activate column * @method ChildModuleQuery groupByPosition() Group by the position column + * @method ChildModuleQuery groupByFullNamespace() Group by the full_namespace column * @method ChildModuleQuery groupByCreatedAt() Group by the created_at column * @method ChildModuleQuery groupByUpdatedAt() Group by the updated_at column * @@ -58,6 +60,7 @@ use Thelia\Model\Map\ModuleTableMap; * @method ChildModule findOneByType(int $type) Return the first ChildModule filtered by the type column * @method ChildModule findOneByActivate(int $activate) Return the first ChildModule filtered by the activate column * @method ChildModule findOneByPosition(int $position) Return the first ChildModule filtered by the position column + * @method ChildModule findOneByFullNamespace(string $full_namespace) Return the first ChildModule filtered by the full_namespace column * @method ChildModule findOneByCreatedAt(string $created_at) Return the first ChildModule filtered by the created_at column * @method ChildModule findOneByUpdatedAt(string $updated_at) Return the first ChildModule filtered by the updated_at column * @@ -66,6 +69,7 @@ use Thelia\Model\Map\ModuleTableMap; * @method array findByType(int $type) Return ChildModule objects filtered by the type column * @method array findByActivate(int $activate) Return ChildModule objects filtered by the activate column * @method array findByPosition(int $position) Return ChildModule objects filtered by the position column + * @method array findByFullNamespace(string $full_namespace) Return ChildModule objects filtered by the full_namespace column * @method array findByCreatedAt(string $created_at) Return ChildModule objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildModule objects filtered by the updated_at column * @@ -156,7 +160,7 @@ abstract class ModuleQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, TYPE, ACTIVATE, POSITION, CREATED_AT, UPDATED_AT FROM module WHERE ID = :p0'; + $sql = 'SELECT ID, CODE, TYPE, ACTIVATE, POSITION, FULL_NAMESPACE, CREATED_AT, UPDATED_AT FROM module WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -438,6 +442,35 @@ abstract class ModuleQuery extends ModelCriteria return $this->addUsingAlias(ModuleTableMap::POSITION, $position, $comparison); } + /** + * Filter the query on the full_namespace column + * + * Example usage: + * + * $query->filterByFullNamespace('fooValue'); // WHERE full_namespace = 'fooValue' + * $query->filterByFullNamespace('%fooValue%'); // WHERE full_namespace LIKE '%fooValue%' + * + * + * @param string $fullNamespace The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildModuleQuery The current query, for fluid interface + */ + public function filterByFullNamespace($fullNamespace = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($fullNamespace)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $fullNamespace)) { + $fullNamespace = str_replace('*', '%', $fullNamespace); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(ModuleTableMap::FULL_NAMESPACE, $fullNamespace, $comparison); + } + /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Base/Order.php b/core/lib/Thelia/Model/Base/Order.php index b815aff34..6932ec6c4 100644 --- a/core/lib/Thelia/Model/Base/Order.php +++ b/core/lib/Thelia/Model/Base/Order.php @@ -388,7 +388,7 @@ abstract class Order implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/OrderAddress.php b/core/lib/Thelia/Model/Base/OrderAddress.php index b5ff32951..d0220d4e0 100644 --- a/core/lib/Thelia/Model/Base/OrderAddress.php +++ b/core/lib/Thelia/Model/Base/OrderAddress.php @@ -329,7 +329,7 @@ abstract class OrderAddress implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/OrderFeature.php b/core/lib/Thelia/Model/Base/OrderFeature.php index 49c1a0911..e2b52e6b1 100644 --- a/core/lib/Thelia/Model/Base/OrderFeature.php +++ b/core/lib/Thelia/Model/Base/OrderFeature.php @@ -261,7 +261,7 @@ abstract class OrderFeature implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/OrderProduct.php b/core/lib/Thelia/Model/Base/OrderProduct.php index b448e4e0c..2bf9c7ace 100644 --- a/core/lib/Thelia/Model/Base/OrderProduct.php +++ b/core/lib/Thelia/Model/Base/OrderProduct.php @@ -312,7 +312,7 @@ abstract class OrderProduct implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/OrderStatus.php b/core/lib/Thelia/Model/Base/OrderStatus.php index fc4a224d1..d249b4865 100644 --- a/core/lib/Thelia/Model/Base/OrderStatus.php +++ b/core/lib/Thelia/Model/Base/OrderStatus.php @@ -285,7 +285,7 @@ abstract class OrderStatus implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/OrderStatusI18n.php b/core/lib/Thelia/Model/Base/OrderStatusI18n.php index 76ec4a28a..2946cc55b 100644 --- a/core/lib/Thelia/Model/Base/OrderStatusI18n.php +++ b/core/lib/Thelia/Model/Base/OrderStatusI18n.php @@ -272,7 +272,7 @@ abstract class OrderStatusI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Product.php b/core/lib/Thelia/Model/Base/Product.php index 9a1828e25..f7457d47b 100644 --- a/core/lib/Thelia/Model/Base/Product.php +++ b/core/lib/Thelia/Model/Base/Product.php @@ -23,11 +23,11 @@ use Thelia\Model\CartItem as ChildCartItem; use Thelia\Model\CartItemQuery as ChildCartItemQuery; use Thelia\Model\Category as ChildCategory; use Thelia\Model\CategoryQuery as ChildCategoryQuery; -use Thelia\Model\ContentAssoc as ChildContentAssoc; -use Thelia\Model\ContentAssocQuery as ChildContentAssocQuery; use Thelia\Model\FeatureProduct as ChildFeatureProduct; use Thelia\Model\FeatureProductQuery as ChildFeatureProductQuery; use Thelia\Model\Product as ChildProduct; +use Thelia\Model\ProductAssociatedContent as ChildProductAssociatedContent; +use Thelia\Model\ProductAssociatedContentQuery as ChildProductAssociatedContentQuery; use Thelia\Model\ProductCategory as ChildProductCategory; use Thelia\Model\ProductCategoryQuery as ChildProductCategoryQuery; use Thelia\Model\ProductDocument as ChildProductDocument; @@ -41,8 +41,6 @@ use Thelia\Model\ProductSaleElements as ChildProductSaleElements; use Thelia\Model\ProductSaleElementsQuery as ChildProductSaleElementsQuery; use Thelia\Model\ProductVersion as ChildProductVersion; use Thelia\Model\ProductVersionQuery as ChildProductVersionQuery; -use Thelia\Model\Rewriting as ChildRewriting; -use Thelia\Model\RewritingQuery as ChildRewritingQuery; use Thelia\Model\TaxRule as ChildTaxRule; use Thelia\Model\TaxRuleQuery as ChildTaxRuleQuery; use Thelia\Model\Map\ProductTableMap; @@ -167,12 +165,6 @@ abstract class Product implements ActiveRecordInterface protected $collProductSaleElementss; protected $collProductSaleElementssPartial; - /** - * @var ObjectCollection|ChildContentAssoc[] Collection to store aggregation of ChildContentAssoc objects. - */ - protected $collContentAssocs; - protected $collContentAssocsPartial; - /** * @var ObjectCollection|ChildProductImage[] Collection to store aggregation of ChildProductImage objects. */ @@ -197,18 +189,18 @@ abstract class Product implements ActiveRecordInterface protected $collAccessoriesRelatedByAccessory; protected $collAccessoriesRelatedByAccessoryPartial; - /** - * @var ObjectCollection|ChildRewriting[] Collection to store aggregation of ChildRewriting objects. - */ - protected $collRewritings; - protected $collRewritingsPartial; - /** * @var ObjectCollection|ChildCartItem[] Collection to store aggregation of ChildCartItem objects. */ protected $collCartItems; protected $collCartItemsPartial; + /** + * @var ObjectCollection|ChildProductAssociatedContent[] Collection to store aggregation of ChildProductAssociatedContent objects. + */ + protected $collProductAssociatedContents; + protected $collProductAssociatedContentsPartial; + /** * @var ObjectCollection|ChildProductI18n[] Collection to store aggregation of ChildProductI18n objects. */ @@ -302,12 +294,6 @@ abstract class Product implements ActiveRecordInterface */ protected $productSaleElementssScheduledForDeletion = null; - /** - * An array of objects scheduled for deletion. - * @var ObjectCollection - */ - protected $contentAssocsScheduledForDeletion = null; - /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -336,13 +322,13 @@ abstract class Product implements ActiveRecordInterface * An array of objects scheduled for deletion. * @var ObjectCollection */ - protected $rewritingsScheduledForDeletion = null; + protected $cartItemsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection */ - protected $cartItemsScheduledForDeletion = null; + protected $productAssociatedContentsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. @@ -526,7 +512,7 @@ abstract class Product implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -1137,8 +1123,6 @@ abstract class Product implements ActiveRecordInterface $this->collProductSaleElementss = null; - $this->collContentAssocs = null; - $this->collProductImages = null; $this->collProductDocuments = null; @@ -1147,10 +1131,10 @@ abstract class Product implements ActiveRecordInterface $this->collAccessoriesRelatedByAccessory = null; - $this->collRewritings = null; - $this->collCartItems = null; + $this->collProductAssociatedContents = null; + $this->collProductI18ns = null; $this->collProductVersions = null; @@ -1447,23 +1431,6 @@ abstract class Product implements ActiveRecordInterface } } - if ($this->contentAssocsScheduledForDeletion !== null) { - if (!$this->contentAssocsScheduledForDeletion->isEmpty()) { - \Thelia\Model\ContentAssocQuery::create() - ->filterByPrimaryKeys($this->contentAssocsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->contentAssocsScheduledForDeletion = null; - } - } - - if ($this->collContentAssocs !== null) { - foreach ($this->collContentAssocs as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - if ($this->productImagesScheduledForDeletion !== null) { if (!$this->productImagesScheduledForDeletion->isEmpty()) { \Thelia\Model\ProductImageQuery::create() @@ -1532,23 +1499,6 @@ abstract class Product implements ActiveRecordInterface } } - if ($this->rewritingsScheduledForDeletion !== null) { - if (!$this->rewritingsScheduledForDeletion->isEmpty()) { - \Thelia\Model\RewritingQuery::create() - ->filterByPrimaryKeys($this->rewritingsScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->rewritingsScheduledForDeletion = null; - } - } - - if ($this->collRewritings !== null) { - foreach ($this->collRewritings as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - if ($this->cartItemsScheduledForDeletion !== null) { if (!$this->cartItemsScheduledForDeletion->isEmpty()) { \Thelia\Model\CartItemQuery::create() @@ -1566,6 +1516,23 @@ abstract class Product implements ActiveRecordInterface } } + if ($this->productAssociatedContentsScheduledForDeletion !== null) { + if (!$this->productAssociatedContentsScheduledForDeletion->isEmpty()) { + \Thelia\Model\ProductAssociatedContentQuery::create() + ->filterByPrimaryKeys($this->productAssociatedContentsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->productAssociatedContentsScheduledForDeletion = null; + } + } + + if ($this->collProductAssociatedContents !== null) { + foreach ($this->collProductAssociatedContents as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + if ($this->productI18nsScheduledForDeletion !== null) { if (!$this->productI18nsScheduledForDeletion->isEmpty()) { \Thelia\Model\ProductI18nQuery::create() @@ -1848,9 +1815,6 @@ abstract class Product implements ActiveRecordInterface if (null !== $this->collProductSaleElementss) { $result['ProductSaleElementss'] = $this->collProductSaleElementss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } - if (null !== $this->collContentAssocs) { - $result['ContentAssocs'] = $this->collContentAssocs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } if (null !== $this->collProductImages) { $result['ProductImages'] = $this->collProductImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1863,12 +1827,12 @@ abstract class Product implements ActiveRecordInterface if (null !== $this->collAccessoriesRelatedByAccessory) { $result['AccessoriesRelatedByAccessory'] = $this->collAccessoriesRelatedByAccessory->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } - if (null !== $this->collRewritings) { - $result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } if (null !== $this->collCartItems) { $result['CartItems'] = $this->collCartItems->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } + if (null !== $this->collProductAssociatedContents) { + $result['ProductAssociatedContents'] = $this->collProductAssociatedContents->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } if (null !== $this->collProductI18ns) { $result['ProductI18ns'] = $this->collProductI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -2090,12 +2054,6 @@ abstract class Product implements ActiveRecordInterface } } - foreach ($this->getContentAssocs() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addContentAssoc($relObj->copy($deepCopy)); - } - } - foreach ($this->getProductImages() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addProductImage($relObj->copy($deepCopy)); @@ -2120,18 +2078,18 @@ abstract class Product implements ActiveRecordInterface } } - foreach ($this->getRewritings() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addRewriting($relObj->copy($deepCopy)); - } - } - foreach ($this->getCartItems() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCartItem($relObj->copy($deepCopy)); } } + foreach ($this->getProductAssociatedContents() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addProductAssociatedContent($relObj->copy($deepCopy)); + } + } + foreach ($this->getProductI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addProductI18n($relObj->copy($deepCopy)); @@ -2245,9 +2203,6 @@ abstract class Product implements ActiveRecordInterface if ('ProductSaleElements' == $relationName) { return $this->initProductSaleElementss(); } - if ('ContentAssoc' == $relationName) { - return $this->initContentAssocs(); - } if ('ProductImage' == $relationName) { return $this->initProductImages(); } @@ -2260,12 +2215,12 @@ abstract class Product implements ActiveRecordInterface if ('AccessoryRelatedByAccessory' == $relationName) { return $this->initAccessoriesRelatedByAccessory(); } - if ('Rewriting' == $relationName) { - return $this->initRewritings(); - } if ('CartItem' == $relationName) { return $this->initCartItems(); } + if ('ProductAssociatedContent' == $relationName) { + return $this->initProductAssociatedContents(); + } if ('ProductI18n' == $relationName) { return $this->initProductI18ns(); } @@ -3006,274 +2961,6 @@ abstract class Product implements ActiveRecordInterface return $this; } - /** - * Clears out the collContentAssocs collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addContentAssocs() - */ - public function clearContentAssocs() - { - $this->collContentAssocs = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Reset is the collContentAssocs collection loaded partially. - */ - public function resetPartialContentAssocs($v = true) - { - $this->collContentAssocsPartial = $v; - } - - /** - * Initializes the collContentAssocs collection. - * - * By default this just sets the collContentAssocs collection to an empty array (like clearcollContentAssocs()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initContentAssocs($overrideExisting = true) - { - if (null !== $this->collContentAssocs && !$overrideExisting) { - return; - } - $this->collContentAssocs = new ObjectCollection(); - $this->collContentAssocs->setModel('\Thelia\Model\ContentAssoc'); - } - - /** - * Gets an array of ChildContentAssoc objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this ChildProduct is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects - * @throws PropelException - */ - public function getContentAssocs($criteria = null, ConnectionInterface $con = null) - { - $partial = $this->collContentAssocsPartial && !$this->isNew(); - if (null === $this->collContentAssocs || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collContentAssocs) { - // return empty collection - $this->initContentAssocs(); - } else { - $collContentAssocs = ChildContentAssocQuery::create(null, $criteria) - ->filterByProduct($this) - ->find($con); - - if (null !== $criteria) { - if (false !== $this->collContentAssocsPartial && count($collContentAssocs)) { - $this->initContentAssocs(false); - - foreach ($collContentAssocs as $obj) { - if (false == $this->collContentAssocs->contains($obj)) { - $this->collContentAssocs->append($obj); - } - } - - $this->collContentAssocsPartial = true; - } - - $collContentAssocs->getInternalIterator()->rewind(); - - return $collContentAssocs; - } - - if ($partial && $this->collContentAssocs) { - foreach ($this->collContentAssocs as $obj) { - if ($obj->isNew()) { - $collContentAssocs[] = $obj; - } - } - } - - $this->collContentAssocs = $collContentAssocs; - $this->collContentAssocsPartial = false; - } - } - - return $this->collContentAssocs; - } - - /** - * Sets a collection of ContentAssoc objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param Collection $contentAssocs A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return ChildProduct The current object (for fluent API support) - */ - public function setContentAssocs(Collection $contentAssocs, ConnectionInterface $con = null) - { - $contentAssocsToDelete = $this->getContentAssocs(new Criteria(), $con)->diff($contentAssocs); - - - $this->contentAssocsScheduledForDeletion = $contentAssocsToDelete; - - foreach ($contentAssocsToDelete as $contentAssocRemoved) { - $contentAssocRemoved->setProduct(null); - } - - $this->collContentAssocs = null; - foreach ($contentAssocs as $contentAssoc) { - $this->addContentAssoc($contentAssoc); - } - - $this->collContentAssocs = $contentAssocs; - $this->collContentAssocsPartial = false; - - return $this; - } - - /** - * Returns the number of related ContentAssoc objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related ContentAssoc objects. - * @throws PropelException - */ - public function countContentAssocs(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) - { - $partial = $this->collContentAssocsPartial && !$this->isNew(); - if (null === $this->collContentAssocs || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collContentAssocs) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getContentAssocs()); - } - - $query = ChildContentAssocQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByProduct($this) - ->count($con); - } - - return count($this->collContentAssocs); - } - - /** - * Method called to associate a ChildContentAssoc object to this object - * through the ChildContentAssoc foreign key attribute. - * - * @param ChildContentAssoc $l ChildContentAssoc - * @return \Thelia\Model\Product The current object (for fluent API support) - */ - public function addContentAssoc(ChildContentAssoc $l) - { - if ($this->collContentAssocs === null) { - $this->initContentAssocs(); - $this->collContentAssocsPartial = true; - } - - if (!in_array($l, $this->collContentAssocs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddContentAssoc($l); - } - - return $this; - } - - /** - * @param ContentAssoc $contentAssoc The contentAssoc object to add. - */ - protected function doAddContentAssoc($contentAssoc) - { - $this->collContentAssocs[]= $contentAssoc; - $contentAssoc->setProduct($this); - } - - /** - * @param ContentAssoc $contentAssoc The contentAssoc object to remove. - * @return ChildProduct The current object (for fluent API support) - */ - public function removeContentAssoc($contentAssoc) - { - if ($this->getContentAssocs()->contains($contentAssoc)) { - $this->collContentAssocs->remove($this->collContentAssocs->search($contentAssoc)); - if (null === $this->contentAssocsScheduledForDeletion) { - $this->contentAssocsScheduledForDeletion = clone $this->collContentAssocs; - $this->contentAssocsScheduledForDeletion->clear(); - } - $this->contentAssocsScheduledForDeletion[]= $contentAssoc; - $contentAssoc->setProduct(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Product is new, it will return - * an empty collection; or if this Product has previously - * been saved, it will retrieve related ContentAssocs from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Product. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects - */ - public function getContentAssocsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildContentAssocQuery::create(null, $criteria); - $query->joinWith('Category', $joinBehavior); - - return $this->getContentAssocs($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Product is new, it will return - * an empty collection; or if this Product has previously - * been saved, it will retrieve related ContentAssocs from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Product. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildContentAssoc[] List of ChildContentAssoc objects - */ - public function getContentAssocsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildContentAssocQuery::create(null, $criteria); - $query->joinWith('Content', $joinBehavior); - - return $this->getContentAssocs($query, $con); - } - /** * Clears out the collProductImages collection * @@ -4146,299 +3833,6 @@ abstract class Product implements ActiveRecordInterface return $this; } - /** - * Clears out the collRewritings collection - * - * This does not modify the database; however, it will remove any associated objects, causing - * them to be refetched by subsequent calls to accessor method. - * - * @return void - * @see addRewritings() - */ - public function clearRewritings() - { - $this->collRewritings = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Reset is the collRewritings collection loaded partially. - */ - public function resetPartialRewritings($v = true) - { - $this->collRewritingsPartial = $v; - } - - /** - * Initializes the collRewritings collection. - * - * By default this just sets the collRewritings collection to an empty array (like clearcollRewritings()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initRewritings($overrideExisting = true) - { - if (null !== $this->collRewritings && !$overrideExisting) { - return; - } - $this->collRewritings = new ObjectCollection(); - $this->collRewritings->setModel('\Thelia\Model\Rewriting'); - } - - /** - * Gets an array of ChildRewriting objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this ChildProduct is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @return Collection|ChildRewriting[] List of ChildRewriting objects - * @throws PropelException - */ - public function getRewritings($criteria = null, ConnectionInterface $con = null) - { - $partial = $this->collRewritingsPartial && !$this->isNew(); - if (null === $this->collRewritings || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collRewritings) { - // return empty collection - $this->initRewritings(); - } else { - $collRewritings = ChildRewritingQuery::create(null, $criteria) - ->filterByProduct($this) - ->find($con); - - if (null !== $criteria) { - if (false !== $this->collRewritingsPartial && count($collRewritings)) { - $this->initRewritings(false); - - foreach ($collRewritings as $obj) { - if (false == $this->collRewritings->contains($obj)) { - $this->collRewritings->append($obj); - } - } - - $this->collRewritingsPartial = true; - } - - $collRewritings->getInternalIterator()->rewind(); - - return $collRewritings; - } - - if ($partial && $this->collRewritings) { - foreach ($this->collRewritings as $obj) { - if ($obj->isNew()) { - $collRewritings[] = $obj; - } - } - } - - $this->collRewritings = $collRewritings; - $this->collRewritingsPartial = false; - } - } - - return $this->collRewritings; - } - - /** - * Sets a collection of Rewriting objects related by a one-to-many relationship - * to the current object. - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) - * and new objects from the given Propel collection. - * - * @param Collection $rewritings A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return ChildProduct The current object (for fluent API support) - */ - public function setRewritings(Collection $rewritings, ConnectionInterface $con = null) - { - $rewritingsToDelete = $this->getRewritings(new Criteria(), $con)->diff($rewritings); - - - $this->rewritingsScheduledForDeletion = $rewritingsToDelete; - - foreach ($rewritingsToDelete as $rewritingRemoved) { - $rewritingRemoved->setProduct(null); - } - - $this->collRewritings = null; - foreach ($rewritings as $rewriting) { - $this->addRewriting($rewriting); - } - - $this->collRewritings = $rewritings; - $this->collRewritingsPartial = false; - - return $this; - } - - /** - * Returns the number of related Rewriting objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related Rewriting objects. - * @throws PropelException - */ - public function countRewritings(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) - { - $partial = $this->collRewritingsPartial && !$this->isNew(); - if (null === $this->collRewritings || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collRewritings) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getRewritings()); - } - - $query = ChildRewritingQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByProduct($this) - ->count($con); - } - - return count($this->collRewritings); - } - - /** - * Method called to associate a ChildRewriting object to this object - * through the ChildRewriting foreign key attribute. - * - * @param ChildRewriting $l ChildRewriting - * @return \Thelia\Model\Product The current object (for fluent API support) - */ - public function addRewriting(ChildRewriting $l) - { - if ($this->collRewritings === null) { - $this->initRewritings(); - $this->collRewritingsPartial = true; - } - - if (!in_array($l, $this->collRewritings->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddRewriting($l); - } - - return $this; - } - - /** - * @param Rewriting $rewriting The rewriting object to add. - */ - protected function doAddRewriting($rewriting) - { - $this->collRewritings[]= $rewriting; - $rewriting->setProduct($this); - } - - /** - * @param Rewriting $rewriting The rewriting object to remove. - * @return ChildProduct The current object (for fluent API support) - */ - public function removeRewriting($rewriting) - { - if ($this->getRewritings()->contains($rewriting)) { - $this->collRewritings->remove($this->collRewritings->search($rewriting)); - if (null === $this->rewritingsScheduledForDeletion) { - $this->rewritingsScheduledForDeletion = clone $this->collRewritings; - $this->rewritingsScheduledForDeletion->clear(); - } - $this->rewritingsScheduledForDeletion[]= $rewriting; - $rewriting->setProduct(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Product is new, it will return - * an empty collection; or if this Product has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Product. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinCategory($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Category', $joinBehavior); - - return $this->getRewritings($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Product is new, it will return - * an empty collection; or if this Product has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Product. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinFolder($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Folder', $joinBehavior); - - return $this->getRewritings($query, $con); - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Product is new, it will return - * an empty collection; or if this Product has previously - * been saved, it will retrieve related Rewritings from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Product. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildRewriting[] List of ChildRewriting objects - */ - public function getRewritingsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildRewritingQuery::create(null, $criteria); - $query->joinWith('Content', $joinBehavior); - - return $this->getRewritings($query, $con); - } - /** * Clears out the collCartItems collection * @@ -4707,6 +4101,249 @@ abstract class Product implements ActiveRecordInterface return $this->getCartItems($query, $con); } + /** + * Clears out the collProductAssociatedContents collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addProductAssociatedContents() + */ + public function clearProductAssociatedContents() + { + $this->collProductAssociatedContents = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collProductAssociatedContents collection loaded partially. + */ + public function resetPartialProductAssociatedContents($v = true) + { + $this->collProductAssociatedContentsPartial = $v; + } + + /** + * Initializes the collProductAssociatedContents collection. + * + * By default this just sets the collProductAssociatedContents collection to an empty array (like clearcollProductAssociatedContents()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @param boolean $overrideExisting If set to true, the method call initializes + * the collection even if it is not empty + * + * @return void + */ + public function initProductAssociatedContents($overrideExisting = true) + { + if (null !== $this->collProductAssociatedContents && !$overrideExisting) { + return; + } + $this->collProductAssociatedContents = new ObjectCollection(); + $this->collProductAssociatedContents->setModel('\Thelia\Model\ProductAssociatedContent'); + } + + /** + * Gets an array of ChildProductAssociatedContent objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this ChildProduct is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @return Collection|ChildProductAssociatedContent[] List of ChildProductAssociatedContent objects + * @throws PropelException + */ + public function getProductAssociatedContents($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collProductAssociatedContentsPartial && !$this->isNew(); + if (null === $this->collProductAssociatedContents || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collProductAssociatedContents) { + // return empty collection + $this->initProductAssociatedContents(); + } else { + $collProductAssociatedContents = ChildProductAssociatedContentQuery::create(null, $criteria) + ->filterByProduct($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collProductAssociatedContentsPartial && count($collProductAssociatedContents)) { + $this->initProductAssociatedContents(false); + + foreach ($collProductAssociatedContents as $obj) { + if (false == $this->collProductAssociatedContents->contains($obj)) { + $this->collProductAssociatedContents->append($obj); + } + } + + $this->collProductAssociatedContentsPartial = true; + } + + $collProductAssociatedContents->getInternalIterator()->rewind(); + + return $collProductAssociatedContents; + } + + if ($partial && $this->collProductAssociatedContents) { + foreach ($this->collProductAssociatedContents as $obj) { + if ($obj->isNew()) { + $collProductAssociatedContents[] = $obj; + } + } + } + + $this->collProductAssociatedContents = $collProductAssociatedContents; + $this->collProductAssociatedContentsPartial = false; + } + } + + return $this->collProductAssociatedContents; + } + + /** + * Sets a collection of ProductAssociatedContent objects related by a one-to-many relationship + * to the current object. + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) + * and new objects from the given Propel collection. + * + * @param Collection $productAssociatedContents A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildProduct The current object (for fluent API support) + */ + public function setProductAssociatedContents(Collection $productAssociatedContents, ConnectionInterface $con = null) + { + $productAssociatedContentsToDelete = $this->getProductAssociatedContents(new Criteria(), $con)->diff($productAssociatedContents); + + + $this->productAssociatedContentsScheduledForDeletion = $productAssociatedContentsToDelete; + + foreach ($productAssociatedContentsToDelete as $productAssociatedContentRemoved) { + $productAssociatedContentRemoved->setProduct(null); + } + + $this->collProductAssociatedContents = null; + foreach ($productAssociatedContents as $productAssociatedContent) { + $this->addProductAssociatedContent($productAssociatedContent); + } + + $this->collProductAssociatedContents = $productAssociatedContents; + $this->collProductAssociatedContentsPartial = false; + + return $this; + } + + /** + * Returns the number of related ProductAssociatedContent objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related ProductAssociatedContent objects. + * @throws PropelException + */ + public function countProductAssociatedContents(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collProductAssociatedContentsPartial && !$this->isNew(); + if (null === $this->collProductAssociatedContents || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collProductAssociatedContents) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getProductAssociatedContents()); + } + + $query = ChildProductAssociatedContentQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByProduct($this) + ->count($con); + } + + return count($this->collProductAssociatedContents); + } + + /** + * Method called to associate a ChildProductAssociatedContent object to this object + * through the ChildProductAssociatedContent foreign key attribute. + * + * @param ChildProductAssociatedContent $l ChildProductAssociatedContent + * @return \Thelia\Model\Product The current object (for fluent API support) + */ + public function addProductAssociatedContent(ChildProductAssociatedContent $l) + { + if ($this->collProductAssociatedContents === null) { + $this->initProductAssociatedContents(); + $this->collProductAssociatedContentsPartial = true; + } + + if (!in_array($l, $this->collProductAssociatedContents->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddProductAssociatedContent($l); + } + + return $this; + } + + /** + * @param ProductAssociatedContent $productAssociatedContent The productAssociatedContent object to add. + */ + protected function doAddProductAssociatedContent($productAssociatedContent) + { + $this->collProductAssociatedContents[]= $productAssociatedContent; + $productAssociatedContent->setProduct($this); + } + + /** + * @param ProductAssociatedContent $productAssociatedContent The productAssociatedContent object to remove. + * @return ChildProduct The current object (for fluent API support) + */ + public function removeProductAssociatedContent($productAssociatedContent) + { + if ($this->getProductAssociatedContents()->contains($productAssociatedContent)) { + $this->collProductAssociatedContents->remove($this->collProductAssociatedContents->search($productAssociatedContent)); + if (null === $this->productAssociatedContentsScheduledForDeletion) { + $this->productAssociatedContentsScheduledForDeletion = clone $this->collProductAssociatedContents; + $this->productAssociatedContentsScheduledForDeletion->clear(); + } + $this->productAssociatedContentsScheduledForDeletion[]= clone $productAssociatedContent; + $productAssociatedContent->setProduct(null); + } + + return $this; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Product is new, it will return + * an empty collection; or if this Product has previously + * been saved, it will retrieve related ProductAssociatedContents from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in Product. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return Collection|ChildProductAssociatedContent[] List of ChildProductAssociatedContent objects + */ + public function getProductAssociatedContentsJoinContent($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) + { + $query = ChildProductAssociatedContentQuery::create(null, $criteria); + $query->joinWith('Content', $joinBehavior); + + return $this->getProductAssociatedContents($query, $con); + } + /** * Clears out the collProductI18ns collection * @@ -5752,11 +5389,6 @@ abstract class Product implements ActiveRecordInterface $o->clearAllReferences($deep); } } - if ($this->collContentAssocs) { - foreach ($this->collContentAssocs as $o) { - $o->clearAllReferences($deep); - } - } if ($this->collProductImages) { foreach ($this->collProductImages as $o) { $o->clearAllReferences($deep); @@ -5777,13 +5409,13 @@ abstract class Product implements ActiveRecordInterface $o->clearAllReferences($deep); } } - if ($this->collRewritings) { - foreach ($this->collRewritings as $o) { + if ($this->collCartItems) { + foreach ($this->collCartItems as $o) { $o->clearAllReferences($deep); } } - if ($this->collCartItems) { - foreach ($this->collCartItems as $o) { + if ($this->collProductAssociatedContents) { + foreach ($this->collProductAssociatedContents as $o) { $o->clearAllReferences($deep); } } @@ -5830,10 +5462,6 @@ abstract class Product implements ActiveRecordInterface $this->collProductSaleElementss->clearIterator(); } $this->collProductSaleElementss = null; - if ($this->collContentAssocs instanceof Collection) { - $this->collContentAssocs->clearIterator(); - } - $this->collContentAssocs = null; if ($this->collProductImages instanceof Collection) { $this->collProductImages->clearIterator(); } @@ -5850,14 +5478,14 @@ abstract class Product implements ActiveRecordInterface $this->collAccessoriesRelatedByAccessory->clearIterator(); } $this->collAccessoriesRelatedByAccessory = null; - if ($this->collRewritings instanceof Collection) { - $this->collRewritings->clearIterator(); - } - $this->collRewritings = null; if ($this->collCartItems instanceof Collection) { $this->collCartItems->clearIterator(); } $this->collCartItems = null; + if ($this->collProductAssociatedContents instanceof Collection) { + $this->collProductAssociatedContents->clearIterator(); + } + $this->collProductAssociatedContents = null; if ($this->collProductI18ns instanceof Collection) { $this->collProductI18ns->clearIterator(); } diff --git a/core/lib/Thelia/Model/Base/Rewriting.php b/core/lib/Thelia/Model/Base/ProductAssociatedContent.php similarity index 73% rename from core/lib/Thelia/Model/Base/Rewriting.php rename to core/lib/Thelia/Model/Base/ProductAssociatedContent.php index 12229c438..bbc97d5d1 100644 --- a/core/lib/Thelia/Model/Base/Rewriting.php +++ b/core/lib/Thelia/Model/Base/ProductAssociatedContent.php @@ -16,24 +16,20 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; -use Thelia\Model\Category as ChildCategory; -use Thelia\Model\CategoryQuery as ChildCategoryQuery; use Thelia\Model\Content as ChildContent; use Thelia\Model\ContentQuery as ChildContentQuery; -use Thelia\Model\Folder as ChildFolder; -use Thelia\Model\FolderQuery as ChildFolderQuery; use Thelia\Model\Product as ChildProduct; +use Thelia\Model\ProductAssociatedContent as ChildProductAssociatedContent; +use Thelia\Model\ProductAssociatedContentQuery as ChildProductAssociatedContentQuery; use Thelia\Model\ProductQuery as ChildProductQuery; -use Thelia\Model\Rewriting as ChildRewriting; -use Thelia\Model\RewritingQuery as ChildRewritingQuery; -use Thelia\Model\Map\RewritingTableMap; +use Thelia\Model\Map\ProductAssociatedContentTableMap; -abstract class Rewriting implements ActiveRecordInterface +abstract class ProductAssociatedContent implements ActiveRecordInterface { /** * TableMap class name */ - const TABLE_MAP = '\\Thelia\\Model\\Map\\RewritingTableMap'; + const TABLE_MAP = '\\Thelia\\Model\\Map\\ProductAssociatedContentTableMap'; /** @@ -68,36 +64,24 @@ abstract class Rewriting implements ActiveRecordInterface */ protected $id; - /** - * The value for the url field. - * @var string - */ - protected $url; - /** * The value for the product_id field. * @var int */ protected $product_id; - /** - * The value for the category_id field. - * @var int - */ - protected $category_id; - - /** - * The value for the folder_id field. - * @var int - */ - protected $folder_id; - /** * The value for the content_id field. * @var int */ protected $content_id; + /** + * The value for the position field. + * @var int + */ + protected $position; + /** * The value for the created_at field. * @var string @@ -115,16 +99,6 @@ abstract class Rewriting implements ActiveRecordInterface */ protected $aProduct; - /** - * @var Category - */ - protected $aCategory; - - /** - * @var Folder - */ - protected $aFolder; - /** * @var Content */ @@ -139,7 +113,7 @@ abstract class Rewriting implements ActiveRecordInterface protected $alreadyInSave = false; /** - * Initializes internal state of Thelia\Model\Base\Rewriting object. + * Initializes internal state of Thelia\Model\Base\ProductAssociatedContent object. */ public function __construct() { @@ -234,9 +208,9 @@ abstract class Rewriting implements ActiveRecordInterface } /** - * Compares this with another Rewriting instance. If - * obj is an instance of Rewriting, delegates to - * equals(Rewriting). Otherwise, returns false. + * Compares this with another ProductAssociatedContent instance. If + * 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. @@ -294,7 +268,7 @@ abstract class Rewriting implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -317,7 +291,7 @@ abstract class Rewriting implements ActiveRecordInterface * @param string $name The virtual column name * @param mixed $value The value to give to the virtual column * - * @return Rewriting The current object, for fluid interface + * @return ProductAssociatedContent The current object, for fluid interface */ public function setVirtualColumn($name, $value) { @@ -349,7 +323,7 @@ abstract class Rewriting implements ActiveRecordInterface * or a format name ('XML', 'YAML', 'JSON', 'CSV') * @param string $data The source data to import from * - * @return Rewriting The current object, for fluid interface + * @return ProductAssociatedContent The current object, for fluid interface */ public function importFrom($parser, $data) { @@ -403,17 +377,6 @@ abstract class Rewriting implements ActiveRecordInterface return $this->id; } - /** - * Get the [url] column value. - * - * @return string - */ - public function getUrl() - { - - return $this->url; - } - /** * Get the [product_id] column value. * @@ -425,28 +388,6 @@ abstract class Rewriting implements ActiveRecordInterface return $this->product_id; } - /** - * Get the [category_id] column value. - * - * @return int - */ - public function getCategoryId() - { - - return $this->category_id; - } - - /** - * Get the [folder_id] column value. - * - * @return int - */ - public function getFolderId() - { - - return $this->folder_id; - } - /** * Get the [content_id] column value. * @@ -458,6 +399,17 @@ abstract class Rewriting implements ActiveRecordInterface return $this->content_id; } + /** + * Get the [position] column value. + * + * @return int + */ + public function getPosition() + { + + return $this->position; + } + /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -502,7 +454,7 @@ abstract class Rewriting implements ActiveRecordInterface * Set the value of [id] column. * * @param int $v new value - * @return \Thelia\Model\Rewriting The current object (for fluent API support) + * @return \Thelia\Model\ProductAssociatedContent The current object (for fluent API support) */ public function setId($v) { @@ -512,39 +464,18 @@ abstract class Rewriting implements ActiveRecordInterface if ($this->id !== $v) { $this->id = $v; - $this->modifiedColumns[] = RewritingTableMap::ID; + $this->modifiedColumns[] = ProductAssociatedContentTableMap::ID; } return $this; } // setId() - /** - * Set the value of [url] column. - * - * @param string $v new value - * @return \Thelia\Model\Rewriting The current object (for fluent API support) - */ - public function setUrl($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->url !== $v) { - $this->url = $v; - $this->modifiedColumns[] = RewritingTableMap::URL; - } - - - return $this; - } // setUrl() - /** * Set the value of [product_id] column. * * @param int $v new value - * @return \Thelia\Model\Rewriting The current object (for fluent API support) + * @return \Thelia\Model\ProductAssociatedContent The current object (for fluent API support) */ public function setProductId($v) { @@ -554,7 +485,7 @@ abstract class Rewriting implements ActiveRecordInterface if ($this->product_id !== $v) { $this->product_id = $v; - $this->modifiedColumns[] = RewritingTableMap::PRODUCT_ID; + $this->modifiedColumns[] = ProductAssociatedContentTableMap::PRODUCT_ID; } if ($this->aProduct !== null && $this->aProduct->getId() !== $v) { @@ -565,61 +496,11 @@ abstract class Rewriting implements ActiveRecordInterface return $this; } // setProductId() - /** - * Set the value of [category_id] column. - * - * @param int $v new value - * @return \Thelia\Model\Rewriting The current object (for fluent API support) - */ - public function setCategoryId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->category_id !== $v) { - $this->category_id = $v; - $this->modifiedColumns[] = RewritingTableMap::CATEGORY_ID; - } - - if ($this->aCategory !== null && $this->aCategory->getId() !== $v) { - $this->aCategory = null; - } - - - return $this; - } // setCategoryId() - - /** - * Set the value of [folder_id] column. - * - * @param int $v new value - * @return \Thelia\Model\Rewriting The current object (for fluent API support) - */ - public function setFolderId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->folder_id !== $v) { - $this->folder_id = $v; - $this->modifiedColumns[] = RewritingTableMap::FOLDER_ID; - } - - if ($this->aFolder !== null && $this->aFolder->getId() !== $v) { - $this->aFolder = null; - } - - - return $this; - } // setFolderId() - /** * Set the value of [content_id] column. * * @param int $v new value - * @return \Thelia\Model\Rewriting The current object (for fluent API support) + * @return \Thelia\Model\ProductAssociatedContent The current object (for fluent API support) */ public function setContentId($v) { @@ -629,7 +510,7 @@ abstract class Rewriting implements ActiveRecordInterface if ($this->content_id !== $v) { $this->content_id = $v; - $this->modifiedColumns[] = RewritingTableMap::CONTENT_ID; + $this->modifiedColumns[] = ProductAssociatedContentTableMap::CONTENT_ID; } if ($this->aContent !== null && $this->aContent->getId() !== $v) { @@ -640,12 +521,33 @@ abstract class Rewriting implements ActiveRecordInterface return $this; } // setContentId() + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return \Thelia\Model\ProductAssociatedContent The current object (for fluent API support) + */ + public function setPosition($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->position !== $v) { + $this->position = $v; + $this->modifiedColumns[] = ProductAssociatedContentTableMap::POSITION; + } + + + return $this; + } // setPosition() + /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\Rewriting The current object (for fluent API support) + * @return \Thelia\Model\ProductAssociatedContent The current object (for fluent API support) */ public function setCreatedAt($v) { @@ -653,7 +555,7 @@ abstract class Rewriting implements ActiveRecordInterface if ($this->created_at !== null || $dt !== null) { if ($dt !== $this->created_at) { $this->created_at = $dt; - $this->modifiedColumns[] = RewritingTableMap::CREATED_AT; + $this->modifiedColumns[] = ProductAssociatedContentTableMap::CREATED_AT; } } // if either are not null @@ -666,7 +568,7 @@ abstract class Rewriting implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\Rewriting The current object (for fluent API support) + * @return \Thelia\Model\ProductAssociatedContent The current object (for fluent API support) */ public function setUpdatedAt($v) { @@ -674,7 +576,7 @@ abstract class Rewriting implements ActiveRecordInterface if ($this->updated_at !== null || $dt !== null) { if ($dt !== $this->updated_at) { $this->updated_at = $dt; - $this->modifiedColumns[] = RewritingTableMap::UPDATED_AT; + $this->modifiedColumns[] = ProductAssociatedContentTableMap::UPDATED_AT; } } // if either are not null @@ -719,31 +621,25 @@ abstract class Rewriting implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : RewritingTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProductAssociatedContentTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : RewritingTableMap::translateFieldName('Url', TableMap::TYPE_PHPNAME, $indexType)]; - $this->url = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : RewritingTableMap::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductAssociatedContentTableMap::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)]; $this->product_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : RewritingTableMap::translateFieldName('CategoryId', TableMap::TYPE_PHPNAME, $indexType)]; - $this->category_id = (null !== $col) ? (int) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : RewritingTableMap::translateFieldName('FolderId', TableMap::TYPE_PHPNAME, $indexType)]; - $this->folder_id = (null !== $col) ? (int) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : RewritingTableMap::translateFieldName('ContentId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductAssociatedContentTableMap::translateFieldName('ContentId', TableMap::TYPE_PHPNAME, $indexType)]; $this->content_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : RewritingTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductAssociatedContentTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $this->position = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductAssociatedContentTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : RewritingTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductAssociatedContentTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -756,10 +652,10 @@ abstract class Rewriting implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 8; // 8 = RewritingTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = ProductAssociatedContentTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException("Error populating \Thelia\Model\Rewriting object", 0, $e); + throw new PropelException("Error populating \Thelia\Model\ProductAssociatedContent object", 0, $e); } } @@ -781,12 +677,6 @@ abstract class Rewriting implements ActiveRecordInterface if ($this->aProduct !== null && $this->product_id !== $this->aProduct->getId()) { $this->aProduct = null; } - if ($this->aCategory !== null && $this->category_id !== $this->aCategory->getId()) { - $this->aCategory = null; - } - if ($this->aFolder !== null && $this->folder_id !== $this->aFolder->getId()) { - $this->aFolder = null; - } if ($this->aContent !== null && $this->content_id !== $this->aContent->getId()) { $this->aContent = null; } @@ -813,13 +703,13 @@ abstract class Rewriting implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(RewritingTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ProductAssociatedContentTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. - $dataFetcher = ChildRewritingQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $dataFetcher = ChildProductAssociatedContentQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { @@ -830,8 +720,6 @@ abstract class Rewriting implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? $this->aProduct = null; - $this->aCategory = null; - $this->aFolder = null; $this->aContent = null; } // if (deep) } @@ -842,8 +730,8 @@ abstract class Rewriting implements ActiveRecordInterface * @param ConnectionInterface $con * @return void * @throws PropelException - * @see Rewriting::setDeleted() - * @see Rewriting::isDeleted() + * @see ProductAssociatedContent::setDeleted() + * @see ProductAssociatedContent::isDeleted() */ public function delete(ConnectionInterface $con = null) { @@ -852,12 +740,12 @@ abstract class Rewriting implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(RewritingTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductAssociatedContentTableMap::DATABASE_NAME); } $con->beginTransaction(); try { - $deleteQuery = ChildRewritingQuery::create() + $deleteQuery = ChildProductAssociatedContentQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { @@ -894,7 +782,7 @@ abstract class Rewriting implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(RewritingTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductAssociatedContentTableMap::DATABASE_NAME); } $con->beginTransaction(); @@ -904,16 +792,16 @@ abstract class Rewriting implements ActiveRecordInterface if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - if (!$this->isColumnModified(RewritingTableMap::CREATED_AT)) { + if (!$this->isColumnModified(ProductAssociatedContentTableMap::CREATED_AT)) { $this->setCreatedAt(time()); } - if (!$this->isColumnModified(RewritingTableMap::UPDATED_AT)) { + if (!$this->isColumnModified(ProductAssociatedContentTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } else { $ret = $ret && $this->preUpdate($con); // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(RewritingTableMap::UPDATED_AT)) { + if ($this->isModified() && !$this->isColumnModified(ProductAssociatedContentTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } @@ -925,7 +813,7 @@ abstract class Rewriting implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - RewritingTableMap::addInstanceToPool($this); + ProductAssociatedContentTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -967,20 +855,6 @@ abstract class Rewriting implements ActiveRecordInterface $this->setProduct($this->aProduct); } - if ($this->aCategory !== null) { - if ($this->aCategory->isModified() || $this->aCategory->isNew()) { - $affectedRows += $this->aCategory->save($con); - } - $this->setCategory($this->aCategory); - } - - if ($this->aFolder !== null) { - if ($this->aFolder->isModified() || $this->aFolder->isNew()) { - $affectedRows += $this->aFolder->save($con); - } - $this->setFolder($this->aFolder); - } - if ($this->aContent !== null) { if ($this->aContent->isModified() || $this->aContent->isNew()) { $affectedRows += $this->aContent->save($con); @@ -1019,35 +893,33 @@ abstract class Rewriting implements ActiveRecordInterface $modifiedColumns = array(); $index = 0; + $this->modifiedColumns[] = ProductAssociatedContentTableMap::ID; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ProductAssociatedContentTableMap::ID . ')'); + } // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(RewritingTableMap::ID)) { + if ($this->isColumnModified(ProductAssociatedContentTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(RewritingTableMap::URL)) { - $modifiedColumns[':p' . $index++] = 'URL'; - } - if ($this->isColumnModified(RewritingTableMap::PRODUCT_ID)) { + if ($this->isColumnModified(ProductAssociatedContentTableMap::PRODUCT_ID)) { $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; } - if ($this->isColumnModified(RewritingTableMap::CATEGORY_ID)) { - $modifiedColumns[':p' . $index++] = 'CATEGORY_ID'; - } - if ($this->isColumnModified(RewritingTableMap::FOLDER_ID)) { - $modifiedColumns[':p' . $index++] = 'FOLDER_ID'; - } - if ($this->isColumnModified(RewritingTableMap::CONTENT_ID)) { + if ($this->isColumnModified(ProductAssociatedContentTableMap::CONTENT_ID)) { $modifiedColumns[':p' . $index++] = 'CONTENT_ID'; } - if ($this->isColumnModified(RewritingTableMap::CREATED_AT)) { + if ($this->isColumnModified(ProductAssociatedContentTableMap::POSITION)) { + $modifiedColumns[':p' . $index++] = 'POSITION'; + } + if ($this->isColumnModified(ProductAssociatedContentTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } - if ($this->isColumnModified(RewritingTableMap::UPDATED_AT)) { + if ($this->isColumnModified(ProductAssociatedContentTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; } $sql = sprintf( - 'INSERT INTO rewriting (%s) VALUES (%s)', + 'INSERT INTO product_associated_content (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1059,21 +931,15 @@ abstract class Rewriting implements ActiveRecordInterface case 'ID': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'URL': - $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); - break; case 'PRODUCT_ID': $stmt->bindValue($identifier, $this->product_id, PDO::PARAM_INT); break; - case 'CATEGORY_ID': - $stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); - break; - case 'FOLDER_ID': - $stmt->bindValue($identifier, $this->folder_id, PDO::PARAM_INT); - break; case 'CONTENT_ID': $stmt->bindValue($identifier, $this->content_id, PDO::PARAM_INT); break; + case 'POSITION': + $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); + break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -1088,6 +954,13 @@ abstract class Rewriting 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); } @@ -1119,7 +992,7 @@ abstract class Rewriting implements ActiveRecordInterface */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { - $pos = RewritingTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ProductAssociatedContentTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); return $field; @@ -1139,24 +1012,18 @@ abstract class Rewriting implements ActiveRecordInterface return $this->getId(); break; case 1: - return $this->getUrl(); - break; - case 2: return $this->getProductId(); break; - case 3: - return $this->getCategoryId(); - break; - case 4: - return $this->getFolderId(); - break; - case 5: + case 2: return $this->getContentId(); break; - case 6: + case 3: + return $this->getPosition(); + break; + case 4: return $this->getCreatedAt(); break; - case 7: + case 5: return $this->getUpdatedAt(); break; default: @@ -1182,20 +1049,18 @@ abstract class Rewriting implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['Rewriting'][$this->getPrimaryKey()])) { + if (isset($alreadyDumpedObjects['ProductAssociatedContent'][$this->getPrimaryKey()])) { return '*RECURSION*'; } - $alreadyDumpedObjects['Rewriting'][$this->getPrimaryKey()] = true; - $keys = RewritingTableMap::getFieldNames($keyType); + $alreadyDumpedObjects['ProductAssociatedContent'][$this->getPrimaryKey()] = true; + $keys = ProductAssociatedContentTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), - $keys[1] => $this->getUrl(), - $keys[2] => $this->getProductId(), - $keys[3] => $this->getCategoryId(), - $keys[4] => $this->getFolderId(), - $keys[5] => $this->getContentId(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), + $keys[1] => $this->getProductId(), + $keys[2] => $this->getContentId(), + $keys[3] => $this->getPosition(), + $keys[4] => $this->getCreatedAt(), + $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1207,12 +1072,6 @@ abstract class Rewriting implements ActiveRecordInterface if (null !== $this->aProduct) { $result['Product'] = $this->aProduct->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } - if (null !== $this->aCategory) { - $result['Category'] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } - if (null !== $this->aFolder) { - $result['Folder'] = $this->aFolder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } if (null !== $this->aContent) { $result['Content'] = $this->aContent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } @@ -1234,7 +1093,7 @@ abstract class Rewriting implements ActiveRecordInterface */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) { - $pos = RewritingTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ProductAssociatedContentTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); return $this->setByPosition($pos, $value); } @@ -1254,24 +1113,18 @@ abstract class Rewriting implements ActiveRecordInterface $this->setId($value); break; case 1: - $this->setUrl($value); - break; - case 2: $this->setProductId($value); break; - case 3: - $this->setCategoryId($value); - break; - case 4: - $this->setFolderId($value); - break; - case 5: + case 2: $this->setContentId($value); break; - case 6: + case 3: + $this->setPosition($value); + break; + case 4: $this->setCreatedAt($value); break; - case 7: + case 5: $this->setUpdatedAt($value); break; } // switch() @@ -1296,16 +1149,14 @@ abstract class Rewriting implements ActiveRecordInterface */ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { - $keys = RewritingTableMap::getFieldNames($keyType); + $keys = ProductAssociatedContentTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setUrl($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setProductId($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setCategoryId($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setFolderId($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setContentId($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); + if (array_key_exists($keys[1], $arr)) $this->setProductId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setContentId($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); } /** @@ -1315,16 +1166,14 @@ abstract class Rewriting implements ActiveRecordInterface */ public function buildCriteria() { - $criteria = new Criteria(RewritingTableMap::DATABASE_NAME); + $criteria = new Criteria(ProductAssociatedContentTableMap::DATABASE_NAME); - if ($this->isColumnModified(RewritingTableMap::ID)) $criteria->add(RewritingTableMap::ID, $this->id); - if ($this->isColumnModified(RewritingTableMap::URL)) $criteria->add(RewritingTableMap::URL, $this->url); - if ($this->isColumnModified(RewritingTableMap::PRODUCT_ID)) $criteria->add(RewritingTableMap::PRODUCT_ID, $this->product_id); - if ($this->isColumnModified(RewritingTableMap::CATEGORY_ID)) $criteria->add(RewritingTableMap::CATEGORY_ID, $this->category_id); - if ($this->isColumnModified(RewritingTableMap::FOLDER_ID)) $criteria->add(RewritingTableMap::FOLDER_ID, $this->folder_id); - if ($this->isColumnModified(RewritingTableMap::CONTENT_ID)) $criteria->add(RewritingTableMap::CONTENT_ID, $this->content_id); - if ($this->isColumnModified(RewritingTableMap::CREATED_AT)) $criteria->add(RewritingTableMap::CREATED_AT, $this->created_at); - if ($this->isColumnModified(RewritingTableMap::UPDATED_AT)) $criteria->add(RewritingTableMap::UPDATED_AT, $this->updated_at); + if ($this->isColumnModified(ProductAssociatedContentTableMap::ID)) $criteria->add(ProductAssociatedContentTableMap::ID, $this->id); + if ($this->isColumnModified(ProductAssociatedContentTableMap::PRODUCT_ID)) $criteria->add(ProductAssociatedContentTableMap::PRODUCT_ID, $this->product_id); + if ($this->isColumnModified(ProductAssociatedContentTableMap::CONTENT_ID)) $criteria->add(ProductAssociatedContentTableMap::CONTENT_ID, $this->content_id); + if ($this->isColumnModified(ProductAssociatedContentTableMap::POSITION)) $criteria->add(ProductAssociatedContentTableMap::POSITION, $this->position); + if ($this->isColumnModified(ProductAssociatedContentTableMap::CREATED_AT)) $criteria->add(ProductAssociatedContentTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(ProductAssociatedContentTableMap::UPDATED_AT)) $criteria->add(ProductAssociatedContentTableMap::UPDATED_AT, $this->updated_at); return $criteria; } @@ -1339,8 +1188,8 @@ abstract class Rewriting implements ActiveRecordInterface */ public function buildPkeyCriteria() { - $criteria = new Criteria(RewritingTableMap::DATABASE_NAME); - $criteria->add(RewritingTableMap::ID, $this->id); + $criteria = new Criteria(ProductAssociatedContentTableMap::DATABASE_NAME); + $criteria->add(ProductAssociatedContentTableMap::ID, $this->id); return $criteria; } @@ -1381,23 +1230,21 @@ abstract class Rewriting implements ActiveRecordInterface * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \Thelia\Model\Rewriting (or compatible) type. + * @param object $copyObj An object of \Thelia\Model\ProductAssociatedContent (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setId($this->getId()); - $copyObj->setUrl($this->getUrl()); $copyObj->setProductId($this->getProductId()); - $copyObj->setCategoryId($this->getCategoryId()); - $copyObj->setFolderId($this->getFolderId()); $copyObj->setContentId($this->getContentId()); + $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($makeNew) { $copyObj->setNew(true); + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1410,7 +1257,7 @@ abstract class Rewriting implements ActiveRecordInterface * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return \Thelia\Model\Rewriting Clone of current object. + * @return \Thelia\Model\ProductAssociatedContent Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) @@ -1427,7 +1274,7 @@ abstract class Rewriting implements ActiveRecordInterface * Declares an association between this object and a ChildProduct object. * * @param ChildProduct $v - * @return \Thelia\Model\Rewriting The current object (for fluent API support) + * @return \Thelia\Model\ProductAssociatedContent The current object (for fluent API support) * @throws PropelException */ public function setProduct(ChildProduct $v = null) @@ -1443,7 +1290,7 @@ abstract class Rewriting implements ActiveRecordInterface // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildProduct object, it will not be re-added. if ($v !== null) { - $v->addRewriting($this); + $v->addProductAssociatedContent($this); } @@ -1467,120 +1314,18 @@ abstract class Rewriting implements ActiveRecordInterface to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. - $this->aProduct->addRewritings($this); + $this->aProduct->addProductAssociatedContents($this); */ } return $this->aProduct; } - /** - * Declares an association between this object and a ChildCategory object. - * - * @param ChildCategory $v - * @return \Thelia\Model\Rewriting The current object (for fluent API support) - * @throws PropelException - */ - public function setCategory(ChildCategory $v = null) - { - if ($v === null) { - $this->setCategoryId(NULL); - } else { - $this->setCategoryId($v->getId()); - } - - $this->aCategory = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the ChildCategory object, it will not be re-added. - if ($v !== null) { - $v->addRewriting($this); - } - - - return $this; - } - - - /** - * Get the associated ChildCategory object - * - * @param ConnectionInterface $con Optional Connection object. - * @return ChildCategory The associated ChildCategory object. - * @throws PropelException - */ - public function getCategory(ConnectionInterface $con = null) - { - if ($this->aCategory === null && ($this->category_id !== null)) { - $this->aCategory = ChildCategoryQuery::create()->findPk($this->category_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCategory->addRewritings($this); - */ - } - - return $this->aCategory; - } - - /** - * Declares an association between this object and a ChildFolder object. - * - * @param ChildFolder $v - * @return \Thelia\Model\Rewriting The current object (for fluent API support) - * @throws PropelException - */ - public function setFolder(ChildFolder $v = null) - { - if ($v === null) { - $this->setFolderId(NULL); - } else { - $this->setFolderId($v->getId()); - } - - $this->aFolder = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the ChildFolder object, it will not be re-added. - if ($v !== null) { - $v->addRewriting($this); - } - - - return $this; - } - - - /** - * Get the associated ChildFolder object - * - * @param ConnectionInterface $con Optional Connection object. - * @return ChildFolder The associated ChildFolder object. - * @throws PropelException - */ - public function getFolder(ConnectionInterface $con = null) - { - if ($this->aFolder === null && ($this->folder_id !== null)) { - $this->aFolder = ChildFolderQuery::create()->findPk($this->folder_id, $con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aFolder->addRewritings($this); - */ - } - - return $this->aFolder; - } - /** * Declares an association between this object and a ChildContent object. * * @param ChildContent $v - * @return \Thelia\Model\Rewriting The current object (for fluent API support) + * @return \Thelia\Model\ProductAssociatedContent The current object (for fluent API support) * @throws PropelException */ public function setContent(ChildContent $v = null) @@ -1596,7 +1341,7 @@ abstract class Rewriting implements ActiveRecordInterface // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildContent object, it will not be re-added. if ($v !== null) { - $v->addRewriting($this); + $v->addProductAssociatedContent($this); } @@ -1620,7 +1365,7 @@ abstract class Rewriting implements ActiveRecordInterface to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. - $this->aContent->addRewritings($this); + $this->aContent->addProductAssociatedContents($this); */ } @@ -1633,11 +1378,9 @@ abstract class Rewriting implements ActiveRecordInterface public function clear() { $this->id = null; - $this->url = null; $this->product_id = null; - $this->category_id = null; - $this->folder_id = null; $this->content_id = null; + $this->position = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; @@ -1662,8 +1405,6 @@ abstract class Rewriting implements ActiveRecordInterface } // if ($deep) $this->aProduct = null; - $this->aCategory = null; - $this->aFolder = null; $this->aContent = null; } @@ -1674,7 +1415,7 @@ abstract class Rewriting implements ActiveRecordInterface */ public function __toString() { - return (string) $this->exportTo(RewritingTableMap::DEFAULT_STRING_FORMAT); + return (string) $this->exportTo(ProductAssociatedContentTableMap::DEFAULT_STRING_FORMAT); } // timestampable behavior @@ -1682,11 +1423,11 @@ abstract class Rewriting implements ActiveRecordInterface /** * Mark the current object so that the update date doesn't get updated during next save * - * @return ChildRewriting The current object (for fluent API support) + * @return ChildProductAssociatedContent The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { - $this->modifiedColumns[] = RewritingTableMap::UPDATED_AT; + $this->modifiedColumns[] = ProductAssociatedContentTableMap::UPDATED_AT; return $this; } diff --git a/core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php b/core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php new file mode 100644 index 000000000..d387f40ed --- /dev/null +++ b/core/lib/Thelia/Model/Base/ProductAssociatedContentQuery.php @@ -0,0 +1,804 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + + return $query; + } + + /** + * Find object by primary key. + * Propel uses the instance pool to skip the database if the object exists. + * Go fast if the query is untouched. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildProductAssociatedContent|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = ProductAssociatedContentTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(ProductAssociatedContentTableMap::DATABASE_NAME); + } + $this->basePreSelect($con); + if ($this->formatter || $this->modelAlias || $this->with || $this->select + || $this->selectColumns || $this->asColumns || $this->selectModifiers + || $this->map || $this->having || $this->joins) { + return $this->findPkComplex($key, $con); + } else { + return $this->findPkSimple($key, $con); + } + } + + /** + * Find object by primary key using raw SQL to go fast. + * Bypass doSelect() and the object formatter by using generated code. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildProductAssociatedContent A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT ID, PRODUCT_ID, CONTENT_ID, POSITION, CREATED_AT, UPDATED_AT FROM product_associated_content WHERE ID = :p0'; + try { + $stmt = $con->prepare($sql); + $stmt->bindValue(':p0', $key, PDO::PARAM_INT); + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); + } + $obj = null; + if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { + $obj = new ChildProductAssociatedContent(); + $obj->hydrate($row); + ProductAssociatedContentTableMap::addInstanceToPool($obj, (string) $key); + } + $stmt->closeCursor(); + + return $obj; + } + + /** + * Find object by primary key. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildProductAssociatedContent|array|mixed the result, formatted by the current formatter + */ + protected function findPkComplex($key, $con) + { + // As the query uses a PK condition, no limit(1) is necessary. + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKey($key) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); + } + $this->basePreSelect($con); + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKeys($keys) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->format($dataFetcher); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(ProductAssociatedContentTableMap::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(ProductAssociatedContentTableMap::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @param mixed $id The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id)) { + $useMinMax = false; + if (isset($id['min'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ProductAssociatedContentTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the product_id column + * + * Example usage: + * + * $query->filterByProductId(1234); // WHERE product_id = 1234 + * $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34) + * $query->filterByProductId(array('min' => 12)); // WHERE product_id > 12 + * + * + * @see filterByProduct() + * + * @param mixed $productId The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function filterByProductId($productId = null, $comparison = null) + { + if (is_array($productId)) { + $useMinMax = false; + if (isset($productId['min'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($productId['max'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $productId, $comparison); + } + + /** + * Filter the query on the content_id column + * + * Example usage: + * + * $query->filterByContentId(1234); // WHERE content_id = 1234 + * $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34) + * $query->filterByContentId(array('min' => 12)); // WHERE content_id > 12 + * + * + * @see filterByContent() + * + * @param mixed $contentId The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function filterByContentId($contentId = null, $comparison = null) + { + if (is_array($contentId)) { + $useMinMax = false; + if (isset($contentId['min'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($contentId['max'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $contentId, $comparison); + } + + /** + * Filter the query on the position column + * + * Example usage: + * + * $query->filterByPosition(1234); // WHERE position = 1234 + * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34) + * $query->filterByPosition(array('min' => 12)); // WHERE position > 12 + * + * + * @param mixed $position The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function filterByPosition($position = null, $comparison = null) + { + if (is_array($position)) { + $useMinMax = false; + if (isset($position['min'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($position['max'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ProductAssociatedContentTableMap::POSITION, $position, $comparison); + } + + /** + * Filter the query on the created_at column + * + * Example usage: + * + * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' + * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' + * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' + * + * + * @param mixed $createdAt The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function filterByCreatedAt($createdAt = null, $comparison = null) + { + if (is_array($createdAt)) { + $useMinMax = false; + if (isset($createdAt['min'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($createdAt['max'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ProductAssociatedContentTableMap::CREATED_AT, $createdAt, $comparison); + } + + /** + * Filter the query on the updated_at column + * + * Example usage: + * + * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' + * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' + * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' + * + * + * @param mixed $updatedAt The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function filterByUpdatedAt($updatedAt = null, $comparison = null) + { + if (is_array($updatedAt)) { + $useMinMax = false; + if (isset($updatedAt['min'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($updatedAt['max'])) { + $this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, $updatedAt, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\Product object + * + * @param \Thelia\Model\Product|ObjectCollection $product The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function filterByProduct($product, $comparison = null) + { + if ($product instanceof \Thelia\Model\Product) { + return $this + ->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $product->getId(), $comparison); + } elseif ($product instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(ProductAssociatedContentTableMap::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Product relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Product'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'Product'); + } + + return $this; + } + + /** + * Use the Product relation Product object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query + */ + public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinProduct($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery'); + } + + /** + * Filter the query by a related \Thelia\Model\Content object + * + * @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function filterByContent($content, $comparison = null) + { + if ($content instanceof \Thelia\Model\Content) { + return $this + ->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $content->getId(), $comparison); + } elseif ($content instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(ProductAssociatedContentTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByContent() only accepts arguments of type \Thelia\Model\Content or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Content relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function joinContent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Content'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'Content'); + } + + return $this; + } + + /** + * Use the Content relation Content object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query + */ + public function useContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinContent($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery'); + } + + /** + * Exclude object from result + * + * @param ChildProductAssociatedContent $productAssociatedContent Object to remove from the list of results + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function prune($productAssociatedContent = null) + { + if ($productAssociatedContent) { + $this->addUsingAlias(ProductAssociatedContentTableMap::ID, $productAssociatedContent->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the product_associated_content table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public function doDeleteAll(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(ProductAssociatedContentTableMap::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += parent::doDeleteAll($con); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + ProductAssociatedContentTableMap::clearInstancePool(); + ProductAssociatedContentTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildProductAssociatedContent or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildProductAssociatedContent object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public function delete(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(ProductAssociatedContentTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(ProductAssociatedContentTableMap::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + + ProductAssociatedContentTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + ProductAssociatedContentTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + // timestampable behavior + + /** + * Filter by the latest updated + * + * @param int $nbDays Maximum age of the latest update in days + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function recentlyUpdated($nbDays = 7) + { + return $this->addUsingAlias(ProductAssociatedContentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Filter by the latest created + * + * @param int $nbDays Maximum age of in days + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function recentlyCreated($nbDays = 7) + { + return $this->addUsingAlias(ProductAssociatedContentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Order by update date desc + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function lastUpdatedFirst() + { + return $this->addDescendingOrderByColumn(ProductAssociatedContentTableMap::UPDATED_AT); + } + + /** + * Order by update date asc + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function firstUpdatedFirst() + { + return $this->addAscendingOrderByColumn(ProductAssociatedContentTableMap::UPDATED_AT); + } + + /** + * Order by create date desc + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function lastCreatedFirst() + { + return $this->addDescendingOrderByColumn(ProductAssociatedContentTableMap::CREATED_AT); + } + + /** + * Order by create date asc + * + * @return ChildProductAssociatedContentQuery The current query, for fluid interface + */ + public function firstCreatedFirst() + { + return $this->addAscendingOrderByColumn(ProductAssociatedContentTableMap::CREATED_AT); + } + +} // ProductAssociatedContentQuery diff --git a/core/lib/Thelia/Model/Base/ProductCategory.php b/core/lib/Thelia/Model/Base/ProductCategory.php index 74affb0c0..62a6ea425 100644 --- a/core/lib/Thelia/Model/Base/ProductCategory.php +++ b/core/lib/Thelia/Model/Base/ProductCategory.php @@ -256,7 +256,7 @@ abstract class ProductCategory implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ProductDocument.php b/core/lib/Thelia/Model/Base/ProductDocument.php index 58c9999ed..4223679c1 100644 --- a/core/lib/Thelia/Model/Base/ProductDocument.php +++ b/core/lib/Thelia/Model/Base/ProductDocument.php @@ -290,7 +290,7 @@ abstract class ProductDocument implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ProductDocumentI18n.php b/core/lib/Thelia/Model/Base/ProductDocumentI18n.php index 2c5ca4d0c..1a6017966 100644 --- a/core/lib/Thelia/Model/Base/ProductDocumentI18n.php +++ b/core/lib/Thelia/Model/Base/ProductDocumentI18n.php @@ -272,7 +272,7 @@ abstract class ProductDocumentI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ProductI18n.php b/core/lib/Thelia/Model/Base/ProductI18n.php index b0c74bb54..3ef14e787 100644 --- a/core/lib/Thelia/Model/Base/ProductI18n.php +++ b/core/lib/Thelia/Model/Base/ProductI18n.php @@ -272,7 +272,7 @@ abstract class ProductI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ProductImage.php b/core/lib/Thelia/Model/Base/ProductImage.php index 0b4030ccb..a54d22cd0 100644 --- a/core/lib/Thelia/Model/Base/ProductImage.php +++ b/core/lib/Thelia/Model/Base/ProductImage.php @@ -290,7 +290,7 @@ abstract class ProductImage implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ProductImageI18n.php b/core/lib/Thelia/Model/Base/ProductImageI18n.php index 634f726a3..679ded79c 100644 --- a/core/lib/Thelia/Model/Base/ProductImageI18n.php +++ b/core/lib/Thelia/Model/Base/ProductImageI18n.php @@ -272,7 +272,7 @@ abstract class ProductImageI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ProductPrice.php b/core/lib/Thelia/Model/Base/ProductPrice.php index dab6e47a4..15502a385 100644 --- a/core/lib/Thelia/Model/Base/ProductPrice.php +++ b/core/lib/Thelia/Model/Base/ProductPrice.php @@ -274,7 +274,7 @@ abstract class ProductPrice implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ProductQuery.php b/core/lib/Thelia/Model/Base/ProductQuery.php index 3df8ecbae..75f05dfcf 100644 --- a/core/lib/Thelia/Model/Base/ProductQuery.php +++ b/core/lib/Thelia/Model/Base/ProductQuery.php @@ -64,10 +64,6 @@ use Thelia\Model\Map\ProductTableMap; * @method ChildProductQuery rightJoinProductSaleElements($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductSaleElements relation * @method ChildProductQuery innerJoinProductSaleElements($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductSaleElements relation * - * @method ChildProductQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation - * @method ChildProductQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation - * @method ChildProductQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation - * * @method ChildProductQuery leftJoinProductImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductImage relation * @method ChildProductQuery rightJoinProductImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductImage relation * @method ChildProductQuery innerJoinProductImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductImage relation @@ -84,14 +80,14 @@ use Thelia\Model\Map\ProductTableMap; * @method ChildProductQuery rightJoinAccessoryRelatedByAccessory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AccessoryRelatedByAccessory relation * @method ChildProductQuery innerJoinAccessoryRelatedByAccessory($relationAlias = null) Adds a INNER JOIN clause to the query using the AccessoryRelatedByAccessory relation * - * @method ChildProductQuery leftJoinRewriting($relationAlias = null) Adds a LEFT JOIN clause to the query using the Rewriting relation - * @method ChildProductQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation - * @method ChildProductQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation - * * @method ChildProductQuery leftJoinCartItem($relationAlias = null) Adds a LEFT JOIN clause to the query using the CartItem relation * @method ChildProductQuery rightJoinCartItem($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CartItem relation * @method ChildProductQuery innerJoinCartItem($relationAlias = null) Adds a INNER JOIN clause to the query using the CartItem relation * + * @method ChildProductQuery leftJoinProductAssociatedContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductAssociatedContent relation + * @method ChildProductQuery rightJoinProductAssociatedContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductAssociatedContent relation + * @method ChildProductQuery innerJoinProductAssociatedContent($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductAssociatedContent relation + * * @method ChildProductQuery leftJoinProductI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductI18n relation * @method ChildProductQuery rightJoinProductI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductI18n relation * @method ChildProductQuery innerJoinProductI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductI18n relation @@ -996,79 +992,6 @@ abstract class ProductQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'ProductSaleElements', '\Thelia\Model\ProductSaleElementsQuery'); } - /** - * Filter the query by a related \Thelia\Model\ContentAssoc object - * - * @param \Thelia\Model\ContentAssoc|ObjectCollection $contentAssoc the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildProductQuery The current query, for fluid interface - */ - public function filterByContentAssoc($contentAssoc, $comparison = null) - { - if ($contentAssoc instanceof \Thelia\Model\ContentAssoc) { - return $this - ->addUsingAlias(ProductTableMap::ID, $contentAssoc->getProductId(), $comparison); - } elseif ($contentAssoc instanceof ObjectCollection) { - return $this - ->useContentAssocQuery() - ->filterByPrimaryKeys($contentAssoc->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByContentAssoc() only accepts arguments of type \Thelia\Model\ContentAssoc or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the ContentAssoc relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildProductQuery The current query, for fluid interface - */ - public function joinContentAssoc($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ContentAssoc'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'ContentAssoc'); - } - - return $this; - } - - /** - * Use the ContentAssoc relation ContentAssoc object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ContentAssocQuery A secondary query class using the current class as primary query - */ - public function useContentAssocQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinContentAssoc($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ContentAssoc', '\Thelia\Model\ContentAssocQuery'); - } - /** * Filter the query by a related \Thelia\Model\ProductImage object * @@ -1361,79 +1284,6 @@ abstract class ProductQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'AccessoryRelatedByAccessory', '\Thelia\Model\AccessoryQuery'); } - /** - * Filter the query by a related \Thelia\Model\Rewriting object - * - * @param \Thelia\Model\Rewriting|ObjectCollection $rewriting the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildProductQuery The current query, for fluid interface - */ - public function filterByRewriting($rewriting, $comparison = null) - { - if ($rewriting instanceof \Thelia\Model\Rewriting) { - return $this - ->addUsingAlias(ProductTableMap::ID, $rewriting->getProductId(), $comparison); - } elseif ($rewriting instanceof ObjectCollection) { - return $this - ->useRewritingQuery() - ->filterByPrimaryKeys($rewriting->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByRewriting() only accepts arguments of type \Thelia\Model\Rewriting or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Rewriting relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildProductQuery The current query, for fluid interface - */ - public function joinRewriting($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Rewriting'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Rewriting'); - } - - return $this; - } - - /** - * Use the Rewriting relation Rewriting object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\RewritingQuery A secondary query class using the current class as primary query - */ - public function useRewritingQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinRewriting($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery'); - } - /** * Filter the query by a related \Thelia\Model\CartItem object * @@ -1507,6 +1357,79 @@ abstract class ProductQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CartItem', '\Thelia\Model\CartItemQuery'); } + /** + * Filter the query by a related \Thelia\Model\ProductAssociatedContent object + * + * @param \Thelia\Model\ProductAssociatedContent|ObjectCollection $productAssociatedContent the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildProductQuery The current query, for fluid interface + */ + public function filterByProductAssociatedContent($productAssociatedContent, $comparison = null) + { + if ($productAssociatedContent instanceof \Thelia\Model\ProductAssociatedContent) { + return $this + ->addUsingAlias(ProductTableMap::ID, $productAssociatedContent->getProductId(), $comparison); + } elseif ($productAssociatedContent instanceof ObjectCollection) { + return $this + ->useProductAssociatedContentQuery() + ->filterByPrimaryKeys($productAssociatedContent->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByProductAssociatedContent() only accepts arguments of type \Thelia\Model\ProductAssociatedContent or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the ProductAssociatedContent relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildProductQuery The current query, for fluid interface + */ + public function joinProductAssociatedContent($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('ProductAssociatedContent'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'ProductAssociatedContent'); + } + + return $this; + } + + /** + * Use the ProductAssociatedContent relation ProductAssociatedContent object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\ProductAssociatedContentQuery A secondary query class using the current class as primary query + */ + public function useProductAssociatedContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinProductAssociatedContent($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ProductAssociatedContent', '\Thelia\Model\ProductAssociatedContentQuery'); + } + /** * Filter the query by a related \Thelia\Model\ProductI18n object * diff --git a/core/lib/Thelia/Model/Base/ProductSaleElements.php b/core/lib/Thelia/Model/Base/ProductSaleElements.php index 22a8c9752..f79d9a246 100644 --- a/core/lib/Thelia/Model/Base/ProductSaleElements.php +++ b/core/lib/Thelia/Model/Base/ProductSaleElements.php @@ -332,7 +332,7 @@ abstract class ProductSaleElements implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ProductVersion.php b/core/lib/Thelia/Model/Base/ProductVersion.php index 1779cee20..071dfc742 100644 --- a/core/lib/Thelia/Model/Base/ProductVersion.php +++ b/core/lib/Thelia/Model/Base/ProductVersion.php @@ -300,7 +300,7 @@ abstract class ProductVersion implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/Resource.php b/core/lib/Thelia/Model/Base/Resource.php index c6c527134..5a51bdc29 100644 --- a/core/lib/Thelia/Model/Base/Resource.php +++ b/core/lib/Thelia/Model/Base/Resource.php @@ -298,7 +298,7 @@ abstract class Resource implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/ResourceI18n.php b/core/lib/Thelia/Model/Base/ResourceI18n.php index c060e8776..ac9ca106f 100644 --- a/core/lib/Thelia/Model/Base/ResourceI18n.php +++ b/core/lib/Thelia/Model/Base/ResourceI18n.php @@ -272,7 +272,7 @@ abstract class ResourceI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/CouponRule.php b/core/lib/Thelia/Model/Base/RewritingArgument.php similarity index 73% rename from core/lib/Thelia/Model/Base/CouponRule.php rename to core/lib/Thelia/Model/Base/RewritingArgument.php index 5602b0044..45f26c24f 100644 --- a/core/lib/Thelia/Model/Base/CouponRule.php +++ b/core/lib/Thelia/Model/Base/RewritingArgument.php @@ -16,18 +16,18 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; -use Thelia\Model\Coupon as ChildCoupon; -use Thelia\Model\CouponQuery as ChildCouponQuery; -use Thelia\Model\CouponRule as ChildCouponRule; -use Thelia\Model\CouponRuleQuery as ChildCouponRuleQuery; -use Thelia\Model\Map\CouponRuleTableMap; +use Thelia\Model\RewritingArgument as ChildRewritingArgument; +use Thelia\Model\RewritingArgumentQuery as ChildRewritingArgumentQuery; +use Thelia\Model\RewritingUrl as ChildRewritingUrl; +use Thelia\Model\RewritingUrlQuery as ChildRewritingUrlQuery; +use Thelia\Model\Map\RewritingArgumentTableMap; -abstract class CouponRule implements ActiveRecordInterface +abstract class RewritingArgument implements ActiveRecordInterface { /** * TableMap class name */ - const TABLE_MAP = '\\Thelia\\Model\\Map\\CouponRuleTableMap'; + const TABLE_MAP = '\\Thelia\\Model\\Map\\RewritingArgumentTableMap'; /** @@ -57,32 +57,20 @@ abstract class CouponRule implements ActiveRecordInterface protected $virtualColumns = array(); /** - * The value for the id field. + * The value for the rewriting_url_id field. * @var int */ - protected $id; + protected $rewriting_url_id; /** - * The value for the coupon_id field. - * @var int - */ - protected $coupon_id; - - /** - * The value for the controller field. + * The value for the parameter field. * @var string */ - protected $controller; - - /** - * The value for the operation field. - * @var string - */ - protected $operation; + protected $parameter; /** * The value for the value field. - * @var double + * @var string */ protected $value; @@ -99,9 +87,9 @@ abstract class CouponRule implements ActiveRecordInterface protected $updated_at; /** - * @var Coupon + * @var RewritingUrl */ - protected $aCoupon; + protected $aRewritingUrl; /** * Flag to prevent endless save loop, if this object is referenced @@ -112,7 +100,7 @@ abstract class CouponRule implements ActiveRecordInterface protected $alreadyInSave = false; /** - * Initializes internal state of Thelia\Model\Base\CouponRule object. + * Initializes internal state of Thelia\Model\Base\RewritingArgument object. */ public function __construct() { @@ -207,9 +195,9 @@ abstract class CouponRule implements ActiveRecordInterface } /** - * Compares this with another CouponRule instance. If - * obj is an instance of CouponRule, delegates to - * equals(CouponRule). Otherwise, returns false. + * Compares this with another RewritingArgument instance. If + * 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. @@ -267,7 +255,7 @@ abstract class CouponRule implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -290,7 +278,7 @@ abstract class CouponRule implements ActiveRecordInterface * @param string $name The virtual column name * @param mixed $value The value to give to the virtual column * - * @return CouponRule The current object, for fluid interface + * @return RewritingArgument The current object, for fluid interface */ public function setVirtualColumn($name, $value) { @@ -322,7 +310,7 @@ abstract class CouponRule implements ActiveRecordInterface * or a format name ('XML', 'YAML', 'JSON', 'CSV') * @param string $data The source data to import from * - * @return CouponRule The current object, for fluid interface + * @return RewritingArgument The current object, for fluid interface */ public function importFrom($parser, $data) { @@ -366,53 +354,31 @@ abstract class CouponRule implements ActiveRecordInterface } /** - * Get the [id] column value. + * Get the [rewriting_url_id] column value. * * @return int */ - public function getId() + public function getRewritingUrlId() { - return $this->id; + return $this->rewriting_url_id; } /** - * Get the [coupon_id] column value. - * - * @return int - */ - public function getCouponId() - { - - return $this->coupon_id; - } - - /** - * Get the [controller] column value. + * Get the [parameter] column value. * * @return string */ - public function getController() + public function getParameter() { - return $this->controller; - } - - /** - * Get the [operation] column value. - * - * @return string - */ - public function getOperation() - { - - return $this->operation; + return $this->parameter; } /** * Get the [value] column value. * - * @return double + * @return string */ public function getValue() { @@ -461,108 +427,66 @@ abstract class CouponRule implements ActiveRecordInterface } /** - * Set the value of [id] column. + * Set the value of [rewriting_url_id] column. * * @param int $v new value - * @return \Thelia\Model\CouponRule The current object (for fluent API support) + * @return \Thelia\Model\RewritingArgument The current object (for fluent API support) */ - public function setId($v) + public function setRewritingUrlId($v) { if ($v !== null) { $v = (int) $v; } - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = CouponRuleTableMap::ID; + if ($this->rewriting_url_id !== $v) { + $this->rewriting_url_id = $v; + $this->modifiedColumns[] = RewritingArgumentTableMap::REWRITING_URL_ID; + } + + if ($this->aRewritingUrl !== null && $this->aRewritingUrl->getId() !== $v) { + $this->aRewritingUrl = null; } return $this; - } // setId() + } // setRewritingUrlId() /** - * Set the value of [coupon_id] column. - * - * @param int $v new value - * @return \Thelia\Model\CouponRule The current object (for fluent API support) - */ - public function setCouponId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->coupon_id !== $v) { - $this->coupon_id = $v; - $this->modifiedColumns[] = CouponRuleTableMap::COUPON_ID; - } - - if ($this->aCoupon !== null && $this->aCoupon->getId() !== $v) { - $this->aCoupon = null; - } - - - return $this; - } // setCouponId() - - /** - * Set the value of [controller] column. + * Set the value of [parameter] column. * * @param string $v new value - * @return \Thelia\Model\CouponRule The current object (for fluent API support) + * @return \Thelia\Model\RewritingArgument The current object (for fluent API support) */ - public function setController($v) + public function setParameter($v) { if ($v !== null) { $v = (string) $v; } - if ($this->controller !== $v) { - $this->controller = $v; - $this->modifiedColumns[] = CouponRuleTableMap::CONTROLLER; + if ($this->parameter !== $v) { + $this->parameter = $v; + $this->modifiedColumns[] = RewritingArgumentTableMap::PARAMETER; } return $this; - } // setController() - - /** - * Set the value of [operation] column. - * - * @param string $v new value - * @return \Thelia\Model\CouponRule The current object (for fluent API support) - */ - public function setOperation($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->operation !== $v) { - $this->operation = $v; - $this->modifiedColumns[] = CouponRuleTableMap::OPERATION; - } - - - return $this; - } // setOperation() + } // setParameter() /** * Set the value of [value] column. * - * @param double $v new value - * @return \Thelia\Model\CouponRule The current object (for fluent API support) + * @param string $v new value + * @return \Thelia\Model\RewritingArgument The current object (for fluent API support) */ public function setValue($v) { if ($v !== null) { - $v = (double) $v; + $v = (string) $v; } if ($this->value !== $v) { $this->value = $v; - $this->modifiedColumns[] = CouponRuleTableMap::VALUE; + $this->modifiedColumns[] = RewritingArgumentTableMap::VALUE; } @@ -574,7 +498,7 @@ abstract class CouponRule implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\CouponRule The current object (for fluent API support) + * @return \Thelia\Model\RewritingArgument The current object (for fluent API support) */ public function setCreatedAt($v) { @@ -582,7 +506,7 @@ abstract class CouponRule implements ActiveRecordInterface if ($this->created_at !== null || $dt !== null) { if ($dt !== $this->created_at) { $this->created_at = $dt; - $this->modifiedColumns[] = CouponRuleTableMap::CREATED_AT; + $this->modifiedColumns[] = RewritingArgumentTableMap::CREATED_AT; } } // if either are not null @@ -595,7 +519,7 @@ abstract class CouponRule implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\CouponRule The current object (for fluent API support) + * @return \Thelia\Model\RewritingArgument The current object (for fluent API support) */ public function setUpdatedAt($v) { @@ -603,7 +527,7 @@ abstract class CouponRule implements ActiveRecordInterface if ($this->updated_at !== null || $dt !== null) { if ($dt !== $this->updated_at) { $this->updated_at = $dt; - $this->modifiedColumns[] = CouponRuleTableMap::UPDATED_AT; + $this->modifiedColumns[] = RewritingArgumentTableMap::UPDATED_AT; } } // if either are not null @@ -648,28 +572,22 @@ abstract class CouponRule implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : CouponRuleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; - $this->id = (null !== $col) ? (int) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : RewritingArgumentTableMap::translateFieldName('RewritingUrlId', TableMap::TYPE_PHPNAME, $indexType)]; + $this->rewriting_url_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponRuleTableMap::translateFieldName('CouponId', TableMap::TYPE_PHPNAME, $indexType)]; - $this->coupon_id = (null !== $col) ? (int) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : RewritingArgumentTableMap::translateFieldName('Parameter', TableMap::TYPE_PHPNAME, $indexType)]; + $this->parameter = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponRuleTableMap::translateFieldName('Controller', TableMap::TYPE_PHPNAME, $indexType)]; - $this->controller = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : RewritingArgumentTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)]; + $this->value = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponRuleTableMap::translateFieldName('Operation', TableMap::TYPE_PHPNAME, $indexType)]; - $this->operation = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponRuleTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)]; - $this->value = (null !== $col) ? (double) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponRuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : RewritingArgumentTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponRuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : RewritingArgumentTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -682,10 +600,10 @@ abstract class CouponRule implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 7; // 7 = CouponRuleTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 5; // 5 = RewritingArgumentTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException("Error populating \Thelia\Model\CouponRule object", 0, $e); + throw new PropelException("Error populating \Thelia\Model\RewritingArgument object", 0, $e); } } @@ -704,8 +622,8 @@ abstract class CouponRule implements ActiveRecordInterface */ public function ensureConsistency() { - if ($this->aCoupon !== null && $this->coupon_id !== $this->aCoupon->getId()) { - $this->aCoupon = null; + if ($this->aRewritingUrl !== null && $this->rewriting_url_id !== $this->aRewritingUrl->getId()) { + $this->aRewritingUrl = null; } } // ensureConsistency @@ -730,13 +648,13 @@ abstract class CouponRule implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(CouponRuleTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(RewritingArgumentTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. - $dataFetcher = ChildCouponRuleQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $dataFetcher = ChildRewritingArgumentQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { @@ -746,7 +664,7 @@ abstract class CouponRule implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->aCoupon = null; + $this->aRewritingUrl = null; } // if (deep) } @@ -756,8 +674,8 @@ abstract class CouponRule implements ActiveRecordInterface * @param ConnectionInterface $con * @return void * @throws PropelException - * @see CouponRule::setDeleted() - * @see CouponRule::isDeleted() + * @see RewritingArgument::setDeleted() + * @see RewritingArgument::isDeleted() */ public function delete(ConnectionInterface $con = null) { @@ -766,12 +684,12 @@ abstract class CouponRule implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponRuleTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(RewritingArgumentTableMap::DATABASE_NAME); } $con->beginTransaction(); try { - $deleteQuery = ChildCouponRuleQuery::create() + $deleteQuery = ChildRewritingArgumentQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { @@ -808,7 +726,7 @@ abstract class CouponRule implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponRuleTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(RewritingArgumentTableMap::DATABASE_NAME); } $con->beginTransaction(); @@ -818,16 +736,16 @@ abstract class CouponRule implements ActiveRecordInterface if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - if (!$this->isColumnModified(CouponRuleTableMap::CREATED_AT)) { + if (!$this->isColumnModified(RewritingArgumentTableMap::CREATED_AT)) { $this->setCreatedAt(time()); } - if (!$this->isColumnModified(CouponRuleTableMap::UPDATED_AT)) { + if (!$this->isColumnModified(RewritingArgumentTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } else { $ret = $ret && $this->preUpdate($con); // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(CouponRuleTableMap::UPDATED_AT)) { + if ($this->isModified() && !$this->isColumnModified(RewritingArgumentTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } @@ -839,7 +757,7 @@ abstract class CouponRule implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - CouponRuleTableMap::addInstanceToPool($this); + RewritingArgumentTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -874,11 +792,11 @@ abstract class CouponRule implements ActiveRecordInterface // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aCoupon !== null) { - if ($this->aCoupon->isModified() || $this->aCoupon->isNew()) { - $affectedRows += $this->aCoupon->save($con); + if ($this->aRewritingUrl !== null) { + if ($this->aRewritingUrl->isModified() || $this->aRewritingUrl->isNew()) { + $affectedRows += $this->aRewritingUrl->save($con); } - $this->setCoupon($this->aCoupon); + $this->setRewritingUrl($this->aRewritingUrl); } if ($this->isNew() || $this->isModified()) { @@ -912,36 +830,26 @@ abstract class CouponRule implements ActiveRecordInterface $modifiedColumns = array(); $index = 0; - $this->modifiedColumns[] = CouponRuleTableMap::ID; - if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . CouponRuleTableMap::ID . ')'); - } // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(CouponRuleTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; + if ($this->isColumnModified(RewritingArgumentTableMap::REWRITING_URL_ID)) { + $modifiedColumns[':p' . $index++] = 'REWRITING_URL_ID'; } - if ($this->isColumnModified(CouponRuleTableMap::COUPON_ID)) { - $modifiedColumns[':p' . $index++] = 'COUPON_ID'; + if ($this->isColumnModified(RewritingArgumentTableMap::PARAMETER)) { + $modifiedColumns[':p' . $index++] = 'PARAMETER'; } - if ($this->isColumnModified(CouponRuleTableMap::CONTROLLER)) { - $modifiedColumns[':p' . $index++] = 'CONTROLLER'; - } - if ($this->isColumnModified(CouponRuleTableMap::OPERATION)) { - $modifiedColumns[':p' . $index++] = 'OPERATION'; - } - if ($this->isColumnModified(CouponRuleTableMap::VALUE)) { + if ($this->isColumnModified(RewritingArgumentTableMap::VALUE)) { $modifiedColumns[':p' . $index++] = 'VALUE'; } - if ($this->isColumnModified(CouponRuleTableMap::CREATED_AT)) { + if ($this->isColumnModified(RewritingArgumentTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } - if ($this->isColumnModified(CouponRuleTableMap::UPDATED_AT)) { + if ($this->isColumnModified(RewritingArgumentTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; } $sql = sprintf( - 'INSERT INTO coupon_rule (%s) VALUES (%s)', + 'INSERT INTO rewriting_argument (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -950,17 +858,11 @@ abstract class CouponRule implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + case 'REWRITING_URL_ID': + $stmt->bindValue($identifier, $this->rewriting_url_id, PDO::PARAM_INT); break; - case 'COUPON_ID': - $stmt->bindValue($identifier, $this->coupon_id, PDO::PARAM_INT); - break; - case 'CONTROLLER': - $stmt->bindValue($identifier, $this->controller, PDO::PARAM_STR); - break; - case 'OPERATION': - $stmt->bindValue($identifier, $this->operation, PDO::PARAM_STR); + case 'PARAMETER': + $stmt->bindValue($identifier, $this->parameter, PDO::PARAM_STR); break; case 'VALUE': $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR); @@ -979,13 +881,6 @@ abstract class CouponRule 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); } @@ -1017,7 +912,7 @@ abstract class CouponRule implements ActiveRecordInterface */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { - $pos = CouponRuleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = RewritingArgumentTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); return $field; @@ -1034,24 +929,18 @@ abstract class CouponRule implements ActiveRecordInterface { switch ($pos) { case 0: - return $this->getId(); + return $this->getRewritingUrlId(); break; case 1: - return $this->getCouponId(); + return $this->getParameter(); break; case 2: - return $this->getController(); - break; - case 3: - return $this->getOperation(); - break; - case 4: return $this->getValue(); break; - case 5: + case 3: return $this->getCreatedAt(); break; - case 6: + case 4: return $this->getUpdatedAt(); break; default: @@ -1077,19 +966,17 @@ abstract class CouponRule implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['CouponRule'][$this->getPrimaryKey()])) { + if (isset($alreadyDumpedObjects['RewritingArgument'][serialize($this->getPrimaryKey())])) { return '*RECURSION*'; } - $alreadyDumpedObjects['CouponRule'][$this->getPrimaryKey()] = true; - $keys = CouponRuleTableMap::getFieldNames($keyType); + $alreadyDumpedObjects['RewritingArgument'][serialize($this->getPrimaryKey())] = true; + $keys = RewritingArgumentTableMap::getFieldNames($keyType); $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getCouponId(), - $keys[2] => $this->getController(), - $keys[3] => $this->getOperation(), - $keys[4] => $this->getValue(), - $keys[5] => $this->getCreatedAt(), - $keys[6] => $this->getUpdatedAt(), + $keys[0] => $this->getRewritingUrlId(), + $keys[1] => $this->getParameter(), + $keys[2] => $this->getValue(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1098,8 +985,8 @@ abstract class CouponRule implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->aCoupon) { - $result['Coupon'] = $this->aCoupon->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + if (null !== $this->aRewritingUrl) { + $result['RewritingUrl'] = $this->aRewritingUrl->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -1119,7 +1006,7 @@ abstract class CouponRule implements ActiveRecordInterface */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) { - $pos = CouponRuleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = RewritingArgumentTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); return $this->setByPosition($pos, $value); } @@ -1136,24 +1023,18 @@ abstract class CouponRule implements ActiveRecordInterface { switch ($pos) { case 0: - $this->setId($value); + $this->setRewritingUrlId($value); break; case 1: - $this->setCouponId($value); + $this->setParameter($value); break; case 2: - $this->setController($value); - break; - case 3: - $this->setOperation($value); - break; - case 4: $this->setValue($value); break; - case 5: + case 3: $this->setCreatedAt($value); break; - case 6: + case 4: $this->setUpdatedAt($value); break; } // switch() @@ -1178,15 +1059,13 @@ abstract class CouponRule implements ActiveRecordInterface */ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { - $keys = CouponRuleTableMap::getFieldNames($keyType); + $keys = RewritingArgumentTableMap::getFieldNames($keyType); - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setCouponId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setController($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setOperation($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setValue($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]); + if (array_key_exists($keys[0], $arr)) $this->setRewritingUrlId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setParameter($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setValue($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); } /** @@ -1196,15 +1075,13 @@ abstract class CouponRule implements ActiveRecordInterface */ public function buildCriteria() { - $criteria = new Criteria(CouponRuleTableMap::DATABASE_NAME); + $criteria = new Criteria(RewritingArgumentTableMap::DATABASE_NAME); - if ($this->isColumnModified(CouponRuleTableMap::ID)) $criteria->add(CouponRuleTableMap::ID, $this->id); - if ($this->isColumnModified(CouponRuleTableMap::COUPON_ID)) $criteria->add(CouponRuleTableMap::COUPON_ID, $this->coupon_id); - if ($this->isColumnModified(CouponRuleTableMap::CONTROLLER)) $criteria->add(CouponRuleTableMap::CONTROLLER, $this->controller); - if ($this->isColumnModified(CouponRuleTableMap::OPERATION)) $criteria->add(CouponRuleTableMap::OPERATION, $this->operation); - if ($this->isColumnModified(CouponRuleTableMap::VALUE)) $criteria->add(CouponRuleTableMap::VALUE, $this->value); - if ($this->isColumnModified(CouponRuleTableMap::CREATED_AT)) $criteria->add(CouponRuleTableMap::CREATED_AT, $this->created_at); - if ($this->isColumnModified(CouponRuleTableMap::UPDATED_AT)) $criteria->add(CouponRuleTableMap::UPDATED_AT, $this->updated_at); + if ($this->isColumnModified(RewritingArgumentTableMap::REWRITING_URL_ID)) $criteria->add(RewritingArgumentTableMap::REWRITING_URL_ID, $this->rewriting_url_id); + if ($this->isColumnModified(RewritingArgumentTableMap::PARAMETER)) $criteria->add(RewritingArgumentTableMap::PARAMETER, $this->parameter); + if ($this->isColumnModified(RewritingArgumentTableMap::VALUE)) $criteria->add(RewritingArgumentTableMap::VALUE, $this->value); + if ($this->isColumnModified(RewritingArgumentTableMap::CREATED_AT)) $criteria->add(RewritingArgumentTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(RewritingArgumentTableMap::UPDATED_AT)) $criteria->add(RewritingArgumentTableMap::UPDATED_AT, $this->updated_at); return $criteria; } @@ -1219,30 +1096,40 @@ abstract class CouponRule implements ActiveRecordInterface */ public function buildPkeyCriteria() { - $criteria = new Criteria(CouponRuleTableMap::DATABASE_NAME); - $criteria->add(CouponRuleTableMap::ID, $this->id); + $criteria = new Criteria(RewritingArgumentTableMap::DATABASE_NAME); + $criteria->add(RewritingArgumentTableMap::REWRITING_URL_ID, $this->rewriting_url_id); + $criteria->add(RewritingArgumentTableMap::PARAMETER, $this->parameter); + $criteria->add(RewritingArgumentTableMap::VALUE, $this->value); return $criteria; } /** - * Returns the primary key for this object (row). - * @return int + * Returns the composite primary key for this object. + * The array elements will be in same order as specified in XML. + * @return array */ public function getPrimaryKey() { - return $this->getId(); + $pks = array(); + $pks[0] = $this->getRewritingUrlId(); + $pks[1] = $this->getParameter(); + $pks[2] = $this->getValue(); + + return $pks; } /** - * Generic method to set the primary key (id column). + * Set the [composite] primary key. * - * @param int $key Primary key. + * @param array $keys The elements of the composite key (order must match the order in XML file). * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey($keys) { - $this->setId($key); + $this->setRewritingUrlId($keys[0]); + $this->setParameter($keys[1]); + $this->setValue($keys[2]); } /** @@ -1252,7 +1139,7 @@ abstract class CouponRule implements ActiveRecordInterface public function isPrimaryKeyNull() { - return null === $this->getId(); + return (null === $this->getRewritingUrlId()) && (null === $this->getParameter()) && (null === $this->getValue()); } /** @@ -1261,22 +1148,20 @@ abstract class CouponRule implements ActiveRecordInterface * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \Thelia\Model\CouponRule (or compatible) type. + * @param object $copyObj An object of \Thelia\Model\RewritingArgument (or compatible) type. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setCouponId($this->getCouponId()); - $copyObj->setController($this->getController()); - $copyObj->setOperation($this->getOperation()); + $copyObj->setRewritingUrlId($this->getRewritingUrlId()); + $copyObj->setParameter($this->getParameter()); $copyObj->setValue($this->getValue()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($makeNew) { $copyObj->setNew(true); - $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } } @@ -1289,7 +1174,7 @@ abstract class CouponRule implements ActiveRecordInterface * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return \Thelia\Model\CouponRule Clone of current object. + * @return \Thelia\Model\RewritingArgument Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) @@ -1303,26 +1188,26 @@ abstract class CouponRule implements ActiveRecordInterface } /** - * Declares an association between this object and a ChildCoupon object. + * Declares an association between this object and a ChildRewritingUrl object. * - * @param ChildCoupon $v - * @return \Thelia\Model\CouponRule The current object (for fluent API support) + * @param ChildRewritingUrl $v + * @return \Thelia\Model\RewritingArgument The current object (for fluent API support) * @throws PropelException */ - public function setCoupon(ChildCoupon $v = null) + public function setRewritingUrl(ChildRewritingUrl $v = null) { if ($v === null) { - $this->setCouponId(NULL); + $this->setRewritingUrlId(NULL); } else { - $this->setCouponId($v->getId()); + $this->setRewritingUrlId($v->getId()); } - $this->aCoupon = $v; + $this->aRewritingUrl = $v; // Add binding for other direction of this n:n relationship. - // If this object has already been added to the ChildCoupon object, it will not be re-added. + // If this object has already been added to the ChildRewritingUrl object, it will not be re-added. if ($v !== null) { - $v->addCouponRule($this); + $v->addRewritingArgument($this); } @@ -1331,26 +1216,26 @@ abstract class CouponRule implements ActiveRecordInterface /** - * Get the associated ChildCoupon object + * Get the associated ChildRewritingUrl object * * @param ConnectionInterface $con Optional Connection object. - * @return ChildCoupon The associated ChildCoupon object. + * @return ChildRewritingUrl The associated ChildRewritingUrl object. * @throws PropelException */ - public function getCoupon(ConnectionInterface $con = null) + public function getRewritingUrl(ConnectionInterface $con = null) { - if ($this->aCoupon === null && ($this->coupon_id !== null)) { - $this->aCoupon = ChildCouponQuery::create()->findPk($this->coupon_id, $con); + if ($this->aRewritingUrl === null && ($this->rewriting_url_id !== null)) { + $this->aRewritingUrl = ChildRewritingUrlQuery::create()->findPk($this->rewriting_url_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. - $this->aCoupon->addCouponRules($this); + $this->aRewritingUrl->addRewritingArguments($this); */ } - return $this->aCoupon; + return $this->aRewritingUrl; } /** @@ -1358,10 +1243,8 @@ abstract class CouponRule implements ActiveRecordInterface */ public function clear() { - $this->id = null; - $this->coupon_id = null; - $this->controller = null; - $this->operation = null; + $this->rewriting_url_id = null; + $this->parameter = null; $this->value = null; $this->created_at = null; $this->updated_at = null; @@ -1386,7 +1269,7 @@ abstract class CouponRule implements ActiveRecordInterface if ($deep) { } // if ($deep) - $this->aCoupon = null; + $this->aRewritingUrl = null; } /** @@ -1396,7 +1279,7 @@ abstract class CouponRule implements ActiveRecordInterface */ public function __toString() { - return (string) $this->exportTo(CouponRuleTableMap::DEFAULT_STRING_FORMAT); + return (string) $this->exportTo(RewritingArgumentTableMap::DEFAULT_STRING_FORMAT); } // timestampable behavior @@ -1404,11 +1287,11 @@ abstract class CouponRule implements ActiveRecordInterface /** * Mark the current object so that the update date doesn't get updated during next save * - * @return ChildCouponRule The current object (for fluent API support) + * @return ChildRewritingArgument The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { - $this->modifiedColumns[] = CouponRuleTableMap::UPDATED_AT; + $this->modifiedColumns[] = RewritingArgumentTableMap::UPDATED_AT; return $this; } diff --git a/core/lib/Thelia/Model/Base/RewritingArgumentQuery.php b/core/lib/Thelia/Model/Base/RewritingArgumentQuery.php new file mode 100644 index 000000000..cd9ca4fd3 --- /dev/null +++ b/core/lib/Thelia/Model/Base/RewritingArgumentQuery.php @@ -0,0 +1,673 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + + return $query; + } + + /** + * Find object by primary key. + * Propel uses the instance pool to skip the database if the object exists. + * Go fast if the query is untouched. + * + * + * $obj = $c->findPk(array(12, 34, 56), $con); + * + * + * @param array[$rewriting_url_id, $parameter, $value] $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildRewritingArgument|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = RewritingArgumentTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1], (string) $key[2]))))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(RewritingArgumentTableMap::DATABASE_NAME); + } + $this->basePreSelect($con); + if ($this->formatter || $this->modelAlias || $this->with || $this->select + || $this->selectColumns || $this->asColumns || $this->selectModifiers + || $this->map || $this->having || $this->joins) { + return $this->findPkComplex($key, $con); + } else { + return $this->findPkSimple($key, $con); + } + } + + /** + * Find object by primary key using raw SQL to go fast. + * Bypass doSelect() and the object formatter by using generated code. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildRewritingArgument A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT REWRITING_URL_ID, PARAMETER, VALUE, CREATED_AT, UPDATED_AT FROM rewriting_argument WHERE REWRITING_URL_ID = :p0 AND PARAMETER = :p1 AND VALUE = :p2'; + try { + $stmt = $con->prepare($sql); + $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); + $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR); + $stmt->bindValue(':p2', $key[2], PDO::PARAM_STR); + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); + } + $obj = null; + if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { + $obj = new ChildRewritingArgument(); + $obj->hydrate($row); + RewritingArgumentTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1], (string) $key[2]))); + } + $stmt->closeCursor(); + + return $obj; + } + + /** + * Find object by primary key. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildRewritingArgument|array|mixed the result, formatted by the current formatter + */ + protected function findPkComplex($key, $con) + { + // As the query uses a PK condition, no limit(1) is necessary. + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKey($key) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); + * + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); + } + $this->basePreSelect($con); + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKeys($keys) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->format($dataFetcher); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + $this->addUsingAlias(RewritingArgumentTableMap::REWRITING_URL_ID, $key[0], Criteria::EQUAL); + $this->addUsingAlias(RewritingArgumentTableMap::PARAMETER, $key[1], Criteria::EQUAL); + $this->addUsingAlias(RewritingArgumentTableMap::VALUE, $key[2], Criteria::EQUAL); + + return $this; + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + if (empty($keys)) { + return $this->add(null, '1<>1', Criteria::CUSTOM); + } + foreach ($keys as $key) { + $cton0 = $this->getNewCriterion(RewritingArgumentTableMap::REWRITING_URL_ID, $key[0], Criteria::EQUAL); + $cton1 = $this->getNewCriterion(RewritingArgumentTableMap::PARAMETER, $key[1], Criteria::EQUAL); + $cton0->addAnd($cton1); + $cton2 = $this->getNewCriterion(RewritingArgumentTableMap::VALUE, $key[2], Criteria::EQUAL); + $cton0->addAnd($cton2); + $this->addOr($cton0); + } + + return $this; + } + + /** + * Filter the query on the rewriting_url_id column + * + * Example usage: + * + * $query->filterByRewritingUrlId(1234); // WHERE rewriting_url_id = 1234 + * $query->filterByRewritingUrlId(array(12, 34)); // WHERE rewriting_url_id IN (12, 34) + * $query->filterByRewritingUrlId(array('min' => 12)); // WHERE rewriting_url_id > 12 + * + * + * @see filterByRewritingUrl() + * + * @param mixed $rewritingUrlId The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function filterByRewritingUrlId($rewritingUrlId = null, $comparison = null) + { + if (is_array($rewritingUrlId)) { + $useMinMax = false; + if (isset($rewritingUrlId['min'])) { + $this->addUsingAlias(RewritingArgumentTableMap::REWRITING_URL_ID, $rewritingUrlId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($rewritingUrlId['max'])) { + $this->addUsingAlias(RewritingArgumentTableMap::REWRITING_URL_ID, $rewritingUrlId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(RewritingArgumentTableMap::REWRITING_URL_ID, $rewritingUrlId, $comparison); + } + + /** + * Filter the query on the parameter column + * + * Example usage: + * + * $query->filterByParameter('fooValue'); // WHERE parameter = 'fooValue' + * $query->filterByParameter('%fooValue%'); // WHERE parameter LIKE '%fooValue%' + * + * + * @param string $parameter The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function filterByParameter($parameter = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($parameter)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $parameter)) { + $parameter = str_replace('*', '%', $parameter); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(RewritingArgumentTableMap::PARAMETER, $parameter, $comparison); + } + + /** + * Filter the query on the value column + * + * Example usage: + * + * $query->filterByValue('fooValue'); // WHERE value = 'fooValue' + * $query->filterByValue('%fooValue%'); // WHERE value LIKE '%fooValue%' + * + * + * @param string $value The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function filterByValue($value = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($value)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $value)) { + $value = str_replace('*', '%', $value); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(RewritingArgumentTableMap::VALUE, $value, $comparison); + } + + /** + * Filter the query on the created_at column + * + * Example usage: + * + * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' + * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' + * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' + * + * + * @param mixed $createdAt The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function filterByCreatedAt($createdAt = null, $comparison = null) + { + if (is_array($createdAt)) { + $useMinMax = false; + if (isset($createdAt['min'])) { + $this->addUsingAlias(RewritingArgumentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($createdAt['max'])) { + $this->addUsingAlias(RewritingArgumentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(RewritingArgumentTableMap::CREATED_AT, $createdAt, $comparison); + } + + /** + * Filter the query on the updated_at column + * + * Example usage: + * + * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' + * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' + * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' + * + * + * @param mixed $updatedAt The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function filterByUpdatedAt($updatedAt = null, $comparison = null) + { + if (is_array($updatedAt)) { + $useMinMax = false; + if (isset($updatedAt['min'])) { + $this->addUsingAlias(RewritingArgumentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($updatedAt['max'])) { + $this->addUsingAlias(RewritingArgumentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(RewritingArgumentTableMap::UPDATED_AT, $updatedAt, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\RewritingUrl object + * + * @param \Thelia\Model\RewritingUrl|ObjectCollection $rewritingUrl The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function filterByRewritingUrl($rewritingUrl, $comparison = null) + { + if ($rewritingUrl instanceof \Thelia\Model\RewritingUrl) { + return $this + ->addUsingAlias(RewritingArgumentTableMap::REWRITING_URL_ID, $rewritingUrl->getId(), $comparison); + } elseif ($rewritingUrl instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(RewritingArgumentTableMap::REWRITING_URL_ID, $rewritingUrl->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByRewritingUrl() only accepts arguments of type \Thelia\Model\RewritingUrl or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the RewritingUrl relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function joinRewritingUrl($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('RewritingUrl'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'RewritingUrl'); + } + + return $this; + } + + /** + * Use the RewritingUrl relation RewritingUrl object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\RewritingUrlQuery A secondary query class using the current class as primary query + */ + public function useRewritingUrlQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinRewritingUrl($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'RewritingUrl', '\Thelia\Model\RewritingUrlQuery'); + } + + /** + * Exclude object from result + * + * @param ChildRewritingArgument $rewritingArgument Object to remove from the list of results + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function prune($rewritingArgument = null) + { + if ($rewritingArgument) { + $this->addCond('pruneCond0', $this->getAliasedColName(RewritingArgumentTableMap::REWRITING_URL_ID), $rewritingArgument->getRewritingUrlId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond1', $this->getAliasedColName(RewritingArgumentTableMap::PARAMETER), $rewritingArgument->getParameter(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond2', $this->getAliasedColName(RewritingArgumentTableMap::VALUE), $rewritingArgument->getValue(), Criteria::NOT_EQUAL); + $this->combine(array('pruneCond0', 'pruneCond1', 'pruneCond2'), Criteria::LOGICAL_OR); + } + + return $this; + } + + /** + * Deletes all rows from the rewriting_argument table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public function doDeleteAll(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(RewritingArgumentTableMap::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += parent::doDeleteAll($con); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + RewritingArgumentTableMap::clearInstancePool(); + RewritingArgumentTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildRewritingArgument or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildRewritingArgument object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public function delete(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(RewritingArgumentTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(RewritingArgumentTableMap::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + + RewritingArgumentTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + RewritingArgumentTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + // timestampable behavior + + /** + * Filter by the latest updated + * + * @param int $nbDays Maximum age of the latest update in days + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function recentlyUpdated($nbDays = 7) + { + return $this->addUsingAlias(RewritingArgumentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Filter by the latest created + * + * @param int $nbDays Maximum age of in days + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function recentlyCreated($nbDays = 7) + { + return $this->addUsingAlias(RewritingArgumentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Order by update date desc + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function lastUpdatedFirst() + { + return $this->addDescendingOrderByColumn(RewritingArgumentTableMap::UPDATED_AT); + } + + /** + * Order by update date asc + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function firstUpdatedFirst() + { + return $this->addAscendingOrderByColumn(RewritingArgumentTableMap::UPDATED_AT); + } + + /** + * Order by create date desc + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function lastCreatedFirst() + { + return $this->addDescendingOrderByColumn(RewritingArgumentTableMap::CREATED_AT); + } + + /** + * Order by create date asc + * + * @return ChildRewritingArgumentQuery The current query, for fluid interface + */ + public function firstCreatedFirst() + { + return $this->addAscendingOrderByColumn(RewritingArgumentTableMap::CREATED_AT); + } + +} // RewritingArgumentQuery diff --git a/core/lib/Thelia/Model/Base/RewritingQuery.php b/core/lib/Thelia/Model/Base/RewritingQuery.php deleted file mode 100644 index bf814cfd2..000000000 --- a/core/lib/Thelia/Model/Base/RewritingQuery.php +++ /dev/null @@ -1,1044 +0,0 @@ -setModelAlias($modelAlias); - } - if ($criteria instanceof Criteria) { - $query->mergeWith($criteria); - } - - return $query; - } - - /** - * Find object by primary key. - * Propel uses the instance pool to skip the database if the object exists. - * Go fast if the query is untouched. - * - * - * $obj = $c->findPk(12, $con); - * - * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con an optional connection object - * - * @return ChildRewriting|array|mixed the result, formatted by the current formatter - */ - public function findPk($key, $con = null) - { - if ($key === null) { - return null; - } - if ((null !== ($obj = RewritingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { - // the object is already in the instance pool - return $obj; - } - if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(RewritingTableMap::DATABASE_NAME); - } - $this->basePreSelect($con); - if ($this->formatter || $this->modelAlias || $this->with || $this->select - || $this->selectColumns || $this->asColumns || $this->selectModifiers - || $this->map || $this->having || $this->joins) { - return $this->findPkComplex($key, $con); - } else { - return $this->findPkSimple($key, $con); - } - } - - /** - * Find object by primary key using raw SQL to go fast. - * Bypass doSelect() and the object formatter by using generated code. - * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object - * - * @return ChildRewriting A model object, or null if the key is not found - */ - protected function findPkSimple($key, $con) - { - $sql = 'SELECT ID, URL, PRODUCT_ID, CATEGORY_ID, FOLDER_ID, CONTENT_ID, CREATED_AT, UPDATED_AT FROM rewriting WHERE ID = :p0'; - try { - $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); - $stmt->execute(); - } catch (Exception $e) { - Propel::log($e->getMessage(), Propel::LOG_ERR); - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); - } - $obj = null; - if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new ChildRewriting(); - $obj->hydrate($row); - RewritingTableMap::addInstanceToPool($obj, (string) $key); - } - $stmt->closeCursor(); - - return $obj; - } - - /** - * Find object by primary key. - * - * @param mixed $key Primary key to use for the query - * @param ConnectionInterface $con A connection object - * - * @return ChildRewriting|array|mixed the result, formatted by the current formatter - */ - protected function findPkComplex($key, $con) - { - // As the query uses a PK condition, no limit(1) is necessary. - $criteria = $this->isKeepQuery() ? clone $this : $this; - $dataFetcher = $criteria - ->filterByPrimaryKey($key) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); - } - - /** - * Find objects by primary key - * - * $objs = $c->findPks(array(12, 56, 832), $con); - * - * @param array $keys Primary keys to use for the query - * @param ConnectionInterface $con an optional connection object - * - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter - */ - public function findPks($keys, $con = null) - { - if (null === $con) { - $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); - } - $this->basePreSelect($con); - $criteria = $this->isKeepQuery() ? clone $this : $this; - $dataFetcher = $criteria - ->filterByPrimaryKeys($keys) - ->doSelect($con); - - return $criteria->getFormatter()->init($criteria)->format($dataFetcher); - } - - /** - * Filter the query by primary key - * - * @param mixed $key Primary key to use for the query - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByPrimaryKey($key) - { - - return $this->addUsingAlias(RewritingTableMap::ID, $key, Criteria::EQUAL); - } - - /** - * Filter the query by a list of primary keys - * - * @param array $keys The list of primary key to use for the query - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByPrimaryKeys($keys) - { - - return $this->addUsingAlias(RewritingTableMap::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id)) { - $useMinMax = false; - if (isset($id['min'])) { - $this->addUsingAlias(RewritingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($id['max'])) { - $this->addUsingAlias(RewritingTableMap::ID, $id['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(RewritingTableMap::ID, $id, $comparison); - } - - /** - * Filter the query on the url column - * - * Example usage: - * - * $query->filterByUrl('fooValue'); // WHERE url = 'fooValue' - * $query->filterByUrl('%fooValue%'); // WHERE url LIKE '%fooValue%' - * - * - * @param string $url The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByUrl($url = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($url)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $url)) { - $url = str_replace('*', '%', $url); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(RewritingTableMap::URL, $url, $comparison); - } - - /** - * Filter the query on the product_id column - * - * Example usage: - * - * $query->filterByProductId(1234); // WHERE product_id = 1234 - * $query->filterByProductId(array(12, 34)); // WHERE product_id IN (12, 34) - * $query->filterByProductId(array('min' => 12)); // WHERE product_id > 12 - * - * - * @see filterByProduct() - * - * @param mixed $productId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByProductId($productId = null, $comparison = null) - { - if (is_array($productId)) { - $useMinMax = false; - if (isset($productId['min'])) { - $this->addUsingAlias(RewritingTableMap::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($productId['max'])) { - $this->addUsingAlias(RewritingTableMap::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(RewritingTableMap::PRODUCT_ID, $productId, $comparison); - } - - /** - * Filter the query on the category_id column - * - * Example usage: - * - * $query->filterByCategoryId(1234); // WHERE category_id = 1234 - * $query->filterByCategoryId(array(12, 34)); // WHERE category_id IN (12, 34) - * $query->filterByCategoryId(array('min' => 12)); // WHERE category_id > 12 - * - * - * @see filterByCategory() - * - * @param mixed $categoryId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByCategoryId($categoryId = null, $comparison = null) - { - if (is_array($categoryId)) { - $useMinMax = false; - if (isset($categoryId['min'])) { - $this->addUsingAlias(RewritingTableMap::CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($categoryId['max'])) { - $this->addUsingAlias(RewritingTableMap::CATEGORY_ID, $categoryId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(RewritingTableMap::CATEGORY_ID, $categoryId, $comparison); - } - - /** - * Filter the query on the folder_id column - * - * Example usage: - * - * $query->filterByFolderId(1234); // WHERE folder_id = 1234 - * $query->filterByFolderId(array(12, 34)); // WHERE folder_id IN (12, 34) - * $query->filterByFolderId(array('min' => 12)); // WHERE folder_id > 12 - * - * - * @see filterByFolder() - * - * @param mixed $folderId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByFolderId($folderId = null, $comparison = null) - { - if (is_array($folderId)) { - $useMinMax = false; - if (isset($folderId['min'])) { - $this->addUsingAlias(RewritingTableMap::FOLDER_ID, $folderId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($folderId['max'])) { - $this->addUsingAlias(RewritingTableMap::FOLDER_ID, $folderId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(RewritingTableMap::FOLDER_ID, $folderId, $comparison); - } - - /** - * Filter the query on the content_id column - * - * Example usage: - * - * $query->filterByContentId(1234); // WHERE content_id = 1234 - * $query->filterByContentId(array(12, 34)); // WHERE content_id IN (12, 34) - * $query->filterByContentId(array('min' => 12)); // WHERE content_id > 12 - * - * - * @see filterByContent() - * - * @param mixed $contentId The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByContentId($contentId = null, $comparison = null) - { - if (is_array($contentId)) { - $useMinMax = false; - if (isset($contentId['min'])) { - $this->addUsingAlias(RewritingTableMap::CONTENT_ID, $contentId['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($contentId['max'])) { - $this->addUsingAlias(RewritingTableMap::CONTENT_ID, $contentId['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(RewritingTableMap::CONTENT_ID, $contentId, $comparison); - } - - /** - * Filter the query on the created_at column - * - * Example usage: - * - * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' - * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' - * - * - * @param mixed $createdAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByCreatedAt($createdAt = null, $comparison = null) - { - if (is_array($createdAt)) { - $useMinMax = false; - if (isset($createdAt['min'])) { - $this->addUsingAlias(RewritingTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($createdAt['max'])) { - $this->addUsingAlias(RewritingTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(RewritingTableMap::CREATED_AT, $createdAt, $comparison); - } - - /** - * Filter the query on the updated_at column - * - * Example usage: - * - * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' - * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' - * - * - * @param mixed $updatedAt The value to use as filter. - * Values can be integers (unix timestamps), DateTime objects, or strings. - * Empty strings are treated as NULL. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByUpdatedAt($updatedAt = null, $comparison = null) - { - if (is_array($updatedAt)) { - $useMinMax = false; - if (isset($updatedAt['min'])) { - $this->addUsingAlias(RewritingTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($updatedAt['max'])) { - $this->addUsingAlias(RewritingTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } - } - - return $this->addUsingAlias(RewritingTableMap::UPDATED_AT, $updatedAt, $comparison); - } - - /** - * Filter the query by a related \Thelia\Model\Product object - * - * @param \Thelia\Model\Product|ObjectCollection $product The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByProduct($product, $comparison = null) - { - if ($product instanceof \Thelia\Model\Product) { - return $this - ->addUsingAlias(RewritingTableMap::PRODUCT_ID, $product->getId(), $comparison); - } elseif ($product instanceof ObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(RewritingTableMap::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Product relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function joinProduct($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Product'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Product'); - } - - return $this; - } - - /** - * Use the Product relation Product object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query - */ - public function useProductQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinProduct($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery'); - } - - /** - * Filter the query by a related \Thelia\Model\Category object - * - * @param \Thelia\Model\Category|ObjectCollection $category The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByCategory($category, $comparison = null) - { - if ($category instanceof \Thelia\Model\Category) { - return $this - ->addUsingAlias(RewritingTableMap::CATEGORY_ID, $category->getId(), $comparison); - } elseif ($category instanceof ObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(RewritingTableMap::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByCategory() only accepts arguments of type \Thelia\Model\Category or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Category relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function joinCategory($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Category'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Category'); - } - - return $this; - } - - /** - * Use the Category relation Category object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query - */ - public function useCategoryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinCategory($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery'); - } - - /** - * Filter the query by a related \Thelia\Model\Folder object - * - * @param \Thelia\Model\Folder|ObjectCollection $folder The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByFolder($folder, $comparison = null) - { - if ($folder instanceof \Thelia\Model\Folder) { - return $this - ->addUsingAlias(RewritingTableMap::FOLDER_ID, $folder->getId(), $comparison); - } elseif ($folder instanceof ObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(RewritingTableMap::FOLDER_ID, $folder->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByFolder() only accepts arguments of type \Thelia\Model\Folder or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Folder relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function joinFolder($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Folder'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Folder'); - } - - return $this; - } - - /** - * Use the Folder relation Folder object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\FolderQuery A secondary query class using the current class as primary query - */ - public function useFolderQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinFolder($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Folder', '\Thelia\Model\FolderQuery'); - } - - /** - * Filter the query by a related \Thelia\Model\Content object - * - * @param \Thelia\Model\Content|ObjectCollection $content The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function filterByContent($content, $comparison = null) - { - if ($content instanceof \Thelia\Model\Content) { - return $this - ->addUsingAlias(RewritingTableMap::CONTENT_ID, $content->getId(), $comparison); - } elseif ($content instanceof ObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(RewritingTableMap::CONTENT_ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison); - } else { - throw new PropelException('filterByContent() only accepts arguments of type \Thelia\Model\Content or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Content relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function joinContent($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Content'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Content'); - } - - return $this; - } - - /** - * Use the Content relation Content object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query - */ - public function useContentQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) - { - return $this - ->joinContent($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery'); - } - - /** - * Exclude object from result - * - * @param ChildRewriting $rewriting Object to remove from the list of results - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function prune($rewriting = null) - { - if ($rewriting) { - $this->addUsingAlias(RewritingTableMap::ID, $rewriting->getId(), Criteria::NOT_EQUAL); - } - - return $this; - } - - /** - * Deletes all rows from the rewriting table. - * - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). - */ - public function doDeleteAll(ConnectionInterface $con = null) - { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(RewritingTableMap::DATABASE_NAME); - } - $affectedRows = 0; // initialize var to track total num of affected rows - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - $affectedRows += parent::doDeleteAll($con); - // Because this db requires some delete cascade/set null emulation, we have to - // clear the cached instance *after* the emulation has happened (since - // instances get re-added by the select statement contained therein). - RewritingTableMap::clearInstancePool(); - RewritingTableMap::clearRelatedInstancePool(); - - $con->commit(); - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - - return $affectedRows; - } - - /** - * Performs a DELETE on the database, given a ChildRewriting or Criteria object OR a primary key value. - * - * @param mixed $values Criteria or ChildRewriting object or primary key or array of primary keys - * which is used to create the DELETE statement - * @param ConnectionInterface $con the connection to use - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows - * if supported by native driver or if emulated using Propel. - * @throws PropelException Any exceptions caught during processing will be - * rethrown wrapped into a PropelException. - */ - public function delete(ConnectionInterface $con = null) - { - if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(RewritingTableMap::DATABASE_NAME); - } - - $criteria = $this; - - // Set the correct dbName - $criteria->setDbName(RewritingTableMap::DATABASE_NAME); - - $affectedRows = 0; // initialize var to track total num of affected rows - - try { - // use transaction because $criteria could contain info - // for more than one table or we could emulating ON DELETE CASCADE, etc. - $con->beginTransaction(); - - - RewritingTableMap::removeInstanceFromPool($criteria); - - $affectedRows += ModelCriteria::delete($con); - RewritingTableMap::clearRelatedInstancePool(); - $con->commit(); - - return $affectedRows; - } catch (PropelException $e) { - $con->rollBack(); - throw $e; - } - } - - // timestampable behavior - - /** - * Filter by the latest updated - * - * @param int $nbDays Maximum age of the latest update in days - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function recentlyUpdated($nbDays = 7) - { - return $this->addUsingAlias(RewritingTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Filter by the latest created - * - * @param int $nbDays Maximum age of in days - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function recentlyCreated($nbDays = 7) - { - return $this->addUsingAlias(RewritingTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); - } - - /** - * Order by update date desc - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function lastUpdatedFirst() - { - return $this->addDescendingOrderByColumn(RewritingTableMap::UPDATED_AT); - } - - /** - * Order by update date asc - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function firstUpdatedFirst() - { - return $this->addAscendingOrderByColumn(RewritingTableMap::UPDATED_AT); - } - - /** - * Order by create date desc - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function lastCreatedFirst() - { - return $this->addDescendingOrderByColumn(RewritingTableMap::CREATED_AT); - } - - /** - * Order by create date asc - * - * @return ChildRewritingQuery The current query, for fluid interface - */ - public function firstCreatedFirst() - { - return $this->addAscendingOrderByColumn(RewritingTableMap::CREATED_AT); - } - -} // RewritingQuery diff --git a/core/lib/Thelia/Model/Base/RewritingUrl.php b/core/lib/Thelia/Model/Base/RewritingUrl.php new file mode 100644 index 000000000..75ee97e79 --- /dev/null +++ b/core/lib/Thelia/Model/Base/RewritingUrl.php @@ -0,0 +1,2158 @@ +modifiedColumns); + } + + /** + * Has specified column been modified? + * + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return boolean True if $col has been modified. + */ + public function isColumnModified($col) + { + return in_array($col, $this->modifiedColumns); + } + + /** + * Get the columns that have been modified in this object. + * @return array A unique list of the modified column names for this object. + */ + public function getModifiedColumns() + { + return array_unique($this->modifiedColumns); + } + + /** + * Returns whether the object has ever been saved. This will + * be false, if the object was retrieved from storage or was created + * and then saved. + * + * @return true, if the object has never been persisted. + */ + public function isNew() + { + return $this->new; + } + + /** + * Setter for the isNew attribute. This method will be called + * by Propel-generated children and objects. + * + * @param boolean $b the state of the object. + */ + public function setNew($b) + { + $this->new = (Boolean) $b; + } + + /** + * Whether this object has been deleted. + * @return boolean The deleted state of this object. + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Specify whether this object has been deleted. + * @param boolean $b The deleted state of this object. + * @return void + */ + public function setDeleted($b) + { + $this->deleted = (Boolean) $b; + } + + /** + * Sets the modified state for the object to be false. + * @param string $col If supplied, only the specified column is reset. + * @return void + */ + public function resetModified($col = null) + { + if (null !== $col) { + while (false !== ($offset = array_search($col, $this->modifiedColumns))) { + array_splice($this->modifiedColumns, $offset, 1); + } + } else { + $this->modifiedColumns = array(); + } + } + + /** + * Compares this with another RewritingUrl instance. If + * 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. + */ + public function equals($obj) + { + $thisclazz = get_class($this); + if (!is_object($obj) || !($obj instanceof $thisclazz)) { + return false; + } + + if ($this === $obj) { + return true; + } + + if (null === $this->getPrimaryKey() + || null === $obj->getPrimaryKey()) { + return false; + } + + return $this->getPrimaryKey() === $obj->getPrimaryKey(); + } + + /** + * If the primary key is not null, return the hashcode of the + * primary key. Otherwise, return the hash code of the object. + * + * @return int Hashcode + */ + public function hashCode() + { + if (null !== $this->getPrimaryKey()) { + return crc32(serialize($this->getPrimaryKey())); + } + + return crc32(serialize(clone $this)); + } + + /** + * Get the associative array of the virtual columns in this object + * + * @param string $name The virtual column name + * + * @return array + */ + public function getVirtualColumns() + { + return $this->virtualColumns; + } + + /** + * Checks the existence of a virtual column in this object + * + * @return boolean + */ + public function hasVirtualColumn($name) + { + return array_key_exists($name, $this->virtualColumns); + } + + /** + * Get the value of a virtual column in this object + * + * @return mixed + */ + public function getVirtualColumn($name) + { + if (!$this->hasVirtualColumn($name)) { + throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + } + + return $this->virtualColumns[$name]; + } + + /** + * Set the value of a virtual column in this object + * + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column + * + * @return RewritingUrl The current object, for fluid interface + */ + public function setVirtualColumn($name, $value) + { + $this->virtualColumns[$name] = $value; + + return $this; + } + + /** + * Logs a message using Propel::log(). + * + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return boolean + */ + protected function log($msg, $priority = Propel::LOG_INFO) + { + return Propel::log(get_class($this) . ': ' . $msg, $priority); + } + + /** + * Populate the current object from a string, using a given parser format + * + * $book = new Book(); + * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, + * or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param string $data The source data to import from + * + * @return RewritingUrl The current object, for fluid interface + */ + public function importFrom($parser, $data) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + } + + /** + * Export the current object properties to a string, using a given parser format + * + * $book = BookQuery::create()->findPk(9012); + * echo $book->exportTo('JSON'); + * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @return string The exported data + */ + public function exportTo($parser, $includeLazyLoadColumns = true) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + } + + /** + * Clean up internal collections prior to serializing + * Avoids recursive loops that turn into segmentation faults when serializing + */ + public function __sleep() + { + $this->clearAllReferences(); + + return array_keys(get_object_vars($this)); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + + return $this->id; + } + + /** + * Get the [url] column value. + * + * @return string + */ + public function getUrl() + { + + return $this->url; + } + + /** + * Get the [view] column value. + * + * @return string + */ + public function getView() + { + + return $this->view; + } + + /** + * Get the [view_id] column value. + * + * @return string + */ + public function getViewId() + { + + return $this->view_id; + } + + /** + * Get the [view_locale] column value. + * + * @return string + */ + public function getViewLocale() + { + + return $this->view_locale; + } + + /** + * Get the [redirected] column value. + * + * @return int + */ + public function getRedirected() + { + + return $this->redirected; + } + + /** + * Get the [optionally formatted] temporal [created_at] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw \DateTime object will be returned. + * + * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getCreatedAt($format = NULL) + { + if ($format === null) { + return $this->created_at; + } else { + return $this->created_at !== null ? $this->created_at->format($format) : null; + } + } + + /** + * Get the [optionally formatted] temporal [updated_at] column value. + * + * + * @param string $format The date/time format string (either date()-style or strftime()-style). + * If format is NULL, then the raw \DateTime object will be returned. + * + * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00 + * + * @throws PropelException - if unable to parse/validate the date/time value. + */ + public function getUpdatedAt($format = NULL) + { + if ($format === null) { + return $this->updated_at; + } else { + return $this->updated_at !== null ? $this->updated_at->format($format) : null; + } + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = RewritingUrlTableMap::ID; + } + + + return $this; + } // setId() + + /** + * Set the value of [url] column. + * + * @param string $v new value + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + */ + public function setUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->url !== $v) { + $this->url = $v; + $this->modifiedColumns[] = RewritingUrlTableMap::URL; + } + + + return $this; + } // setUrl() + + /** + * Set the value of [view] column. + * + * @param string $v new value + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + */ + public function setView($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->view !== $v) { + $this->view = $v; + $this->modifiedColumns[] = RewritingUrlTableMap::VIEW; + } + + + return $this; + } // setView() + + /** + * Set the value of [view_id] column. + * + * @param string $v new value + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + */ + public function setViewId($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->view_id !== $v) { + $this->view_id = $v; + $this->modifiedColumns[] = RewritingUrlTableMap::VIEW_ID; + } + + + return $this; + } // setViewId() + + /** + * Set the value of [view_locale] column. + * + * @param string $v new value + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + */ + public function setViewLocale($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->view_locale !== $v) { + $this->view_locale = $v; + $this->modifiedColumns[] = RewritingUrlTableMap::VIEW_LOCALE; + } + + + return $this; + } // setViewLocale() + + /** + * Set the value of [redirected] column. + * + * @param int $v new value + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + */ + public function setRedirected($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->redirected !== $v) { + $this->redirected = $v; + $this->modifiedColumns[] = RewritingUrlTableMap::REDIRECTED; + } + + if ($this->aRewritingUrlRelatedByRedirected !== null && $this->aRewritingUrlRelatedByRedirected->getId() !== $v) { + $this->aRewritingUrlRelatedByRedirected = null; + } + + + return $this; + } // setRedirected() + + /** + * Sets the value of [created_at] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or \DateTime value. + * Empty strings are treated as NULL. + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + */ + public function setCreatedAt($v) + { + $dt = PropelDateTime::newInstance($v, null, '\DateTime'); + if ($this->created_at !== null || $dt !== null) { + if ($dt !== $this->created_at) { + $this->created_at = $dt; + $this->modifiedColumns[] = RewritingUrlTableMap::CREATED_AT; + } + } // if either are not null + + + return $this; + } // setCreatedAt() + + /** + * Sets the value of [updated_at] column to a normalized version of the date/time value specified. + * + * @param mixed $v string, integer (timestamp), or \DateTime value. + * Empty strings are treated as NULL. + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + */ + public function setUpdatedAt($v) + { + $dt = PropelDateTime::newInstance($v, null, '\DateTime'); + if ($this->updated_at !== null || $dt !== null) { + if ($dt !== $this->updated_at) { + $this->updated_at = $dt; + $this->modifiedColumns[] = RewritingUrlTableMap::UPDATED_AT; + } + } // if either are not null + + + return $this; + } // setUpdatedAt() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + { + try { + + + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : RewritingUrlTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : RewritingUrlTableMap::translateFieldName('Url', TableMap::TYPE_PHPNAME, $indexType)]; + $this->url = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : RewritingUrlTableMap::translateFieldName('View', TableMap::TYPE_PHPNAME, $indexType)]; + $this->view = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : RewritingUrlTableMap::translateFieldName('ViewId', TableMap::TYPE_PHPNAME, $indexType)]; + $this->view_id = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : RewritingUrlTableMap::translateFieldName('ViewLocale', TableMap::TYPE_PHPNAME, $indexType)]; + $this->view_locale = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : RewritingUrlTableMap::translateFieldName('Redirected', TableMap::TYPE_PHPNAME, $indexType)]; + $this->redirected = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : RewritingUrlTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + if ($col === '0000-00-00 00:00:00') { + $col = null; + } + $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : RewritingUrlTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + if ($col === '0000-00-00 00:00:00') { + $col = null; + } + $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 8; // 8 = RewritingUrlTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \Thelia\Model\RewritingUrl object", 0, $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + if ($this->aRewritingUrlRelatedByRedirected !== null && $this->redirected !== $this->aRewritingUrlRelatedByRedirected->getId()) { + $this->aRewritingUrlRelatedByRedirected = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(RewritingUrlTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildRewritingUrlQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $row = $dataFetcher->fetch(); + $dataFetcher->close(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aRewritingUrlRelatedByRedirected = null; + $this->collRewritingUrlsRelatedById = null; + + $this->collRewritingArguments = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see RewritingUrl::setDeleted() + * @see RewritingUrl::isDeleted() + */ + public function delete(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(RewritingUrlTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildRewritingUrlQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(RewritingUrlTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + // timestampable behavior + if (!$this->isColumnModified(RewritingUrlTableMap::CREATED_AT)) { + $this->setCreatedAt(time()); + } + if (!$this->isColumnModified(RewritingUrlTableMap::UPDATED_AT)) { + $this->setUpdatedAt(time()); + } + } else { + $ret = $ret && $this->preUpdate($con); + // timestampable behavior + if ($this->isModified() && !$this->isColumnModified(RewritingUrlTableMap::UPDATED_AT)) { + $this->setUpdatedAt(time()); + } + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + RewritingUrlTableMap::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(ConnectionInterface $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aRewritingUrlRelatedByRedirected !== null) { + if ($this->aRewritingUrlRelatedByRedirected->isModified() || $this->aRewritingUrlRelatedByRedirected->isNew()) { + $affectedRows += $this->aRewritingUrlRelatedByRedirected->save($con); + } + $this->setRewritingUrlRelatedByRedirected($this->aRewritingUrlRelatedByRedirected); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + if ($this->rewritingUrlsRelatedByIdScheduledForDeletion !== null) { + if (!$this->rewritingUrlsRelatedByIdScheduledForDeletion->isEmpty()) { + foreach ($this->rewritingUrlsRelatedByIdScheduledForDeletion as $rewritingUrlRelatedById) { + // need to save related object because we set the relation to null + $rewritingUrlRelatedById->save($con); + } + $this->rewritingUrlsRelatedByIdScheduledForDeletion = null; + } + } + + if ($this->collRewritingUrlsRelatedById !== null) { + foreach ($this->collRewritingUrlsRelatedById as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->rewritingArgumentsScheduledForDeletion !== null) { + if (!$this->rewritingArgumentsScheduledForDeletion->isEmpty()) { + \Thelia\Model\RewritingArgumentQuery::create() + ->filterByPrimaryKeys($this->rewritingArgumentsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->rewritingArgumentsScheduledForDeletion = null; + } + } + + if ($this->collRewritingArguments !== null) { + foreach ($this->collRewritingArguments as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param ConnectionInterface $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(ConnectionInterface $con) + { + $modifiedColumns = array(); + $index = 0; + + $this->modifiedColumns[] = RewritingUrlTableMap::ID; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . RewritingUrlTableMap::ID . ')'); + } + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(RewritingUrlTableMap::ID)) { + $modifiedColumns[':p' . $index++] = 'ID'; + } + if ($this->isColumnModified(RewritingUrlTableMap::URL)) { + $modifiedColumns[':p' . $index++] = 'URL'; + } + if ($this->isColumnModified(RewritingUrlTableMap::VIEW)) { + $modifiedColumns[':p' . $index++] = 'VIEW'; + } + if ($this->isColumnModified(RewritingUrlTableMap::VIEW_ID)) { + $modifiedColumns[':p' . $index++] = 'VIEW_ID'; + } + if ($this->isColumnModified(RewritingUrlTableMap::VIEW_LOCALE)) { + $modifiedColumns[':p' . $index++] = 'VIEW_LOCALE'; + } + if ($this->isColumnModified(RewritingUrlTableMap::REDIRECTED)) { + $modifiedColumns[':p' . $index++] = 'REDIRECTED'; + } + if ($this->isColumnModified(RewritingUrlTableMap::CREATED_AT)) { + $modifiedColumns[':p' . $index++] = 'CREATED_AT'; + } + if ($this->isColumnModified(RewritingUrlTableMap::UPDATED_AT)) { + $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; + } + + $sql = sprintf( + 'INSERT INTO rewriting_url (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case 'ID': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; + case 'URL': + $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); + break; + case 'VIEW': + $stmt->bindValue($identifier, $this->view, PDO::PARAM_STR); + break; + case 'VIEW_ID': + $stmt->bindValue($identifier, $this->view_id, PDO::PARAM_STR); + break; + case 'VIEW_LOCALE': + $stmt->bindValue($identifier, $this->view_locale, PDO::PARAM_STR); + break; + case 'REDIRECTED': + $stmt->bindValue($identifier, $this->redirected, PDO::PARAM_INT); + break; + case 'CREATED_AT': + $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); + break; + case 'UPDATED_AT': + $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + 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); + } + + /** + * Update the row in the database. + * + * @param ConnectionInterface $con + * + * @return Integer Number of updated rows + * @see doSave() + */ + protected function doUpdate(ConnectionInterface $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + + return $selectCriteria->doUpdate($valuesCriteria, $con); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return mixed Value of field. + */ + public function getByName($name, $type = TableMap::TYPE_PHPNAME) + { + $pos = RewritingUrlTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getUrl(); + break; + case 2: + return $this->getView(); + break; + case 3: + return $this->getViewId(); + break; + case 4: + return $this->getViewLocale(); + break; + case 5: + return $this->getRedirected(); + break; + case 6: + return $this->getCreatedAt(); + break; + case 7: + return $this->getUpdatedAt(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + if (isset($alreadyDumpedObjects['RewritingUrl'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['RewritingUrl'][$this->getPrimaryKey()] = true; + $keys = RewritingUrlTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getUrl(), + $keys[2] => $this->getView(), + $keys[3] => $this->getViewId(), + $keys[4] => $this->getViewLocale(), + $keys[5] => $this->getRedirected(), + $keys[6] => $this->getCreatedAt(), + $keys[7] => $this->getUpdatedAt(), + ); + $virtualColumns = $this->virtualColumns; + foreach($virtualColumns as $key => $virtualColumn) + { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aRewritingUrlRelatedByRedirected) { + $result['RewritingUrlRelatedByRedirected'] = $this->aRewritingUrlRelatedByRedirected->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + if (null !== $this->collRewritingUrlsRelatedById) { + $result['RewritingUrlsRelatedById'] = $this->collRewritingUrlsRelatedById->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } + if (null !== $this->collRewritingArguments) { + $result['RewritingArguments'] = $this->collRewritingArguments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } + } + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return void + */ + public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + { + $pos = RewritingUrlTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setUrl($value); + break; + case 2: + $this->setView($value); + break; + case 3: + $this->setViewId($value); + break; + case 4: + $this->setViewLocale($value); + break; + case 5: + $this->setRedirected($value); + break; + case 6: + $this->setCreatedAt($value); + break; + case 7: + $this->setUpdatedAt($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * The default key type is the column's TableMap::TYPE_PHPNAME. + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + { + $keys = RewritingUrlTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setUrl($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setView($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setViewId($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setViewLocale($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setRedirected($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(RewritingUrlTableMap::DATABASE_NAME); + + if ($this->isColumnModified(RewritingUrlTableMap::ID)) $criteria->add(RewritingUrlTableMap::ID, $this->id); + if ($this->isColumnModified(RewritingUrlTableMap::URL)) $criteria->add(RewritingUrlTableMap::URL, $this->url); + if ($this->isColumnModified(RewritingUrlTableMap::VIEW)) $criteria->add(RewritingUrlTableMap::VIEW, $this->view); + if ($this->isColumnModified(RewritingUrlTableMap::VIEW_ID)) $criteria->add(RewritingUrlTableMap::VIEW_ID, $this->view_id); + if ($this->isColumnModified(RewritingUrlTableMap::VIEW_LOCALE)) $criteria->add(RewritingUrlTableMap::VIEW_LOCALE, $this->view_locale); + if ($this->isColumnModified(RewritingUrlTableMap::REDIRECTED)) $criteria->add(RewritingUrlTableMap::REDIRECTED, $this->redirected); + if ($this->isColumnModified(RewritingUrlTableMap::CREATED_AT)) $criteria->add(RewritingUrlTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(RewritingUrlTableMap::UPDATED_AT)) $criteria->add(RewritingUrlTableMap::UPDATED_AT, $this->updated_at); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(RewritingUrlTableMap::DATABASE_NAME); + $criteria->add(RewritingUrlTableMap::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of \Thelia\Model\RewritingUrl (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->setUrl($this->getUrl()); + $copyObj->setView($this->getView()); + $copyObj->setViewId($this->getViewId()); + $copyObj->setViewLocale($this->getViewLocale()); + $copyObj->setRedirected($this->getRedirected()); + $copyObj->setCreatedAt($this->getCreatedAt()); + $copyObj->setUpdatedAt($this->getUpdatedAt()); + + if ($deepCopy) { + // important: temporarily setNew(false) because this affects the behavior of + // the getter/setter methods for fkey referrer objects. + $copyObj->setNew(false); + + foreach ($this->getRewritingUrlsRelatedById() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addRewritingUrlRelatedById($relObj->copy($deepCopy)); + } + } + + foreach ($this->getRewritingArguments() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addRewritingArgument($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + if ($makeNew) { + $copyObj->setNew(true); + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return \Thelia\Model\RewritingUrl Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Declares an association between this object and a ChildRewritingUrl object. + * + * @param ChildRewritingUrl $v + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + * @throws PropelException + */ + public function setRewritingUrlRelatedByRedirected(ChildRewritingUrl $v = null) + { + if ($v === null) { + $this->setRedirected(NULL); + } else { + $this->setRedirected($v->getId()); + } + + $this->aRewritingUrlRelatedByRedirected = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildRewritingUrl object, it will not be re-added. + if ($v !== null) { + $v->addRewritingUrlRelatedById($this); + } + + + return $this; + } + + + /** + * Get the associated ChildRewritingUrl object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildRewritingUrl The associated ChildRewritingUrl object. + * @throws PropelException + */ + public function getRewritingUrlRelatedByRedirected(ConnectionInterface $con = null) + { + if ($this->aRewritingUrlRelatedByRedirected === null && ($this->redirected !== null)) { + $this->aRewritingUrlRelatedByRedirected = ChildRewritingUrlQuery::create()->findPk($this->redirected, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aRewritingUrlRelatedByRedirected->addRewritingUrlsRelatedById($this); + */ + } + + return $this->aRewritingUrlRelatedByRedirected; + } + + + /** + * Initializes a collection based on the name of a relation. + * Avoids crafting an 'init[$relationName]s' method name + * that wouldn't work when StandardEnglishPluralizer is used. + * + * @param string $relationName The name of the relation to initialize + * @return void + */ + public function initRelation($relationName) + { + if ('RewritingUrlRelatedById' == $relationName) { + return $this->initRewritingUrlsRelatedById(); + } + if ('RewritingArgument' == $relationName) { + return $this->initRewritingArguments(); + } + } + + /** + * Clears out the collRewritingUrlsRelatedById collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addRewritingUrlsRelatedById() + */ + public function clearRewritingUrlsRelatedById() + { + $this->collRewritingUrlsRelatedById = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collRewritingUrlsRelatedById collection loaded partially. + */ + public function resetPartialRewritingUrlsRelatedById($v = true) + { + $this->collRewritingUrlsRelatedByIdPartial = $v; + } + + /** + * Initializes the collRewritingUrlsRelatedById collection. + * + * By default this just sets the collRewritingUrlsRelatedById collection to an empty array (like clearcollRewritingUrlsRelatedById()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @param boolean $overrideExisting If set to true, the method call initializes + * the collection even if it is not empty + * + * @return void + */ + public function initRewritingUrlsRelatedById($overrideExisting = true) + { + if (null !== $this->collRewritingUrlsRelatedById && !$overrideExisting) { + return; + } + $this->collRewritingUrlsRelatedById = new ObjectCollection(); + $this->collRewritingUrlsRelatedById->setModel('\Thelia\Model\RewritingUrl'); + } + + /** + * Gets an array of ChildRewritingUrl objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this ChildRewritingUrl is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @return Collection|ChildRewritingUrl[] List of ChildRewritingUrl objects + * @throws PropelException + */ + public function getRewritingUrlsRelatedById($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collRewritingUrlsRelatedByIdPartial && !$this->isNew(); + if (null === $this->collRewritingUrlsRelatedById || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritingUrlsRelatedById) { + // return empty collection + $this->initRewritingUrlsRelatedById(); + } else { + $collRewritingUrlsRelatedById = ChildRewritingUrlQuery::create(null, $criteria) + ->filterByRewritingUrlRelatedByRedirected($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collRewritingUrlsRelatedByIdPartial && count($collRewritingUrlsRelatedById)) { + $this->initRewritingUrlsRelatedById(false); + + foreach ($collRewritingUrlsRelatedById as $obj) { + if (false == $this->collRewritingUrlsRelatedById->contains($obj)) { + $this->collRewritingUrlsRelatedById->append($obj); + } + } + + $this->collRewritingUrlsRelatedByIdPartial = true; + } + + $collRewritingUrlsRelatedById->getInternalIterator()->rewind(); + + return $collRewritingUrlsRelatedById; + } + + if ($partial && $this->collRewritingUrlsRelatedById) { + foreach ($this->collRewritingUrlsRelatedById as $obj) { + if ($obj->isNew()) { + $collRewritingUrlsRelatedById[] = $obj; + } + } + } + + $this->collRewritingUrlsRelatedById = $collRewritingUrlsRelatedById; + $this->collRewritingUrlsRelatedByIdPartial = false; + } + } + + return $this->collRewritingUrlsRelatedById; + } + + /** + * Sets a collection of RewritingUrlRelatedById objects related by a one-to-many relationship + * to the current object. + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) + * and new objects from the given Propel collection. + * + * @param Collection $rewritingUrlsRelatedById A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildRewritingUrl The current object (for fluent API support) + */ + public function setRewritingUrlsRelatedById(Collection $rewritingUrlsRelatedById, ConnectionInterface $con = null) + { + $rewritingUrlsRelatedByIdToDelete = $this->getRewritingUrlsRelatedById(new Criteria(), $con)->diff($rewritingUrlsRelatedById); + + + $this->rewritingUrlsRelatedByIdScheduledForDeletion = $rewritingUrlsRelatedByIdToDelete; + + foreach ($rewritingUrlsRelatedByIdToDelete as $rewritingUrlRelatedByIdRemoved) { + $rewritingUrlRelatedByIdRemoved->setRewritingUrlRelatedByRedirected(null); + } + + $this->collRewritingUrlsRelatedById = null; + foreach ($rewritingUrlsRelatedById as $rewritingUrlRelatedById) { + $this->addRewritingUrlRelatedById($rewritingUrlRelatedById); + } + + $this->collRewritingUrlsRelatedById = $rewritingUrlsRelatedById; + $this->collRewritingUrlsRelatedByIdPartial = false; + + return $this; + } + + /** + * Returns the number of related RewritingUrl objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related RewritingUrl objects. + * @throws PropelException + */ + public function countRewritingUrlsRelatedById(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collRewritingUrlsRelatedByIdPartial && !$this->isNew(); + if (null === $this->collRewritingUrlsRelatedById || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritingUrlsRelatedById) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getRewritingUrlsRelatedById()); + } + + $query = ChildRewritingUrlQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByRewritingUrlRelatedByRedirected($this) + ->count($con); + } + + return count($this->collRewritingUrlsRelatedById); + } + + /** + * Method called to associate a ChildRewritingUrl object to this object + * through the ChildRewritingUrl foreign key attribute. + * + * @param ChildRewritingUrl $l ChildRewritingUrl + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + */ + public function addRewritingUrlRelatedById(ChildRewritingUrl $l) + { + if ($this->collRewritingUrlsRelatedById === null) { + $this->initRewritingUrlsRelatedById(); + $this->collRewritingUrlsRelatedByIdPartial = true; + } + + if (!in_array($l, $this->collRewritingUrlsRelatedById->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddRewritingUrlRelatedById($l); + } + + return $this; + } + + /** + * @param RewritingUrlRelatedById $rewritingUrlRelatedById The rewritingUrlRelatedById object to add. + */ + protected function doAddRewritingUrlRelatedById($rewritingUrlRelatedById) + { + $this->collRewritingUrlsRelatedById[]= $rewritingUrlRelatedById; + $rewritingUrlRelatedById->setRewritingUrlRelatedByRedirected($this); + } + + /** + * @param RewritingUrlRelatedById $rewritingUrlRelatedById The rewritingUrlRelatedById object to remove. + * @return ChildRewritingUrl The current object (for fluent API support) + */ + public function removeRewritingUrlRelatedById($rewritingUrlRelatedById) + { + if ($this->getRewritingUrlsRelatedById()->contains($rewritingUrlRelatedById)) { + $this->collRewritingUrlsRelatedById->remove($this->collRewritingUrlsRelatedById->search($rewritingUrlRelatedById)); + if (null === $this->rewritingUrlsRelatedByIdScheduledForDeletion) { + $this->rewritingUrlsRelatedByIdScheduledForDeletion = clone $this->collRewritingUrlsRelatedById; + $this->rewritingUrlsRelatedByIdScheduledForDeletion->clear(); + } + $this->rewritingUrlsRelatedByIdScheduledForDeletion[]= $rewritingUrlRelatedById; + $rewritingUrlRelatedById->setRewritingUrlRelatedByRedirected(null); + } + + return $this; + } + + /** + * Clears out the collRewritingArguments collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addRewritingArguments() + */ + public function clearRewritingArguments() + { + $this->collRewritingArguments = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collRewritingArguments collection loaded partially. + */ + public function resetPartialRewritingArguments($v = true) + { + $this->collRewritingArgumentsPartial = $v; + } + + /** + * Initializes the collRewritingArguments collection. + * + * By default this just sets the collRewritingArguments collection to an empty array (like clearcollRewritingArguments()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @param boolean $overrideExisting If set to true, the method call initializes + * the collection even if it is not empty + * + * @return void + */ + public function initRewritingArguments($overrideExisting = true) + { + if (null !== $this->collRewritingArguments && !$overrideExisting) { + return; + } + $this->collRewritingArguments = new ObjectCollection(); + $this->collRewritingArguments->setModel('\Thelia\Model\RewritingArgument'); + } + + /** + * Gets an array of ChildRewritingArgument objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this ChildRewritingUrl is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param ConnectionInterface $con optional connection object + * @return Collection|ChildRewritingArgument[] List of ChildRewritingArgument objects + * @throws PropelException + */ + public function getRewritingArguments($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collRewritingArgumentsPartial && !$this->isNew(); + if (null === $this->collRewritingArguments || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritingArguments) { + // return empty collection + $this->initRewritingArguments(); + } else { + $collRewritingArguments = ChildRewritingArgumentQuery::create(null, $criteria) + ->filterByRewritingUrl($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collRewritingArgumentsPartial && count($collRewritingArguments)) { + $this->initRewritingArguments(false); + + foreach ($collRewritingArguments as $obj) { + if (false == $this->collRewritingArguments->contains($obj)) { + $this->collRewritingArguments->append($obj); + } + } + + $this->collRewritingArgumentsPartial = true; + } + + $collRewritingArguments->getInternalIterator()->rewind(); + + return $collRewritingArguments; + } + + if ($partial && $this->collRewritingArguments) { + foreach ($this->collRewritingArguments as $obj) { + if ($obj->isNew()) { + $collRewritingArguments[] = $obj; + } + } + } + + $this->collRewritingArguments = $collRewritingArguments; + $this->collRewritingArgumentsPartial = false; + } + } + + return $this->collRewritingArguments; + } + + /** + * Sets a collection of RewritingArgument objects related by a one-to-many relationship + * to the current object. + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) + * and new objects from the given Propel collection. + * + * @param Collection $rewritingArguments A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildRewritingUrl The current object (for fluent API support) + */ + public function setRewritingArguments(Collection $rewritingArguments, ConnectionInterface $con = null) + { + $rewritingArgumentsToDelete = $this->getRewritingArguments(new Criteria(), $con)->diff($rewritingArguments); + + + //since at least one column in the foreign key is at the same time a PK + //we can not just set a PK to NULL in the lines below. We have to store + //a backup of all values, so we are able to manipulate these items based on the onDelete value later. + $this->rewritingArgumentsScheduledForDeletion = clone $rewritingArgumentsToDelete; + + foreach ($rewritingArgumentsToDelete as $rewritingArgumentRemoved) { + $rewritingArgumentRemoved->setRewritingUrl(null); + } + + $this->collRewritingArguments = null; + foreach ($rewritingArguments as $rewritingArgument) { + $this->addRewritingArgument($rewritingArgument); + } + + $this->collRewritingArguments = $rewritingArguments; + $this->collRewritingArgumentsPartial = false; + + return $this; + } + + /** + * Returns the number of related RewritingArgument objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related RewritingArgument objects. + * @throws PropelException + */ + public function countRewritingArguments(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collRewritingArgumentsPartial && !$this->isNew(); + if (null === $this->collRewritingArguments || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collRewritingArguments) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getRewritingArguments()); + } + + $query = ChildRewritingArgumentQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByRewritingUrl($this) + ->count($con); + } + + return count($this->collRewritingArguments); + } + + /** + * Method called to associate a ChildRewritingArgument object to this object + * through the ChildRewritingArgument foreign key attribute. + * + * @param ChildRewritingArgument $l ChildRewritingArgument + * @return \Thelia\Model\RewritingUrl The current object (for fluent API support) + */ + public function addRewritingArgument(ChildRewritingArgument $l) + { + if ($this->collRewritingArguments === null) { + $this->initRewritingArguments(); + $this->collRewritingArgumentsPartial = true; + } + + if (!in_array($l, $this->collRewritingArguments->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddRewritingArgument($l); + } + + return $this; + } + + /** + * @param RewritingArgument $rewritingArgument The rewritingArgument object to add. + */ + protected function doAddRewritingArgument($rewritingArgument) + { + $this->collRewritingArguments[]= $rewritingArgument; + $rewritingArgument->setRewritingUrl($this); + } + + /** + * @param RewritingArgument $rewritingArgument The rewritingArgument object to remove. + * @return ChildRewritingUrl The current object (for fluent API support) + */ + public function removeRewritingArgument($rewritingArgument) + { + if ($this->getRewritingArguments()->contains($rewritingArgument)) { + $this->collRewritingArguments->remove($this->collRewritingArguments->search($rewritingArgument)); + if (null === $this->rewritingArgumentsScheduledForDeletion) { + $this->rewritingArgumentsScheduledForDeletion = clone $this->collRewritingArguments; + $this->rewritingArgumentsScheduledForDeletion->clear(); + } + $this->rewritingArgumentsScheduledForDeletion[]= clone $rewritingArgument; + $rewritingArgument->setRewritingUrl(null); + } + + return $this; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->url = null; + $this->view = null; + $this->view_id = null; + $this->view_locale = null; + $this->redirected = null; + $this->created_at = null; + $this->updated_at = null; + $this->alreadyInSave = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collRewritingUrlsRelatedById) { + foreach ($this->collRewritingUrlsRelatedById as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collRewritingArguments) { + foreach ($this->collRewritingArguments as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + if ($this->collRewritingUrlsRelatedById instanceof Collection) { + $this->collRewritingUrlsRelatedById->clearIterator(); + } + $this->collRewritingUrlsRelatedById = null; + if ($this->collRewritingArguments instanceof Collection) { + $this->collRewritingArguments->clearIterator(); + } + $this->collRewritingArguments = null; + $this->aRewritingUrlRelatedByRedirected = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(RewritingUrlTableMap::DEFAULT_STRING_FORMAT); + } + + // timestampable behavior + + /** + * Mark the current object so that the update date doesn't get updated during next save + * + * @return ChildRewritingUrl The current object (for fluent API support) + */ + public function keepUpdateDateUnchanged() + { + $this->modifiedColumns[] = RewritingUrlTableMap::UPDATED_AT; + + return $this; + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/core/lib/Thelia/Model/Base/RewritingUrlQuery.php b/core/lib/Thelia/Model/Base/RewritingUrlQuery.php new file mode 100644 index 000000000..c3c73b923 --- /dev/null +++ b/core/lib/Thelia/Model/Base/RewritingUrlQuery.php @@ -0,0 +1,919 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + + return $query; + } + + /** + * Find object by primary key. + * Propel uses the instance pool to skip the database if the object exists. + * Go fast if the query is untouched. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildRewritingUrl|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = RewritingUrlTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(RewritingUrlTableMap::DATABASE_NAME); + } + $this->basePreSelect($con); + if ($this->formatter || $this->modelAlias || $this->with || $this->select + || $this->selectColumns || $this->asColumns || $this->selectModifiers + || $this->map || $this->having || $this->joins) { + return $this->findPkComplex($key, $con); + } else { + return $this->findPkSimple($key, $con); + } + } + + /** + * Find object by primary key using raw SQL to go fast. + * Bypass doSelect() and the object formatter by using generated code. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildRewritingUrl A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT ID, URL, VIEW, VIEW_ID, VIEW_LOCALE, REDIRECTED, CREATED_AT, UPDATED_AT FROM rewriting_url WHERE ID = :p0'; + try { + $stmt = $con->prepare($sql); + $stmt->bindValue(':p0', $key, PDO::PARAM_INT); + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); + } + $obj = null; + if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { + $obj = new ChildRewritingUrl(); + $obj->hydrate($row); + RewritingUrlTableMap::addInstanceToPool($obj, (string) $key); + } + $stmt->closeCursor(); + + return $obj; + } + + /** + * Find object by primary key. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildRewritingUrl|array|mixed the result, formatted by the current formatter + */ + protected function findPkComplex($key, $con) + { + // As the query uses a PK condition, no limit(1) is necessary. + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKey($key) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); + } + $this->basePreSelect($con); + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKeys($keys) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->format($dataFetcher); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(RewritingUrlTableMap::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(RewritingUrlTableMap::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @param mixed $id The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id)) { + $useMinMax = false; + if (isset($id['min'])) { + $this->addUsingAlias(RewritingUrlTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(RewritingUrlTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(RewritingUrlTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the url column + * + * Example usage: + * + * $query->filterByUrl('fooValue'); // WHERE url = 'fooValue' + * $query->filterByUrl('%fooValue%'); // WHERE url LIKE '%fooValue%' + * + * + * @param string $url The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByUrl($url = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($url)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $url)) { + $url = str_replace('*', '%', $url); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(RewritingUrlTableMap::URL, $url, $comparison); + } + + /** + * Filter the query on the view column + * + * Example usage: + * + * $query->filterByView('fooValue'); // WHERE view = 'fooValue' + * $query->filterByView('%fooValue%'); // WHERE view LIKE '%fooValue%' + * + * + * @param string $view The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByView($view = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($view)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $view)) { + $view = str_replace('*', '%', $view); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(RewritingUrlTableMap::VIEW, $view, $comparison); + } + + /** + * Filter the query on the view_id column + * + * Example usage: + * + * $query->filterByViewId('fooValue'); // WHERE view_id = 'fooValue' + * $query->filterByViewId('%fooValue%'); // WHERE view_id LIKE '%fooValue%' + * + * + * @param string $viewId The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByViewId($viewId = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($viewId)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $viewId)) { + $viewId = str_replace('*', '%', $viewId); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(RewritingUrlTableMap::VIEW_ID, $viewId, $comparison); + } + + /** + * Filter the query on the view_locale column + * + * Example usage: + * + * $query->filterByViewLocale('fooValue'); // WHERE view_locale = 'fooValue' + * $query->filterByViewLocale('%fooValue%'); // WHERE view_locale LIKE '%fooValue%' + * + * + * @param string $viewLocale The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByViewLocale($viewLocale = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($viewLocale)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $viewLocale)) { + $viewLocale = str_replace('*', '%', $viewLocale); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(RewritingUrlTableMap::VIEW_LOCALE, $viewLocale, $comparison); + } + + /** + * Filter the query on the redirected column + * + * Example usage: + * + * $query->filterByRedirected(1234); // WHERE redirected = 1234 + * $query->filterByRedirected(array(12, 34)); // WHERE redirected IN (12, 34) + * $query->filterByRedirected(array('min' => 12)); // WHERE redirected > 12 + * + * + * @see filterByRewritingUrlRelatedByRedirected() + * + * @param mixed $redirected The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByRedirected($redirected = null, $comparison = null) + { + if (is_array($redirected)) { + $useMinMax = false; + if (isset($redirected['min'])) { + $this->addUsingAlias(RewritingUrlTableMap::REDIRECTED, $redirected['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($redirected['max'])) { + $this->addUsingAlias(RewritingUrlTableMap::REDIRECTED, $redirected['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(RewritingUrlTableMap::REDIRECTED, $redirected, $comparison); + } + + /** + * Filter the query on the created_at column + * + * Example usage: + * + * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' + * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' + * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' + * + * + * @param mixed $createdAt The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByCreatedAt($createdAt = null, $comparison = null) + { + if (is_array($createdAt)) { + $useMinMax = false; + if (isset($createdAt['min'])) { + $this->addUsingAlias(RewritingUrlTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($createdAt['max'])) { + $this->addUsingAlias(RewritingUrlTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(RewritingUrlTableMap::CREATED_AT, $createdAt, $comparison); + } + + /** + * Filter the query on the updated_at column + * + * Example usage: + * + * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' + * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' + * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' + * + * + * @param mixed $updatedAt The value to use as filter. + * Values can be integers (unix timestamps), DateTime objects, or strings. + * Empty strings are treated as NULL. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByUpdatedAt($updatedAt = null, $comparison = null) + { + if (is_array($updatedAt)) { + $useMinMax = false; + if (isset($updatedAt['min'])) { + $this->addUsingAlias(RewritingUrlTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($updatedAt['max'])) { + $this->addUsingAlias(RewritingUrlTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(RewritingUrlTableMap::UPDATED_AT, $updatedAt, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\RewritingUrl object + * + * @param \Thelia\Model\RewritingUrl|ObjectCollection $rewritingUrl The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByRewritingUrlRelatedByRedirected($rewritingUrl, $comparison = null) + { + if ($rewritingUrl instanceof \Thelia\Model\RewritingUrl) { + return $this + ->addUsingAlias(RewritingUrlTableMap::REDIRECTED, $rewritingUrl->getId(), $comparison); + } elseif ($rewritingUrl instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(RewritingUrlTableMap::REDIRECTED, $rewritingUrl->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByRewritingUrlRelatedByRedirected() only accepts arguments of type \Thelia\Model\RewritingUrl or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the RewritingUrlRelatedByRedirected relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function joinRewritingUrlRelatedByRedirected($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('RewritingUrlRelatedByRedirected'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'RewritingUrlRelatedByRedirected'); + } + + return $this; + } + + /** + * Use the RewritingUrlRelatedByRedirected relation RewritingUrl object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\RewritingUrlQuery A secondary query class using the current class as primary query + */ + public function useRewritingUrlRelatedByRedirectedQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinRewritingUrlRelatedByRedirected($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'RewritingUrlRelatedByRedirected', '\Thelia\Model\RewritingUrlQuery'); + } + + /** + * Filter the query by a related \Thelia\Model\RewritingUrl object + * + * @param \Thelia\Model\RewritingUrl|ObjectCollection $rewritingUrl the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByRewritingUrlRelatedById($rewritingUrl, $comparison = null) + { + if ($rewritingUrl instanceof \Thelia\Model\RewritingUrl) { + return $this + ->addUsingAlias(RewritingUrlTableMap::ID, $rewritingUrl->getRedirected(), $comparison); + } elseif ($rewritingUrl instanceof ObjectCollection) { + return $this + ->useRewritingUrlRelatedByIdQuery() + ->filterByPrimaryKeys($rewritingUrl->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByRewritingUrlRelatedById() only accepts arguments of type \Thelia\Model\RewritingUrl or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the RewritingUrlRelatedById relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function joinRewritingUrlRelatedById($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('RewritingUrlRelatedById'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'RewritingUrlRelatedById'); + } + + return $this; + } + + /** + * Use the RewritingUrlRelatedById relation RewritingUrl object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\RewritingUrlQuery A secondary query class using the current class as primary query + */ + public function useRewritingUrlRelatedByIdQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinRewritingUrlRelatedById($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'RewritingUrlRelatedById', '\Thelia\Model\RewritingUrlQuery'); + } + + /** + * Filter the query by a related \Thelia\Model\RewritingArgument object + * + * @param \Thelia\Model\RewritingArgument|ObjectCollection $rewritingArgument the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function filterByRewritingArgument($rewritingArgument, $comparison = null) + { + if ($rewritingArgument instanceof \Thelia\Model\RewritingArgument) { + return $this + ->addUsingAlias(RewritingUrlTableMap::ID, $rewritingArgument->getRewritingUrlId(), $comparison); + } elseif ($rewritingArgument instanceof ObjectCollection) { + return $this + ->useRewritingArgumentQuery() + ->filterByPrimaryKeys($rewritingArgument->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByRewritingArgument() only accepts arguments of type \Thelia\Model\RewritingArgument or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the RewritingArgument relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function joinRewritingArgument($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('RewritingArgument'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'RewritingArgument'); + } + + return $this; + } + + /** + * Use the RewritingArgument relation RewritingArgument object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\RewritingArgumentQuery A secondary query class using the current class as primary query + */ + public function useRewritingArgumentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinRewritingArgument($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'RewritingArgument', '\Thelia\Model\RewritingArgumentQuery'); + } + + /** + * Exclude object from result + * + * @param ChildRewritingUrl $rewritingUrl Object to remove from the list of results + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function prune($rewritingUrl = null) + { + if ($rewritingUrl) { + $this->addUsingAlias(RewritingUrlTableMap::ID, $rewritingUrl->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the rewriting_url table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public function doDeleteAll(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(RewritingUrlTableMap::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += parent::doDeleteAll($con); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + RewritingUrlTableMap::clearInstancePool(); + RewritingUrlTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildRewritingUrl or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildRewritingUrl object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public function delete(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(RewritingUrlTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(RewritingUrlTableMap::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + + RewritingUrlTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + RewritingUrlTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + // timestampable behavior + + /** + * Filter by the latest updated + * + * @param int $nbDays Maximum age of the latest update in days + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function recentlyUpdated($nbDays = 7) + { + return $this->addUsingAlias(RewritingUrlTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Filter by the latest created + * + * @param int $nbDays Maximum age of in days + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function recentlyCreated($nbDays = 7) + { + return $this->addUsingAlias(RewritingUrlTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Order by update date desc + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function lastUpdatedFirst() + { + return $this->addDescendingOrderByColumn(RewritingUrlTableMap::UPDATED_AT); + } + + /** + * Order by update date asc + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function firstUpdatedFirst() + { + return $this->addAscendingOrderByColumn(RewritingUrlTableMap::UPDATED_AT); + } + + /** + * Order by create date desc + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function lastCreatedFirst() + { + return $this->addDescendingOrderByColumn(RewritingUrlTableMap::CREATED_AT); + } + + /** + * Order by create date asc + * + * @return ChildRewritingUrlQuery The current query, for fluid interface + */ + public function firstCreatedFirst() + { + return $this->addAscendingOrderByColumn(RewritingUrlTableMap::CREATED_AT); + } + +} // RewritingUrlQuery diff --git a/core/lib/Thelia/Model/Base/Tax.php b/core/lib/Thelia/Model/Base/Tax.php index 3e405414c..ed4bb40f7 100644 --- a/core/lib/Thelia/Model/Base/Tax.php +++ b/core/lib/Thelia/Model/Base/Tax.php @@ -285,7 +285,7 @@ abstract class Tax implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -791,10 +791,9 @@ abstract class Tax implements ActiveRecordInterface if ($this->taxRuleCountriesScheduledForDeletion !== null) { if (!$this->taxRuleCountriesScheduledForDeletion->isEmpty()) { - foreach ($this->taxRuleCountriesScheduledForDeletion as $taxRuleCountry) { - // need to save related object because we set the relation to null - $taxRuleCountry->save($con); - } + \Thelia\Model\TaxRuleCountryQuery::create() + ->filterByPrimaryKeys($this->taxRuleCountriesScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); $this->taxRuleCountriesScheduledForDeletion = null; } } @@ -1346,7 +1345,10 @@ abstract class Tax implements ActiveRecordInterface $taxRuleCountriesToDelete = $this->getTaxRuleCountries(new Criteria(), $con)->diff($taxRuleCountries); - $this->taxRuleCountriesScheduledForDeletion = $taxRuleCountriesToDelete; + //since at least one column in the foreign key is at the same time a PK + //we can not just set a PK to NULL in the lines below. We have to store + //a backup of all values, so we are able to manipulate these items based on the onDelete value later. + $this->taxRuleCountriesScheduledForDeletion = clone $taxRuleCountriesToDelete; foreach ($taxRuleCountriesToDelete as $taxRuleCountryRemoved) { $taxRuleCountryRemoved->setTax(null); @@ -1439,7 +1441,7 @@ abstract class Tax implements ActiveRecordInterface $this->taxRuleCountriesScheduledForDeletion = clone $this->collTaxRuleCountries; $this->taxRuleCountriesScheduledForDeletion->clear(); } - $this->taxRuleCountriesScheduledForDeletion[]= $taxRuleCountry; + $this->taxRuleCountriesScheduledForDeletion[]= clone $taxRuleCountry; $taxRuleCountry->setTax(null); } diff --git a/core/lib/Thelia/Model/Base/TaxI18n.php b/core/lib/Thelia/Model/Base/TaxI18n.php index f8577e860..abb659135 100644 --- a/core/lib/Thelia/Model/Base/TaxI18n.php +++ b/core/lib/Thelia/Model/Base/TaxI18n.php @@ -260,7 +260,7 @@ abstract class TaxI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** diff --git a/core/lib/Thelia/Model/Base/TaxQuery.php b/core/lib/Thelia/Model/Base/TaxQuery.php index 307ace57c..07316bf69 100644 --- a/core/lib/Thelia/Model/Base/TaxQuery.php +++ b/core/lib/Thelia/Model/Base/TaxQuery.php @@ -432,7 +432,7 @@ abstract class TaxQuery extends ModelCriteria * * @return ChildTaxQuery The current query, for fluid interface */ - public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('TaxRuleCountry'); @@ -467,7 +467,7 @@ abstract class TaxQuery extends ModelCriteria * * @return \Thelia\Model\TaxRuleCountryQuery A secondary query class using the current class as primary query */ - public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinTaxRuleCountry($relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Base/TaxRule.php b/core/lib/Thelia/Model/Base/TaxRule.php index bf318498c..61f21d4e1 100644 --- a/core/lib/Thelia/Model/Base/TaxRule.php +++ b/core/lib/Thelia/Model/Base/TaxRule.php @@ -67,24 +67,6 @@ abstract class TaxRule implements ActiveRecordInterface */ protected $id; - /** - * The value for the code field. - * @var string - */ - protected $code; - - /** - * The value for the title field. - * @var string - */ - protected $title; - - /** - * The value for the description field. - * @var string - */ - protected $description; - /** * The value for the created_at field. * @var string @@ -311,7 +293,7 @@ abstract class TaxRule implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -420,39 +402,6 @@ abstract class TaxRule implements ActiveRecordInterface return $this->id; } - /** - * Get the [code] column value. - * - * @return string - */ - public function getCode() - { - - return $this->code; - } - - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - - return $this->title; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - - return $this->description; - } - /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -514,69 +463,6 @@ abstract class TaxRule implements ActiveRecordInterface return $this; } // setId() - /** - * Set the value of [code] column. - * - * @param string $v new value - * @return \Thelia\Model\TaxRule The current object (for fluent API support) - */ - public function setCode($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->code !== $v) { - $this->code = $v; - $this->modifiedColumns[] = TaxRuleTableMap::CODE; - } - - - return $this; - } // setCode() - - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return \Thelia\Model\TaxRule The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = TaxRuleTableMap::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return \Thelia\Model\TaxRule The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = TaxRuleTableMap::DESCRIPTION; - } - - - return $this; - } // setDescription() - /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -659,22 +545,13 @@ abstract class TaxRule implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TaxRuleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; - $this->code = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; - $this->title = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxRuleTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; - $this->description = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : TaxRuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : TaxRuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -687,7 +564,7 @@ abstract class TaxRule implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 6; // 6 = TaxRuleTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 3; // 3 = TaxRuleTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\TaxRule object", 0, $e); @@ -968,15 +845,6 @@ abstract class TaxRule implements ActiveRecordInterface if ($this->isColumnModified(TaxRuleTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(TaxRuleTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; - } - if ($this->isColumnModified(TaxRuleTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; - } - if ($this->isColumnModified(TaxRuleTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; - } if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -997,15 +865,6 @@ abstract class TaxRule implements ActiveRecordInterface case 'ID': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'CODE': - $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); - break; - case 'TITLE': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case 'DESCRIPTION': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -1078,18 +937,9 @@ abstract class TaxRule implements ActiveRecordInterface return $this->getId(); break; case 1: - return $this->getCode(); - break; - case 2: - return $this->getTitle(); - break; - case 3: - return $this->getDescription(); - break; - case 4: return $this->getCreatedAt(); break; - case 5: + case 2: return $this->getUpdatedAt(); break; default: @@ -1122,11 +972,8 @@ abstract class TaxRule implements ActiveRecordInterface $keys = TaxRuleTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), - $keys[1] => $this->getCode(), - $keys[2] => $this->getTitle(), - $keys[3] => $this->getDescription(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), + $keys[1] => $this->getCreatedAt(), + $keys[2] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1182,18 +1029,9 @@ abstract class TaxRule implements ActiveRecordInterface $this->setId($value); break; case 1: - $this->setCode($value); - break; - case 2: - $this->setTitle($value); - break; - case 3: - $this->setDescription($value); - break; - case 4: $this->setCreatedAt($value); break; - case 5: + case 2: $this->setUpdatedAt($value); break; } // switch() @@ -1221,11 +1059,8 @@ abstract class TaxRule implements ActiveRecordInterface $keys = TaxRuleTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); + if (array_key_exists($keys[1], $arr)) $this->setCreatedAt($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setUpdatedAt($arr[$keys[2]]); } /** @@ -1238,9 +1073,6 @@ abstract class TaxRule implements ActiveRecordInterface $criteria = new Criteria(TaxRuleTableMap::DATABASE_NAME); if ($this->isColumnModified(TaxRuleTableMap::ID)) $criteria->add(TaxRuleTableMap::ID, $this->id); - if ($this->isColumnModified(TaxRuleTableMap::CODE)) $criteria->add(TaxRuleTableMap::CODE, $this->code); - if ($this->isColumnModified(TaxRuleTableMap::TITLE)) $criteria->add(TaxRuleTableMap::TITLE, $this->title); - if ($this->isColumnModified(TaxRuleTableMap::DESCRIPTION)) $criteria->add(TaxRuleTableMap::DESCRIPTION, $this->description); if ($this->isColumnModified(TaxRuleTableMap::CREATED_AT)) $criteria->add(TaxRuleTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(TaxRuleTableMap::UPDATED_AT)) $criteria->add(TaxRuleTableMap::UPDATED_AT, $this->updated_at); @@ -1306,9 +1138,6 @@ abstract class TaxRule implements ActiveRecordInterface */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setCode($this->getCode()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setDescription($this->getDescription()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1723,7 +1552,10 @@ abstract class TaxRule implements ActiveRecordInterface $taxRuleCountriesToDelete = $this->getTaxRuleCountries(new Criteria(), $con)->diff($taxRuleCountries); - $this->taxRuleCountriesScheduledForDeletion = $taxRuleCountriesToDelete; + //since at least one column in the foreign key is at the same time a PK + //we can not just set a PK to NULL in the lines below. We have to store + //a backup of all values, so we are able to manipulate these items based on the onDelete value later. + $this->taxRuleCountriesScheduledForDeletion = clone $taxRuleCountriesToDelete; foreach ($taxRuleCountriesToDelete as $taxRuleCountryRemoved) { $taxRuleCountryRemoved->setTaxRule(null); @@ -1816,7 +1648,7 @@ abstract class TaxRule implements ActiveRecordInterface $this->taxRuleCountriesScheduledForDeletion = clone $this->collTaxRuleCountries; $this->taxRuleCountriesScheduledForDeletion->clear(); } - $this->taxRuleCountriesScheduledForDeletion[]= $taxRuleCountry; + $this->taxRuleCountriesScheduledForDeletion[]= clone $taxRuleCountry; $taxRuleCountry->setTaxRule(null); } @@ -2104,9 +1936,6 @@ abstract class TaxRule implements ActiveRecordInterface public function clear() { $this->id = null; - $this->code = null; - $this->title = null; - $this->description = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; @@ -2286,6 +2115,54 @@ abstract class TaxRule implements ActiveRecordInterface return $this->getTranslation($this->getLocale(), $con); } + + /** + * Get the [title] column value. + * + * @return string + */ + public function getTitle() + { + return $this->getCurrentTranslation()->getTitle(); + } + + + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return \Thelia\Model\TaxRuleI18n The current object (for fluent API support) + */ + public function setTitle($v) + { $this->getCurrentTranslation()->setTitle($v); + + return $this; + } + + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->getCurrentTranslation()->getDescription(); + } + + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return \Thelia\Model\TaxRuleI18n The current object (for fluent API support) + */ + public function setDescription($v) + { $this->getCurrentTranslation()->setDescription($v); + + return $this; + } + /** * Code to be run before persisting the object * @param ConnectionInterface $con diff --git a/core/lib/Thelia/Model/Base/TaxRuleCountry.php b/core/lib/Thelia/Model/Base/TaxRuleCountry.php index b5ae7941b..0cc3e74eb 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleCountry.php +++ b/core/lib/Thelia/Model/Base/TaxRuleCountry.php @@ -60,12 +60,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface */ protected $virtualColumns = array(); - /** - * The value for the id field. - * @var int - */ - protected $id; - /** * The value for the tax_rule_id field. * @var int @@ -85,10 +79,10 @@ abstract class TaxRuleCountry implements ActiveRecordInterface protected $tax_id; /** - * The value for the none field. + * The value for the position field. * @var int */ - protected $none; + protected $position; /** * The value for the created_at field. @@ -281,7 +275,7 @@ abstract class TaxRuleCountry implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -379,17 +373,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface return array_keys(get_object_vars($this)); } - /** - * Get the [id] column value. - * - * @return int - */ - public function getId() - { - - return $this->id; - } - /** * Get the [tax_rule_id] column value. * @@ -424,14 +407,14 @@ abstract class TaxRuleCountry implements ActiveRecordInterface } /** - * Get the [none] column value. + * Get the [position] column value. * * @return int */ - public function getNone() + public function getPosition() { - return $this->none; + return $this->position; } /** @@ -474,27 +457,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface } } - /** - * Set the value of [id] column. - * - * @param int $v new value - * @return \Thelia\Model\TaxRuleCountry The current object (for fluent API support) - */ - public function setId($v) - { - if ($v !== null) { - $v = (int) $v; - } - - if ($this->id !== $v) { - $this->id = $v; - $this->modifiedColumns[] = TaxRuleCountryTableMap::ID; - } - - - return $this; - } // setId() - /** * Set the value of [tax_rule_id] column. * @@ -571,25 +533,25 @@ abstract class TaxRuleCountry implements ActiveRecordInterface } // setTaxId() /** - * Set the value of [none] column. + * Set the value of [position] column. * * @param int $v new value * @return \Thelia\Model\TaxRuleCountry The current object (for fluent API support) */ - public function setNone($v) + public function setPosition($v) { if ($v !== null) { $v = (int) $v; } - if ($this->none !== $v) { - $this->none = $v; - $this->modifiedColumns[] = TaxRuleCountryTableMap::NONE; + if ($this->position !== $v) { + $this->position = $v; + $this->modifiedColumns[] = TaxRuleCountryTableMap::POSITION; } return $this; - } // setNone() + } // setPosition() /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. @@ -670,28 +632,25 @@ abstract class TaxRuleCountry implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TaxRuleCountryTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; - $this->id = (null !== $col) ? (int) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleCountryTableMap::translateFieldName('TaxRuleId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : TaxRuleCountryTableMap::translateFieldName('TaxRuleId', TableMap::TYPE_PHPNAME, $indexType)]; $this->tax_rule_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleCountryTableMap::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleCountryTableMap::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)]; $this->country_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxRuleCountryTableMap::translateFieldName('TaxId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleCountryTableMap::translateFieldName('TaxId', TableMap::TYPE_PHPNAME, $indexType)]; $this->tax_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : TaxRuleCountryTableMap::translateFieldName('None', TableMap::TYPE_PHPNAME, $indexType)]; - $this->none = (null !== $col) ? (int) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxRuleCountryTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $this->position = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : TaxRuleCountryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : TaxRuleCountryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : TaxRuleCountryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : TaxRuleCountryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -704,7 +663,7 @@ abstract class TaxRuleCountry implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 7; // 7 = TaxRuleCountryTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = TaxRuleCountryTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\TaxRuleCountry object", 0, $e); @@ -958,9 +917,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(TaxRuleCountryTableMap::ID)) { - $modifiedColumns[':p' . $index++] = 'ID'; - } if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_RULE_ID)) { $modifiedColumns[':p' . $index++] = 'TAX_RULE_ID'; } @@ -970,8 +926,8 @@ abstract class TaxRuleCountry implements ActiveRecordInterface if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_ID)) { $modifiedColumns[':p' . $index++] = 'TAX_ID'; } - if ($this->isColumnModified(TaxRuleCountryTableMap::NONE)) { - $modifiedColumns[':p' . $index++] = 'NONE'; + if ($this->isColumnModified(TaxRuleCountryTableMap::POSITION)) { + $modifiedColumns[':p' . $index++] = 'POSITION'; } if ($this->isColumnModified(TaxRuleCountryTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; @@ -990,9 +946,6 @@ abstract class TaxRuleCountry implements ActiveRecordInterface $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { - case 'ID': - $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); - break; case 'TAX_RULE_ID': $stmt->bindValue($identifier, $this->tax_rule_id, PDO::PARAM_INT); break; @@ -1002,8 +955,8 @@ abstract class TaxRuleCountry implements ActiveRecordInterface case 'TAX_ID': $stmt->bindValue($identifier, $this->tax_id, PDO::PARAM_INT); break; - case 'NONE': - $stmt->bindValue($identifier, $this->none, PDO::PARAM_INT); + case 'POSITION': + $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); @@ -1067,24 +1020,21 @@ abstract class TaxRuleCountry implements ActiveRecordInterface { switch ($pos) { case 0: - return $this->getId(); - break; - case 1: return $this->getTaxRuleId(); break; - case 2: + case 1: return $this->getCountryId(); break; - case 3: + case 2: return $this->getTaxId(); break; - case 4: - return $this->getNone(); + case 3: + return $this->getPosition(); break; - case 5: + case 4: return $this->getCreatedAt(); break; - case 6: + case 5: return $this->getUpdatedAt(); break; default: @@ -1110,19 +1060,18 @@ abstract class TaxRuleCountry implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['TaxRuleCountry'][$this->getPrimaryKey()])) { + if (isset($alreadyDumpedObjects['TaxRuleCountry'][serialize($this->getPrimaryKey())])) { return '*RECURSION*'; } - $alreadyDumpedObjects['TaxRuleCountry'][$this->getPrimaryKey()] = true; + $alreadyDumpedObjects['TaxRuleCountry'][serialize($this->getPrimaryKey())] = true; $keys = TaxRuleCountryTableMap::getFieldNames($keyType); $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getTaxRuleId(), - $keys[2] => $this->getCountryId(), - $keys[3] => $this->getTaxId(), - $keys[4] => $this->getNone(), - $keys[5] => $this->getCreatedAt(), - $keys[6] => $this->getUpdatedAt(), + $keys[0] => $this->getTaxRuleId(), + $keys[1] => $this->getCountryId(), + $keys[2] => $this->getTaxId(), + $keys[3] => $this->getPosition(), + $keys[4] => $this->getCreatedAt(), + $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1175,24 +1124,21 @@ abstract class TaxRuleCountry implements ActiveRecordInterface { switch ($pos) { case 0: - $this->setId($value); - break; - case 1: $this->setTaxRuleId($value); break; - case 2: + case 1: $this->setCountryId($value); break; - case 3: + case 2: $this->setTaxId($value); break; - case 4: - $this->setNone($value); + case 3: + $this->setPosition($value); break; - case 5: + case 4: $this->setCreatedAt($value); break; - case 6: + case 5: $this->setUpdatedAt($value); break; } // switch() @@ -1219,13 +1165,12 @@ abstract class TaxRuleCountry implements ActiveRecordInterface { $keys = TaxRuleCountryTableMap::getFieldNames($keyType); - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setTaxRuleId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setCountryId($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTaxId($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setNone($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]); + if (array_key_exists($keys[0], $arr)) $this->setTaxRuleId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setCountryId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTaxId($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); } /** @@ -1237,11 +1182,10 @@ abstract class TaxRuleCountry implements ActiveRecordInterface { $criteria = new Criteria(TaxRuleCountryTableMap::DATABASE_NAME); - if ($this->isColumnModified(TaxRuleCountryTableMap::ID)) $criteria->add(TaxRuleCountryTableMap::ID, $this->id); if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_RULE_ID)) $criteria->add(TaxRuleCountryTableMap::TAX_RULE_ID, $this->tax_rule_id); if ($this->isColumnModified(TaxRuleCountryTableMap::COUNTRY_ID)) $criteria->add(TaxRuleCountryTableMap::COUNTRY_ID, $this->country_id); if ($this->isColumnModified(TaxRuleCountryTableMap::TAX_ID)) $criteria->add(TaxRuleCountryTableMap::TAX_ID, $this->tax_id); - if ($this->isColumnModified(TaxRuleCountryTableMap::NONE)) $criteria->add(TaxRuleCountryTableMap::NONE, $this->none); + if ($this->isColumnModified(TaxRuleCountryTableMap::POSITION)) $criteria->add(TaxRuleCountryTableMap::POSITION, $this->position); if ($this->isColumnModified(TaxRuleCountryTableMap::CREATED_AT)) $criteria->add(TaxRuleCountryTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(TaxRuleCountryTableMap::UPDATED_AT)) $criteria->add(TaxRuleCountryTableMap::UPDATED_AT, $this->updated_at); @@ -1259,29 +1203,39 @@ abstract class TaxRuleCountry implements ActiveRecordInterface public function buildPkeyCriteria() { $criteria = new Criteria(TaxRuleCountryTableMap::DATABASE_NAME); - $criteria->add(TaxRuleCountryTableMap::ID, $this->id); + $criteria->add(TaxRuleCountryTableMap::TAX_RULE_ID, $this->tax_rule_id); + $criteria->add(TaxRuleCountryTableMap::COUNTRY_ID, $this->country_id); + $criteria->add(TaxRuleCountryTableMap::TAX_ID, $this->tax_id); return $criteria; } /** - * Returns the primary key for this object (row). - * @return int + * Returns the composite primary key for this object. + * The array elements will be in same order as specified in XML. + * @return array */ public function getPrimaryKey() { - return $this->getId(); + $pks = array(); + $pks[0] = $this->getTaxRuleId(); + $pks[1] = $this->getCountryId(); + $pks[2] = $this->getTaxId(); + + return $pks; } /** - * Generic method to set the primary key (id column). + * Set the [composite] primary key. * - * @param int $key Primary key. + * @param array $keys The elements of the composite key (order must match the order in XML file). * @return void */ - public function setPrimaryKey($key) + public function setPrimaryKey($keys) { - $this->setId($key); + $this->setTaxRuleId($keys[0]); + $this->setCountryId($keys[1]); + $this->setTaxId($keys[2]); } /** @@ -1291,7 +1245,7 @@ abstract class TaxRuleCountry implements ActiveRecordInterface public function isPrimaryKeyNull() { - return null === $this->getId(); + return (null === $this->getTaxRuleId()) && (null === $this->getCountryId()) && (null === $this->getTaxId()); } /** @@ -1307,11 +1261,10 @@ abstract class TaxRuleCountry implements ActiveRecordInterface */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setId($this->getId()); $copyObj->setTaxRuleId($this->getTaxRuleId()); $copyObj->setCountryId($this->getCountryId()); $copyObj->setTaxId($this->getTaxId()); - $copyObj->setNone($this->getNone()); + $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($makeNew) { @@ -1499,11 +1452,10 @@ abstract class TaxRuleCountry implements ActiveRecordInterface */ public function clear() { - $this->id = null; $this->tax_rule_id = null; $this->country_id = null; $this->tax_id = null; - $this->none = null; + $this->position = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; diff --git a/core/lib/Thelia/Model/Base/TaxRuleCountryQuery.php b/core/lib/Thelia/Model/Base/TaxRuleCountryQuery.php index b4d4cd1c2..5674643f7 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleCountryQuery.php +++ b/core/lib/Thelia/Model/Base/TaxRuleCountryQuery.php @@ -21,19 +21,17 @@ use Thelia\Model\Map\TaxRuleCountryTableMap; * * * - * @method ChildTaxRuleCountryQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildTaxRuleCountryQuery orderByTaxRuleId($order = Criteria::ASC) Order by the tax_rule_id column * @method ChildTaxRuleCountryQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column * @method ChildTaxRuleCountryQuery orderByTaxId($order = Criteria::ASC) Order by the tax_id column - * @method ChildTaxRuleCountryQuery orderByNone($order = Criteria::ASC) Order by the none column + * @method ChildTaxRuleCountryQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildTaxRuleCountryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildTaxRuleCountryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * - * @method ChildTaxRuleCountryQuery groupById() Group by the id column * @method ChildTaxRuleCountryQuery groupByTaxRuleId() Group by the tax_rule_id column * @method ChildTaxRuleCountryQuery groupByCountryId() Group by the country_id column * @method ChildTaxRuleCountryQuery groupByTaxId() Group by the tax_id column - * @method ChildTaxRuleCountryQuery groupByNone() Group by the none column + * @method ChildTaxRuleCountryQuery groupByPosition() Group by the position column * @method ChildTaxRuleCountryQuery groupByCreatedAt() Group by the created_at column * @method ChildTaxRuleCountryQuery groupByUpdatedAt() Group by the updated_at column * @@ -56,19 +54,17 @@ use Thelia\Model\Map\TaxRuleCountryTableMap; * @method ChildTaxRuleCountry findOne(ConnectionInterface $con = null) Return the first ChildTaxRuleCountry matching the query * @method ChildTaxRuleCountry findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTaxRuleCountry matching the query, or a new ChildTaxRuleCountry object populated from the query conditions when no match is found * - * @method ChildTaxRuleCountry findOneById(int $id) Return the first ChildTaxRuleCountry filtered by the id column * @method ChildTaxRuleCountry findOneByTaxRuleId(int $tax_rule_id) Return the first ChildTaxRuleCountry filtered by the tax_rule_id column * @method ChildTaxRuleCountry findOneByCountryId(int $country_id) Return the first ChildTaxRuleCountry filtered by the country_id column * @method ChildTaxRuleCountry findOneByTaxId(int $tax_id) Return the first ChildTaxRuleCountry filtered by the tax_id column - * @method ChildTaxRuleCountry findOneByNone(int $none) Return the first ChildTaxRuleCountry filtered by the none column + * @method ChildTaxRuleCountry findOneByPosition(int $position) Return the first ChildTaxRuleCountry filtered by the position column * @method ChildTaxRuleCountry findOneByCreatedAt(string $created_at) Return the first ChildTaxRuleCountry filtered by the created_at column * @method ChildTaxRuleCountry findOneByUpdatedAt(string $updated_at) Return the first ChildTaxRuleCountry filtered by the updated_at column * - * @method array findById(int $id) Return ChildTaxRuleCountry objects filtered by the id column * @method array findByTaxRuleId(int $tax_rule_id) Return ChildTaxRuleCountry objects filtered by the tax_rule_id column * @method array findByCountryId(int $country_id) Return ChildTaxRuleCountry objects filtered by the country_id column * @method array findByTaxId(int $tax_id) Return ChildTaxRuleCountry objects filtered by the tax_id column - * @method array findByNone(int $none) Return ChildTaxRuleCountry objects filtered by the none column + * @method array findByPosition(int $position) Return ChildTaxRuleCountry objects filtered by the position column * @method array findByCreatedAt(string $created_at) Return ChildTaxRuleCountry objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildTaxRuleCountry objects filtered by the updated_at column * @@ -118,10 +114,10 @@ abstract class TaxRuleCountryQuery extends ModelCriteria * Go fast if the query is untouched. * * - * $obj = $c->findPk(12, $con); + * $obj = $c->findPk(array(12, 34, 56), $con); * * - * @param mixed $key Primary key to use for the query + * @param array[$tax_rule_id, $country_id, $tax_id] $key Primary key to use for the query * @param ConnectionInterface $con an optional connection object * * @return ChildTaxRuleCountry|array|mixed the result, formatted by the current formatter @@ -131,7 +127,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria if ($key === null) { return null; } - if ((null !== ($obj = TaxRuleCountryTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + if ((null !== ($obj = TaxRuleCountryTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1], (string) $key[2]))))) && !$this->formatter) { // the object is already in the instance pool return $obj; } @@ -159,10 +155,12 @@ abstract class TaxRuleCountryQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, TAX_RULE_ID, COUNTRY_ID, TAX_ID, NONE, CREATED_AT, UPDATED_AT FROM tax_rule_country WHERE ID = :p0'; + $sql = 'SELECT TAX_RULE_ID, COUNTRY_ID, TAX_ID, POSITION, CREATED_AT, UPDATED_AT FROM tax_rule_country WHERE TAX_RULE_ID = :p0 AND COUNTRY_ID = :p1 AND TAX_ID = :p2'; try { $stmt = $con->prepare($sql); - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); + $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); + $stmt->bindValue(':p1', $key[1], PDO::PARAM_INT); + $stmt->bindValue(':p2', $key[2], PDO::PARAM_INT); $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); @@ -172,7 +170,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { $obj = new ChildTaxRuleCountry(); $obj->hydrate($row); - TaxRuleCountryTableMap::addInstanceToPool($obj, (string) $key); + TaxRuleCountryTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1], (string) $key[2]))); } $stmt->closeCursor(); @@ -201,7 +199,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria /** * Find objects by primary key * - * $objs = $c->findPks(array(12, 56, 832), $con); + * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); * * @param array $keys Primary keys to use for the query * @param ConnectionInterface $con an optional connection object @@ -231,8 +229,11 @@ abstract class TaxRuleCountryQuery extends ModelCriteria */ public function filterByPrimaryKey($key) { + $this->addUsingAlias(TaxRuleCountryTableMap::TAX_RULE_ID, $key[0], Criteria::EQUAL); + $this->addUsingAlias(TaxRuleCountryTableMap::COUNTRY_ID, $key[1], Criteria::EQUAL); + $this->addUsingAlias(TaxRuleCountryTableMap::TAX_ID, $key[2], Criteria::EQUAL); - return $this->addUsingAlias(TaxRuleCountryTableMap::ID, $key, Criteria::EQUAL); + return $this; } /** @@ -244,49 +245,19 @@ abstract class TaxRuleCountryQuery extends ModelCriteria */ public function filterByPrimaryKeys($keys) { - - return $this->addUsingAlias(TaxRuleCountryTableMap::ID, $keys, Criteria::IN); - } - - /** - * Filter the query on the id column - * - * Example usage: - * - * $query->filterById(1234); // WHERE id = 1234 - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) - * $query->filterById(array('min' => 12)); // WHERE id > 12 - * - * - * @param mixed $id The value to use as filter. - * Use scalar values for equality. - * Use array values for in_array() equivalent. - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildTaxRuleCountryQuery The current query, for fluid interface - */ - public function filterById($id = null, $comparison = null) - { - if (is_array($id)) { - $useMinMax = false; - if (isset($id['min'])) { - $this->addUsingAlias(TaxRuleCountryTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); - $useMinMax = true; - } - if (isset($id['max'])) { - $this->addUsingAlias(TaxRuleCountryTableMap::ID, $id['max'], Criteria::LESS_EQUAL); - $useMinMax = true; - } - if ($useMinMax) { - return $this; - } - if (null === $comparison) { - $comparison = Criteria::IN; - } + if (empty($keys)) { + return $this->add(null, '1<>1', Criteria::CUSTOM); + } + foreach ($keys as $key) { + $cton0 = $this->getNewCriterion(TaxRuleCountryTableMap::TAX_RULE_ID, $key[0], Criteria::EQUAL); + $cton1 = $this->getNewCriterion(TaxRuleCountryTableMap::COUNTRY_ID, $key[1], Criteria::EQUAL); + $cton0->addAnd($cton1); + $cton2 = $this->getNewCriterion(TaxRuleCountryTableMap::TAX_ID, $key[2], Criteria::EQUAL); + $cton0->addAnd($cton2); + $this->addOr($cton0); } - return $this->addUsingAlias(TaxRuleCountryTableMap::ID, $id, $comparison); + return $this; } /** @@ -419,16 +390,16 @@ abstract class TaxRuleCountryQuery extends ModelCriteria } /** - * Filter the query on the none column + * Filter the query on the position column * * Example usage: * - * $query->filterByNone(1234); // WHERE none = 1234 - * $query->filterByNone(array(12, 34)); // WHERE none IN (12, 34) - * $query->filterByNone(array('min' => 12)); // WHERE none > 12 + * $query->filterByPosition(1234); // WHERE position = 1234 + * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34) + * $query->filterByPosition(array('min' => 12)); // WHERE position > 12 * * - * @param mixed $none The value to use as filter. + * @param mixed $position The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @@ -436,16 +407,16 @@ abstract class TaxRuleCountryQuery extends ModelCriteria * * @return ChildTaxRuleCountryQuery The current query, for fluid interface */ - public function filterByNone($none = null, $comparison = null) + public function filterByPosition($position = null, $comparison = null) { - if (is_array($none)) { + if (is_array($position)) { $useMinMax = false; - if (isset($none['min'])) { - $this->addUsingAlias(TaxRuleCountryTableMap::NONE, $none['min'], Criteria::GREATER_EQUAL); + if (isset($position['min'])) { + $this->addUsingAlias(TaxRuleCountryTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($none['max'])) { - $this->addUsingAlias(TaxRuleCountryTableMap::NONE, $none['max'], Criteria::LESS_EQUAL); + if (isset($position['max'])) { + $this->addUsingAlias(TaxRuleCountryTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -456,7 +427,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria } } - return $this->addUsingAlias(TaxRuleCountryTableMap::NONE, $none, $comparison); + return $this->addUsingAlias(TaxRuleCountryTableMap::POSITION, $position, $comparison); } /** @@ -578,7 +549,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria * * @return ChildTaxRuleCountryQuery The current query, for fluid interface */ - public function joinTax($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinTax($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Tax'); @@ -613,7 +584,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria * * @return \Thelia\Model\TaxQuery A secondary query class using the current class as primary query */ - public function useTaxQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useTaxQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinTax($relationAlias, $joinType) @@ -653,7 +624,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria * * @return ChildTaxRuleCountryQuery The current query, for fluid interface */ - public function joinTaxRule($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinTaxRule($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('TaxRule'); @@ -688,7 +659,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria * * @return \Thelia\Model\TaxRuleQuery A secondary query class using the current class as primary query */ - public function useTaxRuleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useTaxRuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinTaxRule($relationAlias, $joinType) @@ -728,7 +699,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria * * @return ChildTaxRuleCountryQuery The current query, for fluid interface */ - public function joinCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('Country'); @@ -763,7 +734,7 @@ abstract class TaxRuleCountryQuery extends ModelCriteria * * @return \Thelia\Model\CountryQuery A secondary query class using the current class as primary query */ - public function useCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinCountry($relationAlias, $joinType) @@ -780,7 +751,10 @@ abstract class TaxRuleCountryQuery extends ModelCriteria public function prune($taxRuleCountry = null) { if ($taxRuleCountry) { - $this->addUsingAlias(TaxRuleCountryTableMap::ID, $taxRuleCountry->getId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond0', $this->getAliasedColName(TaxRuleCountryTableMap::TAX_RULE_ID), $taxRuleCountry->getTaxRuleId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond1', $this->getAliasedColName(TaxRuleCountryTableMap::COUNTRY_ID), $taxRuleCountry->getCountryId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond2', $this->getAliasedColName(TaxRuleCountryTableMap::TAX_ID), $taxRuleCountry->getTaxId(), Criteria::NOT_EQUAL); + $this->combine(array('pruneCond0', 'pruneCond1', 'pruneCond2'), Criteria::LOGICAL_OR); } return $this; diff --git a/core/lib/Thelia/Model/Base/TaxRuleI18n.php b/core/lib/Thelia/Model/Base/TaxRuleI18n.php index 51bab6a77..711dba307 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleI18n.php +++ b/core/lib/Thelia/Model/Base/TaxRuleI18n.php @@ -66,6 +66,18 @@ abstract class TaxRuleI18n implements ActiveRecordInterface */ protected $locale; + /** + * The value for the title field. + * @var string + */ + protected $title; + + /** + * The value for the description field. + * @var string + */ + protected $description; + /** * @var TaxRule */ @@ -248,7 +260,7 @@ abstract class TaxRuleI18n implements ActiveRecordInterface */ public function hasVirtualColumn($name) { - return isset($this->virtualColumns[$name]); + return array_key_exists($name, $this->virtualColumns); } /** @@ -368,6 +380,28 @@ abstract class TaxRuleI18n implements ActiveRecordInterface return $this->locale; } + /** + * Get the [title] column value. + * + * @return string + */ + public function getTitle() + { + + return $this->title; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + + return $this->description; + } + /** * Set the value of [id] column. * @@ -414,6 +448,48 @@ abstract class TaxRuleI18n implements ActiveRecordInterface return $this; } // setLocale() + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return \Thelia\Model\TaxRuleI18n The current object (for fluent API support) + */ + public function setTitle($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->title !== $v) { + $this->title = $v; + $this->modifiedColumns[] = TaxRuleI18nTableMap::TITLE; + } + + + return $this; + } // setTitle() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return \Thelia\Model\TaxRuleI18n The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = TaxRuleI18nTableMap::DESCRIPTION; + } + + + return $this; + } // setDescription() + /** * Indicates whether the columns in this object are only set to default values. * @@ -460,6 +536,12 @@ abstract class TaxRuleI18n implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : TaxRuleI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; $this->locale = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : TaxRuleI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $this->title = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : TaxRuleI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; + $this->description = (null !== $col) ? (string) $col : null; $this->resetModified(); $this->setNew(false); @@ -468,7 +550,7 @@ abstract class TaxRuleI18n implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 2; // 2 = TaxRuleI18nTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 4; // 4 = TaxRuleI18nTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\TaxRuleI18n object", 0, $e); @@ -695,6 +777,12 @@ abstract class TaxRuleI18n implements ActiveRecordInterface if ($this->isColumnModified(TaxRuleI18nTableMap::LOCALE)) { $modifiedColumns[':p' . $index++] = 'LOCALE'; } + if ($this->isColumnModified(TaxRuleI18nTableMap::TITLE)) { + $modifiedColumns[':p' . $index++] = 'TITLE'; + } + if ($this->isColumnModified(TaxRuleI18nTableMap::DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + } $sql = sprintf( 'INSERT INTO tax_rule_i18n (%s) VALUES (%s)', @@ -712,6 +800,12 @@ abstract class TaxRuleI18n implements ActiveRecordInterface case 'LOCALE': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; + case 'TITLE': + $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); + break; + case 'DESCRIPTION': + $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; } } $stmt->execute(); @@ -773,6 +867,12 @@ abstract class TaxRuleI18n implements ActiveRecordInterface case 1: return $this->getLocale(); break; + case 2: + return $this->getTitle(); + break; + case 3: + return $this->getDescription(); + break; default: return null; break; @@ -804,6 +904,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getLocale(), + $keys[2] => $this->getTitle(), + $keys[3] => $this->getDescription(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -855,6 +957,12 @@ abstract class TaxRuleI18n implements ActiveRecordInterface case 1: $this->setLocale($value); break; + case 2: + $this->setTitle($value); + break; + case 3: + $this->setDescription($value); + break; } // switch() } @@ -881,6 +989,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]); } /** @@ -894,6 +1004,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface if ($this->isColumnModified(TaxRuleI18nTableMap::ID)) $criteria->add(TaxRuleI18nTableMap::ID, $this->id); if ($this->isColumnModified(TaxRuleI18nTableMap::LOCALE)) $criteria->add(TaxRuleI18nTableMap::LOCALE, $this->locale); + if ($this->isColumnModified(TaxRuleI18nTableMap::TITLE)) $criteria->add(TaxRuleI18nTableMap::TITLE, $this->title); + if ($this->isColumnModified(TaxRuleI18nTableMap::DESCRIPTION)) $criteria->add(TaxRuleI18nTableMap::DESCRIPTION, $this->description); return $criteria; } @@ -966,6 +1078,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface { $copyObj->setId($this->getId()); $copyObj->setLocale($this->getLocale()); + $copyObj->setTitle($this->getTitle()); + $copyObj->setDescription($this->getDescription()); if ($makeNew) { $copyObj->setNew(true); } @@ -1051,6 +1165,8 @@ abstract class TaxRuleI18n implements ActiveRecordInterface { $this->id = null; $this->locale = null; + $this->title = null; + $this->description = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->applyDefaultValues(); diff --git a/core/lib/Thelia/Model/Base/TaxRuleI18nQuery.php b/core/lib/Thelia/Model/Base/TaxRuleI18nQuery.php index 02667f4ac..dfb3e100c 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleI18nQuery.php +++ b/core/lib/Thelia/Model/Base/TaxRuleI18nQuery.php @@ -23,9 +23,13 @@ use Thelia\Model\Map\TaxRuleI18nTableMap; * * @method ChildTaxRuleI18nQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildTaxRuleI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column + * @method ChildTaxRuleI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column + * @method ChildTaxRuleI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column * * @method ChildTaxRuleI18nQuery groupById() Group by the id column * @method ChildTaxRuleI18nQuery groupByLocale() Group by the locale column + * @method ChildTaxRuleI18nQuery groupByTitle() Group by the title column + * @method ChildTaxRuleI18nQuery groupByDescription() Group by the description column * * @method ChildTaxRuleI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildTaxRuleI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -40,9 +44,13 @@ use Thelia\Model\Map\TaxRuleI18nTableMap; * * @method ChildTaxRuleI18n findOneById(int $id) Return the first ChildTaxRuleI18n filtered by the id column * @method ChildTaxRuleI18n findOneByLocale(string $locale) Return the first ChildTaxRuleI18n filtered by the locale column + * @method ChildTaxRuleI18n findOneByTitle(string $title) Return the first ChildTaxRuleI18n filtered by the title column + * @method ChildTaxRuleI18n findOneByDescription(string $description) Return the first ChildTaxRuleI18n filtered by the description column * * @method array findById(int $id) Return ChildTaxRuleI18n objects filtered by the id column * @method array findByLocale(string $locale) Return ChildTaxRuleI18n objects filtered by the locale column + * @method array findByTitle(string $title) Return ChildTaxRuleI18n objects filtered by the title column + * @method array findByDescription(string $description) Return ChildTaxRuleI18n objects filtered by the description column * */ abstract class TaxRuleI18nQuery extends ModelCriteria @@ -131,7 +139,7 @@ abstract class TaxRuleI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE FROM tax_rule_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION FROM tax_rule_i18n WHERE ID = :p0 AND LOCALE = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -304,6 +312,64 @@ abstract class TaxRuleI18nQuery extends ModelCriteria return $this->addUsingAlias(TaxRuleI18nTableMap::LOCALE, $locale, $comparison); } + /** + * Filter the query on the title column + * + * Example usage: + * + * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' + * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' + * + * + * @param string $title The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildTaxRuleI18nQuery The current query, for fluid interface + */ + public function filterByTitle($title = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($title)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $title)) { + $title = str_replace('*', '%', $title); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(TaxRuleI18nTableMap::TITLE, $title, $comparison); + } + + /** + * Filter the query on the description column + * + * Example usage: + * + * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' + * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' + * + * + * @param string $description The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildTaxRuleI18nQuery The current query, for fluid interface + */ + public function filterByDescription($description = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($description)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $description)) { + $description = str_replace('*', '%', $description); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(TaxRuleI18nTableMap::DESCRIPTION, $description, $comparison); + } + /** * Filter the query by a related \Thelia\Model\TaxRule object * diff --git a/core/lib/Thelia/Model/Base/TaxRuleQuery.php b/core/lib/Thelia/Model/Base/TaxRuleQuery.php index 2fb478b7a..8ee264415 100644 --- a/core/lib/Thelia/Model/Base/TaxRuleQuery.php +++ b/core/lib/Thelia/Model/Base/TaxRuleQuery.php @@ -23,16 +23,10 @@ use Thelia\Model\Map\TaxRuleTableMap; * * * @method ChildTaxRuleQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildTaxRuleQuery orderByCode($order = Criteria::ASC) Order by the code column - * @method ChildTaxRuleQuery orderByTitle($order = Criteria::ASC) Order by the title column - * @method ChildTaxRuleQuery orderByDescription($order = Criteria::ASC) Order by the description column * @method ChildTaxRuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildTaxRuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildTaxRuleQuery groupById() Group by the id column - * @method ChildTaxRuleQuery groupByCode() Group by the code column - * @method ChildTaxRuleQuery groupByTitle() Group by the title column - * @method ChildTaxRuleQuery groupByDescription() Group by the description column * @method ChildTaxRuleQuery groupByCreatedAt() Group by the created_at column * @method ChildTaxRuleQuery groupByUpdatedAt() Group by the updated_at column * @@ -56,16 +50,10 @@ use Thelia\Model\Map\TaxRuleTableMap; * @method ChildTaxRule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTaxRule matching the query, or a new ChildTaxRule object populated from the query conditions when no match is found * * @method ChildTaxRule findOneById(int $id) Return the first ChildTaxRule filtered by the id column - * @method ChildTaxRule findOneByCode(string $code) Return the first ChildTaxRule filtered by the code column - * @method ChildTaxRule findOneByTitle(string $title) Return the first ChildTaxRule filtered by the title column - * @method ChildTaxRule findOneByDescription(string $description) Return the first ChildTaxRule filtered by the description column * @method ChildTaxRule findOneByCreatedAt(string $created_at) Return the first ChildTaxRule filtered by the created_at column * @method ChildTaxRule findOneByUpdatedAt(string $updated_at) Return the first ChildTaxRule filtered by the updated_at column * * @method array findById(int $id) Return ChildTaxRule objects filtered by the id column - * @method array findByCode(string $code) Return ChildTaxRule objects filtered by the code column - * @method array findByTitle(string $title) Return ChildTaxRule objects filtered by the title column - * @method array findByDescription(string $description) Return ChildTaxRule objects filtered by the description column * @method array findByCreatedAt(string $created_at) Return ChildTaxRule objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildTaxRule objects filtered by the updated_at column * @@ -156,7 +144,7 @@ abstract class TaxRuleQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, TITLE, DESCRIPTION, CREATED_AT, UPDATED_AT FROM tax_rule WHERE ID = :p0'; + $sql = 'SELECT ID, CREATED_AT, UPDATED_AT FROM tax_rule WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -286,93 +274,6 @@ abstract class TaxRuleQuery extends ModelCriteria return $this->addUsingAlias(TaxRuleTableMap::ID, $id, $comparison); } - /** - * Filter the query on the code column - * - * Example usage: - * - * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' - * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' - * - * - * @param string $code The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildTaxRuleQuery The current query, for fluid interface - */ - public function filterByCode($code = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($code)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $code)) { - $code = str_replace('*', '%', $code); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(TaxRuleTableMap::CODE, $code, $comparison); - } - - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildTaxRuleQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(TaxRuleTableMap::TITLE, $title, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildTaxRuleQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(TaxRuleTableMap::DESCRIPTION, $description, $comparison); - } - /** * Filter the query on the created_at column * @@ -563,7 +464,7 @@ abstract class TaxRuleQuery extends ModelCriteria * * @return ChildTaxRuleQuery The current query, for fluid interface */ - public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function joinTaxRuleCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); $relationMap = $tableMap->getRelation('TaxRuleCountry'); @@ -598,7 +499,7 @@ abstract class TaxRuleQuery extends ModelCriteria * * @return \Thelia\Model\TaxRuleCountryQuery A secondary query class using the current class as primary query */ - public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + public function useTaxRuleCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this ->joinTaxRuleCountry($relationAlias, $joinType) diff --git a/core/lib/Thelia/Model/Cart.php b/core/lib/Thelia/Model/Cart.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/CartItem.php b/core/lib/Thelia/Model/CartItem.php old mode 100644 new mode 100755 index 39408763e..5ef6048a5 --- a/core/lib/Thelia/Model/CartItem.php +++ b/core/lib/Thelia/Model/CartItem.php @@ -4,10 +4,10 @@ namespace Thelia\Model; use Propel\Runtime\Connection\ConnectionInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Thelia\Core\Event\Internal\CartEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Base\CartItem as BaseCartItem; use Thelia\Model\ConfigQuery; +use Thelia\Core\Event\CartEvent; class CartItem extends BaseCartItem { @@ -32,7 +32,7 @@ class CartItem extends BaseCartItem if ($this->dispatcher) { $cartEvent = new CartEvent($this->getCart()); - $this->dispatcher->dispatch(TheliaEvents::AFTER_CARTCHANGEITEM, $cartEvent); + $this->dispatcher->dispatch(TheliaEvents::AFTER_CARTUPDATEITEM, $cartEvent); } } diff --git a/core/lib/Thelia/Model/CartItemQuery.php b/core/lib/Thelia/Model/CartItemQuery.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/CartQuery.php b/core/lib/Thelia/Model/CartQuery.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php index 35ac49e0e..ced10c94b 100755 --- a/core/lib/Thelia/Model/Category.php +++ b/core/lib/Thelia/Model/Category.php @@ -2,10 +2,19 @@ namespace Thelia\Model; +use Thelia\Core\Event\CategoryEvent; use Thelia\Model\Base\Category as BaseCategory; use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Tools\URL; +use Thelia\Core\Event\TheliaEvents; +use Propel\Runtime\Connection\ConnectionInterface; + +class Category extends BaseCategory +{ + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + + use \Thelia\Model\Tools\PositionManagementTrait; -class Category extends BaseCategory { /** * @return int number of child for the current category */ @@ -14,10 +23,11 @@ class Category extends BaseCategory { return CategoryQuery::countChild($this->getId()); } - public function getUrl() + public function getUrl($locale) { - + return URL::getInstance()->retrieve('category', $this->getId(), $locale)->toString(); } + /** * Create a new category. * @@ -38,18 +48,6 @@ class Category extends BaseCategory { $this->save(); } - public function getNextPosition($parent) { - - $last = CategoryQuery::create() - ->filterByParent($parent) - ->orderByPosition(Criteria::DESC) - ->limit(1) - ->findOne() - ; - - return $last->getPosition() + 1; - } - /** * * count all products for current category and sub categories @@ -71,8 +69,39 @@ class Category extends BaseCategory { } return $countProduct; - } + public function preInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY, new CategoryEvent($this)); -} + return true; + } + + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATECATEGORY, new CategoryEvent($this)); + } + + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECATEGORY, new CategoryEvent($this)); + + return true; + } + + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_UPDATECATEGORY, new CategoryEvent($this)); + } + + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETECATEGORY, new CategoryEvent($this)); + } + + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETECATEGORY, new CategoryEvent($this)); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/CategoryAssociatedContent.php b/core/lib/Thelia/Model/CategoryAssociatedContent.php new file mode 100644 index 000000000..9296e6274 --- /dev/null +++ b/core/lib/Thelia/Model/CategoryAssociatedContent.php @@ -0,0 +1,9 @@ +. */ +/* */ +/*************************************************************************************/ namespace Thelia\Model; use Thelia\Model\Base\Config as BaseConfig; +use Propel\Runtime\Connection\ConnectionInterface; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Event\ConfigEvent; class Config extends BaseConfig { -} + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CREATECONFIG, new ConfigEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATECONFIG, new ConfigEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECONFIG, new ConfigEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_UPDATECONFIG, new ConfigEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETECONFIG, new ConfigEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETECONFIG, new ConfigEvent($this)); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/ConfigQuery.php b/core/lib/Thelia/Model/ConfigQuery.php index b00ef7d8c..87b506e93 100755 --- a/core/lib/Thelia/Model/ConfigQuery.php +++ b/core/lib/Thelia/Model/ConfigQuery.php @@ -22,4 +22,24 @@ class ConfigQuery extends BaseConfigQuery { return $value ? $value->getValue() : $default; } + + public static function getDefaultLangWhenNoTranslationAvailable() + { + return ConfigQuery::read("default_lang_without_translation", 1); + } + + public static function isRewritingEnable() + { + return self::read("rewriting_enable") == 1; + } + + public static function getPageNotFoundView() + { + return self::read("page_not_found_view", '404.html'); + } + + public static function getActiveTemplate() + { + return self::read('active-template', 'default'); + } } // ConfigQuery diff --git a/core/lib/Thelia/Model/Content.php b/core/lib/Thelia/Model/Content.php index 19b76bba2..5bc0ba6b2 100755 --- a/core/lib/Thelia/Model/Content.php +++ b/core/lib/Thelia/Model/Content.php @@ -3,7 +3,12 @@ namespace Thelia\Model; use Thelia\Model\Base\Content as BaseContent; +use Thelia\Tools\URL; -class Content extends BaseContent { - +class Content extends BaseContent +{ + public function getUrl($locale) + { + return URL::getInstance()->retrieve('content', $this->getId(), $locale)->toString(); + } } diff --git a/core/lib/Thelia/Model/ContentAssoc.php b/core/lib/Thelia/Model/ContentAssoc.php deleted file mode 100755 index 0723ef537..000000000 --- a/core/lib/Thelia/Model/ContentAssoc.php +++ /dev/null @@ -1,9 +0,0 @@ -. */ +/* */ +/**********************************************************************************/ namespace Thelia\Model; +use Propel\Runtime\Propel; +use Thelia\Constraint\Rule\CouponRuleInterface; +use Thelia\Coupon\CouponRuleCollection; use Thelia\Model\Base\Coupon as BaseCoupon; +use Thelia\Model\Map\CouponTableMap; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Used to provide an effect (mostly a discount) + * at the end of the Customer checkout tunnel + * It will be usable for a Customer only if it matches the Coupon criteria (Rules) + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class Coupon extends BaseCoupon +{ + + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + + + /** + * Constructor + * + * @param string $code Coupon Code + * @param string $title Coupon title + * @param float $amount Amount removed from the Total Checkout + * @param string $effect Coupon effect + * @param string $shortDescription Coupon short description + * @param string $description Coupon description + * @param boolean $isEnabled Enable/Disable + * @param \DateTime $expirationDate Coupon expiration date + * @param boolean $isAvailableOnSpecialOffers Is available on special offers + * @param boolean $isCumulative Is cumulative + * @param boolean $isRemovingPostage Is removing Postage + * @param int $maxUsage Coupon quantity + * @param CouponRuleCollection $rules CouponRuleInterface to add + * @param string $locale Coupon Language code ISO (ex: fr_FR) + */ + function createOrUpdate($code, $title, $amount, $effect, $shortDescription, $description, $isEnabled, $expirationDate, $isAvailableOnSpecialOffers, $isCumulative, $maxUsage, $rules, $locale = null) + { + $this->setCode($code) + ->setTitle($title) + ->setShortDescription($shortDescription) + ->setDescription($description) + ->setType($effect) + ->setAmount($amount) + ->setType($amount) + ->setIsEnabled($isEnabled) + ->setExpirationDate($expirationDate) + ->setIsAvailableOnSpecialOffers($isAvailableOnSpecialOffers) + ->setIsCumulative($isCumulative) + ->setMaxUsage($maxUsage) + ->setRules($rules); + + // Set object language (i18n) + if (!is_null($locale)) { + $this->setLocale($locale); + } + + $con = Propel::getWriteConnection(CouponTableMap::DATABASE_NAME); + $con->beginTransaction(); + try { + $this->save($con); + $con->commit(); + + } catch(\Exception $e) { + $con->rollback(); + throw $e; + } + } + +// /** +// * Set the value of [serialized_rules] column. +// * Convert a CouponRuleCollection into a serialized array of SerializableRule +// * +// * @param CouponRuleCollection $rules A set of Rules +// * +// * @return \Thelia\Model\Coupon The current object (for fluent API support) +// */ +// public function setRules(CouponRuleCollection $rules) +// { +// $serializedRules = null; +// if ($rules !== null) { +// /** @var $rule CouponRuleInterface */ +// foreach ($rules->getRules() as $rule) { +// $serializedRules[] = $rule->getSerializableRule(); +// } +// +// $serializedRules = (string) base64_encode(serialize($serializedRules)); +// } +// +// if ($this->serialized_rules !== $serializedRules) { +// $this->serialized_rules = $serializedRules; +// $this->modifiedColumns[] = CouponTableMap::SERIALIZED_RULES; +// } +// +// return $this; +// } + -class Coupon extends BaseCoupon { } diff --git a/core/lib/Thelia/Model/CouponI18n.php b/core/lib/Thelia/Model/CouponI18n.php new file mode 100644 index 000000000..ee34845ac --- /dev/null +++ b/core/lib/Thelia/Model/CouponI18n.php @@ -0,0 +1,9 @@ +dispatchEvent(TheliaEvents::BEFORE_CREATECURRENCY, new CurrencyEvent($this)); + + // Set the current position for the new object + $this->setPosition($this->getNextPosition()); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATECURRENCY, new CurrencyEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECURRENCY, new CurrencyEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_UPDATECURRENCY, new CurrencyEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETECURRENCY, new CurrencyEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETECURRENCY, new CurrencyEvent($this)); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/CurrencyI18n.php b/core/lib/Thelia/Model/CurrencyI18n.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/CurrencyI18nQuery.php b/core/lib/Thelia/Model/CurrencyI18nQuery.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php index a6a4927b2..080c02ed6 100755 --- a/core/lib/Thelia/Model/Customer.php +++ b/core/lib/Thelia/Model/Customer.php @@ -2,8 +2,8 @@ namespace Thelia\Model; -use Symfony\Component\Config\Definition\Exception\Exception; -use Thelia\Core\Event\Internal\CustomerEvent; +use Propel\Runtime\Exception\PropelException; +use Thelia\Model\AddressQuery; use Thelia\Model\Base\Customer as BaseCustomer; use Thelia\Model\Exception\InvalidArgumentException; @@ -17,6 +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; /** * Skeleton subclass for representing a row from the 'customer' table. @@ -31,10 +32,7 @@ use Thelia\Core\Security\Role\Role; */ class Customer extends BaseCustomer implements UserInterface { - /** - * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface - */ - protected $dispatcher; + use \Thelia\Model\Tools\ModelEventDispatcherTrait; /** * @param int $titleId customer title id (from customer_title table) @@ -77,84 +75,74 @@ class Customer extends BaseCustomer implements UserInterface $con = Propel::getWriteConnection(CustomerTableMap::DATABASE_NAME); $con->beginTransaction(); try { + if ($this->isNew()) { + $address = new Address(); + + $address + ->setTitleId($titleId) + ->setFirstname($firstname) + ->setLastname($lastname) + ->setAddress1($address1) + ->setAddress2($address2) + ->setAddress3($address3) + ->setPhone($phone) + ->setCellphone($cellphone) + ->setZipcode($zipcode) + ->setCountryId($countryId) + ->setIsDefault(1) + ; + + $this->addAddress($address); + + } else { + $address = $this->getDefaultAddress(); + + $address + ->setTitleId($titleId) + ->setFirstname($firstname) + ->setLastname($lastname) + ->setAddress1($address1) + ->setAddress2($address2) + ->setAddress3($address3) + ->setPhone($phone) + ->setCellphone($cellphone) + ->setZipcode($zipcode) + ->setCountryId($countryId) + ->save($con) + ; + } $this->save($con); - $address = new Address(); - - $address - ->setTitleId($titleId) - ->setFirstname($firstname) - ->setLastname($lastname) - ->setAddress1($address1) - ->setAddress2($address2) - ->setAddress3($address3) - ->setPhone($phone) - ->setCellphone($cellphone) - ->setZipcode($zipcode) - ->setCountryId($countryId) - ->setIsDefault(1) - ->setCustomer($this) - ->save($con); - $con->commit(); - - } catch(Exception $e) { + } catch(PropelException $e) { $con->rollback(); throw $e; } } - public function preInsert(ConnectionInterface $con = null) - { - $this->setRef($this->generateRef()); - $customerEvent = new CustomerEvent($this); - - $this->dispatchEvent(TheliaEvents::BEFORE_CREATECUSTOMER, $customerEvent); - - return true; - } - - public function postInsert(ConnectionInterface $con = null) - { - $customerEvent = new CustomerEvent($this); - - $this->dispatchEvent(TheliaEvents::AFTER_CREATECUSTOMER, $customerEvent); - - } - - public function preUpdate(ConnectionInterface $con = null) - { - $customerEvent = new CustomerEvent($this); - $this->dispatchEvent(TheliaEvents::BEFORE_CHANGECUSTOMER, $customerEvent); - - return true; - } - - public function postUpdate(ConnectionInterface $con = null) - { - $customerEvent = new CustomerEvent($this); - $this->dispatchEvent(TheliaEvents::AFTER_CHANGECUSTOMER, $customerEvent); - } - - protected function dispatchEvent($eventName, CustomerEvent $customerEvent) - { - if (!is_null($this->dispatcher)) { - $this->dispatcher->dispatch($eventName, $customerEvent); - } - } - protected function generateRef() { return uniqid(substr($this->getLastname(), 0, (strlen($this->getLastname()) >= 3) ? 3 : strlen($this->getLastname())), true); } + /** + * @return Address + */ + public function getDefaultAddress() + { + return AddressQuery::create() + ->filterByCustomer($this) + ->filterByIsDefault(1) + ->findOne(); + } + /** * create hash for plain password and set it in Customer object * * @param string $password plain password before hashing + * @throws Exception\InvalidArgumentException * @return $this|Customer - * @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException */ public function setPassword($password) { @@ -184,11 +172,6 @@ class Customer extends BaseCustomer implements UserInterface return parent::setEmail($email); } - public function setDispatcher(EventDispatcherInterface $dispatcher) - { - $this->dispatcher = $dispatcher; - } - /** * {@inheritDoc} */ @@ -217,4 +200,57 @@ class Customer extends BaseCustomer implements UserInterface public function getRoles() { return array(new Role('CUSTOMER')); } + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->setRef($this->generateRef()); + + $this->dispatchEvent(TheliaEvents::BEFORE_CREATECUSTOMER, new CustomerEvent($this)); + return true; + } + + /** + * {@inheritDoc} + */ + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATECUSTOMER, new CustomerEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECUSTOMER, new CustomerEvent($this)); + return true; + } + + /** + * {@inheritDoc} + */ + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_UPDATECUSTOMER, new CustomerEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETECONFIG, new CustomerEvent($this)); + return true; + } + + /** + * {@inheritDoc} + */ + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETECONFIG, new CustomerEvent($this)); + } } diff --git a/core/lib/Thelia/Model/Exception/InvalidArgumentException.php b/core/lib/Thelia/Model/Exception/InvalidArgumentException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/Exception/ModelException.php b/core/lib/Thelia/Model/Exception/ModelException.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/FeatureProduct.php b/core/lib/Thelia/Model/FeatureProduct.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/FeatureProductQuery.php b/core/lib/Thelia/Model/FeatureProductQuery.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/Folder.php b/core/lib/Thelia/Model/Folder.php index a19ab6796..8151dae0e 100755 --- a/core/lib/Thelia/Model/Folder.php +++ b/core/lib/Thelia/Model/Folder.php @@ -3,6 +3,7 @@ namespace Thelia\Model; use Thelia\Model\Base\Folder as BaseFolder; +use Thelia\Tools\URL; class Folder extends BaseFolder { @@ -14,6 +15,11 @@ class Folder extends BaseFolder return FolderQuery::countChild($this->getId()); } + public function getUrl($locale) + { + return URL::getInstance()->retrieve('folder', $this->getId(), $locale)->toString(); + } + /** * * count all products for current category and sub categories diff --git a/core/lib/Thelia/Model/FolderDocument.php b/core/lib/Thelia/Model/FolderDocument.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/FolderDocumentI18n.php b/core/lib/Thelia/Model/FolderDocumentI18n.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/FolderDocumentI18nQuery.php b/core/lib/Thelia/Model/FolderDocumentI18nQuery.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/FolderDocumentQuery.php b/core/lib/Thelia/Model/FolderDocumentQuery.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/FolderImage.php b/core/lib/Thelia/Model/FolderImage.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/FolderImageI18n.php b/core/lib/Thelia/Model/FolderImageI18n.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/FolderImageI18nQuery.php b/core/lib/Thelia/Model/FolderImageI18nQuery.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/FolderImageQuery.php b/core/lib/Thelia/Model/FolderImageQuery.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/Lang.php b/core/lib/Thelia/Model/Lang.php index d63422680..3c45ade33 100755 --- a/core/lib/Thelia/Model/Lang.php +++ b/core/lib/Thelia/Model/Lang.php @@ -6,4 +6,18 @@ use Thelia\Model\Base\Lang as BaseLang; class Lang extends BaseLang { + /** + * Return the default language object, using a local variable to cache it. + * + * @throws \RuntimeException + */ + public static function getDefaultLanguage() { + + + $default_lang = LangQuery::create()->findOneByByDefault(1); + + if ($default_lang == null) throw new \RuntimeException("No default language is defined. Please define one."); + + return $default_lang; + } } diff --git a/core/lib/Thelia/Model/Map/AccessoryTableMap.php b/core/lib/Thelia/Model/Map/AccessoryTableMap.php index 80c0548ef..bcd663892 100644 --- a/core/lib/Thelia/Model/Map/AccessoryTableMap.php +++ b/core/lib/Thelia/Model/Map/AccessoryTableMap.php @@ -148,7 +148,7 @@ class AccessoryTableMap extends TableMap $this->setPhpName('Accessory'); $this->setClassName('\\Thelia\\Model\\Accessory'); $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(false); + $this->setUseIdGenerator(true); $this->setIsCrossRef(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); @@ -429,6 +429,10 @@ class AccessoryTableMap extends TableMap $criteria = $criteria->buildCriteria(); // build Criteria from Accessory object } + if ($criteria->containsKey(AccessoryTableMap::ID) && $criteria->keyContainsValue(AccessoryTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.AccessoryTableMap::ID.')'); + } + // Set the correct dbName $query = AccessoryQuery::create()->mergeWith($criteria); diff --git a/core/lib/Thelia/Model/Map/AddressTableMap.php b/core/lib/Thelia/Model/Map/AddressTableMap.php index dabd6a54e..46e2be02d 100644 --- a/core/lib/Thelia/Model/Map/AddressTableMap.php +++ b/core/lib/Thelia/Model/Map/AddressTableMap.php @@ -75,9 +75,9 @@ class AddressTableMap extends TableMap const ID = 'address.ID'; /** - * the column name for the NAME field + * the column name for the LABEL field */ - const NAME = 'address.NAME'; + const LABEL = 'address.LABEL'; /** * the column name for the CUSTOMER_ID field @@ -171,11 +171,11 @@ class AddressTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Name', 'CustomerId', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'name', 'customerId', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::NAME, AddressTableMap::CUSTOMER_ID, AddressTableMap::TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'CUSTOMER_ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'name', 'customer_id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ), + self::TYPE_PHPNAME => array('Id', 'Label', 'CustomerId', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'label', 'customerId', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::LABEL, AddressTableMap::CUSTOMER_ID, AddressTableMap::TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'LABEL', 'CUSTOMER_ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'label', 'customer_id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) ); @@ -186,11 +186,11 @@ class AddressTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'CustomerId' => 2, 'TitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'customerId' => 2, 'titleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ), - self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::NAME => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'CUSTOMER_ID' => 2, 'TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'customer_id' => 2, 'title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ), + self::TYPE_PHPNAME => array('Id' => 0, 'Label' => 1, 'CustomerId' => 2, 'TitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'label' => 1, 'customerId' => 2, 'titleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ), + self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::LABEL => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LABEL' => 1, 'CUSTOMER_ID' => 2, 'TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ), + self::TYPE_FIELDNAME => array('id' => 0, 'label' => 1, 'customer_id' => 2, 'title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) ); @@ -211,7 +211,7 @@ class AddressTableMap extends TableMap $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('NAME', 'Name', 'VARCHAR', false, 255, null); + $this->addColumn('LABEL', 'Label', 'VARCHAR', false, 255, null); $this->addForeignKey('CUSTOMER_ID', 'CustomerId', 'INTEGER', 'customer', 'ID', true, null, null); $this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null); $this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null); @@ -394,7 +394,7 @@ class AddressTableMap extends TableMap { if (null === $alias) { $criteria->addSelectColumn(AddressTableMap::ID); - $criteria->addSelectColumn(AddressTableMap::NAME); + $criteria->addSelectColumn(AddressTableMap::LABEL); $criteria->addSelectColumn(AddressTableMap::CUSTOMER_ID); $criteria->addSelectColumn(AddressTableMap::TITLE_ID); $criteria->addSelectColumn(AddressTableMap::COMPANY); @@ -413,7 +413,7 @@ class AddressTableMap extends TableMap $criteria->addSelectColumn(AddressTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.NAME'); + $criteria->addSelectColumn($alias . '.LABEL'); $criteria->addSelectColumn($alias . '.CUSTOMER_ID'); $criteria->addSelectColumn($alias . '.TITLE_ID'); $criteria->addSelectColumn($alias . '.COMPANY'); diff --git a/core/lib/Thelia/Model/Map/ContentAssocTableMap.php b/core/lib/Thelia/Model/Map/CategoryAssociatedContentTableMap.php similarity index 68% rename from core/lib/Thelia/Model/Map/ContentAssocTableMap.php rename to core/lib/Thelia/Model/Map/CategoryAssociatedContentTableMap.php index b080bea83..c78d59506 100644 --- a/core/lib/Thelia/Model/Map/ContentAssocTableMap.php +++ b/core/lib/Thelia/Model/Map/CategoryAssociatedContentTableMap.php @@ -10,12 +10,12 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\RelationMap; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMapTrait; -use Thelia\Model\ContentAssoc; -use Thelia\Model\ContentAssocQuery; +use Thelia\Model\CategoryAssociatedContent; +use Thelia\Model\CategoryAssociatedContentQuery; /** - * This class defines the structure of the 'content_assoc' table. + * This class defines the structure of the 'category_associated_content' table. * * * @@ -25,14 +25,14 @@ use Thelia\Model\ContentAssocQuery; * (i.e. if it's a text column type). * */ -class ContentAssocTableMap extends TableMap +class CategoryAssociatedContentTableMap extends TableMap { use InstancePoolTrait; use TableMapTrait; /** * The (dot-path) name of this class */ - const CLASS_NAME = 'Thelia.Model.Map.ContentAssocTableMap'; + const CLASS_NAME = 'Thelia.Model.Map.CategoryAssociatedContentTableMap'; /** * The default database name for this class @@ -42,22 +42,22 @@ class ContentAssocTableMap extends TableMap /** * The table name for this class */ - const TABLE_NAME = 'content_assoc'; + const TABLE_NAME = 'category_associated_content'; /** * The related Propel class for this table */ - const OM_CLASS = '\\Thelia\\Model\\ContentAssoc'; + const OM_CLASS = '\\Thelia\\Model\\CategoryAssociatedContent'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'Thelia.Model.ContentAssoc'; + const CLASS_DEFAULT = 'Thelia.Model.CategoryAssociatedContent'; /** * The total number of columns */ - const NUM_COLUMNS = 7; + const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns @@ -67,42 +67,37 @@ class ContentAssocTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 7; + const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the ID field */ - const ID = 'content_assoc.ID'; + const ID = 'category_associated_content.ID'; /** * the column name for the CATEGORY_ID field */ - const CATEGORY_ID = 'content_assoc.CATEGORY_ID'; - - /** - * the column name for the PRODUCT_ID field - */ - const PRODUCT_ID = 'content_assoc.PRODUCT_ID'; + const CATEGORY_ID = 'category_associated_content.CATEGORY_ID'; /** * the column name for the CONTENT_ID field */ - const CONTENT_ID = 'content_assoc.CONTENT_ID'; + const CONTENT_ID = 'category_associated_content.CONTENT_ID'; /** * the column name for the POSITION field */ - const POSITION = 'content_assoc.POSITION'; + const POSITION = 'category_associated_content.POSITION'; /** * the column name for the CREATED_AT field */ - const CREATED_AT = 'content_assoc.CREATED_AT'; + const CREATED_AT = 'category_associated_content.CREATED_AT'; /** * the column name for the UPDATED_AT field */ - const UPDATED_AT = 'content_assoc.UPDATED_AT'; + const UPDATED_AT = 'category_associated_content.UPDATED_AT'; /** * The default string format for model objects of the related table @@ -116,12 +111,12 @@ class ContentAssocTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'CategoryId', 'ProductId', 'ContentId', 'Position', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'categoryId', 'productId', 'contentId', 'position', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(ContentAssocTableMap::ID, ContentAssocTableMap::CATEGORY_ID, ContentAssocTableMap::PRODUCT_ID, ContentAssocTableMap::CONTENT_ID, ContentAssocTableMap::POSITION, ContentAssocTableMap::CREATED_AT, ContentAssocTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'CATEGORY_ID', 'PRODUCT_ID', 'CONTENT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'category_id', 'product_id', 'content_id', 'position', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('Id', 'CategoryId', 'ContentId', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'categoryId', 'contentId', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(CategoryAssociatedContentTableMap::ID, CategoryAssociatedContentTableMap::CATEGORY_ID, CategoryAssociatedContentTableMap::CONTENT_ID, CategoryAssociatedContentTableMap::POSITION, CategoryAssociatedContentTableMap::CREATED_AT, CategoryAssociatedContentTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'CATEGORY_ID', 'CONTENT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'category_id', 'content_id', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -131,12 +126,12 @@ class ContentAssocTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'CategoryId' => 1, 'ProductId' => 2, 'ContentId' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'categoryId' => 1, 'productId' => 2, 'contentId' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - self::TYPE_COLNAME => array(ContentAssocTableMap::ID => 0, ContentAssocTableMap::CATEGORY_ID => 1, ContentAssocTableMap::PRODUCT_ID => 2, ContentAssocTableMap::CONTENT_ID => 3, ContentAssocTableMap::POSITION => 4, ContentAssocTableMap::CREATED_AT => 5, ContentAssocTableMap::UPDATED_AT => 6, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CATEGORY_ID' => 1, 'PRODUCT_ID' => 2, 'CONTENT_ID' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - self::TYPE_FIELDNAME => array('id' => 0, 'category_id' => 1, 'product_id' => 2, 'content_id' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('Id' => 0, 'CategoryId' => 1, 'ContentId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'categoryId' => 1, 'contentId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), + self::TYPE_COLNAME => array(CategoryAssociatedContentTableMap::ID => 0, CategoryAssociatedContentTableMap::CATEGORY_ID => 1, CategoryAssociatedContentTableMap::CONTENT_ID => 2, CategoryAssociatedContentTableMap::POSITION => 3, CategoryAssociatedContentTableMap::CREATED_AT => 4, CategoryAssociatedContentTableMap::UPDATED_AT => 5, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CATEGORY_ID' => 1, 'CONTENT_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), + self::TYPE_FIELDNAME => array('id' => 0, 'category_id' => 1, 'content_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -149,17 +144,16 @@ class ContentAssocTableMap extends TableMap public function initialize() { // attributes - $this->setName('content_assoc'); - $this->setPhpName('ContentAssoc'); - $this->setClassName('\\Thelia\\Model\\ContentAssoc'); + $this->setName('category_associated_content'); + $this->setPhpName('CategoryAssociatedContent'); + $this->setClassName('\\Thelia\\Model\\CategoryAssociatedContent'); $this->setPackage('Thelia.Model'); $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', false, null, null); - $this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', false, null, null); - $this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', false, null, null); - $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null); + $this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', true, null, null); + $this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', true, null, null); + $this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -170,7 +164,6 @@ class ContentAssocTableMap extends TableMap public function buildRelations() { $this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT'); - $this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT'); $this->addRelation('Content', '\\Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT'); } // buildRelations() @@ -243,7 +236,7 @@ class ContentAssocTableMap extends TableMap */ public static function getOMClass($withPrefix = true) { - return $withPrefix ? ContentAssocTableMap::CLASS_DEFAULT : ContentAssocTableMap::OM_CLASS; + return $withPrefix ? CategoryAssociatedContentTableMap::CLASS_DEFAULT : CategoryAssociatedContentTableMap::OM_CLASS; } /** @@ -257,21 +250,21 @@ class ContentAssocTableMap extends TableMap * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (ContentAssoc object, last column rank) + * @return array (CategoryAssociatedContent object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - $key = ContentAssocTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = ContentAssocTableMap::getInstanceFromPool($key))) { + $key = CategoryAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = CategoryAssociatedContentTableMap::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, $offset, true); // rehydrate - $col = $offset + ContentAssocTableMap::NUM_HYDRATE_COLUMNS; + $col = $offset + CategoryAssociatedContentTableMap::NUM_HYDRATE_COLUMNS; } else { - $cls = ContentAssocTableMap::OM_CLASS; + $cls = CategoryAssociatedContentTableMap::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); - ContentAssocTableMap::addInstanceToPool($obj, $key); + CategoryAssociatedContentTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); @@ -294,8 +287,8 @@ class ContentAssocTableMap extends TableMap $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { - $key = ContentAssocTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = ContentAssocTableMap::getInstanceFromPool($key))) { + $key = CategoryAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = CategoryAssociatedContentTableMap::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, 0, true); // rehydrate @@ -304,7 +297,7 @@ class ContentAssocTableMap extends TableMap $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; - ContentAssocTableMap::addInstanceToPool($obj, $key); + CategoryAssociatedContentTableMap::addInstanceToPool($obj, $key); } // if key exists } @@ -325,17 +318,15 @@ class ContentAssocTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(ContentAssocTableMap::ID); - $criteria->addSelectColumn(ContentAssocTableMap::CATEGORY_ID); - $criteria->addSelectColumn(ContentAssocTableMap::PRODUCT_ID); - $criteria->addSelectColumn(ContentAssocTableMap::CONTENT_ID); - $criteria->addSelectColumn(ContentAssocTableMap::POSITION); - $criteria->addSelectColumn(ContentAssocTableMap::CREATED_AT); - $criteria->addSelectColumn(ContentAssocTableMap::UPDATED_AT); + $criteria->addSelectColumn(CategoryAssociatedContentTableMap::ID); + $criteria->addSelectColumn(CategoryAssociatedContentTableMap::CATEGORY_ID); + $criteria->addSelectColumn(CategoryAssociatedContentTableMap::CONTENT_ID); + $criteria->addSelectColumn(CategoryAssociatedContentTableMap::POSITION); + $criteria->addSelectColumn(CategoryAssociatedContentTableMap::CREATED_AT); + $criteria->addSelectColumn(CategoryAssociatedContentTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.CATEGORY_ID'); - $criteria->addSelectColumn($alias . '.PRODUCT_ID'); $criteria->addSelectColumn($alias . '.CONTENT_ID'); $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); @@ -352,7 +343,7 @@ class ContentAssocTableMap extends TableMap */ public static function getTableMap() { - return Propel::getServiceContainer()->getDatabaseMap(ContentAssocTableMap::DATABASE_NAME)->getTable(ContentAssocTableMap::TABLE_NAME); + return Propel::getServiceContainer()->getDatabaseMap(CategoryAssociatedContentTableMap::DATABASE_NAME)->getTable(CategoryAssociatedContentTableMap::TABLE_NAME); } /** @@ -360,16 +351,16 @@ class ContentAssocTableMap extends TableMap */ public static function buildTableMap() { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(ContentAssocTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(ContentAssocTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new ContentAssocTableMap()); + $dbMap = Propel::getServiceContainer()->getDatabaseMap(CategoryAssociatedContentTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(CategoryAssociatedContentTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new CategoryAssociatedContentTableMap()); } } /** - * Performs a DELETE on the database, given a ContentAssoc or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a CategoryAssociatedContent or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ContentAssoc object or primary key or array of primary keys + * @param mixed $values Criteria or CategoryAssociatedContent object or primary key or array of primary keys * which is used to create the DELETE statement * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows @@ -380,25 +371,25 @@ class ContentAssocTableMap extends TableMap public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ContentAssocTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(CategoryAssociatedContentTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; - } elseif ($values instanceof \Thelia\Model\ContentAssoc) { // it's a model object + } elseif ($values instanceof \Thelia\Model\CategoryAssociatedContent) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks - $criteria = new Criteria(ContentAssocTableMap::DATABASE_NAME); - $criteria->add(ContentAssocTableMap::ID, (array) $values, Criteria::IN); + $criteria = new Criteria(CategoryAssociatedContentTableMap::DATABASE_NAME); + $criteria->add(CategoryAssociatedContentTableMap::ID, (array) $values, Criteria::IN); } - $query = ContentAssocQuery::create()->mergeWith($criteria); + $query = CategoryAssociatedContentQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { ContentAssocTableMap::clearInstancePool(); + if ($values instanceof Criteria) { CategoryAssociatedContentTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { ContentAssocTableMap::removeInstanceFromPool($singleval); + foreach ((array) $values as $singleval) { CategoryAssociatedContentTableMap::removeInstanceFromPool($singleval); } } @@ -406,20 +397,20 @@ class ContentAssocTableMap extends TableMap } /** - * Deletes all rows from the content_assoc table. + * Deletes all rows from the category_associated_content table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ public static function doDeleteAll(ConnectionInterface $con = null) { - return ContentAssocQuery::create()->doDeleteAll($con); + return CategoryAssociatedContentQuery::create()->doDeleteAll($con); } /** - * Performs an INSERT on the database, given a ContentAssoc or Criteria object. + * Performs an INSERT on the database, given a CategoryAssociatedContent or Criteria object. * - * @param mixed $criteria Criteria or ContentAssoc object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or CategoryAssociatedContent object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use * @return mixed The new primary key. * @throws PropelException Any exceptions caught during processing will be @@ -428,22 +419,22 @@ class ContentAssocTableMap extends TableMap public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ContentAssocTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(CategoryAssociatedContentTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { - $criteria = $criteria->buildCriteria(); // build Criteria from ContentAssoc object + $criteria = $criteria->buildCriteria(); // build Criteria from CategoryAssociatedContent object } - if ($criteria->containsKey(ContentAssocTableMap::ID) && $criteria->keyContainsValue(ContentAssocTableMap::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ContentAssocTableMap::ID.')'); + if ($criteria->containsKey(CategoryAssociatedContentTableMap::ID) && $criteria->keyContainsValue(CategoryAssociatedContentTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CategoryAssociatedContentTableMap::ID.')'); } // Set the correct dbName - $query = ContentAssocQuery::create()->mergeWith($criteria); + $query = CategoryAssociatedContentQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info @@ -459,7 +450,7 @@ class ContentAssocTableMap extends TableMap return $pk; } -} // ContentAssocTableMap +} // CategoryAssociatedContentTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // -ContentAssocTableMap::buildTableMap(); +CategoryAssociatedContentTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/CategoryTableMap.php b/core/lib/Thelia/Model/Map/CategoryTableMap.php index 5e02d04c5..6a2d052a1 100644 --- a/core/lib/Thelia/Model/Map/CategoryTableMap.php +++ b/core/lib/Thelia/Model/Map/CategoryTableMap.php @@ -193,10 +193,9 @@ class CategoryTableMap extends TableMap $this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories'); $this->addRelation('FeatureCategory', '\\Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'FeatureCategories'); $this->addRelation('AttributeCategory', '\\Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategories'); - $this->addRelation('ContentAssoc', '\\Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'ContentAssocs'); - $this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Rewritings'); $this->addRelation('CategoryImage', '\\Thelia\\Model\\CategoryImage', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryImages'); $this->addRelation('CategoryDocument', '\\Thelia\\Model\\CategoryDocument', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryDocuments'); + $this->addRelation('CategoryAssociatedContent', '\\Thelia\\Model\\CategoryAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryAssociatedContents'); $this->addRelation('CategoryI18n', '\\Thelia\\Model\\CategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryI18ns'); $this->addRelation('CategoryVersion', '\\Thelia\\Model\\CategoryVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryVersions'); $this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Products'); @@ -228,10 +227,9 @@ class CategoryTableMap extends TableMap ProductCategoryTableMap::clearInstancePool(); FeatureCategoryTableMap::clearInstancePool(); AttributeCategoryTableMap::clearInstancePool(); - ContentAssocTableMap::clearInstancePool(); - RewritingTableMap::clearInstancePool(); CategoryImageTableMap::clearInstancePool(); CategoryDocumentTableMap::clearInstancePool(); + CategoryAssociatedContentTableMap::clearInstancePool(); CategoryI18nTableMap::clearInstancePool(); CategoryVersionTableMap::clearInstancePool(); } diff --git a/core/lib/Thelia/Model/Map/ContentTableMap.php b/core/lib/Thelia/Model/Map/ContentTableMap.php index 4a489cedb..ae9b908c0 100644 --- a/core/lib/Thelia/Model/Map/ContentTableMap.php +++ b/core/lib/Thelia/Model/Map/ContentTableMap.php @@ -184,11 +184,11 @@ class ContentTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('ContentAssoc', '\\Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentAssocs'); - $this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'Rewritings'); $this->addRelation('ContentFolder', '\\Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders'); $this->addRelation('ContentImage', '\\Thelia\\Model\\ContentImage', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentImages'); $this->addRelation('ContentDocument', '\\Thelia\\Model\\ContentDocument', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentDocuments'); + $this->addRelation('ProductAssociatedContent', '\\Thelia\\Model\\ProductAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ProductAssociatedContents'); + $this->addRelation('CategoryAssociatedContent', '\\Thelia\\Model\\CategoryAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'CategoryAssociatedContents'); $this->addRelation('ContentI18n', '\\Thelia\\Model\\ContentI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentI18ns'); $this->addRelation('ContentVersion', '\\Thelia\\Model\\ContentVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentVersions'); $this->addRelation('Folder', '\\Thelia\\Model\\Folder', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Folders'); @@ -215,11 +215,11 @@ class ContentTableMap extends TableMap { // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - ContentAssocTableMap::clearInstancePool(); - RewritingTableMap::clearInstancePool(); ContentFolderTableMap::clearInstancePool(); ContentImageTableMap::clearInstancePool(); ContentDocumentTableMap::clearInstancePool(); + ProductAssociatedContentTableMap::clearInstancePool(); + CategoryAssociatedContentTableMap::clearInstancePool(); ContentI18nTableMap::clearInstancePool(); ContentVersionTableMap::clearInstancePool(); } diff --git a/core/lib/Thelia/Model/Map/CouponI18nTableMap.php b/core/lib/Thelia/Model/Map/CouponI18nTableMap.php new file mode 100644 index 000000000..46ecdce3b --- /dev/null +++ b/core/lib/Thelia/Model/Map/CouponI18nTableMap.php @@ -0,0 +1,489 @@ + array('Id', 'Locale', 'Title', 'ShortDescription', 'Description', ), + self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'shortDescription', 'description', ), + self::TYPE_COLNAME => array(CouponI18nTableMap::ID, CouponI18nTableMap::LOCALE, CouponI18nTableMap::TITLE, CouponI18nTableMap::SHORT_DESCRIPTION, CouponI18nTableMap::DESCRIPTION, ), + self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', ), + self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'short_description', 'description', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'ShortDescription' => 3, 'Description' => 4, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'shortDescription' => 3, 'description' => 4, ), + self::TYPE_COLNAME => array(CouponI18nTableMap::ID => 0, CouponI18nTableMap::LOCALE => 1, CouponI18nTableMap::TITLE => 2, CouponI18nTableMap::SHORT_DESCRIPTION => 3, CouponI18nTableMap::DESCRIPTION => 4, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'SHORT_DESCRIPTION' => 3, 'DESCRIPTION' => 4, ), + self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'short_description' => 3, 'description' => 4, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('coupon_i18n'); + $this->setPhpName('CouponI18n'); + $this->setClassName('\\Thelia\\Model\\CouponI18n'); + $this->setPackage('Thelia.Model'); + $this->setUseIdGenerator(false); + // columns + $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); + $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); + $this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null); + $this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null); + } // buildRelations() + + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by find*() + * and findPk*() calls. + * + * @param \Thelia\Model\CouponI18n $obj A \Thelia\Model\CouponI18n object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool($obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if (null === $key) { + $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale())); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A \Thelia\Model\CouponI18n object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && null !== $value) { + if (is_object($value) && $value instanceof \Thelia\Model\CouponI18n) { + $key = serialize(array((string) $value->getId(), (string) $value->getLocale())); + + } elseif (is_array($value) && count($value) === 2) { + // assume we've been passed a primary key"; + $key = serialize(array((string) $value[0], (string) $value[1])); + } elseif ($value instanceof Criteria) { + self::$instances = []; + + return; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\CouponI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + */ + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)] === null) { + return null; + } + + return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)])); + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + + return $pks; + } + + /** + * The class that the tableMap will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is translated into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CouponI18nTableMap::CLASS_DEFAULT : CouponI18nTableMap::OM_CLASS; + } + + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CouponI18n object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = CouponI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = CouponI18nTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $offset, true); // rehydrate + $col = $offset + CouponI18nTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = CouponI18nTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + CouponI18nTableMap::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @param DataFetcherInterface $dataFetcher + * @return array + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(DataFetcherInterface $dataFetcher) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = static::getOMClass(false); + // populate the object(s) + while ($row = $dataFetcher->fetch()) { + $key = CouponI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = CouponI18nTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CouponI18nTableMap::addInstanceToPool($obj, $key); + } // if key exists + } + + return $results; + } + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CouponI18nTableMap::ID); + $criteria->addSelectColumn(CouponI18nTableMap::LOCALE); + $criteria->addSelectColumn(CouponI18nTableMap::TITLE); + $criteria->addSelectColumn(CouponI18nTableMap::SHORT_DESCRIPTION); + $criteria->addSelectColumn(CouponI18nTableMap::DESCRIPTION); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.LOCALE'); + $criteria->addSelectColumn($alias . '.TITLE'); + $criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION'); + $criteria->addSelectColumn($alias . '.DESCRIPTION'); + } + } + + /** + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getServiceContainer()->getDatabaseMap(CouponI18nTableMap::DATABASE_NAME)->getTable(CouponI18nTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponI18nTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(CouponI18nTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new CouponI18nTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a CouponI18n or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CouponI18n object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \Thelia\Model\CouponI18n) { // it's a model object + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(CouponI18nTableMap::DATABASE_NAME); + // primary key is composite; we therefore, expect + // the primary key passed to be an array of pkey values + if (count($values) == count($values, COUNT_RECURSIVE)) { + // array is not multi-dimensional + $values = array($values); + } + foreach ($values as $value) { + $criterion = $criteria->getNewCriterion(CouponI18nTableMap::ID, $value[0]); + $criterion->addAnd($criteria->getNewCriterion(CouponI18nTableMap::LOCALE, $value[1])); + $criteria->addOr($criterion); + } + } + + $query = CouponI18nQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { CouponI18nTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { CouponI18nTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the coupon_i18n table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll(ConnectionInterface $con = null) + { + return CouponI18nQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a CouponI18n or Criteria object. + * + * @param mixed $criteria Criteria or CouponI18n object containing data that is used to create the INSERT statement. + * @param ConnectionInterface $con the ConnectionInterface connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($criteria, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponI18nTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from CouponI18n object + } + + + // Set the correct dbName + $query = CouponI18nQuery::create()->mergeWith($criteria); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = $query->doInsert($con); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + +} // CouponI18nTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +CouponI18nTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/CouponOrderTableMap.php b/core/lib/Thelia/Model/Map/CouponOrderTableMap.php index 9d91ef068..d96183505 100644 --- a/core/lib/Thelia/Model/Map/CouponOrderTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponOrderTableMap.php @@ -57,7 +57,7 @@ class CouponOrderTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 6; + const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class CouponOrderTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 6; + const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the ID field @@ -79,11 +79,6 @@ class CouponOrderTableMap extends TableMap */ const ORDER_ID = 'coupon_order.ORDER_ID'; - /** - * the column name for the CODE field - */ - const CODE = 'coupon_order.CODE'; - /** * the column name for the VALUE field */ @@ -111,12 +106,12 @@ class CouponOrderTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'OrderId', 'Code', 'Value', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'code', 'value', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(CouponOrderTableMap::ID, CouponOrderTableMap::ORDER_ID, CouponOrderTableMap::CODE, CouponOrderTableMap::VALUE, CouponOrderTableMap::CREATED_AT, CouponOrderTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'CODE', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'order_id', 'code', 'value', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id', 'OrderId', 'Value', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'value', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(CouponOrderTableMap::ID, CouponOrderTableMap::ORDER_ID, CouponOrderTableMap::VALUE, CouponOrderTableMap::CREATED_AT, CouponOrderTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'order_id', 'value', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -126,12 +121,12 @@ class CouponOrderTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Code' => 2, 'Value' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'code' => 2, 'value' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), - self::TYPE_COLNAME => array(CouponOrderTableMap::ID => 0, CouponOrderTableMap::ORDER_ID => 1, CouponOrderTableMap::CODE => 2, CouponOrderTableMap::VALUE => 3, CouponOrderTableMap::CREATED_AT => 4, CouponOrderTableMap::UPDATED_AT => 5, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'CODE' => 2, 'VALUE' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), - self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'code' => 2, 'value' => 3, 'created_at' => 4, 'updated_at' => 5, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Value' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'value' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), + self::TYPE_COLNAME => array(CouponOrderTableMap::ID => 0, CouponOrderTableMap::ORDER_ID => 1, CouponOrderTableMap::VALUE => 2, CouponOrderTableMap::CREATED_AT => 3, CouponOrderTableMap::UPDATED_AT => 4, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'VALUE' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), + self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'value' => 2, 'created_at' => 3, 'updated_at' => 4, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -152,7 +147,6 @@ class CouponOrderTableMap extends TableMap // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null); - $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); $this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -319,14 +313,12 @@ class CouponOrderTableMap extends TableMap if (null === $alias) { $criteria->addSelectColumn(CouponOrderTableMap::ID); $criteria->addSelectColumn(CouponOrderTableMap::ORDER_ID); - $criteria->addSelectColumn(CouponOrderTableMap::CODE); $criteria->addSelectColumn(CouponOrderTableMap::VALUE); $criteria->addSelectColumn(CouponOrderTableMap::CREATED_AT); $criteria->addSelectColumn(CouponOrderTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ORDER_ID'); - $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.VALUE'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); diff --git a/core/lib/Thelia/Model/Map/CouponTableMap.php b/core/lib/Thelia/Model/Map/CouponTableMap.php index d1ff79ac0..bd9079be6 100644 --- a/core/lib/Thelia/Model/Map/CouponTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponTableMap.php @@ -57,7 +57,7 @@ class CouponTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 10; + const NUM_COLUMNS = 15; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class CouponTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 10; + const NUM_HYDRATE_COLUMNS = 15; /** * the column name for the ID field @@ -80,34 +80,54 @@ class CouponTableMap extends TableMap const CODE = 'coupon.CODE'; /** - * the column name for the ACTION field + * the column name for the TYPE field */ - const ACTION = 'coupon.ACTION'; + const TYPE = 'coupon.TYPE'; /** - * the column name for the VALUE field + * the column name for the AMOUNT field */ - const VALUE = 'coupon.VALUE'; + const AMOUNT = 'coupon.AMOUNT'; /** - * the column name for the USED field + * the column name for the IS_USED field */ - const USED = 'coupon.USED'; + const IS_USED = 'coupon.IS_USED'; /** - * the column name for the AVAILABLE_SINCE field + * the column name for the IS_ENABLED field */ - const AVAILABLE_SINCE = 'coupon.AVAILABLE_SINCE'; + const IS_ENABLED = 'coupon.IS_ENABLED'; /** - * the column name for the DATE_LIMIT field + * the column name for the EXPIRATION_DATE field */ - const DATE_LIMIT = 'coupon.DATE_LIMIT'; + const EXPIRATION_DATE = 'coupon.EXPIRATION_DATE'; /** - * the column name for the ACTIVATE field + * the column name for the SERIALIZED_RULES field */ - const ACTIVATE = 'coupon.ACTIVATE'; + const SERIALIZED_RULES = 'coupon.SERIALIZED_RULES'; + + /** + * the column name for the IS_CUMULATIVE field + */ + const IS_CUMULATIVE = 'coupon.IS_CUMULATIVE'; + + /** + * the column name for the IS_REMOVING_POSTAGE field + */ + const IS_REMOVING_POSTAGE = 'coupon.IS_REMOVING_POSTAGE'; + + /** + * the column name for the MAX_USAGE field + */ + const MAX_USAGE = 'coupon.MAX_USAGE'; + + /** + * the column name for the IS_AVAILABLE_ON_SPECIAL_OFFERS field + */ + const IS_AVAILABLE_ON_SPECIAL_OFFERS = 'coupon.IS_AVAILABLE_ON_SPECIAL_OFFERS'; /** * the column name for the CREATED_AT field @@ -119,11 +139,25 @@ class CouponTableMap extends TableMap */ const UPDATED_AT = 'coupon.UPDATED_AT'; + /** + * the column name for the VERSION field + */ + const VERSION = 'coupon.VERSION'; + /** * The default string format for model objects of the related table */ const DEFAULT_STRING_FORMAT = 'YAML'; + // i18n behavior + + /** + * The default locale to use for translations. + * + * @var string + */ + const DEFAULT_LOCALE = 'en_US'; + /** * holds an array of fieldnames * @@ -131,12 +165,12 @@ class CouponTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Action', 'Value', 'Used', 'AvailableSince', 'DateLimit', 'Activate', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'action', 'value', 'used', 'availableSince', 'dateLimit', 'activate', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::ACTION, CouponTableMap::VALUE, CouponTableMap::USED, CouponTableMap::AVAILABLE_SINCE, CouponTableMap::DATE_LIMIT, CouponTableMap::ACTIVATE, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'ACTION', 'VALUE', 'USED', 'AVAILABLE_SINCE', 'DATE_LIMIT', 'ACTIVATE', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'code', 'action', 'value', 'used', 'available_since', 'date_limit', 'activate', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) + self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ), + self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ), + self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::AMOUNT, CouponTableMap::IS_USED, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::SERIALIZED_RULES, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ), + self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), + self::TYPE_FIELDNAME => array('id', 'code', 'type', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -146,12 +180,12 @@ class CouponTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Action' => 2, 'Value' => 3, 'Used' => 4, 'AvailableSince' => 5, 'DateLimit' => 6, 'Activate' => 7, 'CreatedAt' => 8, 'UpdatedAt' => 9, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'action' => 2, 'value' => 3, 'used' => 4, 'availableSince' => 5, 'dateLimit' => 6, 'activate' => 7, 'createdAt' => 8, 'updatedAt' => 9, ), - self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::ACTION => 2, CouponTableMap::VALUE => 3, CouponTableMap::USED => 4, CouponTableMap::AVAILABLE_SINCE => 5, CouponTableMap::DATE_LIMIT => 6, CouponTableMap::ACTIVATE => 7, CouponTableMap::CREATED_AT => 8, CouponTableMap::UPDATED_AT => 9, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'ACTION' => 2, 'VALUE' => 3, 'USED' => 4, 'AVAILABLE_SINCE' => 5, 'DATE_LIMIT' => 6, 'ACTIVATE' => 7, 'CREATED_AT' => 8, 'UPDATED_AT' => 9, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'action' => 2, 'value' => 3, 'used' => 4, 'available_since' => 5, 'date_limit' => 6, 'activate' => 7, 'created_at' => 8, 'updated_at' => 9, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Amount' => 3, 'IsUsed' => 4, 'IsEnabled' => 5, 'ExpirationDate' => 6, 'SerializedRules' => 7, 'IsCumulative' => 8, 'IsRemovingPostage' => 9, 'MaxUsage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'isUsed' => 4, 'isEnabled' => 5, 'expirationDate' => 6, 'serializedRules' => 7, 'isCumulative' => 8, 'isRemovingPostage' => 9, 'maxUsage' => 10, 'isAvailableOnSpecialOffers' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, ), + self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::AMOUNT => 3, CouponTableMap::IS_USED => 4, CouponTableMap::IS_ENABLED => 5, CouponTableMap::EXPIRATION_DATE => 6, CouponTableMap::SERIALIZED_RULES => 7, CouponTableMap::IS_CUMULATIVE => 8, CouponTableMap::IS_REMOVING_POSTAGE => 9, CouponTableMap::MAX_USAGE => 10, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, CouponTableMap::CREATED_AT => 12, CouponTableMap::UPDATED_AT => 13, CouponTableMap::VERSION => 14, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'AMOUNT' => 3, 'IS_USED' => 4, 'IS_ENABLED' => 5, 'EXPIRATION_DATE' => 6, 'SERIALIZED_RULES' => 7, 'IS_CUMULATIVE' => 8, 'IS_REMOVING_POSTAGE' => 9, 'MAX_USAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, ), + self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'is_used' => 4, 'is_enabled' => 5, 'expiration_date' => 6, 'serialized_rules' => 7, 'is_cumulative' => 8, 'is_removing_postage' => 9, 'max_usage' => 10, 'is_available_on_special_offers' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -172,14 +206,19 @@ class CouponTableMap extends TableMap // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); - $this->addColumn('ACTION', 'Action', 'VARCHAR', true, 255, null); - $this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null); - $this->addColumn('USED', 'Used', 'TINYINT', false, null, null); - $this->addColumn('AVAILABLE_SINCE', 'AvailableSince', 'TIMESTAMP', false, null, null); - $this->addColumn('DATE_LIMIT', 'DateLimit', 'TIMESTAMP', false, null, null); - $this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null); + $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null); + $this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null); + $this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null); + $this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null); + $this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null); + $this->addColumn('SERIALIZED_RULES', 'SerializedRules', 'LONGVARCHAR', true, null, null); + $this->addColumn('IS_CUMULATIVE', 'IsCumulative', 'TINYINT', true, null, null); + $this->addColumn('IS_REMOVING_POSTAGE', 'IsRemovingPostage', 'TINYINT', true, null, null); + $this->addColumn('MAX_USAGE', 'MaxUsage', 'INTEGER', true, null, null); + $this->addColumn('IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IsAvailableOnSpecialOffers', 'BOOLEAN', true, 1, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); + $this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0); } // initialize() /** @@ -187,7 +226,8 @@ class CouponTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('CouponRule', '\\Thelia\\Model\\CouponRule', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', 'RESTRICT', 'CouponRules'); + $this->addRelation('CouponI18n', '\\Thelia\\Model\\CouponI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponI18ns'); + $this->addRelation('CouponVersion', '\\Thelia\\Model\\CouponVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponVersions'); } // buildRelations() /** @@ -200,6 +240,8 @@ class CouponTableMap extends TableMap { return array( 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), + 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, short_description, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), + 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'false', 'log_created_by' => 'false', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ), ); } // getBehaviors() /** @@ -209,7 +251,8 @@ class CouponTableMap extends TableMap { // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - CouponRuleTableMap::clearInstancePool(); + CouponI18nTableMap::clearInstancePool(); + CouponVersionTableMap::clearInstancePool(); } /** @@ -352,25 +395,35 @@ class CouponTableMap extends TableMap if (null === $alias) { $criteria->addSelectColumn(CouponTableMap::ID); $criteria->addSelectColumn(CouponTableMap::CODE); - $criteria->addSelectColumn(CouponTableMap::ACTION); - $criteria->addSelectColumn(CouponTableMap::VALUE); - $criteria->addSelectColumn(CouponTableMap::USED); - $criteria->addSelectColumn(CouponTableMap::AVAILABLE_SINCE); - $criteria->addSelectColumn(CouponTableMap::DATE_LIMIT); - $criteria->addSelectColumn(CouponTableMap::ACTIVATE); + $criteria->addSelectColumn(CouponTableMap::TYPE); + $criteria->addSelectColumn(CouponTableMap::AMOUNT); + $criteria->addSelectColumn(CouponTableMap::IS_USED); + $criteria->addSelectColumn(CouponTableMap::IS_ENABLED); + $criteria->addSelectColumn(CouponTableMap::EXPIRATION_DATE); + $criteria->addSelectColumn(CouponTableMap::SERIALIZED_RULES); + $criteria->addSelectColumn(CouponTableMap::IS_CUMULATIVE); + $criteria->addSelectColumn(CouponTableMap::IS_REMOVING_POSTAGE); + $criteria->addSelectColumn(CouponTableMap::MAX_USAGE); + $criteria->addSelectColumn(CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS); $criteria->addSelectColumn(CouponTableMap::CREATED_AT); $criteria->addSelectColumn(CouponTableMap::UPDATED_AT); + $criteria->addSelectColumn(CouponTableMap::VERSION); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.CODE'); - $criteria->addSelectColumn($alias . '.ACTION'); - $criteria->addSelectColumn($alias . '.VALUE'); - $criteria->addSelectColumn($alias . '.USED'); - $criteria->addSelectColumn($alias . '.AVAILABLE_SINCE'); - $criteria->addSelectColumn($alias . '.DATE_LIMIT'); - $criteria->addSelectColumn($alias . '.ACTIVATE'); + $criteria->addSelectColumn($alias . '.TYPE'); + $criteria->addSelectColumn($alias . '.AMOUNT'); + $criteria->addSelectColumn($alias . '.IS_USED'); + $criteria->addSelectColumn($alias . '.IS_ENABLED'); + $criteria->addSelectColumn($alias . '.EXPIRATION_DATE'); + $criteria->addSelectColumn($alias . '.SERIALIZED_RULES'); + $criteria->addSelectColumn($alias . '.IS_CUMULATIVE'); + $criteria->addSelectColumn($alias . '.IS_REMOVING_POSTAGE'); + $criteria->addSelectColumn($alias . '.MAX_USAGE'); + $criteria->addSelectColumn($alias . '.IS_AVAILABLE_ON_SPECIAL_OFFERS'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); + $criteria->addSelectColumn($alias . '.VERSION'); } } diff --git a/core/lib/Thelia/Model/Map/CouponVersionTableMap.php b/core/lib/Thelia/Model/Map/CouponVersionTableMap.php new file mode 100644 index 000000000..30ce279b8 --- /dev/null +++ b/core/lib/Thelia/Model/Map/CouponVersionTableMap.php @@ -0,0 +1,569 @@ + array('Id', 'Code', 'Type', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ), + self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ), + self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::AMOUNT, CouponVersionTableMap::IS_USED, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::SERIALIZED_RULES, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ), + self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), + self::TYPE_FIELDNAME => array('id', 'code', 'type', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Amount' => 3, 'IsUsed' => 4, 'IsEnabled' => 5, 'ExpirationDate' => 6, 'SerializedRules' => 7, 'IsCumulative' => 8, 'IsRemovingPostage' => 9, 'MaxUsage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'isUsed' => 4, 'isEnabled' => 5, 'expirationDate' => 6, 'serializedRules' => 7, 'isCumulative' => 8, 'isRemovingPostage' => 9, 'maxUsage' => 10, 'isAvailableOnSpecialOffers' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, ), + self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::AMOUNT => 3, CouponVersionTableMap::IS_USED => 4, CouponVersionTableMap::IS_ENABLED => 5, CouponVersionTableMap::EXPIRATION_DATE => 6, CouponVersionTableMap::SERIALIZED_RULES => 7, CouponVersionTableMap::IS_CUMULATIVE => 8, CouponVersionTableMap::IS_REMOVING_POSTAGE => 9, CouponVersionTableMap::MAX_USAGE => 10, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, CouponVersionTableMap::CREATED_AT => 12, CouponVersionTableMap::UPDATED_AT => 13, CouponVersionTableMap::VERSION => 14, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'AMOUNT' => 3, 'IS_USED' => 4, 'IS_ENABLED' => 5, 'EXPIRATION_DATE' => 6, 'SERIALIZED_RULES' => 7, 'IS_CUMULATIVE' => 8, 'IS_REMOVING_POSTAGE' => 9, 'MAX_USAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, ), + self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'is_used' => 4, 'is_enabled' => 5, 'expiration_date' => 6, 'serialized_rules' => 7, 'is_cumulative' => 8, 'is_removing_postage' => 9, 'max_usage' => 10, 'is_available_on_special_offers' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('coupon_version'); + $this->setPhpName('CouponVersion'); + $this->setClassName('\\Thelia\\Model\\CouponVersion'); + $this->setPackage('Thelia.Model'); + $this->setUseIdGenerator(false); + // columns + $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null); + $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); + $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null); + $this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null); + $this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null); + $this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null); + $this->addColumn('EXPIRATION_DATE', 'ExpirationDate', 'TIMESTAMP', true, null, null); + $this->addColumn('SERIALIZED_RULES', 'SerializedRules', 'LONGVARCHAR', true, null, null); + $this->addColumn('IS_CUMULATIVE', 'IsCumulative', 'TINYINT', true, null, null); + $this->addColumn('IS_REMOVING_POSTAGE', 'IsRemovingPostage', 'TINYINT', true, null, null); + $this->addColumn('MAX_USAGE', 'MaxUsage', 'INTEGER', true, null, null); + $this->addColumn('IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IsAvailableOnSpecialOffers', 'BOOLEAN', true, 1, null); + $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); + $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); + $this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null); + } // buildRelations() + + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by find*() + * and findPk*() calls. + * + * @param \Thelia\Model\CouponVersion $obj A \Thelia\Model\CouponVersion object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool($obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if (null === $key) { + $key = serialize(array((string) $obj->getId(), (string) $obj->getVersion())); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A \Thelia\Model\CouponVersion object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && null !== $value) { + if (is_object($value) && $value instanceof \Thelia\Model\CouponVersion) { + $key = serialize(array((string) $value->getId(), (string) $value->getVersion())); + + } elseif (is_array($value) && count($value) === 2) { + // assume we've been passed a primary key"; + $key = serialize(array((string) $value[0], (string) $value[1])); + } elseif ($value instanceof Criteria) { + self::$instances = []; + + return; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\CouponVersion object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + */ + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 14 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) { + return null; + } + + return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 14 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + + return $pks; + } + + /** + * The class that the tableMap will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is translated into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CouponVersionTableMap::CLASS_DEFAULT : CouponVersionTableMap::OM_CLASS; + } + + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CouponVersion object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = CouponVersionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = CouponVersionTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $offset, true); // rehydrate + $col = $offset + CouponVersionTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = CouponVersionTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + CouponVersionTableMap::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @param DataFetcherInterface $dataFetcher + * @return array + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(DataFetcherInterface $dataFetcher) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = static::getOMClass(false); + // populate the object(s) + while ($row = $dataFetcher->fetch()) { + $key = CouponVersionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = CouponVersionTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CouponVersionTableMap::addInstanceToPool($obj, $key); + } // if key exists + } + + return $results; + } + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CouponVersionTableMap::ID); + $criteria->addSelectColumn(CouponVersionTableMap::CODE); + $criteria->addSelectColumn(CouponVersionTableMap::TYPE); + $criteria->addSelectColumn(CouponVersionTableMap::AMOUNT); + $criteria->addSelectColumn(CouponVersionTableMap::IS_USED); + $criteria->addSelectColumn(CouponVersionTableMap::IS_ENABLED); + $criteria->addSelectColumn(CouponVersionTableMap::EXPIRATION_DATE); + $criteria->addSelectColumn(CouponVersionTableMap::SERIALIZED_RULES); + $criteria->addSelectColumn(CouponVersionTableMap::IS_CUMULATIVE); + $criteria->addSelectColumn(CouponVersionTableMap::IS_REMOVING_POSTAGE); + $criteria->addSelectColumn(CouponVersionTableMap::MAX_USAGE); + $criteria->addSelectColumn(CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS); + $criteria->addSelectColumn(CouponVersionTableMap::CREATED_AT); + $criteria->addSelectColumn(CouponVersionTableMap::UPDATED_AT); + $criteria->addSelectColumn(CouponVersionTableMap::VERSION); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.CODE'); + $criteria->addSelectColumn($alias . '.TYPE'); + $criteria->addSelectColumn($alias . '.AMOUNT'); + $criteria->addSelectColumn($alias . '.IS_USED'); + $criteria->addSelectColumn($alias . '.IS_ENABLED'); + $criteria->addSelectColumn($alias . '.EXPIRATION_DATE'); + $criteria->addSelectColumn($alias . '.SERIALIZED_RULES'); + $criteria->addSelectColumn($alias . '.IS_CUMULATIVE'); + $criteria->addSelectColumn($alias . '.IS_REMOVING_POSTAGE'); + $criteria->addSelectColumn($alias . '.MAX_USAGE'); + $criteria->addSelectColumn($alias . '.IS_AVAILABLE_ON_SPECIAL_OFFERS'); + $criteria->addSelectColumn($alias . '.CREATED_AT'); + $criteria->addSelectColumn($alias . '.UPDATED_AT'); + $criteria->addSelectColumn($alias . '.VERSION'); + } + } + + /** + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getServiceContainer()->getDatabaseMap(CouponVersionTableMap::DATABASE_NAME)->getTable(CouponVersionTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponVersionTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(CouponVersionTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new CouponVersionTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a CouponVersion or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CouponVersion object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponVersionTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \Thelia\Model\CouponVersion) { // it's a model object + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(CouponVersionTableMap::DATABASE_NAME); + // primary key is composite; we therefore, expect + // the primary key passed to be an array of pkey values + if (count($values) == count($values, COUNT_RECURSIVE)) { + // array is not multi-dimensional + $values = array($values); + } + foreach ($values as $value) { + $criterion = $criteria->getNewCriterion(CouponVersionTableMap::ID, $value[0]); + $criterion->addAnd($criteria->getNewCriterion(CouponVersionTableMap::VERSION, $value[1])); + $criteria->addOr($criterion); + } + } + + $query = CouponVersionQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { CouponVersionTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { CouponVersionTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the coupon_version table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll(ConnectionInterface $con = null) + { + return CouponVersionQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a CouponVersion or Criteria object. + * + * @param mixed $criteria Criteria or CouponVersion object containing data that is used to create the INSERT statement. + * @param ConnectionInterface $con the ConnectionInterface connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($criteria, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(CouponVersionTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from CouponVersion object + } + + + // Set the correct dbName + $query = CouponVersionQuery::create()->mergeWith($criteria); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = $query->doInsert($con); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + +} // CouponVersionTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +CouponVersionTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/FolderTableMap.php b/core/lib/Thelia/Model/Map/FolderTableMap.php index 1bfe2cd6e..b35f63ae3 100644 --- a/core/lib/Thelia/Model/Map/FolderTableMap.php +++ b/core/lib/Thelia/Model/Map/FolderTableMap.php @@ -190,7 +190,6 @@ class FolderTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'Rewritings'); $this->addRelation('ContentFolder', '\\Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders'); $this->addRelation('FolderImage', '\\Thelia\\Model\\FolderImage', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'FolderImages'); $this->addRelation('FolderDocument', '\\Thelia\\Model\\FolderDocument', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'FolderDocuments'); @@ -220,7 +219,6 @@ class FolderTableMap extends TableMap { // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. - RewritingTableMap::clearInstancePool(); ContentFolderTableMap::clearInstancePool(); FolderImageTableMap::clearInstancePool(); FolderDocumentTableMap::clearInstancePool(); diff --git a/core/lib/Thelia/Model/Map/LangTableMap.php b/core/lib/Thelia/Model/Map/LangTableMap.php index 9eb864388..6d153b869 100644 --- a/core/lib/Thelia/Model/Map/LangTableMap.php +++ b/core/lib/Thelia/Model/Map/LangTableMap.php @@ -57,7 +57,7 @@ class LangTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 9; + const NUM_COLUMNS = 15; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class LangTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 9; + const NUM_HYDRATE_COLUMNS = 15; /** * the column name for the ID field @@ -95,15 +95,45 @@ class LangTableMap extends TableMap const URL = 'lang.URL'; /** - * the column name for the POSITION field + * the column name for the DATE_FORMAT field */ - const POSITION = 'lang.POSITION'; + const DATE_FORMAT = 'lang.DATE_FORMAT'; + + /** + * the column name for the TIME_FORMAT field + */ + const TIME_FORMAT = 'lang.TIME_FORMAT'; + + /** + * the column name for the DATETIME_FORMAT field + */ + const DATETIME_FORMAT = 'lang.DATETIME_FORMAT'; + + /** + * the column name for the DECIMAL_SEPARATOR field + */ + const DECIMAL_SEPARATOR = 'lang.DECIMAL_SEPARATOR'; + + /** + * the column name for the THOUSANDS_SEPARATOR field + */ + const THOUSANDS_SEPARATOR = 'lang.THOUSANDS_SEPARATOR'; + + /** + * the column name for the DECIMALS field + */ + const DECIMALS = 'lang.DECIMALS'; /** * the column name for the BY_DEFAULT field */ const BY_DEFAULT = 'lang.BY_DEFAULT'; + /** + * the column name for the POSITION field + */ + const POSITION = 'lang.POSITION'; + /** * the column name for the CREATED_AT field */ @@ -126,12 +156,12 @@ class LangTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Title', 'Code', 'Locale', 'Url', 'Position', 'ByDefault', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'title', 'code', 'locale', 'url', 'position', 'byDefault', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(LangTableMap::ID, LangTableMap::TITLE, LangTableMap::CODE, LangTableMap::LOCALE, LangTableMap::URL, LangTableMap::POSITION, LangTableMap::BY_DEFAULT, LangTableMap::CREATED_AT, LangTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CODE', 'LOCALE', 'URL', 'POSITION', 'BY_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'title', 'code', 'locale', 'url', 'position', 'by_default', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) + self::TYPE_PHPNAME => array('Id', 'Title', 'Code', 'Locale', 'Url', 'DateFormat', 'TimeFormat', 'DatetimeFormat', 'DecimalSeparator', 'ThousandsSeparator', 'Decimals', 'ByDefault', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'title', 'code', 'locale', 'url', 'dateFormat', 'timeFormat', 'datetimeFormat', 'decimalSeparator', 'thousandsSeparator', 'decimals', 'byDefault', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(LangTableMap::ID, LangTableMap::TITLE, LangTableMap::CODE, LangTableMap::LOCALE, LangTableMap::URL, LangTableMap::DATE_FORMAT, LangTableMap::TIME_FORMAT, LangTableMap::DATETIME_FORMAT, LangTableMap::DECIMAL_SEPARATOR, LangTableMap::THOUSANDS_SEPARATOR, LangTableMap::DECIMALS, LangTableMap::BY_DEFAULT, LangTableMap::POSITION, LangTableMap::CREATED_AT, LangTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CODE', 'LOCALE', 'URL', 'DATE_FORMAT', 'TIME_FORMAT', 'DATETIME_FORMAT', 'DECIMAL_SEPARATOR', 'THOUSANDS_SEPARATOR', 'DECIMALS', 'BY_DEFAULT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'title', 'code', 'locale', 'url', 'date_format', 'time_format', 'datetime_format', 'decimal_separator', 'thousands_separator', 'decimals', 'by_default', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -141,12 +171,12 @@ class LangTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'Code' => 2, 'Locale' => 3, 'Url' => 4, 'Position' => 5, 'ByDefault' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'position' => 5, 'byDefault' => 6, 'createdAt' => 7, 'updatedAt' => 8, ), - self::TYPE_COLNAME => array(LangTableMap::ID => 0, LangTableMap::TITLE => 1, LangTableMap::CODE => 2, LangTableMap::LOCALE => 3, LangTableMap::URL => 4, LangTableMap::POSITION => 5, LangTableMap::BY_DEFAULT => 6, LangTableMap::CREATED_AT => 7, LangTableMap::UPDATED_AT => 8, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CODE' => 2, 'LOCALE' => 3, 'URL' => 4, 'POSITION' => 5, 'BY_DEFAULT' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ), - self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'position' => 5, 'by_default' => 6, 'created_at' => 7, 'updated_at' => 8, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'Code' => 2, 'Locale' => 3, 'Url' => 4, 'DateFormat' => 5, 'TimeFormat' => 6, 'DatetimeFormat' => 7, 'DecimalSeparator' => 8, 'ThousandsSeparator' => 9, 'Decimals' => 10, 'ByDefault' => 11, 'Position' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'dateFormat' => 5, 'timeFormat' => 6, 'datetimeFormat' => 7, 'decimalSeparator' => 8, 'thousandsSeparator' => 9, 'decimals' => 10, 'byDefault' => 11, 'position' => 12, 'createdAt' => 13, 'updatedAt' => 14, ), + self::TYPE_COLNAME => array(LangTableMap::ID => 0, LangTableMap::TITLE => 1, LangTableMap::CODE => 2, LangTableMap::LOCALE => 3, LangTableMap::URL => 4, LangTableMap::DATE_FORMAT => 5, LangTableMap::TIME_FORMAT => 6, LangTableMap::DATETIME_FORMAT => 7, LangTableMap::DECIMAL_SEPARATOR => 8, LangTableMap::THOUSANDS_SEPARATOR => 9, LangTableMap::DECIMALS => 10, LangTableMap::BY_DEFAULT => 11, LangTableMap::POSITION => 12, LangTableMap::CREATED_AT => 13, LangTableMap::UPDATED_AT => 14, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CODE' => 2, 'LOCALE' => 3, 'URL' => 4, 'DATE_FORMAT' => 5, 'TIME_FORMAT' => 6, 'DATETIME_FORMAT' => 7, 'DECIMAL_SEPARATOR' => 8, 'THOUSANDS_SEPARATOR' => 9, 'DECIMALS' => 10, 'BY_DEFAULT' => 11, 'POSITION' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, ), + self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'date_format' => 5, 'time_format' => 6, 'datetime_format' => 7, 'decimal_separator' => 8, 'thousands_separator' => 9, 'decimals' => 10, 'by_default' => 11, 'position' => 12, 'created_at' => 13, 'updated_at' => 14, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -170,8 +200,14 @@ class LangTableMap extends TableMap $this->addColumn('CODE', 'Code', 'VARCHAR', false, 10, null); $this->addColumn('LOCALE', 'Locale', 'VARCHAR', false, 45, null); $this->addColumn('URL', 'Url', 'VARCHAR', false, 255, null); - $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null); + $this->addColumn('DATE_FORMAT', 'DateFormat', 'VARCHAR', false, 45, null); + $this->addColumn('TIME_FORMAT', 'TimeFormat', 'VARCHAR', false, 45, null); + $this->addColumn('DATETIME_FORMAT', 'DatetimeFormat', 'VARCHAR', false, 45, null); + $this->addColumn('DECIMAL_SEPARATOR', 'DecimalSeparator', 'VARCHAR', false, 45, null); + $this->addColumn('THOUSANDS_SEPARATOR', 'ThousandsSeparator', 'VARCHAR', false, 45, null); + $this->addColumn('DECIMALS', 'Decimals', 'VARCHAR', false, 45, null); $this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, null); + $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -339,8 +375,14 @@ class LangTableMap extends TableMap $criteria->addSelectColumn(LangTableMap::CODE); $criteria->addSelectColumn(LangTableMap::LOCALE); $criteria->addSelectColumn(LangTableMap::URL); - $criteria->addSelectColumn(LangTableMap::POSITION); + $criteria->addSelectColumn(LangTableMap::DATE_FORMAT); + $criteria->addSelectColumn(LangTableMap::TIME_FORMAT); + $criteria->addSelectColumn(LangTableMap::DATETIME_FORMAT); + $criteria->addSelectColumn(LangTableMap::DECIMAL_SEPARATOR); + $criteria->addSelectColumn(LangTableMap::THOUSANDS_SEPARATOR); + $criteria->addSelectColumn(LangTableMap::DECIMALS); $criteria->addSelectColumn(LangTableMap::BY_DEFAULT); + $criteria->addSelectColumn(LangTableMap::POSITION); $criteria->addSelectColumn(LangTableMap::CREATED_AT); $criteria->addSelectColumn(LangTableMap::UPDATED_AT); } else { @@ -349,8 +391,14 @@ class LangTableMap extends TableMap $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.LOCALE'); $criteria->addSelectColumn($alias . '.URL'); - $criteria->addSelectColumn($alias . '.POSITION'); + $criteria->addSelectColumn($alias . '.DATE_FORMAT'); + $criteria->addSelectColumn($alias . '.TIME_FORMAT'); + $criteria->addSelectColumn($alias . '.DATETIME_FORMAT'); + $criteria->addSelectColumn($alias . '.DECIMAL_SEPARATOR'); + $criteria->addSelectColumn($alias . '.THOUSANDS_SEPARATOR'); + $criteria->addSelectColumn($alias . '.DECIMALS'); $criteria->addSelectColumn($alias . '.BY_DEFAULT'); + $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } diff --git a/core/lib/Thelia/Model/Map/MessageI18nTableMap.php b/core/lib/Thelia/Model/Map/MessageI18nTableMap.php index bb9bfdd2e..ea5d69766 100644 --- a/core/lib/Thelia/Model/Map/MessageI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/MessageI18nTableMap.php @@ -57,7 +57,7 @@ class MessageI18nTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 5; + const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class MessageI18nTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the ID field @@ -85,14 +85,19 @@ class MessageI18nTableMap extends TableMap const TITLE = 'message_i18n.TITLE'; /** - * the column name for the DESCRIPTION field + * the column name for the SUBJECT field */ - const DESCRIPTION = 'message_i18n.DESCRIPTION'; + const SUBJECT = 'message_i18n.SUBJECT'; /** - * the column name for the DESCRIPTION_HTML field + * the column name for the TEXT_MESSAGE field */ - const DESCRIPTION_HTML = 'message_i18n.DESCRIPTION_HTML'; + const TEXT_MESSAGE = 'message_i18n.TEXT_MESSAGE'; + + /** + * the column name for the HTML_MESSAGE field + */ + const HTML_MESSAGE = 'message_i18n.HTML_MESSAGE'; /** * The default string format for model objects of the related table @@ -106,12 +111,12 @@ class MessageI18nTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'DescriptionHtml', ), - self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'descriptionHtml', ), - self::TYPE_COLNAME => array(MessageI18nTableMap::ID, MessageI18nTableMap::LOCALE, MessageI18nTableMap::TITLE, MessageI18nTableMap::DESCRIPTION, MessageI18nTableMap::DESCRIPTION_HTML, ), - self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'DESCRIPTION_HTML', ), - self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'description_html', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Subject', 'TextMessage', 'HtmlMessage', ), + self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'subject', 'textMessage', 'htmlMessage', ), + self::TYPE_COLNAME => array(MessageI18nTableMap::ID, MessageI18nTableMap::LOCALE, MessageI18nTableMap::TITLE, MessageI18nTableMap::SUBJECT, MessageI18nTableMap::TEXT_MESSAGE, MessageI18nTableMap::HTML_MESSAGE, ), + self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'SUBJECT', 'TEXT_MESSAGE', 'HTML_MESSAGE', ), + self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'subject', 'text_message', 'html_message', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -121,12 +126,12 @@ class MessageI18nTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'DescriptionHtml' => 4, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'descriptionHtml' => 4, ), - self::TYPE_COLNAME => array(MessageI18nTableMap::ID => 0, MessageI18nTableMap::LOCALE => 1, MessageI18nTableMap::TITLE => 2, MessageI18nTableMap::DESCRIPTION => 3, MessageI18nTableMap::DESCRIPTION_HTML => 4, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'DESCRIPTION_HTML' => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'description_html' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Subject' => 3, 'TextMessage' => 4, 'HtmlMessage' => 5, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'subject' => 3, 'textMessage' => 4, 'htmlMessage' => 5, ), + self::TYPE_COLNAME => array(MessageI18nTableMap::ID => 0, MessageI18nTableMap::LOCALE => 1, MessageI18nTableMap::TITLE => 2, MessageI18nTableMap::SUBJECT => 3, MessageI18nTableMap::TEXT_MESSAGE => 4, MessageI18nTableMap::HTML_MESSAGE => 5, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'SUBJECT' => 3, 'TEXT_MESSAGE' => 4, 'HTML_MESSAGE' => 5, ), + self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'subject' => 3, 'text_message' => 4, 'html_message' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -148,8 +153,9 @@ class MessageI18nTableMap extends TableMap $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'message', 'ID', true, null, null); $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'LONGVARCHAR', false, null, null); - $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); - $this->addColumn('DESCRIPTION_HTML', 'DescriptionHtml', 'CLOB', false, null, null); + $this->addColumn('SUBJECT', 'Subject', 'LONGVARCHAR', false, null, null); + $this->addColumn('TEXT_MESSAGE', 'TextMessage', 'CLOB', false, null, null); + $this->addColumn('HTML_MESSAGE', 'HtmlMessage', 'CLOB', false, null, null); } // initialize() /** @@ -350,14 +356,16 @@ class MessageI18nTableMap extends TableMap $criteria->addSelectColumn(MessageI18nTableMap::ID); $criteria->addSelectColumn(MessageI18nTableMap::LOCALE); $criteria->addSelectColumn(MessageI18nTableMap::TITLE); - $criteria->addSelectColumn(MessageI18nTableMap::DESCRIPTION); - $criteria->addSelectColumn(MessageI18nTableMap::DESCRIPTION_HTML); + $criteria->addSelectColumn(MessageI18nTableMap::SUBJECT); + $criteria->addSelectColumn(MessageI18nTableMap::TEXT_MESSAGE); + $criteria->addSelectColumn(MessageI18nTableMap::HTML_MESSAGE); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.LOCALE'); $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); - $criteria->addSelectColumn($alias . '.DESCRIPTION_HTML'); + $criteria->addSelectColumn($alias . '.SUBJECT'); + $criteria->addSelectColumn($alias . '.TEXT_MESSAGE'); + $criteria->addSelectColumn($alias . '.HTML_MESSAGE'); } } diff --git a/core/lib/Thelia/Model/Map/MessageTableMap.php b/core/lib/Thelia/Model/Map/MessageTableMap.php index 392dac824..d56b1210c 100644 --- a/core/lib/Thelia/Model/Map/MessageTableMap.php +++ b/core/lib/Thelia/Model/Map/MessageTableMap.php @@ -57,7 +57,7 @@ class MessageTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 9; + const NUM_COLUMNS = 8; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class MessageTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 9; + const NUM_HYDRATE_COLUMNS = 8; /** * the column name for the ID field @@ -75,20 +75,15 @@ class MessageTableMap extends TableMap const ID = 'message.ID'; /** - * the column name for the CODE field + * the column name for the NAME field */ - const CODE = 'message.CODE'; + const NAME = 'message.NAME'; /** * the column name for the SECURED field */ const SECURED = 'message.SECURED'; - /** - * the column name for the REF field - */ - const REF = 'message.REF'; - /** * the column name for the CREATED_AT field */ @@ -135,12 +130,12 @@ class MessageTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Secured', 'Ref', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'secured', 'ref', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), - self::TYPE_COLNAME => array(MessageTableMap::ID, MessageTableMap::CODE, MessageTableMap::SECURED, MessageTableMap::REF, MessageTableMap::CREATED_AT, MessageTableMap::UPDATED_AT, MessageTableMap::VERSION, MessageTableMap::VERSION_CREATED_AT, MessageTableMap::VERSION_CREATED_BY, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'SECURED', 'REF', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), - self::TYPE_FIELDNAME => array('id', 'code', 'secured', 'ref', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) + self::TYPE_PHPNAME => array('Id', 'Name', 'Secured', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), + self::TYPE_STUDLYPHPNAME => array('id', 'name', 'secured', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), + self::TYPE_COLNAME => array(MessageTableMap::ID, MessageTableMap::NAME, MessageTableMap::SECURED, MessageTableMap::CREATED_AT, MessageTableMap::UPDATED_AT, MessageTableMap::VERSION, MessageTableMap::VERSION_CREATED_AT, MessageTableMap::VERSION_CREATED_BY, ), + self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'SECURED', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), + self::TYPE_FIELDNAME => array('id', 'name', 'secured', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -150,12 +145,12 @@ class MessageTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Secured' => 2, 'Ref' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, 'Version' => 6, 'VersionCreatedAt' => 7, 'VersionCreatedBy' => 8, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'createdAt' => 4, 'updatedAt' => 5, 'version' => 6, 'versionCreatedAt' => 7, 'versionCreatedBy' => 8, ), - self::TYPE_COLNAME => array(MessageTableMap::ID => 0, MessageTableMap::CODE => 1, MessageTableMap::SECURED => 2, MessageTableMap::REF => 3, MessageTableMap::CREATED_AT => 4, MessageTableMap::UPDATED_AT => 5, MessageTableMap::VERSION => 6, MessageTableMap::VERSION_CREATED_AT => 7, MessageTableMap::VERSION_CREATED_BY => 8, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'SECURED' => 2, 'REF' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, 'VERSION' => 6, 'VERSION_CREATED_AT' => 7, 'VERSION_CREATED_BY' => 8, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'created_at' => 4, 'updated_at' => 5, 'version' => 6, 'version_created_at' => 7, 'version_created_by' => 8, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Secured' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, 'Version' => 5, 'VersionCreatedAt' => 6, 'VersionCreatedBy' => 7, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'createdAt' => 3, 'updatedAt' => 4, 'version' => 5, 'versionCreatedAt' => 6, 'versionCreatedBy' => 7, ), + self::TYPE_COLNAME => array(MessageTableMap::ID => 0, MessageTableMap::NAME => 1, MessageTableMap::SECURED => 2, MessageTableMap::CREATED_AT => 3, MessageTableMap::UPDATED_AT => 4, MessageTableMap::VERSION => 5, MessageTableMap::VERSION_CREATED_AT => 6, MessageTableMap::VERSION_CREATED_BY => 7, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'SECURED' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, 'VERSION' => 5, 'VERSION_CREATED_AT' => 6, 'VERSION_CREATED_BY' => 7, ), + self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'created_at' => 3, 'updated_at' => 4, 'version' => 5, 'version_created_at' => 6, 'version_created_by' => 7, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -175,9 +170,8 @@ class MessageTableMap extends TableMap $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); + $this->addColumn('NAME', 'Name', 'VARCHAR', true, 255, null); $this->addColumn('SECURED', 'Secured', 'TINYINT', false, null, null); - $this->addColumn('REF', 'Ref', 'VARCHAR', false, 255, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0); @@ -204,7 +198,7 @@ class MessageTableMap extends TableMap { return array( 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), - 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, description_html', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), + 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, subject, text_message, html_message', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ), ); } // getBehaviors() @@ -358,9 +352,8 @@ class MessageTableMap extends TableMap { if (null === $alias) { $criteria->addSelectColumn(MessageTableMap::ID); - $criteria->addSelectColumn(MessageTableMap::CODE); + $criteria->addSelectColumn(MessageTableMap::NAME); $criteria->addSelectColumn(MessageTableMap::SECURED); - $criteria->addSelectColumn(MessageTableMap::REF); $criteria->addSelectColumn(MessageTableMap::CREATED_AT); $criteria->addSelectColumn(MessageTableMap::UPDATED_AT); $criteria->addSelectColumn(MessageTableMap::VERSION); @@ -368,9 +361,8 @@ class MessageTableMap extends TableMap $criteria->addSelectColumn(MessageTableMap::VERSION_CREATED_BY); } else { $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.CODE'); + $criteria->addSelectColumn($alias . '.NAME'); $criteria->addSelectColumn($alias . '.SECURED'); - $criteria->addSelectColumn($alias . '.REF'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.VERSION'); diff --git a/core/lib/Thelia/Model/Map/MessageVersionTableMap.php b/core/lib/Thelia/Model/Map/MessageVersionTableMap.php index f6587e60a..db043cdc5 100644 --- a/core/lib/Thelia/Model/Map/MessageVersionTableMap.php +++ b/core/lib/Thelia/Model/Map/MessageVersionTableMap.php @@ -57,7 +57,7 @@ class MessageVersionTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 9; + const NUM_COLUMNS = 8; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class MessageVersionTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 9; + const NUM_HYDRATE_COLUMNS = 8; /** * the column name for the ID field @@ -75,20 +75,15 @@ class MessageVersionTableMap extends TableMap const ID = 'message_version.ID'; /** - * the column name for the CODE field + * the column name for the NAME field */ - const CODE = 'message_version.CODE'; + const NAME = 'message_version.NAME'; /** * the column name for the SECURED field */ const SECURED = 'message_version.SECURED'; - /** - * the column name for the REF field - */ - const REF = 'message_version.REF'; - /** * the column name for the CREATED_AT field */ @@ -126,12 +121,12 @@ class MessageVersionTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Secured', 'Ref', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'secured', 'ref', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), - self::TYPE_COLNAME => array(MessageVersionTableMap::ID, MessageVersionTableMap::CODE, MessageVersionTableMap::SECURED, MessageVersionTableMap::REF, MessageVersionTableMap::CREATED_AT, MessageVersionTableMap::UPDATED_AT, MessageVersionTableMap::VERSION, MessageVersionTableMap::VERSION_CREATED_AT, MessageVersionTableMap::VERSION_CREATED_BY, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'SECURED', 'REF', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), - self::TYPE_FIELDNAME => array('id', 'code', 'secured', 'ref', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) + self::TYPE_PHPNAME => array('Id', 'Name', 'Secured', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), + self::TYPE_STUDLYPHPNAME => array('id', 'name', 'secured', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), + self::TYPE_COLNAME => array(MessageVersionTableMap::ID, MessageVersionTableMap::NAME, MessageVersionTableMap::SECURED, MessageVersionTableMap::CREATED_AT, MessageVersionTableMap::UPDATED_AT, MessageVersionTableMap::VERSION, MessageVersionTableMap::VERSION_CREATED_AT, MessageVersionTableMap::VERSION_CREATED_BY, ), + self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'SECURED', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), + self::TYPE_FIELDNAME => array('id', 'name', 'secured', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -141,12 +136,12 @@ class MessageVersionTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Secured' => 2, 'Ref' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, 'Version' => 6, 'VersionCreatedAt' => 7, 'VersionCreatedBy' => 8, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'createdAt' => 4, 'updatedAt' => 5, 'version' => 6, 'versionCreatedAt' => 7, 'versionCreatedBy' => 8, ), - self::TYPE_COLNAME => array(MessageVersionTableMap::ID => 0, MessageVersionTableMap::CODE => 1, MessageVersionTableMap::SECURED => 2, MessageVersionTableMap::REF => 3, MessageVersionTableMap::CREATED_AT => 4, MessageVersionTableMap::UPDATED_AT => 5, MessageVersionTableMap::VERSION => 6, MessageVersionTableMap::VERSION_CREATED_AT => 7, MessageVersionTableMap::VERSION_CREATED_BY => 8, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'SECURED' => 2, 'REF' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, 'VERSION' => 6, 'VERSION_CREATED_AT' => 7, 'VERSION_CREATED_BY' => 8, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'created_at' => 4, 'updated_at' => 5, 'version' => 6, 'version_created_at' => 7, 'version_created_by' => 8, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Secured' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, 'Version' => 5, 'VersionCreatedAt' => 6, 'VersionCreatedBy' => 7, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'createdAt' => 3, 'updatedAt' => 4, 'version' => 5, 'versionCreatedAt' => 6, 'versionCreatedBy' => 7, ), + self::TYPE_COLNAME => array(MessageVersionTableMap::ID => 0, MessageVersionTableMap::NAME => 1, MessageVersionTableMap::SECURED => 2, MessageVersionTableMap::CREATED_AT => 3, MessageVersionTableMap::UPDATED_AT => 4, MessageVersionTableMap::VERSION => 5, MessageVersionTableMap::VERSION_CREATED_AT => 6, MessageVersionTableMap::VERSION_CREATED_BY => 7, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'SECURED' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, 'VERSION' => 5, 'VERSION_CREATED_AT' => 6, 'VERSION_CREATED_BY' => 7, ), + self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'created_at' => 3, 'updated_at' => 4, 'version' => 5, 'version_created_at' => 6, 'version_created_by' => 7, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -166,9 +161,8 @@ class MessageVersionTableMap extends TableMap $this->setUseIdGenerator(false); // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'message', 'ID', true, null, null); - $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); + $this->addColumn('NAME', 'Name', 'VARCHAR', true, 255, null); $this->addColumn('SECURED', 'Secured', 'TINYINT', false, null, null); - $this->addColumn('REF', 'Ref', 'VARCHAR', false, 255, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0); @@ -251,11 +245,11 @@ class MessageVersionTableMap extends TableMap public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { // If the PK cannot be derived from the row, return NULL. - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 6 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) { + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 5 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) { return null; } - return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 6 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); + return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 5 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); } /** @@ -372,9 +366,8 @@ class MessageVersionTableMap extends TableMap { if (null === $alias) { $criteria->addSelectColumn(MessageVersionTableMap::ID); - $criteria->addSelectColumn(MessageVersionTableMap::CODE); + $criteria->addSelectColumn(MessageVersionTableMap::NAME); $criteria->addSelectColumn(MessageVersionTableMap::SECURED); - $criteria->addSelectColumn(MessageVersionTableMap::REF); $criteria->addSelectColumn(MessageVersionTableMap::CREATED_AT); $criteria->addSelectColumn(MessageVersionTableMap::UPDATED_AT); $criteria->addSelectColumn(MessageVersionTableMap::VERSION); @@ -382,9 +375,8 @@ class MessageVersionTableMap extends TableMap $criteria->addSelectColumn(MessageVersionTableMap::VERSION_CREATED_BY); } else { $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.CODE'); + $criteria->addSelectColumn($alias . '.NAME'); $criteria->addSelectColumn($alias . '.SECURED'); - $criteria->addSelectColumn($alias . '.REF'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.VERSION'); diff --git a/core/lib/Thelia/Model/Map/ModuleTableMap.php b/core/lib/Thelia/Model/Map/ModuleTableMap.php index cccaa890a..dae9fda4a 100644 --- a/core/lib/Thelia/Model/Map/ModuleTableMap.php +++ b/core/lib/Thelia/Model/Map/ModuleTableMap.php @@ -57,7 +57,7 @@ class ModuleTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 7; + const NUM_COLUMNS = 8; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class ModuleTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 7; + const NUM_HYDRATE_COLUMNS = 8; /** * the column name for the ID field @@ -94,6 +94,11 @@ class ModuleTableMap extends TableMap */ const POSITION = 'module.POSITION'; + /** + * the column name for the FULL_NAMESPACE field + */ + const FULL_NAMESPACE = 'module.FULL_NAMESPACE'; + /** * the column name for the CREATED_AT field */ @@ -125,12 +130,12 @@ class ModuleTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'FullNamespace', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'fullNamespace', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::FULL_NAMESPACE, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'FULL_NAMESPACE', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'full_namespace', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -140,12 +145,12 @@ class ModuleTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::CREATED_AT => 5, ModuleTableMap::UPDATED_AT => 6, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'FullNamespace' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'fullNamespace' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), + self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::FULL_NAMESPACE => 5, ModuleTableMap::CREATED_AT => 6, ModuleTableMap::UPDATED_AT => 7, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'FULL_NAMESPACE' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), + self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'full_namespace' => 5, 'created_at' => 6, 'updated_at' => 7, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -169,6 +174,7 @@ class ModuleTableMap extends TableMap $this->addColumn('TYPE', 'Type', 'TINYINT', true, null, null); $this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null); $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null); + $this->addColumn('FULL_NAMESPACE', 'FullNamespace', 'VARCHAR', false, 255, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -349,6 +355,7 @@ class ModuleTableMap extends TableMap $criteria->addSelectColumn(ModuleTableMap::TYPE); $criteria->addSelectColumn(ModuleTableMap::ACTIVATE); $criteria->addSelectColumn(ModuleTableMap::POSITION); + $criteria->addSelectColumn(ModuleTableMap::FULL_NAMESPACE); $criteria->addSelectColumn(ModuleTableMap::CREATED_AT); $criteria->addSelectColumn(ModuleTableMap::UPDATED_AT); } else { @@ -357,6 +364,7 @@ class ModuleTableMap extends TableMap $criteria->addSelectColumn($alias . '.TYPE'); $criteria->addSelectColumn($alias . '.ACTIVATE'); $criteria->addSelectColumn($alias . '.POSITION'); + $criteria->addSelectColumn($alias . '.FULL_NAMESPACE'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } diff --git a/core/lib/Thelia/Model/Map/RewritingTableMap.php b/core/lib/Thelia/Model/Map/ProductAssociatedContentTableMap.php similarity index 65% rename from core/lib/Thelia/Model/Map/RewritingTableMap.php rename to core/lib/Thelia/Model/Map/ProductAssociatedContentTableMap.php index afce3e3c7..d4d1dadb8 100644 --- a/core/lib/Thelia/Model/Map/RewritingTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductAssociatedContentTableMap.php @@ -10,12 +10,12 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\RelationMap; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMapTrait; -use Thelia\Model\Rewriting; -use Thelia\Model\RewritingQuery; +use Thelia\Model\ProductAssociatedContent; +use Thelia\Model\ProductAssociatedContentQuery; /** - * This class defines the structure of the 'rewriting' table. + * This class defines the structure of the 'product_associated_content' table. * * * @@ -25,14 +25,14 @@ use Thelia\Model\RewritingQuery; * (i.e. if it's a text column type). * */ -class RewritingTableMap extends TableMap +class ProductAssociatedContentTableMap extends TableMap { use InstancePoolTrait; use TableMapTrait; /** * The (dot-path) name of this class */ - const CLASS_NAME = 'Thelia.Model.Map.RewritingTableMap'; + const CLASS_NAME = 'Thelia.Model.Map.ProductAssociatedContentTableMap'; /** * The default database name for this class @@ -42,22 +42,22 @@ class RewritingTableMap extends TableMap /** * The table name for this class */ - const TABLE_NAME = 'rewriting'; + const TABLE_NAME = 'product_associated_content'; /** * The related Propel class for this table */ - const OM_CLASS = '\\Thelia\\Model\\Rewriting'; + const OM_CLASS = '\\Thelia\\Model\\ProductAssociatedContent'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'Thelia.Model.Rewriting'; + const CLASS_DEFAULT = 'Thelia.Model.ProductAssociatedContent'; /** * The total number of columns */ - const NUM_COLUMNS = 8; + const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns @@ -67,47 +67,37 @@ class RewritingTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 8; + const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the ID field */ - const ID = 'rewriting.ID'; - - /** - * the column name for the URL field - */ - const URL = 'rewriting.URL'; + const ID = 'product_associated_content.ID'; /** * the column name for the PRODUCT_ID field */ - const PRODUCT_ID = 'rewriting.PRODUCT_ID'; - - /** - * the column name for the CATEGORY_ID field - */ - const CATEGORY_ID = 'rewriting.CATEGORY_ID'; - - /** - * the column name for the FOLDER_ID field - */ - const FOLDER_ID = 'rewriting.FOLDER_ID'; + const PRODUCT_ID = 'product_associated_content.PRODUCT_ID'; /** * the column name for the CONTENT_ID field */ - const CONTENT_ID = 'rewriting.CONTENT_ID'; + const CONTENT_ID = 'product_associated_content.CONTENT_ID'; + + /** + * the column name for the POSITION field + */ + const POSITION = 'product_associated_content.POSITION'; /** * the column name for the CREATED_AT field */ - const CREATED_AT = 'rewriting.CREATED_AT'; + const CREATED_AT = 'product_associated_content.CREATED_AT'; /** * the column name for the UPDATED_AT field */ - const UPDATED_AT = 'rewriting.UPDATED_AT'; + const UPDATED_AT = 'product_associated_content.UPDATED_AT'; /** * The default string format for model objects of the related table @@ -121,12 +111,12 @@ class RewritingTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Url', 'ProductId', 'CategoryId', 'FolderId', 'ContentId', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'url', 'productId', 'categoryId', 'folderId', 'contentId', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(RewritingTableMap::ID, RewritingTableMap::URL, RewritingTableMap::PRODUCT_ID, RewritingTableMap::CATEGORY_ID, RewritingTableMap::FOLDER_ID, RewritingTableMap::CONTENT_ID, RewritingTableMap::CREATED_AT, RewritingTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'URL', 'PRODUCT_ID', 'CATEGORY_ID', 'FOLDER_ID', 'CONTENT_ID', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'url', 'product_id', 'category_id', 'folder_id', 'content_id', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) + self::TYPE_PHPNAME => array('Id', 'ProductId', 'ContentId', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'contentId', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(ProductAssociatedContentTableMap::ID, ProductAssociatedContentTableMap::PRODUCT_ID, ProductAssociatedContentTableMap::CONTENT_ID, ProductAssociatedContentTableMap::POSITION, ProductAssociatedContentTableMap::CREATED_AT, ProductAssociatedContentTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'CONTENT_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'product_id', 'content_id', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -136,12 +126,12 @@ class RewritingTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Url' => 1, 'ProductId' => 2, 'CategoryId' => 3, 'FolderId' => 4, 'ContentId' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'url' => 1, 'productId' => 2, 'categoryId' => 3, 'folderId' => 4, 'contentId' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - self::TYPE_COLNAME => array(RewritingTableMap::ID => 0, RewritingTableMap::URL => 1, RewritingTableMap::PRODUCT_ID => 2, RewritingTableMap::CATEGORY_ID => 3, RewritingTableMap::FOLDER_ID => 4, RewritingTableMap::CONTENT_ID => 5, RewritingTableMap::CREATED_AT => 6, RewritingTableMap::UPDATED_AT => 7, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'URL' => 1, 'PRODUCT_ID' => 2, 'CATEGORY_ID' => 3, 'FOLDER_ID' => 4, 'CONTENT_ID' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - self::TYPE_FIELDNAME => array('id' => 0, 'url' => 1, 'product_id' => 2, 'category_id' => 3, 'folder_id' => 4, 'content_id' => 5, 'created_at' => 6, 'updated_at' => 7, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) + self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'ContentId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'contentId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), + self::TYPE_COLNAME => array(ProductAssociatedContentTableMap::ID => 0, ProductAssociatedContentTableMap::PRODUCT_ID => 1, ProductAssociatedContentTableMap::CONTENT_ID => 2, ProductAssociatedContentTableMap::POSITION => 3, ProductAssociatedContentTableMap::CREATED_AT => 4, ProductAssociatedContentTableMap::UPDATED_AT => 5, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'CONTENT_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), + self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'content_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -154,18 +144,16 @@ class RewritingTableMap extends TableMap public function initialize() { // attributes - $this->setName('rewriting'); - $this->setPhpName('Rewriting'); - $this->setClassName('\\Thelia\\Model\\Rewriting'); + $this->setName('product_associated_content'); + $this->setPhpName('ProductAssociatedContent'); + $this->setClassName('\\Thelia\\Model\\ProductAssociatedContent'); $this->setPackage('Thelia.Model'); - $this->setUseIdGenerator(false); + $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('URL', 'Url', 'VARCHAR', true, 255, null); - $this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', false, null, null); - $this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', false, null, null); - $this->addForeignKey('FOLDER_ID', 'FolderId', 'INTEGER', 'folder', 'ID', false, null, null); - $this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', false, null, null); + $this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null); + $this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', true, null, null); + $this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -176,8 +164,6 @@ class RewritingTableMap extends TableMap public function buildRelations() { $this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT'); - $this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT'); - $this->addRelation('Folder', '\\Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', 'RESTRICT'); $this->addRelation('Content', '\\Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT'); } // buildRelations() @@ -250,7 +236,7 @@ class RewritingTableMap extends TableMap */ public static function getOMClass($withPrefix = true) { - return $withPrefix ? RewritingTableMap::CLASS_DEFAULT : RewritingTableMap::OM_CLASS; + return $withPrefix ? ProductAssociatedContentTableMap::CLASS_DEFAULT : ProductAssociatedContentTableMap::OM_CLASS; } /** @@ -264,21 +250,21 @@ class RewritingTableMap extends TableMap * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (Rewriting object, last column rank) + * @return array (ProductAssociatedContent object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - $key = RewritingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = RewritingTableMap::getInstanceFromPool($key))) { + $key = ProductAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ProductAssociatedContentTableMap::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, $offset, true); // rehydrate - $col = $offset + RewritingTableMap::NUM_HYDRATE_COLUMNS; + $col = $offset + ProductAssociatedContentTableMap::NUM_HYDRATE_COLUMNS; } else { - $cls = RewritingTableMap::OM_CLASS; + $cls = ProductAssociatedContentTableMap::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); - RewritingTableMap::addInstanceToPool($obj, $key); + ProductAssociatedContentTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); @@ -301,8 +287,8 @@ class RewritingTableMap extends TableMap $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { - $key = RewritingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = RewritingTableMap::getInstanceFromPool($key))) { + $key = ProductAssociatedContentTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ProductAssociatedContentTableMap::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, 0, true); // rehydrate @@ -311,7 +297,7 @@ class RewritingTableMap extends TableMap $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; - RewritingTableMap::addInstanceToPool($obj, $key); + ProductAssociatedContentTableMap::addInstanceToPool($obj, $key); } // if key exists } @@ -332,21 +318,17 @@ class RewritingTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(RewritingTableMap::ID); - $criteria->addSelectColumn(RewritingTableMap::URL); - $criteria->addSelectColumn(RewritingTableMap::PRODUCT_ID); - $criteria->addSelectColumn(RewritingTableMap::CATEGORY_ID); - $criteria->addSelectColumn(RewritingTableMap::FOLDER_ID); - $criteria->addSelectColumn(RewritingTableMap::CONTENT_ID); - $criteria->addSelectColumn(RewritingTableMap::CREATED_AT); - $criteria->addSelectColumn(RewritingTableMap::UPDATED_AT); + $criteria->addSelectColumn(ProductAssociatedContentTableMap::ID); + $criteria->addSelectColumn(ProductAssociatedContentTableMap::PRODUCT_ID); + $criteria->addSelectColumn(ProductAssociatedContentTableMap::CONTENT_ID); + $criteria->addSelectColumn(ProductAssociatedContentTableMap::POSITION); + $criteria->addSelectColumn(ProductAssociatedContentTableMap::CREATED_AT); + $criteria->addSelectColumn(ProductAssociatedContentTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.URL'); $criteria->addSelectColumn($alias . '.PRODUCT_ID'); - $criteria->addSelectColumn($alias . '.CATEGORY_ID'); - $criteria->addSelectColumn($alias . '.FOLDER_ID'); $criteria->addSelectColumn($alias . '.CONTENT_ID'); + $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } @@ -361,7 +343,7 @@ class RewritingTableMap extends TableMap */ public static function getTableMap() { - return Propel::getServiceContainer()->getDatabaseMap(RewritingTableMap::DATABASE_NAME)->getTable(RewritingTableMap::TABLE_NAME); + return Propel::getServiceContainer()->getDatabaseMap(ProductAssociatedContentTableMap::DATABASE_NAME)->getTable(ProductAssociatedContentTableMap::TABLE_NAME); } /** @@ -369,16 +351,16 @@ class RewritingTableMap extends TableMap */ public static function buildTableMap() { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(RewritingTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(RewritingTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new RewritingTableMap()); + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ProductAssociatedContentTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ProductAssociatedContentTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ProductAssociatedContentTableMap()); } } /** - * Performs a DELETE on the database, given a Rewriting or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ProductAssociatedContent or Criteria object OR a primary key value. * - * @param mixed $values Criteria or Rewriting object or primary key or array of primary keys + * @param mixed $values Criteria or ProductAssociatedContent object or primary key or array of primary keys * which is used to create the DELETE statement * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows @@ -389,25 +371,25 @@ class RewritingTableMap extends TableMap public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(RewritingTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductAssociatedContentTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; - } elseif ($values instanceof \Thelia\Model\Rewriting) { // it's a model object + } elseif ($values instanceof \Thelia\Model\ProductAssociatedContent) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks - $criteria = new Criteria(RewritingTableMap::DATABASE_NAME); - $criteria->add(RewritingTableMap::ID, (array) $values, Criteria::IN); + $criteria = new Criteria(ProductAssociatedContentTableMap::DATABASE_NAME); + $criteria->add(ProductAssociatedContentTableMap::ID, (array) $values, Criteria::IN); } - $query = RewritingQuery::create()->mergeWith($criteria); + $query = ProductAssociatedContentQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { RewritingTableMap::clearInstancePool(); + if ($values instanceof Criteria) { ProductAssociatedContentTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { RewritingTableMap::removeInstanceFromPool($singleval); + foreach ((array) $values as $singleval) { ProductAssociatedContentTableMap::removeInstanceFromPool($singleval); } } @@ -415,20 +397,20 @@ class RewritingTableMap extends TableMap } /** - * Deletes all rows from the rewriting table. + * Deletes all rows from the product_associated_content table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ public static function doDeleteAll(ConnectionInterface $con = null) { - return RewritingQuery::create()->doDeleteAll($con); + return ProductAssociatedContentQuery::create()->doDeleteAll($con); } /** - * Performs an INSERT on the database, given a Rewriting or Criteria object. + * Performs an INSERT on the database, given a ProductAssociatedContent or Criteria object. * - * @param mixed $criteria Criteria or Rewriting object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or ProductAssociatedContent object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use * @return mixed The new primary key. * @throws PropelException Any exceptions caught during processing will be @@ -437,18 +419,22 @@ class RewritingTableMap extends TableMap public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(RewritingTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductAssociatedContentTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { - $criteria = $criteria->buildCriteria(); // build Criteria from Rewriting object + $criteria = $criteria->buildCriteria(); // build Criteria from ProductAssociatedContent object + } + + if ($criteria->containsKey(ProductAssociatedContentTableMap::ID) && $criteria->keyContainsValue(ProductAssociatedContentTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ProductAssociatedContentTableMap::ID.')'); } // Set the correct dbName - $query = RewritingQuery::create()->mergeWith($criteria); + $query = ProductAssociatedContentQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info @@ -464,7 +450,7 @@ class RewritingTableMap extends TableMap return $pk; } -} // RewritingTableMap +} // ProductAssociatedContentTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // -RewritingTableMap::buildTableMap(); +ProductAssociatedContentTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/ProductTableMap.php b/core/lib/Thelia/Model/Map/ProductTableMap.php index 75bf5e4e6..f69f6f702 100644 --- a/core/lib/Thelia/Model/Map/ProductTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductTableMap.php @@ -200,13 +200,12 @@ class ProductTableMap extends TableMap $this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories'); $this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts'); $this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductSaleElementss'); - $this->addRelation('ContentAssoc', '\\Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ContentAssocs'); $this->addRelation('ProductImage', '\\Thelia\\Model\\ProductImage', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductImages'); $this->addRelation('ProductDocument', '\\Thelia\\Model\\ProductDocument', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductDocuments'); $this->addRelation('AccessoryRelatedByProductId', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByProductId'); $this->addRelation('AccessoryRelatedByAccessory', '\\Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'accessory', ), 'CASCADE', 'RESTRICT', 'AccessoriesRelatedByAccessory'); - $this->addRelation('Rewriting', '\\Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'Rewritings'); $this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), null, null, 'CartItems'); + $this->addRelation('ProductAssociatedContent', '\\Thelia\\Model\\ProductAssociatedContent', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductAssociatedContents'); $this->addRelation('ProductI18n', '\\Thelia\\Model\\ProductI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductI18ns'); $this->addRelation('ProductVersion', '\\Thelia\\Model\\ProductVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductVersions'); $this->addRelation('Category', '\\Thelia\\Model\\Category', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Categories'); @@ -238,11 +237,10 @@ class ProductTableMap extends TableMap ProductCategoryTableMap::clearInstancePool(); FeatureProductTableMap::clearInstancePool(); ProductSaleElementsTableMap::clearInstancePool(); - ContentAssocTableMap::clearInstancePool(); ProductImageTableMap::clearInstancePool(); ProductDocumentTableMap::clearInstancePool(); AccessoryTableMap::clearInstancePool(); - RewritingTableMap::clearInstancePool(); + ProductAssociatedContentTableMap::clearInstancePool(); ProductI18nTableMap::clearInstancePool(); ProductVersionTableMap::clearInstancePool(); } diff --git a/core/lib/Thelia/Model/Map/RewritingArgumentTableMap.php b/core/lib/Thelia/Model/Map/RewritingArgumentTableMap.php new file mode 100644 index 000000000..45c75c983 --- /dev/null +++ b/core/lib/Thelia/Model/Map/RewritingArgumentTableMap.php @@ -0,0 +1,503 @@ + array('RewritingUrlId', 'Parameter', 'Value', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('rewritingUrlId', 'parameter', 'value', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(RewritingArgumentTableMap::REWRITING_URL_ID, RewritingArgumentTableMap::PARAMETER, RewritingArgumentTableMap::VALUE, RewritingArgumentTableMap::CREATED_AT, RewritingArgumentTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('REWRITING_URL_ID', 'PARAMETER', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('rewriting_url_id', 'parameter', 'value', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('RewritingUrlId' => 0, 'Parameter' => 1, 'Value' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), + self::TYPE_STUDLYPHPNAME => array('rewritingUrlId' => 0, 'parameter' => 1, 'value' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), + self::TYPE_COLNAME => array(RewritingArgumentTableMap::REWRITING_URL_ID => 0, RewritingArgumentTableMap::PARAMETER => 1, RewritingArgumentTableMap::VALUE => 2, RewritingArgumentTableMap::CREATED_AT => 3, RewritingArgumentTableMap::UPDATED_AT => 4, ), + self::TYPE_RAW_COLNAME => array('REWRITING_URL_ID' => 0, 'PARAMETER' => 1, 'VALUE' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), + self::TYPE_FIELDNAME => array('rewriting_url_id' => 0, 'parameter' => 1, 'value' => 2, 'created_at' => 3, 'updated_at' => 4, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('rewriting_argument'); + $this->setPhpName('RewritingArgument'); + $this->setClassName('\\Thelia\\Model\\RewritingArgument'); + $this->setPackage('Thelia.Model'); + $this->setUseIdGenerator(false); + // columns + $this->addForeignPrimaryKey('REWRITING_URL_ID', 'RewritingUrlId', 'INTEGER' , 'rewriting_url', 'ID', true, null, null); + $this->addPrimaryKey('PARAMETER', 'Parameter', 'VARCHAR', true, 255, null); + $this->addPrimaryKey('VALUE', 'Value', 'VARCHAR', true, 255, null); + $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); + $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('RewritingUrl', '\\Thelia\\Model\\RewritingUrl', RelationMap::MANY_TO_ONE, array('rewriting_url_id' => 'id', ), 'CASCADE', 'RESTRICT'); + } // buildRelations() + + /** + * + * Gets the list of behaviors registered for this table + * + * @return array Associative array (name => parameters) of behaviors + */ + public function getBehaviors() + { + return array( + 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), + ); + } // getBehaviors() + + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by find*() + * and findPk*() calls. + * + * @param \Thelia\Model\RewritingArgument $obj A \Thelia\Model\RewritingArgument object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool($obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if (null === $key) { + $key = serialize(array((string) $obj->getRewritingUrlId(), (string) $obj->getParameter(), (string) $obj->getValue())); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A \Thelia\Model\RewritingArgument object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && null !== $value) { + if (is_object($value) && $value instanceof \Thelia\Model\RewritingArgument) { + $key = serialize(array((string) $value->getRewritingUrlId(), (string) $value->getParameter(), (string) $value->getValue())); + + } elseif (is_array($value) && count($value) === 3) { + // assume we've been passed a primary key"; + $key = serialize(array((string) $value[0], (string) $value[1], (string) $value[2])); + } elseif ($value instanceof Criteria) { + self::$instances = []; + + return; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\RewritingArgument object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + */ + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('RewritingUrlId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Parameter', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)] === null) { + return null; + } + + return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('RewritingUrlId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Parameter', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)])); + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + + return $pks; + } + + /** + * The class that the tableMap will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is translated into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? RewritingArgumentTableMap::CLASS_DEFAULT : RewritingArgumentTableMap::OM_CLASS; + } + + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (RewritingArgument object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = RewritingArgumentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = RewritingArgumentTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $offset, true); // rehydrate + $col = $offset + RewritingArgumentTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = RewritingArgumentTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + RewritingArgumentTableMap::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @param DataFetcherInterface $dataFetcher + * @return array + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(DataFetcherInterface $dataFetcher) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = static::getOMClass(false); + // populate the object(s) + while ($row = $dataFetcher->fetch()) { + $key = RewritingArgumentTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = RewritingArgumentTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + RewritingArgumentTableMap::addInstanceToPool($obj, $key); + } // if key exists + } + + return $results; + } + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(RewritingArgumentTableMap::REWRITING_URL_ID); + $criteria->addSelectColumn(RewritingArgumentTableMap::PARAMETER); + $criteria->addSelectColumn(RewritingArgumentTableMap::VALUE); + $criteria->addSelectColumn(RewritingArgumentTableMap::CREATED_AT); + $criteria->addSelectColumn(RewritingArgumentTableMap::UPDATED_AT); + } else { + $criteria->addSelectColumn($alias . '.REWRITING_URL_ID'); + $criteria->addSelectColumn($alias . '.PARAMETER'); + $criteria->addSelectColumn($alias . '.VALUE'); + $criteria->addSelectColumn($alias . '.CREATED_AT'); + $criteria->addSelectColumn($alias . '.UPDATED_AT'); + } + } + + /** + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getServiceContainer()->getDatabaseMap(RewritingArgumentTableMap::DATABASE_NAME)->getTable(RewritingArgumentTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(RewritingArgumentTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(RewritingArgumentTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new RewritingArgumentTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a RewritingArgument or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or RewritingArgument object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(RewritingArgumentTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \Thelia\Model\RewritingArgument) { // it's a model object + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(RewritingArgumentTableMap::DATABASE_NAME); + // primary key is composite; we therefore, expect + // the primary key passed to be an array of pkey values + if (count($values) == count($values, COUNT_RECURSIVE)) { + // array is not multi-dimensional + $values = array($values); + } + foreach ($values as $value) { + $criterion = $criteria->getNewCriterion(RewritingArgumentTableMap::REWRITING_URL_ID, $value[0]); + $criterion->addAnd($criteria->getNewCriterion(RewritingArgumentTableMap::PARAMETER, $value[1])); + $criterion->addAnd($criteria->getNewCriterion(RewritingArgumentTableMap::VALUE, $value[2])); + $criteria->addOr($criterion); + } + } + + $query = RewritingArgumentQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { RewritingArgumentTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { RewritingArgumentTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the rewriting_argument table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll(ConnectionInterface $con = null) + { + return RewritingArgumentQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a RewritingArgument or Criteria object. + * + * @param mixed $criteria Criteria or RewritingArgument object containing data that is used to create the INSERT statement. + * @param ConnectionInterface $con the ConnectionInterface connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($criteria, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(RewritingArgumentTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from RewritingArgument object + } + + + // Set the correct dbName + $query = RewritingArgumentQuery::create()->mergeWith($criteria); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = $query->doInsert($con); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + +} // RewritingArgumentTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +RewritingArgumentTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/CouponRuleTableMap.php b/core/lib/Thelia/Model/Map/RewritingUrlTableMap.php similarity index 60% rename from core/lib/Thelia/Model/Map/CouponRuleTableMap.php rename to core/lib/Thelia/Model/Map/RewritingUrlTableMap.php index 99faeac59..c6d5e5473 100644 --- a/core/lib/Thelia/Model/Map/CouponRuleTableMap.php +++ b/core/lib/Thelia/Model/Map/RewritingUrlTableMap.php @@ -10,12 +10,12 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\RelationMap; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMapTrait; -use Thelia\Model\CouponRule; -use Thelia\Model\CouponRuleQuery; +use Thelia\Model\RewritingUrl; +use Thelia\Model\RewritingUrlQuery; /** - * This class defines the structure of the 'coupon_rule' table. + * This class defines the structure of the 'rewriting_url' table. * * * @@ -25,14 +25,14 @@ use Thelia\Model\CouponRuleQuery; * (i.e. if it's a text column type). * */ -class CouponRuleTableMap extends TableMap +class RewritingUrlTableMap extends TableMap { use InstancePoolTrait; use TableMapTrait; /** * The (dot-path) name of this class */ - const CLASS_NAME = 'Thelia.Model.Map.CouponRuleTableMap'; + const CLASS_NAME = 'Thelia.Model.Map.RewritingUrlTableMap'; /** * The default database name for this class @@ -42,22 +42,22 @@ class CouponRuleTableMap extends TableMap /** * The table name for this class */ - const TABLE_NAME = 'coupon_rule'; + const TABLE_NAME = 'rewriting_url'; /** * The related Propel class for this table */ - const OM_CLASS = '\\Thelia\\Model\\CouponRule'; + const OM_CLASS = '\\Thelia\\Model\\RewritingUrl'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'Thelia.Model.CouponRule'; + const CLASS_DEFAULT = 'Thelia.Model.RewritingUrl'; /** * The total number of columns */ - const NUM_COLUMNS = 7; + const NUM_COLUMNS = 8; /** * The number of lazy-loaded columns @@ -67,42 +67,47 @@ class CouponRuleTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 7; + const NUM_HYDRATE_COLUMNS = 8; /** * the column name for the ID field */ - const ID = 'coupon_rule.ID'; + const ID = 'rewriting_url.ID'; /** - * the column name for the COUPON_ID field + * the column name for the URL field */ - const COUPON_ID = 'coupon_rule.COUPON_ID'; + const URL = 'rewriting_url.URL'; /** - * the column name for the CONTROLLER field + * the column name for the VIEW field */ - const CONTROLLER = 'coupon_rule.CONTROLLER'; + const VIEW = 'rewriting_url.VIEW'; /** - * the column name for the OPERATION field + * the column name for the VIEW_ID field */ - const OPERATION = 'coupon_rule.OPERATION'; + const VIEW_ID = 'rewriting_url.VIEW_ID'; /** - * the column name for the VALUE field + * the column name for the VIEW_LOCALE field */ - const VALUE = 'coupon_rule.VALUE'; + const VIEW_LOCALE = 'rewriting_url.VIEW_LOCALE'; + + /** + * the column name for the REDIRECTED field + */ + const REDIRECTED = 'rewriting_url.REDIRECTED'; /** * the column name for the CREATED_AT field */ - const CREATED_AT = 'coupon_rule.CREATED_AT'; + const CREATED_AT = 'rewriting_url.CREATED_AT'; /** * the column name for the UPDATED_AT field */ - const UPDATED_AT = 'coupon_rule.UPDATED_AT'; + const UPDATED_AT = 'rewriting_url.UPDATED_AT'; /** * The default string format for model objects of the related table @@ -116,12 +121,12 @@ class CouponRuleTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'CouponId', 'Controller', 'Operation', 'Value', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'couponId', 'controller', 'operation', 'value', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(CouponRuleTableMap::ID, CouponRuleTableMap::COUPON_ID, CouponRuleTableMap::CONTROLLER, CouponRuleTableMap::OPERATION, CouponRuleTableMap::VALUE, CouponRuleTableMap::CREATED_AT, CouponRuleTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'COUPON_ID', 'CONTROLLER', 'OPERATION', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'coupon_id', 'controller', 'operation', 'value', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('Id', 'Url', 'View', 'ViewId', 'ViewLocale', 'Redirected', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'url', 'view', 'viewId', 'viewLocale', 'redirected', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(RewritingUrlTableMap::ID, RewritingUrlTableMap::URL, RewritingUrlTableMap::VIEW, RewritingUrlTableMap::VIEW_ID, RewritingUrlTableMap::VIEW_LOCALE, RewritingUrlTableMap::REDIRECTED, RewritingUrlTableMap::CREATED_AT, RewritingUrlTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'URL', 'VIEW', 'VIEW_ID', 'VIEW_LOCALE', 'REDIRECTED', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'url', 'view', 'view_id', 'view_locale', 'redirected', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -131,12 +136,12 @@ class CouponRuleTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'CouponId' => 1, 'Controller' => 2, 'Operation' => 3, 'Value' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'couponId' => 1, 'controller' => 2, 'operation' => 3, 'value' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - self::TYPE_COLNAME => array(CouponRuleTableMap::ID => 0, CouponRuleTableMap::COUPON_ID => 1, CouponRuleTableMap::CONTROLLER => 2, CouponRuleTableMap::OPERATION => 3, CouponRuleTableMap::VALUE => 4, CouponRuleTableMap::CREATED_AT => 5, CouponRuleTableMap::UPDATED_AT => 6, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'COUPON_ID' => 1, 'CONTROLLER' => 2, 'OPERATION' => 3, 'VALUE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - self::TYPE_FIELDNAME => array('id' => 0, 'coupon_id' => 1, 'controller' => 2, 'operation' => 3, 'value' => 4, 'created_at' => 5, 'updated_at' => 6, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Url' => 1, 'View' => 2, 'ViewId' => 3, 'ViewLocale' => 4, 'Redirected' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'url' => 1, 'view' => 2, 'viewId' => 3, 'viewLocale' => 4, 'redirected' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), + self::TYPE_COLNAME => array(RewritingUrlTableMap::ID => 0, RewritingUrlTableMap::URL => 1, RewritingUrlTableMap::VIEW => 2, RewritingUrlTableMap::VIEW_ID => 3, RewritingUrlTableMap::VIEW_LOCALE => 4, RewritingUrlTableMap::REDIRECTED => 5, RewritingUrlTableMap::CREATED_AT => 6, RewritingUrlTableMap::UPDATED_AT => 7, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'URL' => 1, 'VIEW' => 2, 'VIEW_ID' => 3, 'VIEW_LOCALE' => 4, 'REDIRECTED' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), + self::TYPE_FIELDNAME => array('id' => 0, 'url' => 1, 'view' => 2, 'view_id' => 3, 'view_locale' => 4, 'redirected' => 5, 'created_at' => 6, 'updated_at' => 7, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -149,17 +154,18 @@ class CouponRuleTableMap extends TableMap public function initialize() { // attributes - $this->setName('coupon_rule'); - $this->setPhpName('CouponRule'); - $this->setClassName('\\Thelia\\Model\\CouponRule'); + $this->setName('rewriting_url'); + $this->setPhpName('RewritingUrl'); + $this->setClassName('\\Thelia\\Model\\RewritingUrl'); $this->setPackage('Thelia.Model'); $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('COUPON_ID', 'CouponId', 'INTEGER', 'coupon', 'ID', true, null, null); - $this->addColumn('CONTROLLER', 'Controller', 'VARCHAR', false, 255, null); - $this->addColumn('OPERATION', 'Operation', 'VARCHAR', false, 255, null); - $this->addColumn('VALUE', 'Value', 'FLOAT', false, null, null); + $this->addColumn('URL', 'Url', 'VARCHAR', true, 255, null); + $this->addColumn('VIEW', 'View', 'VARCHAR', false, 255, null); + $this->addColumn('VIEW_ID', 'ViewId', 'VARCHAR', false, 255, null); + $this->addColumn('VIEW_LOCALE', 'ViewLocale', 'VARCHAR', false, 255, null); + $this->addForeignKey('REDIRECTED', 'Redirected', 'INTEGER', 'rewriting_url', 'ID', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -169,7 +175,9 @@ class CouponRuleTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', 'RESTRICT'); + $this->addRelation('RewritingUrlRelatedByRedirected', '\\Thelia\\Model\\RewritingUrl', RelationMap::MANY_TO_ONE, array('redirected' => 'id', ), 'RESTRICT', 'RESTRICT'); + $this->addRelation('RewritingUrlRelatedById', '\\Thelia\\Model\\RewritingUrl', RelationMap::ONE_TO_MANY, array('id' => 'redirected', ), 'RESTRICT', 'RESTRICT', 'RewritingUrlsRelatedById'); + $this->addRelation('RewritingArgument', '\\Thelia\\Model\\RewritingArgument', RelationMap::ONE_TO_MANY, array('id' => 'rewriting_url_id', ), 'CASCADE', 'RESTRICT', 'RewritingArguments'); } // buildRelations() /** @@ -184,6 +192,15 @@ class CouponRuleTableMap extends TableMap 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), ); } // getBehaviors() + /** + * Method to invalidate the instance pool of all tables related to rewriting_url * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + RewritingArgumentTableMap::clearInstancePool(); + } /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. @@ -241,7 +258,7 @@ class CouponRuleTableMap extends TableMap */ public static function getOMClass($withPrefix = true) { - return $withPrefix ? CouponRuleTableMap::CLASS_DEFAULT : CouponRuleTableMap::OM_CLASS; + return $withPrefix ? RewritingUrlTableMap::CLASS_DEFAULT : RewritingUrlTableMap::OM_CLASS; } /** @@ -255,21 +272,21 @@ class CouponRuleTableMap extends TableMap * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (CouponRule object, last column rank) + * @return array (RewritingUrl object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - $key = CouponRuleTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = CouponRuleTableMap::getInstanceFromPool($key))) { + $key = RewritingUrlTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = RewritingUrlTableMap::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, $offset, true); // rehydrate - $col = $offset + CouponRuleTableMap::NUM_HYDRATE_COLUMNS; + $col = $offset + RewritingUrlTableMap::NUM_HYDRATE_COLUMNS; } else { - $cls = CouponRuleTableMap::OM_CLASS; + $cls = RewritingUrlTableMap::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); - CouponRuleTableMap::addInstanceToPool($obj, $key); + RewritingUrlTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); @@ -292,8 +309,8 @@ class CouponRuleTableMap extends TableMap $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { - $key = CouponRuleTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = CouponRuleTableMap::getInstanceFromPool($key))) { + $key = RewritingUrlTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = RewritingUrlTableMap::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://www.propelorm.org/ticket/509 // $obj->hydrate($row, 0, true); // rehydrate @@ -302,7 +319,7 @@ class CouponRuleTableMap extends TableMap $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; - CouponRuleTableMap::addInstanceToPool($obj, $key); + RewritingUrlTableMap::addInstanceToPool($obj, $key); } // if key exists } @@ -323,19 +340,21 @@ class CouponRuleTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(CouponRuleTableMap::ID); - $criteria->addSelectColumn(CouponRuleTableMap::COUPON_ID); - $criteria->addSelectColumn(CouponRuleTableMap::CONTROLLER); - $criteria->addSelectColumn(CouponRuleTableMap::OPERATION); - $criteria->addSelectColumn(CouponRuleTableMap::VALUE); - $criteria->addSelectColumn(CouponRuleTableMap::CREATED_AT); - $criteria->addSelectColumn(CouponRuleTableMap::UPDATED_AT); + $criteria->addSelectColumn(RewritingUrlTableMap::ID); + $criteria->addSelectColumn(RewritingUrlTableMap::URL); + $criteria->addSelectColumn(RewritingUrlTableMap::VIEW); + $criteria->addSelectColumn(RewritingUrlTableMap::VIEW_ID); + $criteria->addSelectColumn(RewritingUrlTableMap::VIEW_LOCALE); + $criteria->addSelectColumn(RewritingUrlTableMap::REDIRECTED); + $criteria->addSelectColumn(RewritingUrlTableMap::CREATED_AT); + $criteria->addSelectColumn(RewritingUrlTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.COUPON_ID'); - $criteria->addSelectColumn($alias . '.CONTROLLER'); - $criteria->addSelectColumn($alias . '.OPERATION'); - $criteria->addSelectColumn($alias . '.VALUE'); + $criteria->addSelectColumn($alias . '.URL'); + $criteria->addSelectColumn($alias . '.VIEW'); + $criteria->addSelectColumn($alias . '.VIEW_ID'); + $criteria->addSelectColumn($alias . '.VIEW_LOCALE'); + $criteria->addSelectColumn($alias . '.REDIRECTED'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } @@ -350,7 +369,7 @@ class CouponRuleTableMap extends TableMap */ public static function getTableMap() { - return Propel::getServiceContainer()->getDatabaseMap(CouponRuleTableMap::DATABASE_NAME)->getTable(CouponRuleTableMap::TABLE_NAME); + return Propel::getServiceContainer()->getDatabaseMap(RewritingUrlTableMap::DATABASE_NAME)->getTable(RewritingUrlTableMap::TABLE_NAME); } /** @@ -358,16 +377,16 @@ class CouponRuleTableMap extends TableMap */ public static function buildTableMap() { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(CouponRuleTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(CouponRuleTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new CouponRuleTableMap()); + $dbMap = Propel::getServiceContainer()->getDatabaseMap(RewritingUrlTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(RewritingUrlTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new RewritingUrlTableMap()); } } /** - * Performs a DELETE on the database, given a CouponRule or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a RewritingUrl or Criteria object OR a primary key value. * - * @param mixed $values Criteria or CouponRule object or primary key or array of primary keys + * @param mixed $values Criteria or RewritingUrl object or primary key or array of primary keys * which is used to create the DELETE statement * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows @@ -378,25 +397,25 @@ class CouponRuleTableMap extends TableMap public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponRuleTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(RewritingUrlTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; - } elseif ($values instanceof \Thelia\Model\CouponRule) { // it's a model object + } elseif ($values instanceof \Thelia\Model\RewritingUrl) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks - $criteria = new Criteria(CouponRuleTableMap::DATABASE_NAME); - $criteria->add(CouponRuleTableMap::ID, (array) $values, Criteria::IN); + $criteria = new Criteria(RewritingUrlTableMap::DATABASE_NAME); + $criteria->add(RewritingUrlTableMap::ID, (array) $values, Criteria::IN); } - $query = CouponRuleQuery::create()->mergeWith($criteria); + $query = RewritingUrlQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { CouponRuleTableMap::clearInstancePool(); + if ($values instanceof Criteria) { RewritingUrlTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { CouponRuleTableMap::removeInstanceFromPool($singleval); + foreach ((array) $values as $singleval) { RewritingUrlTableMap::removeInstanceFromPool($singleval); } } @@ -404,20 +423,20 @@ class CouponRuleTableMap extends TableMap } /** - * Deletes all rows from the coupon_rule table. + * Deletes all rows from the rewriting_url table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). */ public static function doDeleteAll(ConnectionInterface $con = null) { - return CouponRuleQuery::create()->doDeleteAll($con); + return RewritingUrlQuery::create()->doDeleteAll($con); } /** - * Performs an INSERT on the database, given a CouponRule or Criteria object. + * Performs an INSERT on the database, given a RewritingUrl or Criteria object. * - * @param mixed $criteria Criteria or CouponRule object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or RewritingUrl object containing data that is used to create the INSERT statement. * @param ConnectionInterface $con the ConnectionInterface connection to use * @return mixed The new primary key. * @throws PropelException Any exceptions caught during processing will be @@ -426,22 +445,22 @@ class CouponRuleTableMap extends TableMap public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(CouponRuleTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(RewritingUrlTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { - $criteria = $criteria->buildCriteria(); // build Criteria from CouponRule object + $criteria = $criteria->buildCriteria(); // build Criteria from RewritingUrl object } - if ($criteria->containsKey(CouponRuleTableMap::ID) && $criteria->keyContainsValue(CouponRuleTableMap::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.CouponRuleTableMap::ID.')'); + if ($criteria->containsKey(RewritingUrlTableMap::ID) && $criteria->keyContainsValue(RewritingUrlTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.RewritingUrlTableMap::ID.')'); } // Set the correct dbName - $query = CouponRuleQuery::create()->mergeWith($criteria); + $query = RewritingUrlQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info @@ -457,7 +476,7 @@ class CouponRuleTableMap extends TableMap return $pk; } -} // CouponRuleTableMap +} // RewritingUrlTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // -CouponRuleTableMap::buildTableMap(); +RewritingUrlTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/TaxRuleCountryTableMap.php b/core/lib/Thelia/Model/Map/TaxRuleCountryTableMap.php index 42b4e6f59..5282d67fa 100644 --- a/core/lib/Thelia/Model/Map/TaxRuleCountryTableMap.php +++ b/core/lib/Thelia/Model/Map/TaxRuleCountryTableMap.php @@ -57,7 +57,7 @@ class TaxRuleCountryTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 7; + const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns @@ -67,12 +67,7 @@ class TaxRuleCountryTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 7; - - /** - * the column name for the ID field - */ - const ID = 'tax_rule_country.ID'; + const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the TAX_RULE_ID field @@ -90,9 +85,9 @@ class TaxRuleCountryTableMap extends TableMap const TAX_ID = 'tax_rule_country.TAX_ID'; /** - * the column name for the NONE field + * the column name for the POSITION field */ - const NONE = 'tax_rule_country.NONE'; + const POSITION = 'tax_rule_country.POSITION'; /** * the column name for the CREATED_AT field @@ -116,12 +111,12 @@ class TaxRuleCountryTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'CountryId', 'TaxId', 'None', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'countryId', 'taxId', 'none', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(TaxRuleCountryTableMap::ID, TaxRuleCountryTableMap::TAX_RULE_ID, TaxRuleCountryTableMap::COUNTRY_ID, TaxRuleCountryTableMap::TAX_ID, TaxRuleCountryTableMap::NONE, TaxRuleCountryTableMap::CREATED_AT, TaxRuleCountryTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'COUNTRY_ID', 'TAX_ID', 'NONE', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'country_id', 'tax_id', 'none', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('TaxRuleId', 'CountryId', 'TaxId', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('taxRuleId', 'countryId', 'taxId', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(TaxRuleCountryTableMap::TAX_RULE_ID, TaxRuleCountryTableMap::COUNTRY_ID, TaxRuleCountryTableMap::TAX_ID, TaxRuleCountryTableMap::POSITION, TaxRuleCountryTableMap::CREATED_AT, TaxRuleCountryTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('TAX_RULE_ID', 'COUNTRY_ID', 'TAX_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('tax_rule_id', 'country_id', 'tax_id', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -131,12 +126,12 @@ class TaxRuleCountryTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'CountryId' => 2, 'TaxId' => 3, 'None' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'countryId' => 2, 'taxId' => 3, 'none' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - self::TYPE_COLNAME => array(TaxRuleCountryTableMap::ID => 0, TaxRuleCountryTableMap::TAX_RULE_ID => 1, TaxRuleCountryTableMap::COUNTRY_ID => 2, TaxRuleCountryTableMap::TAX_ID => 3, TaxRuleCountryTableMap::NONE => 4, TaxRuleCountryTableMap::CREATED_AT => 5, TaxRuleCountryTableMap::UPDATED_AT => 6, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'COUNTRY_ID' => 2, 'TAX_ID' => 3, 'NONE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'country_id' => 2, 'tax_id' => 3, 'none' => 4, 'created_at' => 5, 'updated_at' => 6, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('TaxRuleId' => 0, 'CountryId' => 1, 'TaxId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), + self::TYPE_STUDLYPHPNAME => array('taxRuleId' => 0, 'countryId' => 1, 'taxId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), + self::TYPE_COLNAME => array(TaxRuleCountryTableMap::TAX_RULE_ID => 0, TaxRuleCountryTableMap::COUNTRY_ID => 1, TaxRuleCountryTableMap::TAX_ID => 2, TaxRuleCountryTableMap::POSITION => 3, TaxRuleCountryTableMap::CREATED_AT => 4, TaxRuleCountryTableMap::UPDATED_AT => 5, ), + self::TYPE_RAW_COLNAME => array('TAX_RULE_ID' => 0, 'COUNTRY_ID' => 1, 'TAX_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), + self::TYPE_FIELDNAME => array('tax_rule_id' => 0, 'country_id' => 1, 'tax_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -155,11 +150,10 @@ class TaxRuleCountryTableMap extends TableMap $this->setPackage('Thelia.Model'); $this->setUseIdGenerator(false); // columns - $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addForeignKey('TAX_RULE_ID', 'TaxRuleId', 'INTEGER', 'tax_rule', 'ID', false, null, null); - $this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', false, null, null); - $this->addForeignKey('TAX_ID', 'TaxId', 'INTEGER', 'tax', 'ID', false, null, null); - $this->addColumn('NONE', 'None', 'TINYINT', false, null, null); + $this->addForeignPrimaryKey('TAX_RULE_ID', 'TaxRuleId', 'INTEGER' , 'tax_rule', 'ID', true, null, null); + $this->addForeignPrimaryKey('COUNTRY_ID', 'CountryId', 'INTEGER' , 'country', 'ID', true, null, null); + $this->addForeignPrimaryKey('TAX_ID', 'TaxId', 'INTEGER' , 'tax', 'ID', true, null, null); + $this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -169,7 +163,7 @@ class TaxRuleCountryTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('Tax', '\\Thelia\\Model\\Tax', RelationMap::MANY_TO_ONE, array('tax_id' => 'id', ), 'SET NULL', 'RESTRICT'); + $this->addRelation('Tax', '\\Thelia\\Model\\Tax', RelationMap::MANY_TO_ONE, array('tax_id' => 'id', ), 'CASCADE', 'RESTRICT'); $this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'CASCADE', 'RESTRICT'); $this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'CASCADE', 'RESTRICT'); } // buildRelations() @@ -187,6 +181,59 @@ class TaxRuleCountryTableMap extends TableMap ); } // getBehaviors() + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by find*() + * and findPk*() calls. + * + * @param \Thelia\Model\TaxRuleCountry $obj A \Thelia\Model\TaxRuleCountry object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool($obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if (null === $key) { + $key = serialize(array((string) $obj->getTaxRuleId(), (string) $obj->getCountryId(), (string) $obj->getTaxId())); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A \Thelia\Model\TaxRuleCountry object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && null !== $value) { + if (is_object($value) && $value instanceof \Thelia\Model\TaxRuleCountry) { + $key = serialize(array((string) $value->getTaxRuleId(), (string) $value->getCountryId(), (string) $value->getTaxId())); + + } elseif (is_array($value) && count($value) === 3) { + // assume we've been passed a primary key"; + $key = serialize(array((string) $value[0], (string) $value[1], (string) $value[2])); + } elseif ($value instanceof Criteria) { + self::$instances = []; + + return; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\TaxRuleCountry object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } + /** * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. * @@ -201,11 +248,11 @@ class TaxRuleCountryTableMap extends TableMap public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { // If the PK cannot be derived from the row, return NULL. - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('TaxRuleId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('TaxId', TableMap::TYPE_PHPNAME, $indexType)] === null) { return null; } - return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('TaxRuleId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('CountryId', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 2 + $offset : static::translateFieldName('TaxId', TableMap::TYPE_PHPNAME, $indexType)])); } /** @@ -223,11 +270,7 @@ class TaxRuleCountryTableMap extends TableMap public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - return (int) $row[ - $indexType == TableMap::TYPE_NUM - ? 0 + $offset - : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) - ]; + return $pks; } /** @@ -325,19 +368,17 @@ class TaxRuleCountryTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(TaxRuleCountryTableMap::ID); $criteria->addSelectColumn(TaxRuleCountryTableMap::TAX_RULE_ID); $criteria->addSelectColumn(TaxRuleCountryTableMap::COUNTRY_ID); $criteria->addSelectColumn(TaxRuleCountryTableMap::TAX_ID); - $criteria->addSelectColumn(TaxRuleCountryTableMap::NONE); + $criteria->addSelectColumn(TaxRuleCountryTableMap::POSITION); $criteria->addSelectColumn(TaxRuleCountryTableMap::CREATED_AT); $criteria->addSelectColumn(TaxRuleCountryTableMap::UPDATED_AT); } else { - $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.TAX_RULE_ID'); $criteria->addSelectColumn($alias . '.COUNTRY_ID'); $criteria->addSelectColumn($alias . '.TAX_ID'); - $criteria->addSelectColumn($alias . '.NONE'); + $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } @@ -391,7 +432,18 @@ class TaxRuleCountryTableMap extends TableMap $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks $criteria = new Criteria(TaxRuleCountryTableMap::DATABASE_NAME); - $criteria->add(TaxRuleCountryTableMap::ID, (array) $values, Criteria::IN); + // primary key is composite; we therefore, expect + // the primary key passed to be an array of pkey values + if (count($values) == count($values, COUNT_RECURSIVE)) { + // array is not multi-dimensional + $values = array($values); + } + foreach ($values as $value) { + $criterion = $criteria->getNewCriterion(TaxRuleCountryTableMap::TAX_RULE_ID, $value[0]); + $criterion->addAnd($criteria->getNewCriterion(TaxRuleCountryTableMap::COUNTRY_ID, $value[1])); + $criterion->addAnd($criteria->getNewCriterion(TaxRuleCountryTableMap::TAX_ID, $value[2])); + $criteria->addOr($criterion); + } } $query = TaxRuleCountryQuery::create()->mergeWith($criteria); diff --git a/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php b/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php index 1f0ed1e96..012ad2e72 100644 --- a/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/TaxRuleI18nTableMap.php @@ -57,7 +57,7 @@ class TaxRuleI18nTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 2; + const NUM_COLUMNS = 4; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class TaxRuleI18nTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 2; + const NUM_HYDRATE_COLUMNS = 4; /** * the column name for the ID field @@ -79,6 +79,16 @@ class TaxRuleI18nTableMap extends TableMap */ const LOCALE = 'tax_rule_i18n.LOCALE'; + /** + * the column name for the TITLE field + */ + const TITLE = 'tax_rule_i18n.TITLE'; + + /** + * the column name for the DESCRIPTION field + */ + const DESCRIPTION = 'tax_rule_i18n.DESCRIPTION'; + /** * The default string format for model objects of the related table */ @@ -91,12 +101,12 @@ class TaxRuleI18nTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Locale', ), - self::TYPE_STUDLYPHPNAME => array('id', 'locale', ), - self::TYPE_COLNAME => array(TaxRuleI18nTableMap::ID, TaxRuleI18nTableMap::LOCALE, ), - self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', ), - self::TYPE_FIELDNAME => array('id', 'locale', ), - self::TYPE_NUM => array(0, 1, ) + self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', ), + self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', ), + self::TYPE_COLNAME => array(TaxRuleI18nTableMap::ID, TaxRuleI18nTableMap::LOCALE, TaxRuleI18nTableMap::TITLE, TaxRuleI18nTableMap::DESCRIPTION, ), + self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', ), + self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', ), + self::TYPE_NUM => array(0, 1, 2, 3, ) ); /** @@ -106,12 +116,12 @@ class TaxRuleI18nTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, ), - self::TYPE_COLNAME => array(TaxRuleI18nTableMap::ID => 0, TaxRuleI18nTableMap::LOCALE => 1, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, ), - self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, ), - self::TYPE_NUM => array(0, 1, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ), + self::TYPE_COLNAME => array(TaxRuleI18nTableMap::ID => 0, TaxRuleI18nTableMap::LOCALE => 1, TaxRuleI18nTableMap::TITLE => 2, TaxRuleI18nTableMap::DESCRIPTION => 3, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, ), + self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ), + self::TYPE_NUM => array(0, 1, 2, 3, ) ); /** @@ -132,6 +142,8 @@ class TaxRuleI18nTableMap extends TableMap // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule', 'ID', true, null, null); $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); + $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); + $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); } // initialize() /** @@ -331,9 +343,13 @@ class TaxRuleI18nTableMap extends TableMap if (null === $alias) { $criteria->addSelectColumn(TaxRuleI18nTableMap::ID); $criteria->addSelectColumn(TaxRuleI18nTableMap::LOCALE); + $criteria->addSelectColumn(TaxRuleI18nTableMap::TITLE); + $criteria->addSelectColumn(TaxRuleI18nTableMap::DESCRIPTION); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.LOCALE'); + $criteria->addSelectColumn($alias . '.TITLE'); + $criteria->addSelectColumn($alias . '.DESCRIPTION'); } } diff --git a/core/lib/Thelia/Model/Map/TaxRuleTableMap.php b/core/lib/Thelia/Model/Map/TaxRuleTableMap.php index cc5f628b9..391e23b6d 100644 --- a/core/lib/Thelia/Model/Map/TaxRuleTableMap.php +++ b/core/lib/Thelia/Model/Map/TaxRuleTableMap.php @@ -57,7 +57,7 @@ class TaxRuleTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 6; + const NUM_COLUMNS = 3; /** * The number of lazy-loaded columns @@ -67,28 +67,13 @@ class TaxRuleTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 6; + const NUM_HYDRATE_COLUMNS = 3; /** * the column name for the ID field */ const ID = 'tax_rule.ID'; - /** - * the column name for the CODE field - */ - const CODE = 'tax_rule.CODE'; - - /** - * the column name for the TITLE field - */ - const TITLE = 'tax_rule.TITLE'; - - /** - * the column name for the DESCRIPTION field - */ - const DESCRIPTION = 'tax_rule.DESCRIPTION'; - /** * the column name for the CREATED_AT field */ @@ -120,12 +105,12 @@ class TaxRuleTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Title', 'Description', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'title', 'description', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(TaxRuleTableMap::ID, TaxRuleTableMap::CODE, TaxRuleTableMap::TITLE, TaxRuleTableMap::DESCRIPTION, TaxRuleTableMap::CREATED_AT, TaxRuleTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TITLE', 'DESCRIPTION', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'code', 'title', 'description', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(TaxRuleTableMap::ID, TaxRuleTableMap::CREATED_AT, TaxRuleTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, ) ); /** @@ -135,12 +120,12 @@ class TaxRuleTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Title' => 2, 'Description' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'title' => 2, 'description' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), - self::TYPE_COLNAME => array(TaxRuleTableMap::ID => 0, TaxRuleTableMap::CODE => 1, TaxRuleTableMap::TITLE => 2, TaxRuleTableMap::DESCRIPTION => 3, TaxRuleTableMap::CREATED_AT => 4, TaxRuleTableMap::UPDATED_AT => 5, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'title' => 2, 'description' => 3, 'created_at' => 4, 'updated_at' => 5, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id' => 0, 'CreatedAt' => 1, 'UpdatedAt' => 2, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'createdAt' => 1, 'updatedAt' => 2, ), + self::TYPE_COLNAME => array(TaxRuleTableMap::ID => 0, TaxRuleTableMap::CREATED_AT => 1, TaxRuleTableMap::UPDATED_AT => 2, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CREATED_AT' => 1, 'UPDATED_AT' => 2, ), + self::TYPE_FIELDNAME => array('id' => 0, 'created_at' => 1, 'updated_at' => 2, ), + self::TYPE_NUM => array(0, 1, 2, ) ); /** @@ -160,9 +145,6 @@ class TaxRuleTableMap extends TableMap $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('CODE', 'Code', 'VARCHAR', false, 45, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); - $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -187,7 +169,7 @@ class TaxRuleTableMap extends TableMap { return array( 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), - 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => '', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), + 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), ); } // getBehaviors() /** @@ -341,16 +323,10 @@ class TaxRuleTableMap extends TableMap { if (null === $alias) { $criteria->addSelectColumn(TaxRuleTableMap::ID); - $criteria->addSelectColumn(TaxRuleTableMap::CODE); - $criteria->addSelectColumn(TaxRuleTableMap::TITLE); - $criteria->addSelectColumn(TaxRuleTableMap::DESCRIPTION); $criteria->addSelectColumn(TaxRuleTableMap::CREATED_AT); $criteria->addSelectColumn(TaxRuleTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.CODE'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } diff --git a/core/lib/Thelia/Model/Map/TaxTableMap.php b/core/lib/Thelia/Model/Map/TaxTableMap.php index 6d43f20e9..11e5047ce 100644 --- a/core/lib/Thelia/Model/Map/TaxTableMap.php +++ b/core/lib/Thelia/Model/Map/TaxTableMap.php @@ -160,7 +160,7 @@ class TaxTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'tax_id', ), 'SET NULL', 'RESTRICT', 'TaxRuleCountries'); + $this->addRelation('TaxRuleCountry', '\\Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'tax_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountries'); $this->addRelation('TaxI18n', '\\Thelia\\Model\\TaxI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'TaxI18ns'); } // buildRelations() diff --git a/core/lib/Thelia/Model/Message.php b/core/lib/Thelia/Model/Message.php index 777c9eaaf..aa6481ab8 100755 --- a/core/lib/Thelia/Model/Message.php +++ b/core/lib/Thelia/Model/Message.php @@ -3,7 +3,65 @@ namespace Thelia\Model; use Thelia\Model\Base\Message as BaseMessage; +use Propel\Runtime\Connection\ConnectionInterface; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Event\MessageEvent; class Message extends BaseMessage { + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CREATEMESSAGE, new MessageEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATEMESSAGE, new MessageEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATEMESSAGE, new MessageEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_UPDATEMESSAGE, new MessageEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETEMESSAGE, new MessageEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETEMESSAGE, new MessageEvent($this)); + } } diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php index 91582750a..f8e6db193 100755 --- a/core/lib/Thelia/Model/Order.php +++ b/core/lib/Thelia/Model/Order.php @@ -6,4 +6,15 @@ use Thelia\Model\Base\Order as BaseOrder; class Order extends BaseOrder { + /** + * calculate the total amount + * + * @TODO create body method + * + * @return int + */ + public function getTotalAmount() + { + return 2; + } } diff --git a/core/lib/Thelia/Model/Product.php b/core/lib/Thelia/Model/Product.php index ca26317e0..06c4640d0 100755 --- a/core/lib/Thelia/Model/Product.php +++ b/core/lib/Thelia/Model/Product.php @@ -2,8 +2,32 @@ namespace Thelia\Model; +use Propel\Runtime\Exception\PropelException; use Thelia\Model\Base\Product as BaseProduct; -use Thelia\Model\ProductSaleElements; +use Thelia\Tools\URL; +use Thelia\TaxEngine\Calculator; -class Product extends BaseProduct { +class Product extends BaseProduct +{ + public function getUrl($locale) + { + return URL::getInstance()->retrieve('product', $this->getId(), $locale)->toString(); + } + + public function getRealLowestPrice($virtualColumnName = 'real_lowest_price') + { + try { + $amount = $this->getVirtualColumn($virtualColumnName); + } catch(PropelException $e) { + throw new PropelException("Virtual column `$virtualColumnName` does not exist in Product::getRealLowestPrice"); + } + + return $amount; + } + + public function getTaxedPrice(Country $country) + { + $taxCalculator = new Calculator(); + return $taxCalculator->load($this, $country)->getTaxedPrice($this->getRealLowestPrice()); + } } diff --git a/core/lib/Thelia/Model/ProductAssociatedContent.php b/core/lib/Thelia/Model/ProductAssociatedContent.php new file mode 100644 index 000000000..9b007baf1 --- /dev/null +++ b/core/lib/Thelia/Model/ProductAssociatedContent.php @@ -0,0 +1,9 @@ +getVirtualColumn($virtualColumnName); + } catch(PropelException $e) { + throw new PropelException("Virtual column `$virtualColumnName` does not exist in ProductSaleElements::getPrice"); + } + return $amount; + } + + public function getPromoPrice($virtualColumnName = 'price_PROMO_PRICE') + { + try { + $amount = $this->getVirtualColumn($virtualColumnName); + } catch(PropelException $e) { + throw new PropelException("Virtual column `$virtualColumnName` does not exist in ProductSaleElements::getPromoPrice"); + } + + return $amount; + } + + public function getTaxedPrice(Country $country) + { + $taxCalculator = new Calculator(); + return $taxCalculator->load($this->getProduct(), $country)->getTaxedPrice($this->getPrice()); + } + + public function getTaxedPromoPrice(Country $country) + { + $taxCalculator = new Calculator(); + return $taxCalculator->load($this->getProduct(), $country)->getTaxedPrice($this->getPromoPrice()); + } } diff --git a/core/lib/Thelia/Model/ProductSaleElementsQuery.php b/core/lib/Thelia/Model/ProductSaleElementsQuery.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Model/Rewriting.php b/core/lib/Thelia/Model/Rewriting.php old mode 100755 new mode 100644 diff --git a/core/lib/Thelia/Model/RewritingArgument.php b/core/lib/Thelia/Model/RewritingArgument.php new file mode 100644 index 000000000..79ab92a54 --- /dev/null +++ b/core/lib/Thelia/Model/RewritingArgument.php @@ -0,0 +1,9 @@ +addExplicitCondition(RewritingUrlTableMap::TABLE_NAME, 'REDIRECTED', 'ru', RewritingUrlTableMap::TABLE_NAME, 'ID', 'is_redirected'); + $redirectedJoin->setJoinType(Criteria::LEFT_JOIN); + + $search = RewritingArgumentQuery::create() + ->joinRewritingUrl('ru', Criteria::RIGHT_JOIN) + ->addJoinObject($redirectedJoin) + ->where('`ru`.URL = ?', $rewrittenUrl, \PDO::PARAM_STR) + ->withColumn('`ru`.URL', 'ru_url') + ->withColumn('`ru`.VIEW', 'ru_view') + ->withColumn('`ru`.VIEW_LOCALE', 'ru_locale') + ->withColumn('`ru`.VIEW_ID', 'ru_viewId') + ->withColumn('`is_redirected`.URL', 'ru_redirected_to_url') + ->find(); + + return $search; + } + + /** + * @param $view + * @param $viewId + * @param $viewLocale + * + * @return null|RewritingUrl + */ + public function getViewUrlQuery($view, $viewLocale, $viewId) + { + return RewritingUrlQuery::create() + ->joinRewritingArgument('ra', Criteria::LEFT_JOIN) + ->where('ISNULL(`ra`.REWRITING_URL_ID)') + ->filterByView($view) + ->filterByViewLocale($viewLocale) + ->filterByViewId($viewId) + ->filterByRedirected(null) + ->orderByUpdatedAt(Criteria::DESC) + ->findOne(); + } + + /** + * @param $view + * @param $viewLocale + * @param $viewId + * @param $viewOtherParameters + * + * @return null|RewritingUrl + */ + public function getSpecificUrlQuery($view, $viewLocale, $viewId, $viewOtherParameters) + { + $urlQuery = RewritingUrlQuery::create() + ->joinRewritingArgument('ra', Criteria::LEFT_JOIN) + ->withColumn('`ra`.REWRITING_URL_ID', 'ra_REWRITING_URL_ID') + ->filterByView($view) + ->filterByViewLocale($viewLocale) + ->filterByViewId($viewId) + ->filterByRedirected(null) + ->orderByUpdatedAt(Criteria::DESC); + + $otherParametersCount = count($viewOtherParameters); + if($otherParametersCount > 0) { + $parameterConditions = array(); + + foreach($viewOtherParameters as $parameter => $value) { + $conditionName = 'other_parameter_condition_' . count($parameterConditions); + $urlQuery->condition('parameter_condition', '`ra`.PARAMETER= ?', $parameter, \PDO::PARAM_STR) + ->condition('value_condition', '`ra`.VALUE = ?', $value, \PDO::PARAM_STR) + ->combine(array('parameter_condition', 'value_condition'), Criteria::LOGICAL_AND, $conditionName); + $parameterConditions[] = $conditionName; + } + + $urlQuery->where($parameterConditions, Criteria::LOGICAL_OR); + + $urlQuery->groupBy(RewritingUrlTableMap::ID); + + $urlQuery->condition('count_condition_1', 'COUNT(' . RewritingUrlTableMap::ID . ') = ?', $otherParametersCount, \PDO::PARAM_INT) // ensure we got all the asked parameters (provided by the query) + ->condition('count_condition_2', 'COUNT(' . RewritingUrlTableMap::ID . ') = (SELECT COUNT(*) FROM rewriting_argument WHERE rewriting_argument.REWRITING_URL_ID = ra_REWRITING_URL_ID)'); // ensure we don't miss any parameters (needed to match the rewritten url) + + $urlQuery->having(array('count_condition_1', 'count_condition_2'), Criteria::LOGICAL_AND); + } else { + $urlQuery->where('ISNULL(`ra`.REWRITING_URL_ID)'); + } + + return $urlQuery->findOne(); + } +} // RewritingUrlQuery diff --git a/core/lib/Thelia/Model/Tax.php b/core/lib/Thelia/Model/Tax.php index ed61876ae..21efbae6a 100755 --- a/core/lib/Thelia/Model/Tax.php +++ b/core/lib/Thelia/Model/Tax.php @@ -2,8 +2,45 @@ namespace Thelia\Model; +use Thelia\Exception\TaxEngineException; use Thelia\Model\Base\Tax as BaseTax; -class Tax extends BaseTax { +class Tax extends BaseTax +{ + public function calculateTax($amount) + { + if(false === filter_var($amount, FILTER_VALIDATE_FLOAT)) { + throw new TaxEngineException('BAD AMOUNT FORMAT', TaxEngineException::BAD_AMOUNT_FORMAT); + } + $rate = $this->getRate(); + + if($rate === null) { + return 0; + } + + return $amount * $rate * 0.01; + } + + public function getTaxRuleCountryPosition() + { + try { + $taxRuleCountryPosition = $this->getVirtualColumn(TaxRuleQuery::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION); + } catch(PropelException $e) { + throw new PropelException("Virtual column `" . TaxRuleQuery::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION . "` does not exist in Tax::getTaxRuleCountryPosition"); + } + + return $taxRuleCountryPosition; + } + + public function getTaxRuleRateSum() + { + try { + $taxRuleRateSum = $this->getVirtualColumn(TaxRuleQuery::ALIAS_FOR_TAX_RATE_SUM); + } catch(PropelException $e) { + throw new PropelException("Virtual column `" . TaxRuleQuery::ALIAS_FOR_TAX_RATE_SUM . "` does not exist in Tax::getTaxRuleRateSum"); + } + + return $taxRuleRateSum; + } } diff --git a/core/lib/Thelia/Model/TaxRuleQuery.php b/core/lib/Thelia/Model/TaxRuleQuery.php index 8cb79562d..f9c6cf1e5 100755 --- a/core/lib/Thelia/Model/TaxRuleQuery.php +++ b/core/lib/Thelia/Model/TaxRuleQuery.php @@ -2,8 +2,10 @@ namespace Thelia\Model; +use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Model\Base\TaxRuleQuery as BaseTaxRuleQuery; - +use Thelia\Model\Map\TaxRuleCountryTableMap; +use Thelia\Model\Map\TaxTableMap; /** * Skeleton subclass for performing query and update operations on the 'tax_rule' table. @@ -15,6 +17,26 @@ use Thelia\Model\Base\TaxRuleQuery as BaseTaxRuleQuery; * long as it does not already exist in the output directory. * */ -class TaxRuleQuery extends BaseTaxRuleQuery { +class TaxRuleQuery extends BaseTaxRuleQuery +{ + const ALIAS_FOR_TAX_RULE_COUNTRY_POSITION = 'taxRuleCountryPosition'; + const ALIAS_FOR_TAX_RATE_SUM = 'taxRateSum'; + public function getTaxCalculatorGroupedCollection(Product $product, Country $country) + { + $search = TaxQuery::create() + ->filterByTaxRuleCountry( + TaxRuleCountryQuery::create() + ->filterByCountry($country, Criteria::EQUAL) + ->filterByTaxRuleId($product->getTaxRuleId()) + ->groupByPosition() + ->orderByPosition() + ->find() + ) + ->withColumn(TaxRuleCountryTableMap::POSITION, self::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION) + ->withColumn('ROUND(SUM(' . TaxTableMap::RATE . '), 2)', self::ALIAS_FOR_TAX_RATE_SUM) + ; + + return $search->find(); + } } // TaxRuleQuery diff --git a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php new file mode 100755 index 000000000..5e5dae010 --- /dev/null +++ b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php @@ -0,0 +1,135 @@ + + */ +class ModelCriteriaTools +{ + /** + * @param ModelCriteria $search + * @param $requestedLocale + * @param array $columns + * @param null $foreignTable + * @param string $foreignKey + */ + public static function getFrontEndI18n(ModelCriteria &$search, $requestedLocale, $columns, $foreignTable, $foreignKey, $forceReturn = false) + { + if($foreignTable === null) { + $foreignTable = $search->getTableMap()->getName(); + $aliasPrefix = ''; + } else { + $aliasPrefix = $foreignTable . '_'; + } + + $defaultLangWithoutTranslation = ConfigQuery::getDefaultLangWhenNoTranslationAvailable(); + + $requestedLocaleI18nAlias = $aliasPrefix . 'requested_locale_i18n'; + $defaultLocaleI18nAlias = $aliasPrefix . 'default_locale_i18n'; + + if($defaultLangWithoutTranslation == 0) { + + $requestedLocaleJoin = new Join(); + $requestedLocaleJoin->addExplicitCondition($search->getTableMap()->getName(), $foreignKey, null, $foreignTable . '_i18n', 'ID', $requestedLocaleI18nAlias); + $requestedLocaleJoin->setJoinType($forceReturn === false ? Criteria::INNER_JOIN : Criteria::LEFT_JOIN); + + $search->addJoinObject($requestedLocaleJoin, $requestedLocaleI18nAlias) + ->addJoinCondition($requestedLocaleI18nAlias ,'`' . $requestedLocaleI18nAlias . '`.LOCALE = ?', $requestedLocale, null, \PDO::PARAM_STR); + + $search->withColumn('NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.`ID`)', $aliasPrefix . 'IS_TRANSLATED'); + + foreach($columns as $column) { + $search->withColumn('`' . $requestedLocaleI18nAlias . '`.`' . $column . '`', $aliasPrefix . 'i18n_' . $column); + } + } else { + $defaultLocale = Lang::getDefaultLanguage()->getLocale(); + + $defaultLocaleJoin = new Join(); + $defaultLocaleJoin->addExplicitCondition($search->getTableMap()->getName(), $foreignKey, null, $foreignTable . '_i18n', 'ID', $defaultLocaleI18nAlias); + $defaultLocaleJoin->setJoinType(Criteria::LEFT_JOIN); + + $search->addJoinObject($defaultLocaleJoin, $defaultLocaleI18nAlias) + ->addJoinCondition($defaultLocaleI18nAlias ,'`' . $defaultLocaleI18nAlias . '`.LOCALE = ?', $defaultLocale, null, \PDO::PARAM_STR); + + $requestedLocaleJoin = new Join(); + $requestedLocaleJoin->addExplicitCondition($search->getTableMap()->getName(), $foreignKey, null, $foreignTable . '_i18n', 'ID', $requestedLocaleI18nAlias); + $requestedLocaleJoin->setJoinType(Criteria::LEFT_JOIN); + + $search->addJoinObject($requestedLocaleJoin, $requestedLocaleI18nAlias) + ->addJoinCondition($requestedLocaleI18nAlias ,'`' . $requestedLocaleI18nAlias . '`.LOCALE = ?', $requestedLocale, null, \PDO::PARAM_STR); + + $search->withColumn('NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.`ID`)', $aliasPrefix . 'IS_TRANSLATED'); + + if($forceReturn === false) { + $search->where('NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.ID)')->_or()->where('NOT ISNULL(`' . $defaultLocaleI18nAlias . '`.ID)'); + } + + foreach($columns as $column) { + $search->withColumn('CASE WHEN NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.ID) THEN `' . $requestedLocaleI18nAlias . '`.`' . $column . '` ELSE `' . $defaultLocaleI18nAlias . '`.`' . $column . '` END', $aliasPrefix . 'i18n_' . $column); + } + } + } + + public static function getBackEndI18n(ModelCriteria &$search, $requestedLocale, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID') + { + if($foreignTable === null) { + $foreignTable = $search->getTableMap()->getName(); + $aliasPrefix = ''; + } else { + $aliasPrefix = $foreignTable . '_'; + } + + $requestedLocaleI18nAlias = 'requested_locale_i18n'; + + $requestedLocaleJoin = new Join(); + $requestedLocaleJoin->addExplicitCondition($search->getTableMap()->getName(), $foreignKey, null, $foreignTable . '_i18n', 'ID', $requestedLocaleI18nAlias); + $requestedLocaleJoin->setJoinType(Criteria::LEFT_JOIN); + + $search->addJoinObject($requestedLocaleJoin, $requestedLocaleI18nAlias) + ->addJoinCondition($requestedLocaleI18nAlias ,'`' . $requestedLocaleI18nAlias . '`.LOCALE = ?', $requestedLocale, null, \PDO::PARAM_STR); + + $search->withColumn('NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.`ID`)', $aliasPrefix . 'IS_TRANSLATED'); + + foreach($columns as $column) { + $search->withColumn('`' . $requestedLocaleI18nAlias . '`.`' . $column . '`', $aliasPrefix . 'i18n_' . $column); + } + } + + public static function getI18n($backendContext, $requestedLangId, ModelCriteria &$search, $currentLocale, $columns, $foreignTable, $foreignKey, $forceReturn = false) + { + // If a lang has been requested, find the related Lang object, and get the locale + if ($requestedLangId !== null) { + $localeSearch = LangQuery::create()->findOneById($requestedLangId); + + if ($localeSearch === null) { + throw new \InvalidArgumentException(sprintf('Incorrect lang argument given : lang ID %d not found', $requestedLangId)); + } + + $locale = $localeSearch->getLocale(); + } + else { + // Use the currently defined locale + $locale = $currentLocale; + } + + // Call the proper method depending on the context: front or back + if ($backendContext) { + self::getBackEndI18n($search, $locale, $columns, $foreignTable, $foreignKey); + } else { + self::getFrontEndI18n($search, $locale, $columns, $foreignTable, $foreignKey, $forceReturn); + } + + return $locale; + } +} diff --git a/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php b/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php new file mode 100644 index 000000000..17af1e44d --- /dev/null +++ b/core/lib/Thelia/Model/Tools/ModelEventDispatcherTrait.php @@ -0,0 +1,58 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Model\Tools; + +use Thelia\Core\Event\ActionEvent; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; + +/** + * A trait to provide event dispatching mechanism to Model objects + */ +trait ModelEventDispatcherTrait { + + /** + * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface + */ + protected $dispatcher = null; + + + public function setDispatcher(EventDispatcherInterface $dispatcher) + { + $this->dispatcher = $dispatcher; + + return $this; + } + + public function getDispatcher() + { + return $this->dispatcher; + } + + protected function dispatchEvent($eventName, ActionEvent $event) + { + if (!is_null($this->dispatcher)) { + $this->dispatcher->dispatch($eventName, $event); + } + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php new file mode 100644 index 000000000..eb71564eb --- /dev/null +++ b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php @@ -0,0 +1,190 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Model\Tools; + +use Propel\Runtime\ActiveQuery\PropelQuery; +use Propel\Runtime\ActiveQuery\Criteria; +use Propel\Runtime\Propel; + +trait PositionManagementTrait { + + /** + * Create an instancer of this object query + */ + private function createQuery() { + return PropelQuery::from(__CLASS__); + } + + /** + * Return the database name from this object's table map. + */ + private function getDatabaseNameFromMap() { + $class = new \ReflectionClass(self::TABLE_MAP); + + return $class->getConstant('DATABASE_NAME'); + } + + + /** + * Get the position of the next inserted object + */ + public function getNextPosition($parent = null) { + + $query = $this->createQuery() + ->orderByPosition(Criteria::DESC) + ->limit(1); + + if ($parent !== null) $query->filterByParent($parent); + + $last = $query->findOne() + ; + + return $last != null ? $last->getPosition() + 1 : 1; + } + + /** + * Move up a object + */ + public function movePositionUp() { + $this->movePositionUpOrDown(true); + } + + /** + * Move down a object + */ + public function movePositionDown() { + $this->movePositionUpOrDown(false); + } + + /** + * Move up or down a object + * + * @param the exchange mode: go up (POSITION_UP) or go down (POSITION_DOWN) + */ + protected function movePositionUpOrDown($up = true) + { + // The current position of the object + $my_position = $this->getPosition(); + + // Find object to exchange position with + $search = $this->createQuery(); + + if (method_exists($this, 'getParent')) $search->filterByParent($this->getParent()); + + // Up or down ? + if ($up === true) { + // Find the object immediately before me + $search->filterByPosition(array('max' => $my_position-1))->orderByPosition(Criteria::DESC); + } + else { + // Find the object immediately after me + $search->filterByPosition(array('min' => $my_position+1))->orderByPosition(Criteria::ASC); + } + + $result = $search->findOne(); + + // If we found the proper object, exchange their positions + if ($result) { + + $cnx = Propel::getWriteConnection($this->getDatabaseName()); + + $cnx->beginTransaction(); + + try { + $this + ->setPosition($result->getPosition()) + ->save() + ; + + $result->setDispatcher($this->getDispatcher())->setPosition($my_position)->save(); + + $cnx->commit(); + } catch (Exception $e) { + $cnx->rollback(); + } + } + } + + /** + * Simply return the database name, from the constant in the MAP class. + */ + protected function getDatabaseName() { + // Find DATABASE_NAME constant + $mapClassName = self::TABLE_MAP; + + return $mapClassName::DATABASE_NAME; + } + + /** + * Changes object position + * + * @param newPosition + */ + public function changeAbsolutePosition($newPosition) + { + // The current position + $current_position = $this->getPosition(); + + if ($newPosition != null && $newPosition > 0 && $newPosition != $current_position) { + + // Find categories to offset + $search = $this->createQuery(); + + if (method_exists($this, 'getParent')) $search->filterByParent($this->getParent()); + + if ($newPosition > $current_position) { + // The new position is after the current position -> we will offset + 1 all categories located between us and the new position + $search->filterByPosition(array('min' => 1+$current_position, 'max' => $newPosition)); + + $delta = -1; + } else { + // The new position is brefore the current position -> we will offset - 1 all categories located between us and the new position + $search->filterByPosition(array('min' => $newPosition, 'max' => $current_position - 1)); + + $delta = 1; + } + + $results = $search->find(); + + $cnx = Propel::getWriteConnection($this->getDatabaseName()); + + $cnx->beginTransaction(); + + try { + foreach ($results as $result) { + $result->setDispatcher($this->getDispatcher())->setPosition($result->getPosition() + $delta)->save($cnx); + } + + $this + ->setPosition($newPosition) + ->save($cnx) + ; + + $cnx->commit(); + } catch (Exception $e) { + $cnx->rollback(); + } + } + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php old mode 100644 new mode 100755 index 07cc1d116..145da3c02 --- a/core/lib/Thelia/Module/BaseModule.php +++ b/core/lib/Thelia/Module/BaseModule.php @@ -24,7 +24,9 @@ namespace Thelia\Module; -abstract class BaseModule +use Symfony\Component\DependencyInjection\ContainerAware; + +abstract class BaseModule extends ContainerAware { public function __construct() @@ -37,6 +39,19 @@ abstract class BaseModule } + public function hasContainer() + { + return null === $this->container; + } + + public function getContainer() + { + if($this->hasContainer() === false) { + throw new \RuntimeException("Sorry, container his not available in this context"); + } + return $this->container; + } + abstract public function install(); abstract public function destroy(); diff --git a/core/lib/Thelia/Module/BaseModuleInterface.php b/core/lib/Thelia/Module/BaseModuleInterface.php new file mode 100644 index 000000000..2db450830 --- /dev/null +++ b/core/lib/Thelia/Module/BaseModuleInterface.php @@ -0,0 +1,37 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Module; + + +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpFoundation\Request; + +interface BaseModuleInterface { + + public function setRequest(Request $request); + public function getRequest(); + + public function setDispatcher(EventDispatcherInterface $dispatcher); + public function getDispatcher(); +} \ No newline at end of file diff --git a/core/lib/Thelia/Module/DeliveryModuleInterface.php b/core/lib/Thelia/Module/DeliveryModuleInterface.php new file mode 100644 index 000000000..b8ffcfc01 --- /dev/null +++ b/core/lib/Thelia/Module/DeliveryModuleInterface.php @@ -0,0 +1,36 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Module; + + +interface DeliveryModuleInterface extends BaseModuleInterface { + + /** + * + * calculate and return delivery price + * + * @return mixed + */ + public function calculate($country = null); +} \ No newline at end of file diff --git a/core/lib/Thelia/Rewriting/RewritingResolver.php b/core/lib/Thelia/Rewriting/RewritingResolver.php new file mode 100755 index 000000000..4c8bcba40 --- /dev/null +++ b/core/lib/Thelia/Rewriting/RewritingResolver.php @@ -0,0 +1,97 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Rewriting; + +use Propel\Runtime\ActiveQuery\Criteria; +use Propel\Runtime\ActiveQuery\Join; +use Thelia\Exception\RewritingUrlException; +use Thelia\Exception\UrlRewritingException; +use Thelia\Model\RewritingUrlQuery; +use Thelia\Model\Map\RewritingUrlTableMap; + +/** + * Class RewritingResolver + * @package Thelia\Rewriting + * @author Etienne Roudeix + * + * This class provides methods to resolve rewritten URL as a query + */ +class RewritingResolver +{ + protected $search = null; + protected $rewritingUrlQuery = null; + + public $view; + public $viewId; + public $locale; + public $otherParameters; + public $redirectedToUrl; + + public function __construct($url = null) + { + $this->rewritingUrlQuery = new RewritingUrlQuery(); + + if($url !== null) { + $this->load($url); + } + } + + public function load($rewrittenUrl) + { + $rewrittenUrl = ltrim($rewrittenUrl, '/'); + + $this->search = $this->rewritingUrlQuery->getResolverSearch($rewrittenUrl); + + if($this->search->count() == 0) { + throw new UrlRewritingException('URL NOT FOUND', UrlRewritingException::URL_NOT_FOUND); + } + + $this->view = $this->search->getFirst()->getVirtualColumn('ru_view'); + $this->viewId = $this->search->getFirst()->getVirtualColumn('ru_viewId'); + $this->locale = $this->search->getFirst()->getVirtualColumn('ru_locale'); + $this->redirectedToUrl = $this->search->getFirst()->getVirtualColumn('ru_redirected_to_url'); + + $this->otherParameters = $this->getOtherParameters(); + } + + protected function getOtherParameters() + { + if($this->search === null) { + throw new UrlRewritingException('RESOLVER NULL SEARCH', UrlRewritingException::RESOLVER_NULL_SEARCH); + } + + $otherParameters = array(); + foreach($this->search as $result) { + $parameter = $result->getParameter(); + $value = $result->getValue(); + + if(null !== $parameter) { + $otherParameters[$parameter] = $value; + } + } + + return $otherParameters; + } + + +} diff --git a/core/lib/Thelia/Rewriting/RewritingRetriever.php b/core/lib/Thelia/Rewriting/RewritingRetriever.php new file mode 100755 index 000000000..8289942f2 --- /dev/null +++ b/core/lib/Thelia/Rewriting/RewritingRetriever.php @@ -0,0 +1,111 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Rewriting; + +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Model\RewritingUrlQuery; +use Thelia\Model\Map\RewritingUrlTableMap; +use Thelia\Tools\URL; + +/** + * Class RewritingRetriever + * @package Thelia\Rewriting + * @author Etienne Roudeix + * + * This class provides methods to retrieve a rewritten URL from a query + */ +class RewritingRetriever +{ + protected $search = null; + protected $rewritingUrlQuery = null; + + public $url; + public $rewrittenUrl; + + public function __construct($view = null, $viewLocale = null, $viewId = null) + { + $this->rewritingUrlQuery = new RewritingUrlQuery(); + + if($view !== null && $viewLocale !== null) { + $this->load($view, $viewLocale, $viewId); + } + } + + /** + * @param $view + * @param $viewLocale + * @param null $viewId + */ + public function loadViewUrl($view, $viewLocale, $viewId = null) + { + $this->search = $this->rewritingUrlQuery->getViewUrlQuery($view, $viewLocale, $viewId); + + $allParametersWithoutView = array(); + $allParametersWithoutView['locale'] = $viewLocale; + if(null !== $viewId) { + $allParametersWithoutView[$view . '_id'] = $viewId; + } + + $this->rewrittenUrl = null; + $this->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView); + if($this->search !== null) { + $this->rewrittenUrl = $this->search->getUrl(); + } + } + + /** + * @param $view + * @param $viewLocale + * @param null $viewId + * @param array $viewOtherParameters + */ + public function loadSpecificUrl($view, $viewLocale, $viewId = null, $viewOtherParameters = array()) + { + if(empty($viewOtherParameters)) { + $this->loadViewUrl($view, $viewLocale, $viewId); + return; + } + + $this->search = $this->rewritingUrlQuery->getSpecificUrlQuery($view, $viewLocale, $viewId, $viewOtherParameters); + + $allParametersWithoutView = $viewOtherParameters; + $allParametersWithoutView['locale'] = $viewLocale; + if(null !== $viewId) { + $allParametersWithoutView[$view . '_id'] = $viewId; + } + + $this->rewrittenUrl = null; + $this->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView); + if($this->search !== null) { + $this->rewrittenUrl = $this->search->getUrl(); + } + } + + /** + * @return mixed + */ + public function toString() + { + return $this->rewrittenUrl === null ? $this->url : $this->rewrittenUrl; + } +} diff --git a/core/lib/Thelia/TaxEngine/Calculator.php b/core/lib/Thelia/TaxEngine/Calculator.php new file mode 100755 index 000000000..66c4fcbbf --- /dev/null +++ b/core/lib/Thelia/TaxEngine/Calculator.php @@ -0,0 +1,95 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\TaxEngine; + +use Thelia\Exception\TaxEngineException; +use Thelia\Model\Country; +use Thelia\Model\Product; +use Thelia\Model\TaxRuleQuery; + +/** + * Class Calculator + * @package Thelia\TaxEngine + * @author Etienne Roudeix + */ +class Calculator +{ + protected $taxRuleQuery = null; + + protected $taxRulesGroupedCollection = null; + + protected $product = null; + protected $country = null; + + public function __construct() + { + $this->taxRuleQuery = new TaxRuleQuery(); + } + + public function load(Product $product, Country $country) + { + $this->product = null; + $this->country = null; + $this->taxRulesGroupedCollection = null; + + if($product->getId() === null) { + throw new TaxEngineException('Product id is empty in Calculator::load', TaxEngineException::UNDEFINED_PRODUCT); + } + if($country->getId() === null) { + throw new TaxEngineException('Country id is empty in Calculator::load', TaxEngineException::UNDEFINED_COUNTRY); + } + + $this->product = $product; + $this->country = $country; + + $this->taxRulesGroupedCollection = $this->taxRuleQuery->getTaxCalculatorGroupedCollection($product, $country); + + return $this; + } + + public function getTaxAmount($amount) + { + if(null === $this->taxRulesGroupedCollection) { + throw new TaxEngineException('Tax rules collection is empty in Calculator::getTaxAmount', TaxEngineException::UNDEFINED_TAX_RULES_COLLECTION); + } + + if(false === filter_var($amount, FILTER_VALIDATE_FLOAT)) { + throw new TaxEngineException('BAD AMOUNT FORMAT', TaxEngineException::BAD_AMOUNT_FORMAT); + } + + $totalTaxAmount = 0; + foreach($this->taxRulesGroupedCollection as $taxRule) { + $rateSum = $taxRule->getTaxRuleRateSum(); + $taxAmount = $amount * $rateSum * 0.01; + $totalTaxAmount += $taxAmount; + $amount += $taxAmount; + } + + return $totalTaxAmount; + } + + public function getTaxedPrice($amount) + { + return $amount + $this->getTaxAmount($amount); + } +} diff --git a/core/lib/Thelia/Tests/Action/AddressTest.php b/core/lib/Thelia/Tests/Action/AddressTest.php new file mode 100644 index 000000000..68fc97923 --- /dev/null +++ b/core/lib/Thelia/Tests/Action/AddressTest.php @@ -0,0 +1,145 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Action; +use Thelia\Action\Address; +use Thelia\Core\Event\AddressCreateOrUpdateEvent; +use Thelia\Model\Base\CustomerQuery; + + +/** + * + * test address eventListener + * + * Class AddressTest + * @package Thelia\Tests\Action + * @author Manuel Raynaud + */ +class AddressTest 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; + } + + public function testCreatedAddress() + { + $customer = CustomerQuery::create()->findOne(); + + $AddressCreateOrUpdateEvent = new AddressCreateOrUpdateEvent( + "test address", + 1, + "Thelia", + "Thelia", + "5 rue rochon", + "", + "", + "63000", + "clermont-ferrand", + 64, + "0102030405", + "", + "" + ); + $AddressCreateOrUpdateEvent->setCustomer($customer); + + $actionAddress = new Address($this->getContainer()); + $actionAddress->create($AddressCreateOrUpdateEvent); + + $createdAddress = $AddressCreateOrUpdateEvent->getAddress(); + + $this->assertInstanceOf("Thelia\Model\Address", $createdAddress); + $this->assertFalse($createdAddress->isNew()); + $this->assertSame($customer, $createdAddress->getCustomer()); + + $this->assertEquals($AddressCreateOrUpdateEvent->getLabel(), $createdAddress->getLabel()); + $this->assertEquals($AddressCreateOrUpdateEvent->getTitle(), $createdAddress->getTitleId()); + $this->assertEquals($AddressCreateOrUpdateEvent->getFirstname(), $createdAddress->getFirstname()); + $this->assertEquals($AddressCreateOrUpdateEvent->getLastname(), $createdAddress->getLastname()); + $this->assertEquals($AddressCreateOrUpdateEvent->getAddress1(), $createdAddress->getAddress1()); + $this->assertEquals($AddressCreateOrUpdateEvent->getAddress2(), $createdAddress->getAddress2()); + $this->assertEquals($AddressCreateOrUpdateEvent->getAddress3(), $createdAddress->getAddress3()); + $this->assertEquals($AddressCreateOrUpdateEvent->getZipcode(), $createdAddress->getZipcode()); + $this->assertEquals($AddressCreateOrUpdateEvent->getCity(), $createdAddress->getCity()); + $this->assertEquals($AddressCreateOrUpdateEvent->getCountry(), $createdAddress->getCountryId()); + $this->assertEquals($AddressCreateOrUpdateEvent->getPhone(), $createdAddress->getPhone()); + $this->assertEquals($AddressCreateOrUpdateEvent->getCellphone(), $createdAddress->getCellphone()); + $this->assertEquals($AddressCreateOrUpdateEvent->getCompany(), $createdAddress->getCompany()); + } + + public function testUpdatedAddress() + { + + $customer = CustomerQuery::create()->findOne(); + $address = $customer->getAddresses()->getFirst(); + + $addressEvent = new AddressCreateOrUpdateEvent( + "", + 1, + "Thelia modif", + "Thelia modif", + "cour des étoiles", + "rue des miracles", + "", + "63000", + "clermont-ferrand", + 64, + "0102030405", + "", + "" + ); + $addressEvent->setAddress($address); + + $actionAddress = new Address($this->getContainer()); + $actionAddress->update($addressEvent); + + + $updatedAddress = $addressEvent->getAddress(); + $this->assertInstanceOf("Thelia\Model\Address", $updatedAddress); + $this->assertFalse($updatedAddress->isNew()); + $this->assertSame($customer, $updatedAddress->getCustomer()); + + $this->assertEquals($address->getLabel(), $updatedAddress->getLabel()); + $this->assertEquals($addressEvent->getTitle(), $updatedAddress->getTitleId()); + $this->assertEquals($addressEvent->getFirstname(), $updatedAddress->getFirstname()); + $this->assertEquals($addressEvent->getLastname(), $updatedAddress->getLastname()); + $this->assertEquals($addressEvent->getAddress1(), $updatedAddress->getAddress1()); + $this->assertEquals($addressEvent->getAddress2(), $updatedAddress->getAddress2()); + $this->assertEquals($addressEvent->getAddress3(), $updatedAddress->getAddress3()); + $this->assertEquals($addressEvent->getZipcode(), $updatedAddress->getZipcode()); + $this->assertEquals($addressEvent->getCity(), $updatedAddress->getCity()); + $this->assertEquals($addressEvent->getCountry(), $updatedAddress->getCountryId()); + $this->assertEquals($addressEvent->getPhone(), $updatedAddress->getPhone()); + $this->assertEquals($addressEvent->getCellphone(), $updatedAddress->getCellphone()); + $this->assertEquals($addressEvent->getCompany(), $updatedAddress->getCompany()); + + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Tests/Action/ImageTest.php b/core/lib/Thelia/Tests/Action/ImageTest.php old mode 100644 new mode 100755 index bde077481..8cc6e5644 --- a/core/lib/Thelia/Tests/Action/ImageTest.php +++ b/core/lib/Thelia/Tests/Action/ImageTest.php @@ -30,13 +30,14 @@ use Thelia\Core\HttpFoundation\Session\Session; use Thelia\Action\Image; use Thelia\Core\Event\ImageEvent; use Thelia\Model\ConfigQuery; +use Thelia\Tools\URL; /** * Class ImageTest * * @package Thelia\Tests\Action\ImageTest */ -class ImageTest extends \PHPUnit_Framework_TestCase +class ImageTest extends \Thelia\Tests\TestCaseWithURLToolSetup { protected $request; @@ -50,6 +51,11 @@ class ImageTest extends \PHPUnit_Framework_TestCase $container->set("event_dispatcher", $dispatcher); + $request = new Request(); + $request->setSession($this->session); + + $container->set("request", $request); + return $container; } diff --git a/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-1.png b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-1.png old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-2.png b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-2.png old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-3.png b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-3.png old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-4.png b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-4.png old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-5.png b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-5.png old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-6.png b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-6.png old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-7.png b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-7.png old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-8.png b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-8.png old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-9.png b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-9.png old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Tests/Cart/CartTraitTest.php b/core/lib/Thelia/Tests/Cart/CartTraitTest.php old mode 100644 new mode 100755 index 586de3d11..039e4448e --- a/core/lib/Thelia/Tests/Cart/CartTraitTest.php +++ b/core/lib/Thelia/Tests/Cart/CartTraitTest.php @@ -34,6 +34,7 @@ use Thelia\Model\Customer; * * Class CartTraitTest * @package Thelia\Tests\Cart\CartTraitTest + * @author Manuel Raynaud */ class CartTraitTest extends \PHPUnit_Framework_TestCase { diff --git a/core/lib/Thelia/Tests/Command/BaseCommandTest.php b/core/lib/Thelia/Tests/Command/BaseCommandTest.php old mode 100644 new mode 100755 index 09a84d54e..54b62e3f5 --- a/core/lib/Thelia/Tests/Command/BaseCommandTest.php +++ b/core/lib/Thelia/Tests/Command/BaseCommandTest.php @@ -22,6 +22,13 @@ /*************************************************************************************/ namespace Thelia\Tests\Command; +/** + * base class for testing command line command + * + * Class BaseCommandTest + * @package Thelia\Tests\Command + * @author Manuel Raynaud + */ abstract class BaseCommandTest extends \PHPUnit_Framework_TestCase { public function getKernel() diff --git a/core/lib/Thelia/Tests/Command/CacheClearTest.php b/core/lib/Thelia/Tests/Command/CacheClearTest.php index 4e05e5611..741fad299 100755 --- a/core/lib/Thelia/Tests/Command/CacheClearTest.php +++ b/core/lib/Thelia/Tests/Command/CacheClearTest.php @@ -28,6 +28,13 @@ use Thelia\Command\CacheClear; use Symfony\Component\Filesystem\Filesystem; +/** + * test the cache:clear command + * + * Class CacheClearTest + * @package Thelia\Tests\Command + * @author Manuel Raynaud + */ class CacheClearTest extends \PHPUnit_Framework_TestCase { @@ -40,6 +47,7 @@ class CacheClearTest extends \PHPUnit_Framework_TestCase $fs = new Filesystem(); $fs->mkdir($this->cache_dir); + $fs->mkdir(THELIA_WEB_DIR . "/assets"); } public function testCacheClear() diff --git a/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php b/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php old mode 100644 new mode 100755 index f1167fe09..78d84ea78 --- a/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php +++ b/core/lib/Thelia/Tests/Command/ModuleGenerateCommandTest.php @@ -27,6 +27,13 @@ use Symfony\Component\Filesystem\Filesystem; use Thelia\Core\Application; use Thelia\Command\ModuleGenerateCommand; +/** + * test the module:generate command + * + * Class ModuleGenerateCommandTest + * @package Thelia\Tests\Command + * @author Manuel Raynaud + */ class ModuleGenerateCommandTest extends BaseCommandTest { protected $command; diff --git a/core/lib/Thelia/Tests/Constraint/ConstraintFactoryTest.php b/core/lib/Thelia/Tests/Constraint/ConstraintFactoryTest.php new file mode 100644 index 000000000..70d6e498c --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/ConstraintFactoryTest.php @@ -0,0 +1,229 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Thelia\Constraint\Rule\AvailableForTotalAmountManager; +use Thelia\Constraint\Rule\AvailableForXArticlesManager; +use Thelia\Constraint\Rule\Operators; +use Thelia\Coupon\CouponBaseAdapter; +use Thelia\Coupon\CouponRuleCollection; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test ConstraintManager Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class ConstraintFactoryTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + public function setUp() + { + } + + /** + * Check the Rules serialization module + */ + public function testBuild() + { + $stubTranslator = $this->getMockBuilder('\Thelia\Core\Translation\Translator') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getTranslator') + ->will($this->returnValue($stubTranslator)); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::SUPERIOR, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 40.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR' + ); + $rule1->setValidatorsFromForm($operators, $values); + + /** @var ConstraintManager $constraintManager */ + $constraintFactory = new ConstraintFactory($this->getContainer()); + $ruleManager1 = $constraintFactory->build($rule1->getServiceId(), $operators, $values); + + $expected = $rule1; + $actual = $ruleManager1; + + $this->assertEquals($expected, $actual); + $this->assertEquals($rule1->getServiceId(), $ruleManager1->getServiceId()); + $this->assertEquals($rule1->getValidators(), $ruleManager1->getValidators()); + } + + /** + * Check the Rules serialization module + */ + public function testBuildFail() + { + $stubTranslator = $this->getMockBuilder('\Thelia\Core\Translation\Translator') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getTranslator') + ->will($this->returnValue($stubTranslator)); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::SUPERIOR, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 40.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR' + ); + $rule1->setValidatorsFromForm($operators, $values); + + /** @var ConstraintManager $constraintManager */ + $constraintFactory = new ConstraintFactory($this->getContainer()); + $ruleManager1 = $constraintFactory->build('unset.service', $operators, $values); + + $expected = false; + $actual = $ruleManager1; + + $this->assertEquals($expected, $actual); + } + + + /** + * Check the Rules serialization module + */ + public function testRuleSerialisation() + { + $stubTranslator = $this->getMockBuilder('\Thelia\Core\Translation\Translator') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getTranslator') + ->will($this->returnValue($stubTranslator)); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::SUPERIOR, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 40.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR' + ); + $rule1->setValidatorsFromForm($operators, $values); + + $rule2 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::SUPERIOR, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR' + ); + $rule2->setValidatorsFromForm($operators, $values); + + $rules = new CouponRuleCollection(); + $rules->add($rule1); + $rules->add($rule2); + + /** @var ConstraintManager $constraintManager */ + $constraintFactory = new ConstraintFactory($this->getContainer()); + + $serializedRules = $constraintFactory->serializeCouponRuleCollection($rules); + $unserializedRules = $constraintFactory->unserializeCouponRuleCollection($serializedRules); + + $expected = (string)$rules; + $actual = (string)$unserializedRules; + + $this->assertEquals($expected, $actual); + } + + /** + * Get Mocked Container with 2 Rules + * + * @return ContainerBuilder + */ + public function getContainer() + { + $container = new ContainerBuilder(); + + $stubTranslator = $this->getMockBuilder('\Thelia\Core\Translation\Translator') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getTranslator') + ->will($this->returnValue($stubTranslator)); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $rule2 = new AvailableForXArticlesManager($stubAdapter); + + $adapter = new CouponBaseAdapter($container); + + $container->set('thelia.constraint.rule.available_for_total_amount', $rule1); + $container->set('thelia.constraint.rule.available_for_x_articles', $rule2); + $container->set('thelia.adapter', $adapter); + + return $container; + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } +} diff --git a/core/lib/Thelia/Tests/Constraint/ConstraintValidatorTest.php b/core/lib/Thelia/Tests/Constraint/ConstraintValidatorTest.php new file mode 100644 index 000000000..28ac4b952 --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/ConstraintValidatorTest.php @@ -0,0 +1,337 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Constraint; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Thelia\Constraint\Rule\AvailableForTotalAmountManager; +use Thelia\Constraint\Rule\AvailableForXArticlesManager; +use Thelia\Constraint\Rule\Operators; +use Thelia\Coupon\CouponBaseAdapter; +use Thelia\Coupon\CouponRuleCollection; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test ConstraintValidator Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + public function setUp() + { + } + + public function testTestSuccess1Rules() + { + $ConstraintValidator = new ConstraintValidator(); + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(401)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => '>', + AvailableForTotalAmountManager::INPUT2 => '==' + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + + $rules = new CouponRuleCollection(); + $rules->add($rule1); + + $isValid = $ConstraintValidator->test($rules); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + public function testTestFail1Rules() + { + $ConstraintValidator = new ConstraintValidator(); + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(400)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => '>', + AvailableForTotalAmountManager::INPUT2 => '==' + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + + $rules = new CouponRuleCollection(); + $rules->add($rule1); + + $isValid = $ConstraintValidator->test($rules); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual, 'Constraints validator always think Customer is matching rules'); + } + + public function testTestSuccess2Rules() + { + $ConstraintValidator = new ConstraintValidator(); + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(401)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(5)); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => '>', + AvailableForTotalAmountManager::INPUT2 => '==' + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $rule2 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => '>' + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 4 + ); + $rule2->setValidatorsFromForm($operators, $values); + + $rules = new CouponRuleCollection(); + $rules->add($rule1); + $rules->add($rule2); + + $isValid = $ConstraintValidator->test($rules); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + public function testTestFail2Rules() + { + $ConstraintValidator = new ConstraintValidator(); + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(400)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(5)); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => '>', + AvailableForTotalAmountManager::INPUT2 => '==' + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $rule2 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => '>' + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 4 + ); + $rule2->setValidatorsFromForm($operators, $values); + + $rules = new CouponRuleCollection(); + $rules->add($rule1); + $rules->add($rule2); + + $isValid = $ConstraintValidator->test($rules); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual, 'Constraints validator always think Customer is matching rules'); + } + + + public function testVariableOpComparisonSuccess() + { + $ConstraintValidator = new ConstraintValidator(); + $expected = true; + $actual = $ConstraintValidator->variableOpComparison(1, Operators::EQUAL, 1); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(1, Operators::DIFFERENT, 2); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(1, Operators::SUPERIOR, 0); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(1, Operators::INFERIOR, 2); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(1, Operators::INFERIOR_OR_EQUAL, 1); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(1, Operators::INFERIOR_OR_EQUAL, 2); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(1, Operators::SUPERIOR_OR_EQUAL, 1); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(1, Operators::SUPERIOR_OR_EQUAL, 0); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(1, Operators::IN, array(1, 2, 3)); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(1, Operators::OUT, array(0, 2, 3)); + $this->assertEquals($expected, $actual); + + } + + public function testVariableOpComparisonFail() + { + $ConstraintValidator = new ConstraintValidator(); + $expected = false; + $actual = $ConstraintValidator->variableOpComparison(2, Operators::EQUAL, 1); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(2, Operators::DIFFERENT, 2); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(0, Operators::SUPERIOR, 0); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(3, Operators::INFERIOR, 2); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(2, Operators::INFERIOR_OR_EQUAL, 1); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(3, Operators::SUPERIOR_OR_EQUAL, 4); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(0, Operators::IN, array(1, 2, 3)); + $this->assertEquals($expected, $actual); + + $actual = $ConstraintValidator->variableOpComparison(2, Operators::OUT, array(0, 2, 3)); + $this->assertEquals($expected, $actual); + + } + + /** + * @expectedException \Exception + */ + public function testVariableOpComparisonException() + { + $ConstraintValidator = new ConstraintValidator(); + $expected = true; + $actual = $ConstraintValidator->variableOpComparison(1, 'bad', 1); + $this->assertEquals($expected, $actual); + } + + /** + * Get Mocked Container with 2 Rules + * + * @return ContainerBuilder + */ + public function getContainer() + { + $container = new ContainerBuilder(); + + $stubTranslator = $this->getMockBuilder('\Thelia\Core\Translation\Translator') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getTranslator') + ->will($this->returnValue($stubTranslator)); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $rule2 = new AvailableForXArticlesManager($stubAdapter); + + $adapter = new CouponBaseAdapter($container); + + $container->set('thelia.constraint.rule.available_for_total_amount', $rule1); + $container->set('thelia.constraint.rule.available_for_x_articles', $rule2); + $container->set('thelia.adapter', $adapter); + + return $container; + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } +} diff --git a/core/lib/Thelia/Tests/Constraint/Rule/AvailableForTotalAmountTest.php b/core/lib/Thelia/Tests/Constraint/Rule/AvailableForTotalAmountTest.php new file mode 100644 index 000000000..bfcde8a21 --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Rule/AvailableForTotalAmountTest.php @@ -0,0 +1,670 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Thelia\Constraint\Rule\AvailableForTotalAmountManager; +use Thelia\Constraint\Rule\Operators; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test AvailableForTotalAmount Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase +{ + /** @var CouponAdapterInterface $stubTheliaAdapter */ + protected $stubTheliaAdapter = null; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { +// /** @var CouponAdapterInterface $stubTheliaAdapter */ +// $this->stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock(); + } + +// /** +// * Generate valid CouponBaseAdapter +// * +// * @param float $cartTotalPrice Total amount of the current Cart +// * +// * @return CouponAdapterInterface +// */ +// protected function generateValidCouponBaseAdapterMock($cartTotalPrice = 421.23) +// { +// /** @var CouponAdapterInterface $stubTheliaAdapter */ +// $stubTheliaAdapter = $this->getMock( +// 'Thelia\Coupon\CouponBaseAdapter', +// array('getCartTotalPrice'), +// array() +// ); +// $stubTheliaAdapter->expects($this->any()) +// ->method('getCartTotalPrice') +// ->will($this->returnValue($cartTotalPrice)); +// +// return $stubTheliaAdapter; +// } + +// /** +// * Check if validity test on BackOffice inputs are working +// * +// * @covers Thelia\Coupon\Rule\AvailableForTotalAmount::checkBackOfficeInput +// * +// */ +// public function testValidBackOfficeInput() +// { +// $adapter = new CouponBaseAdapter(); +// +// $validators = array( +// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( +// Operators::SUPERIOR, +// new PriceParam( +// $adapter, 421.23, 'EUR' +// ) +// ) +// ); +// $rule = new AvailableForTotalAmount($adapter, $validators); +// +// $expected = true; +// $actual = $rule->checkBackOfficeInput(); +// $this->assertEquals($expected, $actual); +// } + +// /** +// * Check if validity test on BackOffice inputs are working +// * +// * @covers Thelia\Coupon\Rule\AvailableForTotalAmount::checkBackOfficeInput +// * @expectedException \Thelia\Exception\InvalidRuleOperatorException +// * +// */ +// public function testInValidBackOfficeInputOperator() +// { +// $adapter = new CouponBaseAdapter(); +// +// $validators = array( +// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( +// 'X', +// new PriceParam( +// $adapter, 421.23, 'EUR' +// ) +// ) +// ); +// +// $rule = new AvailableForTotalAmount($adapter, $validators); +// +// $expected = false; +// $actual = $rule->checkBackOfficeInput(); +// $this->assertEquals($expected, $actual); +// } + +// /** +// * Check if validity test on BackOffice inputs are working +// * +// * @covers Thelia\Coupon\Rule\AvailableForTotalAmount::checkBackOfficeInput +// * @expectedException \ErrorException +// * +// */ +// public function testInValidBackOfficeInputValue() +// { +// $adapter = $this->generateValidCouponBaseAdapterMock(); +// +// $validators = array( +// AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( +// Operators::SUPERIOR, +// 421 +// ) +// ); +// +// $rule = new AvailableForTotalAmount($adapter, $validators); +// +// $expected = false; +// $actual = $rule->checkBackOfficeInput(); +// $this->assertEquals($expected, $actual); +// } + + + /** + * Check if test inferior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testMatchingRuleInferior() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(399)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::INFERIOR, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test inferior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testNotMatchingRuleInferior() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(400)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::INFERIOR, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test inferior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testMatchingRuleInferiorEquals() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(400)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test inferior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testMatchingRuleInferiorEquals2() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(399)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test inferior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testNotMatchingRuleInferiorEquals() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(401)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::INFERIOR_OR_EQUAL, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test equals operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testMatchingRuleEqual() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(400)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::EQUAL, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test equals operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testNotMatchingRuleEqual() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(399)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::EQUAL, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test superior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testMatchingRuleSuperiorEquals() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(401)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test superior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testMatchingRuleSuperiorEquals2() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(400)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test superior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testNotMatchingRuleSuperiorEquals() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(399.00)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + + /** + * Check if test superior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testMatchingRuleSuperior() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(401)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::SUPERIOR, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test superior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testNotMatchingRuleSuperior() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(399.00)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::SUPERIOR, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + + /** + * Check currency is checked + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testMatchingRuleCurrency() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(400.00)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::EQUAL, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'EUR'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check currency is checked + * + * @covers Thelia\Constraint\Rule\AvailableForTotalAmountManager::isMatching + * + */ + public function testNotMatchingRuleCurrency() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(400.00)); + $stubAdapter->expects($this->any()) + ->method('getCheckoutCurrency') + ->will($this->returnValue('EUR')); + + $rule1 = new AvailableForTotalAmountManager($stubAdapter); + $operators = array( + AvailableForTotalAmountManager::INPUT1 => Operators::EQUAL, + AvailableForTotalAmountManager::INPUT2 => Operators::EQUAL + ); + $values = array( + AvailableForTotalAmountManager::INPUT1 => 400.00, + AvailableForTotalAmountManager::INPUT2 => 'USD'); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Constraint/Rule/AvailableForXArticlesTest.php b/core/lib/Thelia/Tests/Constraint/Rule/AvailableForXArticlesTest.php new file mode 100644 index 000000000..3247e4b9a --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Rule/AvailableForXArticlesTest.php @@ -0,0 +1,673 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Thelia\Constraint\Rule\AvailableForXArticlesManager; +use Thelia\Constraint\Rule\Operators; +use Thelia\Constraint\Rule\SerializableRule; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test AvailableForXArticles Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase +{ + +// /** @var CouponAdapterInterface $stubTheliaAdapter */ +// protected $stubTheliaAdapter = null; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { +// /** @var CouponAdapterInterface $stubTheliaAdapter */ +// $this->stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock(); + } + +// /** +// * Generate valid CouponBaseAdapter +// * +// * @param int $nbArticlesInCart Total articles in the current Cart +// * +// * @return CouponAdapterInterface +// */ +// protected function generateValidCouponBaseAdapterMock($nbArticlesInCart = 4) +// { +// /** @var CouponAdapterInterface $stubTheliaAdapter */ +// $stubTheliaAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') +// ->disableOriginalConstructor() +// ->setMethods(array('getNbArticlesInCart')) +// ->getMock(); +// $stubTheliaAdapter->expects($this->any()) +// ->method('getNbArticlesInCart') +// ->will($this->returnValue($nbArticlesInCart)); +// +// return $stubTheliaAdapter; +// } + +// /** +// * Check if validity test on BackOffice inputs are working +// * +// * @covers Thelia\Coupon\Rule\AvailableForXArticles::checkBackOfficeInput +// * +// */ +// public function testValidBackOfficeInput() +// { +// $translator = $this->getMockBuilder('\Thelia\Core\Translation\Translator') +// ->disableOriginalConstructor() +// ->getMock(); +// +// $rule = new AvailableForXArticles($translator); +// $operators = array(AvailableForXArticles::PARAM1_QUANTITY => Operators::SUPERIOR); +// $values = array( +// AvailableForXArticles::PARAM1_QUANTITY => 4 +// ); +// $rule->populateFromForm($operators, $values); +// +// $expected = true; +// $actual = $rule->checkBackOfficeInput(); +// $this->assertEquals($expected, $actual); +// } + +// /** +// * Check if validity test on BackOffice inputs are working +// * +// * @covers Thelia\Coupon\Rule\AvailableForXArticles::checkBackOfficeInput +// * @expectedException \Thelia\Exception\InvalidRuleValueException +// */ +// public function testInValidBackOfficeInputFloat() +// { +// $adapter = $this->stubTheliaAdapter; +// +// $validators = array( +// AvailableForXArticles::PARAM1_QUANTITY => new RuleValidator( +// Operators::SUPERIOR, +// new QuantityParam( +// $adapter, +// 4.5 +// ) +// ) +// ); +// $rule = new AvailableForXArticles($adapter, $validators); +// +// $expected = false; +// $actual = $rule->checkBackOfficeInput(); +// $this->assertEquals($expected, $actual); +// } + +// /** +// * Check if validity test on BackOffice inputs are working +// * +// * @covers Thelia\Coupon\Rule\AvailableForXArticles::checkBackOfficeInput +// * @expectedException \Thelia\Exception\InvalidRuleValueException +// */ +// public function testInValidBackOfficeInputNegative() +// { +// $adapter = $this->stubTheliaAdapter; +// +// $validators = array( +// AvailableForXArticles::PARAM1_QUANTITY => new RuleValidator( +// Operators::SUPERIOR, +// new QuantityParam( +// $adapter, +// -1 +// ) +// ) +// ); +// $rule = new AvailableForXArticles($adapter, $validators); +// +// $expected = false; +// $actual = $rule->checkBackOfficeInput(); +// $this->assertEquals($expected, $actual); +// } + +// /** +// * Check if validity test on BackOffice inputs are working +// * +// * @covers Thelia\Coupon\Rule\AvailableForXArticles::checkBackOfficeInput +// * @expectedException \Thelia\Exception\InvalidRuleValueException +// */ +// public function testInValidBackOfficeInputString() +// { +// $adapter = $this->stubTheliaAdapter; +// +// $validators = array( +// AvailableForXArticles::PARAM1_QUANTITY => new RuleValidator( +// Operators::SUPERIOR, +// new QuantityParam( +// $adapter, +// 'bad' +// ) +// ) +// ); +// $rule = new AvailableForXArticles($adapter, $validators); +// +// $expected = false; +// $actual = $rule->checkBackOfficeInput(); +// $this->assertEquals($expected, $actual); +// } + + + + + + /** + * Check if test inferior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testMatchingRuleInferior() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::INFERIOR + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 5 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test inferior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testNotMatchingRuleInferior() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::INFERIOR + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 4, + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test inferior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testMatchingRuleInferiorEquals() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL, + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 5, + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test inferior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testMatchingRuleInferiorEquals2() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 4 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test inferior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testNotMatchingRuleInferiorEquals() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::INFERIOR_OR_EQUAL + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 3 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test equals operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testMatchingRuleEqual() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::EQUAL + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 4 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test equals operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testNotMatchingRuleEqual() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::EQUAL + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 5 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test superior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testMatchingRuleSuperiorEquals() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 4 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test superior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testMatchingRuleSuperiorEquals2() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 3 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test superior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testNotMatchingRuleSuperiorEquals() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::SUPERIOR_OR_EQUAL + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 5 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + + /** + * Check if test superior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testMatchingRuleSuperior() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::SUPERIOR + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 3 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = true; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + /** + * Check if test superior operator is working + * + * @covers Thelia\Constraint\Rule\AvailableForXArticlesManager::isMatching + * + */ + public function testNotMatchingRuleSuperior() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::SUPERIOR + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 4 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $isValid = $rule1->isMatching(); + + $expected = false; + $actual =$isValid; + $this->assertEquals($expected, $actual); + } + + public function testGetSerializableRule() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::SUPERIOR + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 4 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $serializableRule = $rule1->getSerializableRule(); + + $expected = new SerializableRule(); + $expected->ruleServiceId = $rule1->getServiceId(); + $expected->operators = $operators; + $expected->values = $values; + + $actual = $serializableRule; + + $this->assertEquals($expected, $actual); + + } + + public function testGetAvailableOperators() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::SUPERIOR + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 4 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $expected = array( + AvailableForXArticlesManager::INPUT1 => array( + Operators::INFERIOR, + Operators::INFERIOR_OR_EQUAL, + Operators::EQUAL, + Operators::SUPERIOR_OR_EQUAL, + Operators::SUPERIOR + ) + ); + $actual = $rule1->getAvailableOperators(); + + $this->assertEquals($expected, $actual); + + } + + public function testGetValidators() + { + $stubAdapter = $this->getMockBuilder('\Thelia\Coupon\CouponBaseAdapter') + ->disableOriginalConstructor() + ->getMock(); + + $stubAdapter->expects($this->any()) + ->method('getNbArticlesInCart') + ->will($this->returnValue(4)); + + $rule1 = new AvailableForXArticlesManager($stubAdapter); + $operators = array( + AvailableForXArticlesManager::INPUT1 => Operators::SUPERIOR + ); + $values = array( + AvailableForXArticlesManager::INPUT1 => 4 + ); + $rule1->setValidatorsFromForm($operators, $values); + + $expected = array( + $operators, + $values + ); + $actual = $rule1->getValidators(); + + $this->assertEquals($expected, $actual); + + } + + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Constraint/Rule/OperatorsTest.php b/core/lib/Thelia/Tests/Constraint/Rule/OperatorsTest.php new file mode 100644 index 000000000..01d753201 --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Rule/OperatorsTest.php @@ -0,0 +1,421 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Thelia\Constraint\Validator\QuantityParam; +use Thelia\Constraint\Rule\Operators; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test Operators Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class OperatorsTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorInferiorValidBefore() +// { +// $adapter = new CouponBaseAdapter(); +// // Given +// $a = 11; +// $operator = Operators::INFERIOR; +// $b = new QuantityParam($adapter, 12); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertTrue($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorInferiorInvalidEquals() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 12; +// $operator = Operators::INFERIOR; +// $b = new QuantityParam($adapter, 12); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertFalse($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorInferiorInvalidAfter() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 13; +// $operator = Operators::INFERIOR; +// $b = new QuantityParam($adapter, 12); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertFalse($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorInferiorOrEqualValidEqual() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 11; +// $operator = Operators::INFERIOR_OR_EQUAL; +// $b = new QuantityParam($adapter, 11); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertTrue($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorInferiorOrEqualValidBefore() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 10; +// $operator = Operators::INFERIOR_OR_EQUAL; +// $b = new QuantityParam($adapter, 11); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertTrue($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorInferiorOrEqualInValidAfter() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 12; +// $operator = Operators::INFERIOR_OR_EQUAL; +// $b = new QuantityParam($adapter, 11); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertFalse($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorEqualValidEqual() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 12; +// $operator = Operators::EQUAL; +// $b = new QuantityParam($adapter, 12); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertTrue($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorEqualInValidBefore() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 11; +// $operator = Operators::EQUAL; +// $b = new QuantityParam($adapter, 12); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertFalse($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorEqualInValidAfter() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 13; +// $operator = Operators::EQUAL; +// $b = new QuantityParam($adapter, 12); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertFalse($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorSuperiorOrEqualValidEqual() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 13; +// $operator = Operators::SUPERIOR_OR_EQUAL; +// $b = new QuantityParam($adapter, 13); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertTrue($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorSuperiorOrEqualAfter() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 14; +// $operator = Operators::SUPERIOR_OR_EQUAL; +// $b = new QuantityParam($adapter, 13); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertTrue($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorSuperiorOrEqualInvalidBefore() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 12; +// $operator = Operators::SUPERIOR_OR_EQUAL; +// $b = new QuantityParam($adapter, 13); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertFalse($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorSuperiorValidAfter() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 13; +// $operator = Operators::SUPERIOR; +// $b = new QuantityParam($adapter, 12); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertTrue($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorSuperiorInvalidEqual() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 12; +// $operator = Operators::SUPERIOR; +// $b = new QuantityParam($adapter, 12); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertFalse($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorSuperiorInvalidBefore() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 11; +// $operator = Operators::SUPERIOR; +// $b = new QuantityParam($adapter, 12); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertFalse($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorDifferentValid() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 12; +// $operator = Operators::DIFFERENT; +// $b = new QuantityParam($adapter, 11); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertTrue($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorDifferentInvalidEquals() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 11; +// $operator = Operators::DIFFERENT; +// $b = new QuantityParam($adapter, 11); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertFalse($actual); +// } +// +// /** +// * +// * @covers Thelia\Coupon\Rule\Operator::isValidAccordingToOperator +// * +// */ +// public function testOperatorInValid() +// { +// // Given +// $adapter = new CouponBaseAdapter(); +// $a = 12; +// $operator = 'X'; +// $b = new QuantityParam($adapter, 11); +// +// // When +// $actual = Operators::isValid($a, $operator, $b); +// +// // Then +// $this->assertFalse($actual); +// } + + + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Constraint/Validator/CustomerParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/CustomerParamTest.php new file mode 100644 index 000000000..2cdec7846 --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Validator/CustomerParamTest.php @@ -0,0 +1,161 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use InvalidArgumentException; +use Thelia\Constraint\Validator\CustomerParam; +use Thelia\Constraint\Validator\PriceParam; +use Thelia\Constraint\Validator\QuantityParam; +use Thelia\Model\Customer; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test CustomerParam Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class CustomerParamTest extends \PHPUnit_Framework_TestCase +{ + + /** @var CouponAdapterInterface $stubTheliaAdapter */ + protected $stubTheliaAdapter = null; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + /** @var CouponAdapterInterface $stubTheliaAdapter */ + $this->stubTheliaAdapter = $this->generateValidCouponBaseAdapterMock(); + } + + /** + * Generate valid CouponBaseAdapter + * + * @param int $customerId Customer id + * + * @return CouponAdapterInterface + */ + protected function generateValidCouponBaseAdapterMock($customerId = 4521) + { + $customer = new Customer(); + $customer->setId($customerId); + $customer->setFirstname('Firstname'); + $customer->setLastname('Lastname'); + $customer->setEmail('em@il.com'); + + /** @var CouponAdapterInterface $stubTheliaAdapter */ + $stubTheliaAdapter = $this->getMock( + 'Thelia\Coupon\CouponBaseAdapter', + array('getCustomer'), + array() + ); + $stubTheliaAdapter->expects($this->any()) + ->method('getCustomer') + ->will($this->returnValue($customer)); + + return $stubTheliaAdapter; + } + + /** + * + * @covers Thelia\Coupon\Parameter\QuantityParam::compareTo + * + */ + public function testCanUseCoupon() + { + $customerId = 4521; + $couponValidForCustomerId = 4521; + + $adapter = $this->generateValidCouponBaseAdapterMock($customerId); + + $customerParam = new CustomerParam($adapter, $couponValidForCustomerId); + + $expected = 0; + $actual = $customerParam->compareTo($customerId); + $this->assertEquals($expected, $actual); + } + +// /** +// * +// * @covers Thelia\Coupon\Parameter\QuantityParam::compareTo +// * +// */ +// public function testCanNotUseCouponTest() +// { +// +// } +// +// /** +// * +// * @covers Thelia\Coupon\Parameter\QuantityParam::compareTo +// * @expectedException InvalidArgumentException +// * +// */ +// public function testCanNotUseCouponCustomerNotFoundTest() +// { +// +// } + + + + +// /** +// * Test is the object is serializable +// * If no data is lost during the process +// */ +// public function isSerializableTest() +// { +// $adapter = new CouponBaseAdapter(); +// $intValidator = 42; +// $intToValidate = -1; +// +// $param = new QuantityParam($adapter, $intValidator); +// +// $serialized = base64_encode(serialize($param)); +// /** @var QuantityParam $unserialized */ +// $unserialized = base64_decode(serialize($serialized)); +// +// $this->assertEquals($param->getValue(), $unserialized->getValue()); +// $this->assertEquals($param->getInteger(), $unserialized->getInteger()); +// +// $new = new QuantityParam($adapter, $unserialized->getInteger()); +// $this->assertEquals($param->getInteger(), $new->getInteger()); +// } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Constraint/Validator/DateParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/DateParamTest.php new file mode 100644 index 000000000..45b7f00ae --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Validator/DateParamTest.php @@ -0,0 +1,151 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use InvalidArgumentException; +use Thelia\Constraint\Validator\DateParam; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test DateParam Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class DateParamTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + /** + * + * @covers Thelia\Coupon\Parameter\DateParam::compareTo + * + */ + public function testInferiorDate() + { + $adapter = new CouponBaseAdapter(); + $dateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-07-07"); + + $dateParam = new DateParam($adapter, $dateValidator); + + $expected = 1; + $actual = $dateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\DateParam::compareTo + * + */ + public function testEqualsDate() + { + $adapter = new CouponBaseAdapter(); + $dateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-07-08"); + + $dateParam = new DateParam($adapter, $dateValidator); + + $expected = 0; + $actual = $dateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\DateParam::compareTo + * + */ + public function testSuperiorDate() + { + $adapter = new CouponBaseAdapter(); + $dateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-07-09"); + + $dateParam = new DateParam($adapter, $dateValidator); + + $expected = -1; + $actual = $dateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\DateParam::compareTo + * @expectedException InvalidArgumentException + */ + public function testInvalidArgumentException() + { + $adapter = new CouponBaseAdapter(); + $dateValidator = new \DateTime("2012-07-08"); + $dateToValidate = 1377012588; + + $dateParam = new DateParam($adapter, $dateValidator); + + $dateParam->compareTo($dateToValidate); + } + + /** + * Test is the object is serializable + * If no data is lost during the process + */ + public function isSerializableTest() + { + $adapter = new CouponBaseAdapter(); + $dateValidator = new \DateTime("2012-07-08"); + + $param = new DateParam($adapter, $dateValidator); + + $serialized = base64_encode(serialize($param)); + /** @var DateParam $unserialized */ + $unserialized = base64_decode(serialize($serialized)); + + $this->assertEquals($param->getValue(), $unserialized->getValue()); + $this->assertEquals($param->getDateTime(), $unserialized->getDateTime()); + + $new = new DateParam($adapter, $unserialized->getDateTime()); + $this->assertEquals($param->getDateTime(), $new->getDateTime()); + } + + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Constraint/Validator/IntegerParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/IntegerParamTest.php new file mode 100644 index 000000000..0c7184dde --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Validator/IntegerParamTest.php @@ -0,0 +1,152 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use InvalidArgumentException; +use Thelia\Constraint\Validator\IntegerParam; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test IntegerParam Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class IntegerParamTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + /** + * + * @covers Thelia\Coupon\Parameter\IntegerParam::compareTo + * + */ + public function testInferiorInteger() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = 41; + + $integerParam = new IntegerParam($adapter, $intValidator); + + $expected = 1; + $actual = $integerParam->compareTo($intToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\IntegerParam::compareTo + * + */ + public function testEqualsInteger() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = 42; + + $integerParam = new IntegerParam($adapter, $intValidator); + + $expected = 0; + $actual = $integerParam->compareTo($intToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\IntegerParam::compareTo + * + */ + public function testSuperiorInteger() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = 43; + + $integerParam = new IntegerParam($adapter, $intValidator); + + $expected = -1; + $actual = $integerParam->compareTo($intToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\IntegerParam::compareTo + * @expectedException InvalidArgumentException + */ + public function testInvalidArgumentException() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = '42'; + + $integerParam = new IntegerParam($adapter, $intValidator); + + $expected = 0; + $actual = $integerParam->compareTo($intToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * Test is the object is serializable + * If no data is lost during the process + */ + public function isSerializableTest() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + + $param = new IntegerParam($adapter, $intValidator); + + $serialized = base64_encode(serialize($param)); + /** @var IntegerParam $unserialized */ + $unserialized = base64_decode(serialize($serialized)); + + $this->assertEquals($param->getValue(), $unserialized->getValue()); + $this->assertEquals($param->getInteger(), $unserialized->getInteger()); + + $new = new IntegerParam($adapter, $unserialized->getInteger()); + $this->assertEquals($param->getInteger(), $new->getInteger()); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Constraint/Validator/IntervalParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/IntervalParamTest.php new file mode 100644 index 000000000..77abdbe24 --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Validator/IntervalParamTest.php @@ -0,0 +1,177 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use InvalidArgumentException; +use Thelia\Constraint\Validator\IntervalParam; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test IntervalParam Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class IntervalParamTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + /** + * + * @covers Thelia\Coupon\Parameter\IntervalParam::compareTo + * + */ + public function testInferiorDate() + { + $adapter = new CouponBaseAdapter(); + $dateValidatorStart = new \DateTime("2012-07-08"); + $dateValidatorInterval = new \DateInterval("P1M"); //1month + $dateToValidate = new \DateTime("2012-07-07"); + + $dateParam = new IntervalParam($adapter, $dateValidatorStart, $dateValidatorInterval); + + $expected = 1; + $actual = $dateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\IntervalParam::compareTo + * + */ + public function testEqualsDate() + { + $adapter = new CouponBaseAdapter(); + $dateValidatorStart = new \DateTime("2012-07-08"); + $dateValidatorInterval = new \DateInterval("P1M"); //1month + $dateToValidate = new \DateTime("2012-07-08"); + + echo '1 ' . date_format($dateValidatorStart, 'g:ia \o\n l jS F Y') . "\n"; + echo '2 ' . date_format($dateToValidate, 'g:ia \o\n l jS F Y') . "\n"; + + $dateParam = new IntervalParam($adapter, $dateValidatorStart, $dateValidatorInterval); + + $expected = 0; + $actual = $dateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\IntervalParam::compareTo + * + */ + public function testEqualsDate2() + { + $adapter = new CouponBaseAdapter(); + $dateValidatorStart = new \DateTime("2012-07-08"); + $dateValidatorInterval = new \DateInterval("P1M"); //1month + $dateToValidate = new \DateTime("2012-08-08"); + + $dateParam = new IntervalParam($adapter, $dateValidatorStart, $dateValidatorInterval); + + $expected = 0; + $actual = $dateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\IntervalParam::compareTo + * + */ + public function testSuperiorDate() + { + $adapter = new CouponBaseAdapter(); + $dateValidatorStart = new \DateTime("2012-07-08"); + $dateValidatorInterval = new \DateInterval("P1M"); //1month + $dateToValidate = new \DateTime("2012-08-09"); + + $dateParam = new IntervalParam($adapter, $dateValidatorStart, $dateValidatorInterval); + + $expected = -1; + $actual = $dateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\DateParam::compareTo + * @expectedException InvalidArgumentException + */ + public function testInvalidArgumentException() + { + $adapter = new CouponBaseAdapter(); + $dateValidatorStart = new \DateTime("2012-07-08"); + $dateValidatorInterval = new \DateInterval("P1M"); //1month + $dateToValidate = 1377012588; + + $dateParam = new IntervalParam($adapter, $dateValidatorStart, $dateValidatorInterval); + + $dateParam->compareTo($dateToValidate); + } + + /** + * Test is the object is serializable + * If no data is lost during the process + */ + public function isSerializableTest() + { + $adapter = new CouponBaseAdapter(); + $dateValidatorStart = new \DateTime("2012-07-08"); + $dateValidatorInterval = new \DateInterval("P1M"); //1month + + $param = new IntervalParam($adapter, $dateValidatorStart, $dateValidatorInterval); + + $serialized = base64_encode(serialize($param)); + /** @var IntervalParam $unserialized */ + $unserialized = base64_decode(serialize($serialized)); + + $this->assertEquals($param->getValue(), $unserialized->getValue()); + $this->assertEquals($param->getDatePeriod(), $unserialized->getDatePeriod()); + + $new = new IntervalParam($adapter, $unserialized->getStart(), $unserialized->getInterval()); + $this->assertEquals($param->getDatePeriod(), $new->getDatePeriod()); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Constraint/Validator/PriceParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/PriceParamTest.php new file mode 100644 index 000000000..1cdee6bd2 --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Validator/PriceParamTest.php @@ -0,0 +1,230 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use InvalidArgumentException; +use Thelia\Constraint\Validator\PriceParam; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test PriceParam Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class PriceParamTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + /** + * + * @covers Thelia\Coupon\Parameter\PriceParam::compareTo + * + */ + public function testInferiorPrice() + { + $adapter = new CouponBaseAdapter(); + + $priceValidator = 42.50; + $priceToValidate = 1.00; + + $integerParam = new PriceParam($adapter, $priceValidator, 'EUR'); + + $expected = 1; + $actual = $integerParam->compareTo($priceToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\PriceParam::compareTo + * + */ + public function testInferiorPrice2() + { + $adapter = new CouponBaseAdapter(); + + $priceValidator = 42.50; + $priceToValidate = 42.49; + + $integerParam = new PriceParam($adapter, $priceValidator, 'EUR'); + + $expected = 1; + $actual = $integerParam->compareTo($priceToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\PriceParam::compareTo + * + */ + public function testEqualsPrice() + { + $adapter = new CouponBaseAdapter(); + + $priceValidator = 42.50; + $priceToValidate = 42.50; + + $integerParam = new PriceParam($adapter, $priceValidator, 'EUR'); + + $expected = 0; + $actual = $integerParam->compareTo($priceToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\PriceParam::compareTo + * + */ + public function testSuperiorPrice() + { + $adapter = new CouponBaseAdapter(); + + $priceValidator = 42.50; + $priceToValidate = 42.51; + + $integerParam = new PriceParam($adapter, $priceValidator, 'EUR'); + + $expected = -1; + $actual = $integerParam->compareTo($priceToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\PriceParam::compareTo + * @expectedException InvalidArgumentException + */ + public function testInvalidArgumentException() + { + $adapter = new CouponBaseAdapter(); + + $priceValidator = 42.50; + $priceToValidate = '42.50'; + + $integerParam = new PriceParam($adapter, $priceValidator, 'EUR'); + + $expected = 0; + $actual = $integerParam->compareTo($priceToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\PriceParam::compareTo + * @expectedException InvalidArgumentException + */ + public function testInvalidArgumentException2() + { + $adapter = new CouponBaseAdapter(); + + $priceValidator = 42.50; + $priceToValidate = -1; + + $integerParam = new PriceParam($adapter, $priceValidator, 'EUR'); + + $expected = 0; + $actual = $integerParam->compareTo($priceToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\PriceParam::compareTo + * @expectedException InvalidArgumentException + */ + public function testInvalidArgumentException3() + { + $adapter = new CouponBaseAdapter(); + + $priceValidator = 42.50; + $priceToValidate = 0; + + $integerParam = new PriceParam($adapter, $priceValidator, 'EUR'); + + $expected = 0; + $actual = $integerParam->compareTo($priceToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\PriceParam::compareTo + * @expectedException InvalidArgumentException + */ + public function testInvalidArgumentException4() + { + $adapter = new CouponBaseAdapter(); + $priceValidator = 42.50; + $priceToValidate = 1; + + $integerParam = new PriceParam($adapter, $priceValidator, 'GBP'); + + $expected = 0; + $actual = $integerParam->compareTo($priceToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * Test is the object is serializable + * If no data is lost during the process + */ + public function isSerializableTest() + { + $adapter = new CouponBaseAdapter(); + $priceValidator = 42.50; + + $param = new PriceParam($adapter, $priceValidator, 'GBP'); + + $serialized = base64_encode(serialize($param)); + /** @var PriceParam $unserialized */ + $unserialized = base64_decode(serialize($serialized)); + + $this->assertEquals($param->getValue(), $unserialized->getValue()); + $this->assertEquals($param->getPrice(), $unserialized->getPrice()); + $this->assertEquals($param->getCurrency(), $unserialized->getCurrency()); + + $new = new PriceParam($adapter, $unserialized->getPrice(), $unserialized->getCurrency()); + $this->assertEquals($param->getPrice(), $new->getPrice()); + $this->assertEquals($param->getCurrency(), $new->getCurrency()); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Constraint/Validator/QuantityParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/QuantityParamTest.php new file mode 100644 index 000000000..198e6e611 --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Validator/QuantityParamTest.php @@ -0,0 +1,189 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use InvalidArgumentException; +use Thelia\Constraint\Validator\PriceParam; +use Thelia\Constraint\Validator\QuantityParam; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test QuantityParam Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class QuantityParamTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + /** + * + * @covers Thelia\Coupon\Parameter\QuantityParam::compareTo + * + */ + public function testInferiorQuantity() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = 0; + + $integerParam = new QuantityParam($adapter, $intValidator); + + $expected = 1; + $actual = $integerParam->compareTo($intToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\QuantityParam::compareTo + * + */ + public function testInferiorQuantity2() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = 41; + + $integerParam = new QuantityParam($adapter, $intValidator); + + $expected = 1; + $actual = $integerParam->compareTo($intToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\QuantityParam::compareTo + * + */ + public function testEqualsQuantity() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = 42; + + $integerParam = new QuantityParam($adapter, $intValidator); + + $expected = 0; + $actual = $integerParam->compareTo($intToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\QuantityParam::compareTo + * + */ + public function testSuperiorQuantity() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = 43; + + $integerParam = new QuantityParam($adapter, $intValidator); + + $expected = -1; + $actual = $integerParam->compareTo($intToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\QuantityParam::compareTo + * @expectedException InvalidArgumentException + */ + public function testInvalidArgumentException() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = '42'; + + $integerParam = new QuantityParam($adapter, $intValidator); + + $expected = 0; + $actual = $integerParam->compareTo($intToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\QuantityParam::compareTo + * @expectedException InvalidArgumentException + */ + public function testInvalidArgumentException2() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = -1; + + $integerParam = new QuantityParam($adapter, $intValidator); + + $expected = 0; + $actual = $integerParam->compareTo($intToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * Test is the object is serializable + * If no data is lost during the process + */ + public function isSerializableTest() + { + $adapter = new CouponBaseAdapter(); + $intValidator = 42; + $intToValidate = -1; + + $param = new QuantityParam($adapter, $intValidator); + + $serialized = base64_encode(serialize($param)); + /** @var QuantityParam $unserialized */ + $unserialized = base64_decode(serialize($serialized)); + + $this->assertEquals($param->getValue(), $unserialized->getValue()); + $this->assertEquals($param->getInteger(), $unserialized->getInteger()); + + $new = new QuantityParam($adapter, $unserialized->getInteger()); + $this->assertEquals($param->getInteger(), $new->getInteger()); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Constraint/Validator/RepeatedDateParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/RepeatedDateParamTest.php new file mode 100644 index 000000000..875453666 --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Validator/RepeatedDateParamTest.php @@ -0,0 +1,303 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use InvalidArgumentException; +use Symfony\Component\Intl\Exception\NotImplementedException; +use Thelia\Constraint\Validator\RepeatedDateParam; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test RepeatedDateParam Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class RepeatedDateParamTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedDateParam::compareTo + * + */ + public function testInferiorDate() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-07-07"); + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(); + + $expected = -1; + $actual = $repeatedDateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedDateParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthOneTimeFirstPeriod() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-07-08"); + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(); + + $expected = 0; + $actual = $repeatedDateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedDateParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthOneTimeSecondPeriod() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-08-08"); + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(1, 1); + + $expected = 0; + $actual = $repeatedDateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedDateParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthTenTimesThirdPeriod() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-09-08"); + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(1, 10); + + $expected = 0; + $actual = $repeatedDateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedDateParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthTenTimesTensPeriod() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2013-05-08"); + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(1, 10); + + $expected = 0; + $actual = $repeatedDateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedDateParam::compareTo + * + */ + public function testEqualsDateRepeatEveryFourMonthTwoTimesSecondPeriod() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-11-08"); + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(4, 2); + + $expected = 0; + $actual = $repeatedDateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedDateParam::compareTo + * + */ + public function testEqualsDateRepeatEveryFourMonthTwoTimesLastPeriod() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2013-03-08"); + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(4, 2); + + $expected = 0; + $actual = $repeatedDateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedDateParam::compareTo + * + */ + public function testNotEqualsDateRepeatEveryFourMonthTwoTimes1() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-08-08"); + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(4, 2); + + $expected = -1; + $actual = $repeatedDateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedDateParam::compareTo + * + */ + public function testNotEqualsDateRepeatEveryFourMonthTwoTimes2() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-12-08"); + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(4, 2); + + $expected = -1; + $actual = $repeatedDateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedDateParam::compareTo + * + */ + public function testSuperiorDateRepeatEveryFourMonthTwoTimes() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2013-03-09"); + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(4, 2); + + $expected = -1; + $actual = $repeatedDateParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\DateParam::compareTo + * @expectedException InvalidArgumentException + */ + public function testInvalidArgumentException() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = 1377012588; + + $repeatedDateParam = new RepeatedDateParam($adapter); + $repeatedDateParam->setFrom($startDateValidator); + $repeatedDateParam->repeatEveryMonth(4, 2); + + $repeatedDateParam->compareTo($dateToValidate); + } + + /** + * Test is the object is serializable + * If no data is lost during the process + */ + public function isSerializableTest() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + + $param = new RepeatedDateParam($adapter); + $param->setFrom($startDateValidator); + $param->repeatEveryMonth(4, 2); + + $serialized = base64_encode(serialize($param)); + /** @var RepeatedDateParam $unserialized */ + $unserialized = base64_decode(serialize($serialized)); + + $this->assertEquals($param->getValue(), $unserialized->getValue()); + $this->assertEquals($param->getDatePeriod(), $unserialized->getDatePeriod()); + + $new = new RepeatedDateParam($adapter); + $new->setFrom($unserialized->getFrom()); + $new->repeatEveryMonth($unserialized->getFrequency(), $unserialized->getNbRepetition()); + $this->assertEquals($param->getDatePeriod(), $new->getDatePeriod()); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Constraint/Validator/RepeatedIntervalParamTest.php b/core/lib/Thelia/Tests/Constraint/Validator/RepeatedIntervalParamTest.php new file mode 100644 index 000000000..2b3bd00c8 --- /dev/null +++ b/core/lib/Thelia/Tests/Constraint/Validator/RepeatedIntervalParamTest.php @@ -0,0 +1,420 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Symfony\Component\Intl\Exception\NotImplementedException; +use Thelia\Constraint\Validator\RepeatedIntervalParam; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test RepeatedIntervalParam Class + * + * @package Constraint + * @author Guillaume MOREL + * + */ +class RepeatedIntervalParamTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testInferiorDate() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-07-07"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + + $RepeatedIntervalParam->repeatEveryMonth(); + + $expected = -1; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthOneTimeFirstPeriodBeginning() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-07-08"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(); + + $expected = 0; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthOneTimeFirstPeriodMiddle() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-07-13"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(); + + $expected = 0; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthOneTimeFirstPeriodEnding() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-07-18"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(); + + $expected = 0; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthOneTimeSecondPeriodBeginning() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-08-08"); + $dateToValidate = new \DateTime("2012-08-08"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(); + + $expected = 0; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthOneTimeSecondPeriodMiddle() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-08-08"); + $dateToValidate = new \DateTime("2012-08-13"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(); + + $expected = 0; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthOneTimeSecondPeriodEnding() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-08-08"); + $dateToValidate = new \DateTime("2012-08-18"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(); + + $expected = 0; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthFourTimeLastPeriodBeginning() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-10-08"); + $dateToValidate = new \DateTime("2012-10-08"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(1, 4); + + $expected = 0; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthFourTimeLastPeriodMiddle() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-10-08"); + $dateToValidate = new \DateTime("2012-10-13"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(1, 4); + + $expected = 0; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testEqualsDateRepeatEveryMonthFourTimeLastPeriodEnding() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-10-08"); + $dateToValidate = new \DateTime("2012-10-18"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(1, 4); + + $expected = 0; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testNotEqualsDateRepeatEveryMonthFourTimeInTheBeginning() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-10-08"); + $dateToValidate = new \DateTime("2012-07-19"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(1, 4); + + $expected = -1; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testNotEqualsDateRepeatEveryMonthFourTimeInTheMiddle() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-10-08"); + $dateToValidate = new \DateTime("2012-08-01"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(1, 4); + + $expected = -1; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testNotEqualsDateRepeatEveryMonthFourTimeInTheEnd() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-10-08"); + $dateToValidate = new \DateTime("2012-08-07"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(1, 4); + + $expected = -1; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + + + /** + * + * @covers Thelia\Coupon\Parameter\RepeatedIntervalParam::compareTo + * + */ + public function testSuperiorDateRepeatEveryMonthFourTime() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = new \DateTime("2012-10-19"); + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(1, 0); + + $expected = -1; + $actual = $RepeatedIntervalParam->compareTo($dateToValidate); + $this->assertEquals($expected, $actual); + } + + /** + * @covers Thelia\Coupon\Parameter\DateParam::compareTo + * @expectedException \InvalidArgumentException + */ + public function testInvalidArgumentException() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = 1377012588; + $duration = 10; + + $RepeatedIntervalParam = new RepeatedIntervalParam($adapter); + $RepeatedIntervalParam->setFrom($startDateValidator); + $RepeatedIntervalParam->setDurationInDays($duration); + $RepeatedIntervalParam->repeatEveryMonth(1, 4); + + $RepeatedIntervalParam->compareTo($dateToValidate); + } + + /** + * Test is the object is serializable + * If no data is lost during the process + */ + public function isSerializableTest() + { + $adapter = new CouponBaseAdapter(); + $startDateValidator = new \DateTime("2012-07-08"); + $dateToValidate = 1377012588; + $duration = 10; + + $param = new RepeatedIntervalParam($adapter); + $param->setFrom($startDateValidator); + $param->setDurationInDays($duration); + $param->repeatEveryMonth(1, 4); + + $serialized = base64_encode(serialize($param)); + /** @var RepeatedIntervalParam $unserialized */ + $unserialized = base64_decode(serialize($serialized)); + + $this->assertEquals($param->getValue(), $unserialized->getValue()); + $this->assertEquals($param->getDatePeriod(), $unserialized->getDatePeriod()); + + $new = new RepeatedIntervalParam($adapter); + $new->setFrom($unserialized->getFrom()); + $new->repeatEveryMonth($unserialized->getFrequency(), $unserialized->getNbRepetition()); + $new->setDurationInDays($unserialized->getDurationInDays()); + $this->assertEquals($param->getDatePeriod(), $new->getDatePeriod()); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php index e787403df..177802078 100755 --- a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php +++ b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php @@ -23,9 +23,14 @@ namespace Thelia\Tests\Controller; -use Symfony\Component\HttpFoundation\Request; +use Thelia\Core\HttpFoundation\Request; use Thelia\Controller\Front\DefaultController; +/** + * Class DefaultControllerTest + * @package Thelia\Tests\Controller + * @author Manuel Raynaud + */ class DefaultControllerTest extends \PHPUnit_Framework_TestCase { @@ -38,7 +43,7 @@ class DefaultControllerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($request->attributes->get('_view'), "index"); } - public function testNoActionWithQuery() + public function testNoActionWithGetParam() { $defaultController = new DefaultController(); $request = new Request(array( @@ -50,15 +55,59 @@ class DefaultControllerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($request->attributes->get('_view'), 'foo'); } - public function testNoActionWithRequest() + public function testNoActionWithPostParam() { $defaultController = new DefaultController(); - $request = new Request(array(), array( - "view" => "foo" - )); + $request = new Request( + array(), + array("view" => "foo") + ); $defaultController->noAction($request); $this->assertEquals($request->attributes->get('_view'), 'foo'); } + + + public function testNoActionWithAttribute() + { + $defaultController = new DefaultController(); + $request = new Request( + array(), + array(), + array("_view" => "foo") + ); + + $defaultController->noAction($request); + + $this->assertEquals($request->attributes->get('_view'), 'foo'); + } + + public function testNoActionWithAttributeAndQuery() + { + $defaultController = new DefaultController(); + $request = new Request( + array("view" => "bar"), + array(), + array("_view" => "foo") + ); + + $defaultController->noAction($request); + + $this->assertEquals($request->attributes->get('_view'), 'bar'); + } + + public function testNoActionWithAttributeAndRequest() + { + $defaultController = new DefaultController(); + $request = new Request( + array(), + array("view" => "bar"), + array("_view" => "foo") + ); + + $defaultController->noAction($request); + + $this->assertEquals($request->attributes->get('_view'), 'bar'); + } } diff --git a/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php b/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php old mode 100644 new mode 100755 index f94b5607f..d7437efb9 --- a/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php +++ b/core/lib/Thelia/Tests/Core/HttpFoundation/RequestTest.php @@ -4,6 +4,13 @@ namespace Thelia\Tests\Core\HttpFoundation; use Thelia\Core\HttpFoundation\Request; +/** + * the the helpers addinf in Request class + * + * Class RequestTest + * @package Thelia\Tests\Core\HttpFoundation + * @author Manuel Raynaud + */ class RequestTest extends \PHPUnit_Framework_TestCase { diff --git a/core/lib/Thelia/Tests/Core/HttpFoundation/Session/SessionTest.php b/core/lib/Thelia/Tests/Core/HttpFoundation/Session/SessionTest.php old mode 100644 new mode 100755 index 7efebdedf..317b19dea --- a/core/lib/Thelia/Tests/Core/HttpFoundation/Session/SessionTest.php +++ b/core/lib/Thelia/Tests/Core/HttpFoundation/Session/SessionTest.php @@ -28,6 +28,13 @@ use Thelia\Core\HttpFoundation\Session\Session; use Thelia\Model\Cart; use Thelia\Model\Customer; +/** + * Test the helpers adding in Session class + * + * Class SessionTest + * @package Thelia\Tests\Core\HttpFoundation\Session + * @author Manuel Raynaud + */ class SessionTest extends \PHPUnit_Framework_TestCase { diff --git a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php index c4b0192bc..7d14fbbc5 100755 --- a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php +++ b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php @@ -34,7 +34,7 @@ use Thelia\Core\HttpFoundation\Session\Session; * @author Etienne Roudeix * */ -abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase +abstract class BaseLoopTestor extends \Thelia\Tests\TestCaseWithURLToolSetup { protected $request; protected $dispatcher; diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php new file mode 100755 index 000000000..0a12ad076 --- /dev/null +++ b/core/lib/Thelia/Tests/Core/Template/Loop/AssociatedContentTest.php @@ -0,0 +1,51 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Core\Template\Loop; + +use Thelia\Tests\Core\Template\Element\BaseLoopTestor; + +use Thelia\Core\Template\Loop\AssociatedContent; + +/** + * + * @author Etienne Roudeix + * + */ +class AssociatedContentTest extends BaseLoopTestor +{ + public function getTestedClassName() + { + return 'Thelia\Core\Template\Loop\AssociatedContent'; + } + + public function getTestedInstance() + { + return new AssociatedContent($this->request, $this->dispatcher, $this->securityContext); + } + + public function getMandatoryArguments() + { + return array('product' => 1); + } +} diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php new file mode 100755 index 000000000..c870f32ef --- /dev/null +++ b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeAvailabilityTest.php @@ -0,0 +1,51 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Core\Template\Loop; + +use Thelia\Tests\Core\Template\Element\BaseLoopTestor; + +use Thelia\Core\Template\Loop\AttributeAvailability; + +/** + * + * @author Etienne Roudeix + * + */ +class AttributeAvailabilityTest extends BaseLoopTestor +{ + public function getTestedClassName() + { + return 'Thelia\Core\Template\Loop\AttributeAvailability'; + } + + public function getTestedInstance() + { + return new AttributeAvailability($this->request, $this->dispatcher, $this->securityContext); + } + + public function getMandatoryArguments() + { + return array(); + } +} diff --git a/core/lib/Thelia/Core/Context.php b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php old mode 100644 new mode 100755 similarity index 75% rename from core/lib/Thelia/Core/Context.php rename to core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php index 6fa5a638b..98d0575eb --- a/core/lib/Thelia/Core/Context.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeCombinationTest.php @@ -21,34 +21,31 @@ /* */ /*************************************************************************************/ -namespace Thelia\Core; +namespace Thelia\Tests\Core\Template\Loop; -class Context +use Thelia\Tests\Core\Template\Element\BaseLoopTestor; + +use Thelia\Core\Template\Loop\AttributeCombination; + +/** + * + * @author Etienne Roudeix + * + */ +class AttributeCombinationTest extends BaseLoopTestor { - const CONTEXT_FRONT_OFFICE = 'front'; - const CONTEXT_BACK_OFFICE = 'admin'; - - protected $defineContext = array( - self::CONTEXT_BACK_OFFICE, - self::CONTEXT_FRONT_OFFICE - ); - - protected $currentContext = self::CONTEXT_FRONT_OFFICE; - - public function isValidContext($context) + public function getTestedClassName() { - return in_array($context, $this->defineContext); + return 'Thelia\Core\Template\Loop\AttributeCombination'; } - public function setContext($context) + public function getTestedInstance() { - if ($this->isValidContext($context)) { - $this->currentContext = $context; - } + return new AttributeCombination($this->request, $this->dispatcher, $this->securityContext); } - public function getContext() + public function getMandatoryArguments() { - return $this->currentContext; + return array('product_sale_elements' => 1); } } diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailableTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php similarity index 89% rename from core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailableTest.php rename to core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php index e93b05a69..653de34e9 100755 --- a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailableTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/AttributeTest.php @@ -25,23 +25,23 @@ namespace Thelia\Tests\Core\Template\Loop; use Thelia\Tests\Core\Template\Element\BaseLoopTestor; -use Thelia\Core\Template\Loop\FeatureAvailable; +use Thelia\Core\Template\Loop\Attribute; /** * * @author Etienne Roudeix * */ -class FeatureAvailableTest extends BaseLoopTestor +class AttributeTest extends BaseLoopTestor { public function getTestedClassName() { - return 'Thelia\Core\Template\Loop\FeatureAvailable'; + return 'Thelia\Core\Template\Loop\Attribute'; } public function getTestedInstance() { - return new FeatureAvailable($this->request, $this->dispatcher, $this->securityContext); + return new Attribute($this->request, $this->dispatcher, $this->securityContext); } public function getMandatoryArguments() diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php new file mode 100755 index 000000000..95dd5a5c6 --- /dev/null +++ b/core/lib/Thelia/Tests/Core/Template/Loop/CurrencyTest.php @@ -0,0 +1,51 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Core\Template\Loop; + +use Thelia\Tests\Core\Template\Element\BaseLoopTestor; + +use Thelia\Core\Template\Loop\Currency; + +/** + * + * @author Etienne Roudeix + * + */ +class CurrencyTest extends BaseLoopTestor +{ + public function getTestedClassName() + { + return 'Thelia\Core\Template\Loop\Currency'; + } + + public function getTestedInstance() + { + return new Currency($this->request, $this->dispatcher, $this->securityContext); + } + + public function getMandatoryArguments() + { + return array(); + } +} diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php new file mode 100755 index 000000000..d3a045f33 --- /dev/null +++ b/core/lib/Thelia/Tests/Core/Template/Loop/FeatureAvailabilityTest.php @@ -0,0 +1,51 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Core\Template\Loop; + +use Thelia\Tests\Core\Template\Element\BaseLoopTestor; + +use Thelia\Core\Template\Loop\FeatureAvailability; + +/** + * + * @author Etienne Roudeix + * + */ +class FeatureAvailabilityTest extends BaseLoopTestor +{ + public function getTestedClassName() + { + return 'Thelia\Core\Template\Loop\FeatureAvailability'; + } + + public function getTestedInstance() + { + return new FeatureAvailability($this->request, $this->dispatcher, $this->securityContext); + } + + public function getMandatoryArguments() + { + return array(); + } +} diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php new file mode 100755 index 000000000..612519e04 --- /dev/null +++ b/core/lib/Thelia/Tests/Core/Template/Loop/ProductSaleElementTest.php @@ -0,0 +1,51 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Core\Template\Loop; + +use Thelia\Tests\Core\Template\Element\BaseLoopTestor; + +use Thelia\Core\Template\Loop\ProductSaleElements; + +/** + * + * @author Etienne Roudeix + * + */ +class ProductSaleElementsTest extends BaseLoopTestor +{ + public function getTestedClassName() + { + return 'Thelia\Core\Template\Loop\ProductSaleElements'; + } + + public function getTestedInstance() + { + return new ProductSaleElements($this->request, $this->dispatcher, $this->securityContext); + } + + public function getMandatoryArguments() + { + return array('product' => 1); + } +} diff --git a/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php b/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php new file mode 100644 index 000000000..38c00b55f --- /dev/null +++ b/core/lib/Thelia/Tests/Core/Template/Smarty/Plugins/FormatTest.php @@ -0,0 +1,274 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Tests\Core\Smarty\Plugins; + +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; +use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\HttpFoundation\Session\Session; +use Thelia\Core\Template\Smarty\Plugins\Format; + +/** + * @coversDefaultClass \Thelia\Core\Template\Smarty\Plugins\Format + */ +class FormatTest extends \PHPUnit_Framework_TestCase +{ + protected $request; + + public function setUp() + { + $this->request = new Request(); + + $this->request->setSession(new Session(new MockArraySessionStorage())); + } + + /** + * + * test formatDate method with expected format + * + * @covers ::formatDate + */ + public function testFormatDateWithSpecificFormat() + { + $dateTime = new \DateTime(); + $format = "Y-m-d H:i:s"; + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array( + "date" => $dateTime, + "format" => $format + )); + + $this->assertEquals($dateTime->format($format), $render); + } + + /** + * + * test formatDate method with date default format + * + * @covers ::formatDate + */ + public function testFormatDateWithDefaultSessionParam() + { + $dateTime = new \DateTime(); + + $langMock = $this->getLangMock(); + $this->request->getSession()->setLang($langMock); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array("date" => $dateTime)); + + $this->assertEquals($dateTime->format("Y-m-d H:i:s"), $render); + } + + /** + * + * test formatDate method with time default format + * + * @covers ::formatDate + */ + public function testFormatDateWithDateSessionParam() + { + $dateTime = new \DateTime(); + + $langMock = $this->getLangMock(); + $this->request->getSession()->setLang($langMock); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array( + "date" => $dateTime, + "output" => "date" + )); + + $this->assertEquals($dateTime->format("Y-m-d"), $render); + } + + /** + * + * test formatDate method with datetime default format + * + * @covers ::formatDate + */ + public function testFormatDateWithTimeSessionParam() + { + $dateTime = new \DateTime(); + + $langMock = $this->getLangMock(); + $this->request->getSession()->setLang($langMock); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array( + "date" => $dateTime, + "output" => "time" + )); + + $this->assertEquals($dateTime->format("H:i:s"), $render); + } + + /** + * + * test formatDate method without output or expected format. datetime format must be return + * + * @covers ::formatDate + */ + public function testFormatDateWithDateTimeSessionParam() + { + $dateTime = new \DateTime(); + + $langMock = $this->getLangMock(); + $this->request->getSession()->setLang($langMock); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array( + "date" => $dateTime, + "output" => "datetime" + )); + + $this->assertEquals($dateTime->format("Y-m-d H:i:s"), $render); + } + + /** + * test formatDate without mandatory parameters + * + * @covers ::formatDate + * @expectedException \Thelia\Core\Template\Smarty\Exception\SmartyPluginException + */ + public function testFormatDateWithoutDate() + { + $dateTime = new \DateTime(); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatDate(array()); + + $this->assertEquals($dateTime->format("Y-m-d H:i:s"), $render); + } + + + /** + * test formatNumber without mandatory parameters + * + * @covers ::formatNumber + * @expectedException \Thelia\Core\Template\Smarty\Exception\SmartyPluginException + */ + public function testFormatNumberWithoutParams() + { + $formatClass = new Format($this->request); + + $render = $formatClass->formatNumber(array()); + } + + /** + * test formatDate specifying all parameters + * + * @covers ::formatNumber + */ + public function testFormatNumberWithAllParams() + { + $formatClass = new Format($this->request); + + $number = 1256.12; + $decimals = 1; + $decPoint = ","; + $thousandsSep = " "; + + $render = $formatClass->formatNumber(array( + "number" => $number, + "decimals" => $decimals, + "dec_point" => $decPoint, + "thousands_sep" => $thousandsSep + )); + + $this->assertEquals($render, "1 256,1"); + } + + /** + * @covers ::formatNumber + */ + public function testFormatNumberWithDefaultParameters() + { + $number = 1234.56; + $langMock = $this->getLangMock(); + $this->request->getSession()->setLang($langMock); + + $formatClass = new Format($this->request); + + $render = $formatClass->formatNumber(array( + "number" => $number + )); + + $this->assertEquals( $render, number_format($number, 2, ",", " ")); + } + + /** + * create a mock for Thelia\Model\Lang class + * @return \Thelia\Model\Lang instance + */ + public function getLangMock() + { + $mock = $this->getMock( + "Thelia\Model\Lang", + array( + "getDateFormat", + "getTimeFormat", + "getDateTimeFormat", + "getDecimalSeparator", + "getThousandsSeparator", + "getDecimals" + ) + ); + + $mock->expects($this->any()) + ->method("getDateFormat") + ->will($this->returnValue("Y-m-d")); + + $mock->expects($this->any()) + ->method("getTimeFormat") + ->will($this->returnValue("H:i:s")); + + $mock->expects($this->any()) + ->method("getDateTimeFormat") + ->will($this->returnValue("Y-m-d H:i:s")); + + $mock->expects($this->any()) + ->method("getDecimals") + ->will($this->returnValue(2)); + + $mock->expects($this->any()) + ->method("getDecimalSeparator") + ->will($this->returnValue(",")); + + $mock->expects($this->any()) + ->method("getThousandsSeparator") + ->will($this->returnValue(" ")); + + return $mock; + } + + + +} \ No newline at end of file diff --git a/core/lib/Thelia/Tests/Coupon/CouponBaseAdapterTest.php b/core/lib/Thelia/Tests/Coupon/CouponBaseAdapterTest.php new file mode 100644 index 000000000..78fd5e74f --- /dev/null +++ b/core/lib/Thelia/Tests/Coupon/CouponBaseAdapterTest.php @@ -0,0 +1,96 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test CouponBaseAdapter Class + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var CouponBaseAdapter + */ + protected $object; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + $this->object = new CouponBaseAdapter; + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + + /** + * @covers Thelia\Coupon\CouponBaseAdapter::getCart + * @todo Implement testGetCart(). + */ + public function testGetCart() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Thelia\Coupon\CouponBaseAdapter::getDeliveryAddress + * @todo Implement testGetDeliveryAddress(). + */ + public function testGetDeliveryAddress() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Thelia\Coupon\CouponBaseAdapter::getCustomer + * @todo Implement testGetCustomer(). + */ + public function testGetCustomer() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } +} diff --git a/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php b/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php new file mode 100644 index 000000000..c4006be0d --- /dev/null +++ b/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php @@ -0,0 +1,338 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Thelia\Constraint\Validator\PriceParam; +use Thelia\Constraint\Validator\RuleValidator; +use Thelia\Constraint\Rule\AvailableForTotalAmount; +use Thelia\Constraint\Rule\Operators; +use Thelia\Coupon\Type\CouponInterface; +use Thelia\Exception\CouponExpiredException; +use Thelia\Model\Coupon; + +require_once 'CouponManagerTest.php'; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test CouponFactory Class + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponFactoryTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + /** + * Fake CouponQuery->findByCode + * + * @param string $code Coupon code + * @param string $type Coupon type (object) + * @param string $title Coupon title + * @param string $shortDescription Coupon short description + * @param string $description Coupon description + * @param float $amount Coupon amount + * @param bool $isUsed If Coupon has been used yet + * @param bool $isEnabled If Coupon is enabled + * @param \DateTime $expirationDate When Coupon expires + * @param CouponRuleCollection $rules Coupon rules + * @param bool $isCumulative If Coupon is cumulative + * @param bool $isRemovingPostage If Coupon is removing postage + * + * @return Coupon + */ + public function generateCouponModelMock( + $code = null, + $type = null, + $title = null, + $shortDescription = null, + $description = null, + $amount = null, + $isUsed = null, + $isEnabled = null, + $expirationDate = null, + $rules = null, + $isCumulative = null, + $isRemovingPostage = null + ) { + $coupon = $this->generateValidCoupon( + $code, + $type, + $title, + $shortDescription, + $description, + $amount, + $isUsed, + $isEnabled, + $expirationDate, + $rules, + $isCumulative, + $isRemovingPostage + ); + + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->getMock( + 'Thelia\Coupon\CouponBaseAdapter', + array('findOneCouponByCode'), + array() + ); + $stubCouponBaseAdapter->expects($this->any()) + ->method('findOneCouponByCode') + ->will($this->returnValue($coupon)); + + return $stubCouponBaseAdapter; + } + + + + /** + * Test if an expired Coupon is build or not (superior) + * + * @covers Thelia\Coupon\CouponFactory::buildCouponFromCode + * @expectedException \Thelia\Exception\CouponExpiredException + */ + public function testBuildCouponFromCodeExpiredDateBefore() + { + $date = new \DateTime(); + $date->setTimestamp(strtotime("today - 2 months")); + + /** @var CouponAdapterInterface $mockAdapter */ + $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, $date); + $couponFactory = new CouponFactory($mockAdapter); + $coupon = $couponFactory->buildCouponFromCode('XMAS1'); + } + + /** + * Test if an expired Coupon is build or not (equal) + * + * @covers Thelia\Coupon\CouponFactory::buildCouponFromCode + * @expectedException \Thelia\Exception\CouponExpiredException + */ + public function testBuildCouponFromCodeExpiredDateEquals() + { + $date = new \DateTime(); + + /** @var CouponAdapterInterface $mockAdapter */ + $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, $date); + $couponFactory = new CouponFactory($mockAdapter); + $coupon = $couponFactory->buildCouponFromCode('XMAS1'); + } + + /** + * Test if an expired Coupon is build or not (equal) + * + * @covers Thelia\Coupon\CouponFactory::buildCouponFromCode + * @expectedException \Thelia\Exception\InvalidRuleException + */ + public function testBuildCouponFromCodeWithoutRule() + { + /** @var CouponAdapterInterface $mockAdapter */ + $mockAdapter = $this->generateCouponModelMock(null, null, null, null, null, null, null, null, null, new CouponRuleCollection(array())); + $couponFactory = new CouponFactory($mockAdapter); + $coupon = $couponFactory->buildCouponFromCode('XMAS1'); + } + + /** + * Test if a CouponInterface can be built from database + * + * @covers Thelia\Coupon\CouponFactory::buildCouponFromCode + */ + public function testBuildCouponFromCode() + { + /** @var CouponAdapterInterface $mockAdapter */ + $mockAdapter = $this->generateCouponModelMock(); + $couponFactory = new CouponFactory($mockAdapter); + /** @var CouponInterface $coupon */ + $coupon = $couponFactory->buildCouponFromCode('XMAS1'); + + $this->assertEquals('XMAS1', $coupon->getCode()); + $this->assertEquals('Thelia\Coupon\Type\RemoveXAmount', get_class($coupon)); + $this->assertEquals(CouponManagerTest::VALID_TITLE, $coupon->getTitle()); + $this->assertEquals(CouponManagerTest::VALID_SHORT_DESCRIPTION, $coupon->getShortDescription()); + $this->assertEquals(CouponManagerTest::VALID_DESCRIPTION, $coupon->getDescription()); + $this->assertEquals(10.00, $coupon->getDiscount()); + $this->assertEquals(1, $coupon->isEnabled()); + + $date = new \DateTime(); + $date->setTimestamp(strtotime("today + 2 months")); + $this->assertEquals($date, $coupon->getExpirationDate()); + + $rules = $this->generateValidRules(); + $this->assertEquals($rules, $coupon->getRules()); + + $this->assertEquals(1, $coupon->isCumulative()); + $this->assertEquals(0, $coupon->isRemovingPostage()); + } + + /** + * Generate valid CouponRuleInterfaces + * + * @return CouponRuleCollection Set of CouponRuleInterface + */ + protected function generateValidRules() + { + $rule1 = new AvailableForTotalAmount( + , array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + Operators::SUPERIOR, + new PriceParam( + , 40.00, 'EUR' + ) + ) + ) + ); + $rule2 = new AvailableForTotalAmount( + , array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + Operators::INFERIOR, + new PriceParam( + , 400.00, 'EUR' + ) + ) + ) + ); + $rules = new CouponRuleCollection(array($rule1, $rule2)); + + return $rules; + } + + /** + * Generate valid CouponInterface + * + * @param string $code Coupon code + * @param string $type Coupon type (object) + * @param string $title Coupon title + * @param string $shortDescription Coupon short description + * @param string $description Coupon description + * @param float $amount Coupon amount + * @param bool $isUsed If Coupon has been used yet + * @param bool $isEnabled If Coupon is enabled + * @param \DateTime $expirationDate When Coupon expires + * @param CouponRuleCollection $rules Coupon rules + * @param bool $isCumulative If Coupon is cumulative + * @param bool $isRemovingPostage If Coupon is removing postage + * + * @return Coupon + */ + public function generateValidCoupon( + $code = null, + $type = null, + $title = null, + $shortDescription = null, + $description = null, + $amount = null, + $isUsed = null, + $isEnabled = null, + $expirationDate = null, + $rules = null, + $isCumulative = null, + $isRemovingPostage = null + ) { + $coupon = new Coupon(); + + if ($code === null) { + $code = 'XMAS1'; + } + $coupon->setCode($code); + + if ($type === null) { + $type = 'Thelia\Coupon\Type\RemoveXAmount'; + } + $coupon->setType($type); + + if ($title === null) { + $title = CouponManagerTest::VALID_TITLE; + } + $coupon->setTitle($title); + + if ($shortDescription === null) { + $shortDescription = CouponManagerTest::VALID_SHORT_DESCRIPTION; + } + $coupon->setShortDescription($shortDescription); + + if ($description === null) { + $description = CouponManagerTest::VALID_DESCRIPTION; + } + $coupon->setDescription($description); + + if ($amount === null) { + $amount = 10.00; + } + $coupon->setAmount($amount); + + if ($isUsed === null) { + $isUsed = 1; + } + $coupon->setIsUsed($isUsed); + + if ($isEnabled === null) { + $isEnabled = 1; + } + $coupon->setIsEnabled($isEnabled); + + if ($isCumulative === null) { + $isCumulative = 1; + } + if ($isRemovingPostage === null) { + $isRemovingPostage = 0; + } + + if ($expirationDate === null) { + $date = new \DateTime(); + $coupon->setExpirationDate( + $date->setTimestamp(strtotime("today + 2 months")) + ); + } + + if ($rules === null) { + $rules = $this->generateValidRules(); + } + + $coupon->setSerializedRules(base64_encode(serialize($rules))); + + $coupon->setIsCumulative($isCumulative); + $coupon->setIsRemovingPostage($isRemovingPostage); + + return $coupon; + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } +} diff --git a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php new file mode 100644 index 000000000..9d171a021 --- /dev/null +++ b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php @@ -0,0 +1,804 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Thelia\Constraint\Validator\PriceParam; +use Thelia\Constraint\Validator\RuleValidator; +use Thelia\Constraint\Rule\AvailableForTotalAmount; +use Thelia\Constraint\Rule\Operators; +use Thelia\Coupon\Type\CouponInterface; +use Thelia\Coupon\Type\RemoveXAmount; +use Thelia\Tools\PhpUnitUtils; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test CouponManager Class + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponManagerTest extends \PHPUnit_Framework_TestCase +{ + CONST VALID_CODE = 'XMAS'; + CONST VALID_TITLE = 'XMAS coupon'; + CONST VALID_SHORT_DESCRIPTION = 'Coupon for Christmas removing 10€ if your total checkout is more than 40€'; + CONST VALID_DESCRIPTION = '

Lorem ipsum dolor sit amet

Consectetur adipiscing elit. Cras at luctus tellus. Integer turpis mauris, aliquet vitae risus tristique, pellentesque vestibulum urna. Vestibulum sodales laoreet lectus dictum suscipit. Praesent vulputate, sem id varius condimentum, quam magna tempor elit, quis venenatis ligula nulla eget libero. Cras egestas euismod tellus, id pharetra leo suscipit quis. Donec lacinia ac lacus et ultricies. Nunc in porttitor neque. Proin at quam congue, consectetur orci sed, congue nulla. Nulla eleifend nunc ligula, nec pharetra elit tempus quis. Vivamus vel mauris sed est dictum blandit. Maecenas blandit dapibus velit ut sollicitudin. In in euismod mauris, consequat viverra magna. Cras velit velit, sollicitudin commodo tortor gravida, tempus varius nulla. + +Donec rhoncus leo mauris, id porttitor ante luctus tempus. + +Curabitur quis augue feugiat, ullamcorper mauris ac, interdum mi. Quisque aliquam lorem vitae felis lobortis, id interdum turpis mattis. Vestibulum diam massa, ornare congue blandit quis, facilisis at nisl. In tortor metus, venenatis non arcu nec, sollicitudin ornare nisl. Nunc erat risus, varius nec urna at, iaculis lacinia elit. Aenean ut felis tempus, tincidunt odio non, sagittis nisl. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec vitae hendrerit elit. Nunc sit amet gravida risus, euismod lobortis massa. Nam a erat mauris. Nam a malesuada lorem. Nulla id accumsan dolor, sed rhoncus tellus. Quisque dictum felis sed leo auctor, at volutpat lectus viverra. Morbi rutrum, est ac aliquam imperdiet, nibh sem sagittis justo, ac mattis magna lacus eu nulla. + +Duis interdum lectus nulla, nec pellentesque sapien condimentum at. Suspendisse potenti. Sed eu purus tellus. Nunc quis rhoncus metus. Fusce vitae tellus enim. Interdum et malesuada fames ac ante ipsum primis in faucibus. Etiam tempor porttitor erat vitae iaculis. Sed est elit, consequat non ornare vitae, vehicula eget lectus. Etiam consequat sapien mauris, eget consectetur magna imperdiet eget. Nunc sollicitudin luctus velit, in commodo nulla adipiscing fermentum. Fusce nisi sapien, posuere vitae metus sit amet, facilisis sollicitudin dui. Fusce ultricies auctor enim sit amet iaculis. Morbi at vestibulum enim, eget adipiscing eros. + +Praesent ligula lorem, faucibus ut metus quis, fermentum iaculis erat. Pellentesque elit erat, lacinia sed semper ac, sagittis vel elit. Nam eu convallis est. Curabitur rhoncus odio vitae consectetur pellentesque. Nam vitae arcu nec ante scelerisque dignissim vel nec neque. Suspendisse augue nulla, mollis eget dui et, tempor facilisis erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac diam ipsum. Donec convallis dui ultricies velit auctor, non lobortis nulla ultrices. Morbi vitae dignissim ante, sit amet lobortis tortor. Nunc dapibus condimentum augue, in molestie neque congue non. + +Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesuada tortor vel erat volutpat tincidunt. In vehicula diam est, a convallis eros scelerisque ut. Donec aliquet venenatis iaculis. Ut a arcu gravida, placerat dui eu, iaculis nisl. Quisque adipiscing orci sit amet dui dignissim lacinia. Sed vulputate lorem non dolor adipiscing ornare. Morbi ornare id nisl id aliquam. Ut fringilla elit ante, nec lacinia enim fermentum sit amet. Aenean rutrum lorem eu convallis pharetra. Cras malesuada varius metus, vitae gravida velit. Nam a varius ipsum, ac commodo dolor. Phasellus nec elementum elit. Etiam vel adipiscing leo.'; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + /** + * Test getDiscount() behaviour + * Entering : 1 valid Coupon (If 40 < total amount 400) - 10euros + * + * @covers Thelia\Coupon\CouponManager::getDiscount + */ + public function testGetDiscountOneCoupon() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + /** @var CouponInterface $coupon */ + $coupon = self::generateValidCoupon(); + + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice); + + $couponManager = new CouponManager($stubCouponBaseAdapter); + $discount = $couponManager->getDiscount(); + + $expected = 10.00; + $actual = $discount; + $this->assertEquals($expected, $actual); + } + + /** + * Test getDiscount() behaviour + * Entering : 1 valid Coupon (If 40 < total amount 400) - 10euros + * 1 valid Coupon (If total amount > 20) - 15euros + * + * @covers Thelia\Coupon\CouponManager::getDiscount + */ + public function testGetDiscountTwoCoupon() + { + $adapter = new CouponBaseAdapter(); + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + /** @var CouponInterface $coupon1 */ + $coupon1 = self::generateValidCoupon(); + $rule1 = new AvailableForTotalAmount( + $adapter, array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + Operators::SUPERIOR, + new PriceParam( + $adapter, 40.00, 'EUR' + ) + ) + ) + ); + $rules = new CouponRuleCollection(array($rule1)); + /** @var CouponInterface $coupon2 */ + $coupon2 = $this->generateValidCoupon('XMAS2', null, null, null, 15.00, null, null, $rules); + + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon1, $coupon2), $cartTotalPrice, $checkoutTotalPrice); + + $couponManager = new CouponManager($stubCouponBaseAdapter); + $discount = $couponManager->getDiscount(); + + $expected = 25.00; + $actual = $discount; + $this->assertEquals($expected, $actual); + } + + /** + * Test getDiscount() behaviour + * For a Cart of 21euros + * Entering : 1 valid Coupon (If total amount > 20) - 30euros + * + * @covers Thelia\Coupon\CouponManager::getDiscount + */ + public function testGetDiscountAlwaysInferiorToPrice() + { + $adapter = new CouponBaseAdapter(); + $cartTotalPrice = 21.00; + $checkoutTotalPrice = 26.00; + + $rule1 = new AvailableForTotalAmount( + $adapter, array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + Operators::SUPERIOR, + new PriceParam( + $adapter, 20.00, 'EUR' + ) + ) + ) + ); + $rules = new CouponRuleCollection(array($rule1)); + /** @var CouponInterface $coupon */ + $coupon = $this->generateValidCoupon('XMAS2', null, null, null, 30.00, null, null, $rules); + + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice); + + $couponManager = new CouponManager($stubCouponBaseAdapter); + $discount = $couponManager->getDiscount(); + + $expected = 21.00; + $actual = $discount; + $this->assertEquals($expected, $actual); + } + + + /** + * Check if removing postage on discout is working + * @covers Thelia\Coupon\CouponManager::isCouponRemovingPostage + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testIsCouponRemovingPostage() + { + $adapter = new CouponBaseAdapter(); + $cartTotalPrice = 21.00; + $checkoutTotalPrice = 27.00; + + $rule1 = new AvailableForTotalAmount( + $adapter, array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + Operators::SUPERIOR, + new PriceParam( + $adapter, 20.00, 'EUR' + ) + ) + ) + ); + $rules = new CouponRuleCollection(array($rule1)); + /** @var CouponInterface $coupon */ + $coupon = $this->generateValidCoupon('XMAS2', null, null, null, 30.00, null, null, $rules, null, true); + + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter(array($coupon), $cartTotalPrice, $checkoutTotalPrice); + + $couponManager = new CouponManager($stubCouponBaseAdapter); + $discount = $couponManager->getDiscount(); + + $expected = 21.00; + $actual = $discount; + $this->assertEquals($expected, $actual); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon not cumulative + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationOneCouponNotCumulative() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false); + + $coupons = array($couponCumulative1); + + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = $coupons; + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Array Sorted despite there is only once'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon cumulative + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationOneCouponCumulative() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon(null, null, null, null, null, null, null, null, true); + + $coupons = array($couponCumulative1); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = $coupons; + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Array Sorted despite there is only once'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon cumulative + * 1 Coupon cumulative + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationTwoCouponCumulative() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, null, null, true); + $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true); + + $coupons = array($couponCumulative1, $couponCumulative2); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = $coupons; + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Array Sorted despite both Coupon can be accumulated'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon cumulative + * 1 Coupon non cumulative + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationOneCouponCumulativeOneNonCumulative() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, null, null, true); + $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, false); + + $coupons = array($couponCumulative1, $couponCumulative2); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = array($couponCumulative2); + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Array Sorted despite both Coupon can be accumulated'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon non cumulative + * 1 Coupon cumulative + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationOneCouponNonCumulativeOneCumulative() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, null, null, false); + $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true); + + $coupons = array($couponCumulative1, $couponCumulative2); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = array($couponCumulative2); + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Array Sorted despite both Coupon can be accumulated'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon non cumulative + * 1 Coupon non cumulative + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationTwoCouponNonCumulative() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, null, null, false); + $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, false); + + $coupons = array($couponCumulative1, $couponCumulative2); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = array($couponCumulative2); + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Array Sorted despite both Coupon can be accumulated'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon cumulative expired + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationOneCouponCumulativeExpired() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, new \DateTime(), null, true); + + $coupons = array($couponCumulative1); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = array(); + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Coupon expired ignored'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon cumulative expired + * 1 Coupon cumulative expired + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationTwoCouponCumulativeExpired() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, new \DateTime(), null, true); + $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, new \DateTime(), null, true); + + $coupons = array($couponCumulative1, $couponCumulative2); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = array(); + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Coupon expired ignored'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon cumulative expired + * 1 Coupon cumulative valid + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationOneCouponCumulativeExpiredOneNonExpired() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, new \DateTime(), null, true); + $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true); + + $coupons = array($couponCumulative1, $couponCumulative2); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = array($couponCumulative2); + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Coupon expired ignored'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon cumulative valid + * 1 Coupon cumulative expired + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationOneCouponCumulativeNonExpiredOneExpired() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, null, null, true); + $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, new \DateTime(), null, true); + + $coupons = array($couponCumulative1, $couponCumulative2); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = array($couponCumulative1); + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Coupon expired ignored'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon cumulative valid + * 1 Coupon cumulative valid + * 1 Coupon cumulative valid + * 1 Coupon cumulative valid + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationFourCouponCumulative() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, null, null, true); + $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true); + $couponCumulative3 = $this->generateValidCoupon('XMAS3', null, null, null, null, null, null, null, true); + $couponCumulative4 = $this->generateValidCoupon('XMAS4', null, null, null, null, null, null, null, true); + + $coupons = array($couponCumulative1, $couponCumulative2, $couponCumulative3, $couponCumulative4); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = $coupons; + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Coupon cumulative ignored'); + } + + /** + * Testing how multiple Coupon behaviour + * Entering 1 Coupon cumulative valid + * 1 Coupon cumulative valid + * 1 Coupon cumulative valid + * 1 Coupon non cumulative valid + * + * @covers Thelia\Coupon\CouponManager::sortCoupons + */ + public function testCouponCumulationThreeCouponCumulativeOneNonCumulative() + { + $cartTotalPrice = 100.00; + $checkoutTotalPrice = 120.00; + + // Given + /** @var CouponInterface $coupon */ + $couponCumulative1 = $this->generateValidCoupon('XMAS1', null, null, null, null, null, null, null, true); + $couponCumulative2 = $this->generateValidCoupon('XMAS2', null, null, null, null, null, null, null, true); + $couponCumulative3 = $this->generateValidCoupon('XMAS3', null, null, null, null, null, null, null, true); + $couponCumulative4 = $this->generateValidCoupon('XMAS4', null, null, null, null, null, null, null, false); + + $coupons = array($couponCumulative1, $couponCumulative2, $couponCumulative3, $couponCumulative4); + /** @var CouponAdapterInterface $stubCouponBaseAdapter */ + $stubCouponBaseAdapter = $this->generateFakeAdapter($coupons, $cartTotalPrice, $checkoutTotalPrice); + + // When + $sortedCoupons = PhpUnitUtils::callMethod( + new CouponManager($stubCouponBaseAdapter), + 'sortCoupons', + array($coupons) + ); + + // Then + $expected = array($couponCumulative4); + $actual = $sortedCoupons; + + $this->assertSame($expected, $actual, 'Coupon cumulative ignored'); + } + + + /** + * Generate valid CouponRuleInterfaces + * + * @return array Array of CouponRuleInterface + */ + public static function generateValidRules() + { + $adapter = new CouponBaseAdapter(); + $rule1 = new AvailableForTotalAmount( + $adapter, array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + Operators::SUPERIOR, + new PriceParam( + $adapter, 40.00, 'EUR' + ) + ) + ) + ); + $rule2 = new AvailableForTotalAmount( + $adapter, array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + Operators::INFERIOR, + new PriceParam( + $adapter, 400.00, 'EUR' + ) + ) + ) + ); + $rules = new CouponRuleCollection(array($rule1, $rule2)); + + return $rules; + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + + /** + * Generate a fake Adapter + * + * @param array $coupons Coupons + * @param float $cartTotalPrice Cart total price + * @param float $checkoutTotalPrice Checkout total price + * @param float $postagePrice Checkout postage price + * + * @return \PHPUnit_Framework_MockObject_MockObject + */ + public function generateFakeAdapter(array $coupons, $cartTotalPrice, $checkoutTotalPrice, $postagePrice = 6.00) + { + $stubCouponBaseAdapter = $this->getMock( + 'Thelia\Coupon\CouponBaseAdapter', + array( + 'getCurrentCoupons', + 'getCartTotalPrice', + 'getCheckoutTotalPrice', + 'getCheckoutPostagePrice' + ), + array() + ); + + $stubCouponBaseAdapter->expects($this->any()) + ->method('getCurrentCoupons') + ->will($this->returnValue(($coupons))); + + // Return Cart product amount = $cartTotalPrice euros + $stubCouponBaseAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue($cartTotalPrice)); + + // Return Checkout amount = $checkoutTotalPrice euros + $stubCouponBaseAdapter->expects($this->any()) + ->method('getCheckoutTotalPrice') + ->will($this->returnValue($checkoutTotalPrice)); + + $stubCouponBaseAdapter->expects($this->any()) + ->method('getCheckoutPostagePrice') + ->will($this->returnValue($postagePrice)); + + return $stubCouponBaseAdapter; + } + + /** + * Generate valid CouponInterface + * + * @param string $code Coupon Code + * @param string $title Coupon Title + * @param string $shortDescription Coupon short + * description + * @param string $description Coupon description + * @param float $amount Coupon discount + * @param bool $isEnabled Is Coupon enabled + * @param \DateTime $expirationDate Coupon expiration date + * @param CouponRuleCollection $rules Coupon rules + * @param bool $isCumulative If is cumulative + * @param bool $isRemovingPostage If is removing postage + * @param bool $isAvailableOnSpecialOffers If is available on + * special offers or not + * @param int $maxUsage How many time a Coupon + * can be used + * + * @return CouponInterface + */ + public static function generateValidCoupon( + $code = null, + $title = null, + $shortDescription = null, + $description = null, + $amount = null, + $isEnabled = null, + $expirationDate = null, + $rules = null, + $isCumulative = null, + $isRemovingPostage = null, + $isAvailableOnSpecialOffers = null, + $maxUsage = null + ) { + $adapter = new CouponBaseAdapter(); + if ($code === null) { + $code = self::VALID_CODE; + } + if ($title === null) { + $title = self::VALID_TITLE; + } + if ($shortDescription === null) { + $shortDescription = self::VALID_SHORT_DESCRIPTION; + } + if ($description === null) { + $description = self::VALID_DESCRIPTION; + } + if ($amount === null) { + $amount = 10.00; + } + if ($isEnabled === null) { + $isEnabled = true; + } + if ($isCumulative === null) { + $isCumulative = true; + } + if ($isRemovingPostage === null) { + $isRemovingPostage = false; + } + if ($isAvailableOnSpecialOffers === null) { + $isAvailableOnSpecialOffers = true; + } + if ($maxUsage === null) { + $maxUsage = 40; + } + + if ($expirationDate === null) { + $expirationDate = new \DateTime(); + $expirationDate->setTimestamp(strtotime("today + 2 months")); + } + + $coupon = new RemoveXAmount($adapter, $code, $title, $shortDescription, $description, $amount, $isCumulative, $isRemovingPostage, $isAvailableOnSpecialOffers, $isEnabled, $maxUsage, $expirationDate); + + if ($rules === null) { + $rules = self::generateValidRules(); + } + + $coupon->setRules($rules); + + return $coupon; + } + +} diff --git a/core/lib/Thelia/Tests/Coupon/CouponRuleCollectionTest.php b/core/lib/Thelia/Tests/Coupon/CouponRuleCollectionTest.php new file mode 100644 index 000000000..e1ad4ecdd --- /dev/null +++ b/core/lib/Thelia/Tests/Coupon/CouponRuleCollectionTest.php @@ -0,0 +1,79 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Thelia\Constraint\Validator\PriceParam; +use Thelia\Constraint\Validator\RuleValidator; +use Thelia\Constraint\Rule\AvailableForTotalAmount; +use Thelia\Constraint\Rule\Operators; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test CouponRuleCollection Class + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class CouponRuleCollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * + */ + public function testRuleSerialisation() + { + $rule1 = new AvailableForTotalAmount( + , array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + Operators::SUPERIOR, + new PriceParam( + , 40.00, 'EUR' + ) + ) + ) + ); + $rule2 = new AvailableForTotalAmount( + , array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + Operators::INFERIOR, + new PriceParam( + , 400.00, 'EUR' + ) + ) + ) + ); + $rules = new CouponRuleCollection(array($rule1, $rule2)); + + $serializedRules = base64_encode(serialize($rules)); + $unserializedRules = unserialize(base64_decode($serializedRules)); + + $expected = $rules; + $actual = $unserializedRules; + + $this->assertEquals($expected, $actual); + } +} diff --git a/core/lib/Thelia/Tests/Coupon/RuleOrganizerTest.php b/core/lib/Thelia/Tests/Coupon/RuleOrganizerTest.php new file mode 100644 index 000000000..3300cb19b --- /dev/null +++ b/core/lib/Thelia/Tests/Coupon/RuleOrganizerTest.php @@ -0,0 +1,72 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test RuleOrganizer Class + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RuleOrganizerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var RuleOrganizer + */ + protected $object; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + $this->object = new RuleOrganizer; + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + + /** + * @covers Thelia\Coupon\RuleOrganizer::organize + * @todo Implement testOrganize(). + */ + public function testOrganize() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } +} diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php new file mode 100644 index 000000000..182594666 --- /dev/null +++ b/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php @@ -0,0 +1,377 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use Thelia\Constraint\Validator\PriceParam; +use Thelia\Constraint\Validator\RuleValidator; +use Thelia\Constraint\Rule\AvailableForTotalAmount; +use Thelia\Constraint\Rule\Operators; +use Thelia\Coupon\Type\RemoveXAmount; + +require_once '../CouponManagerTest.php'; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test RemoveXAmount Class + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RemoveXAmountTest extends \PHPUnit_Framework_TestCase +{ + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + + } + + /** + * Test if a Coupon is well displayed + * + * @covers Thelia\Coupon\type\RemoveXAmount::getCode + * @covers Thelia\Coupon\type\RemoveXAmount::getTitle + * @covers Thelia\Coupon\type\RemoveXAmount::getShortDescription + * @covers Thelia\Coupon\type\RemoveXAmount::getDescription + * + */ + public function testDisplay() + { + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, true, true); + + $expected = CouponManagerTest::VALID_CODE; + $actual = $coupon->getCode(); + $this->assertEquals($expected, $actual); + + $expected = CouponManagerTest::VALID_TITLE; + $actual = $coupon->getTitle(); + $this->assertEquals($expected, $actual); + + $expected = CouponManagerTest::VALID_SHORT_DESCRIPTION; + $actual = $coupon->getShortDescription(); + $this->assertEquals($expected, $actual); + + $expected = CouponManagerTest::VALID_DESCRIPTION; + $actual = $coupon->getDescription(); + $this->assertEquals($expected, $actual); + } + + /** + * Test if a Coupon can be Cumulative + * + * @covers Thelia\Coupon\type\RemoveXAmount::isCumulative + * + */ + public function testIsCumulative() + { + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, true, true); + + $actual = $coupon->isCumulative(); + $this->assertTrue($actual); + } + + /** + * Test if a Coupon can be non cumulative + * + * @covers Thelia\Coupon\type\RemoveXAmount::isCumulative + * + */ + public function testIsNotCumulative() + { + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + $actual = $coupon->isCumulative(); + $this->assertFalse($actual); + } + + + /** + * Test if a Coupon can remove postage + * + * @covers Thelia\Coupon\type\RemoveXAmount::isRemovingPostage + * + */ + public function testIsRemovingPostage() + { + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, true, true); + + $actual = $coupon->isRemovingPostage(); + $this->assertTrue($actual); + } + + /** + * Test if a Coupon won't remove postage if not set to + * + * @covers Thelia\Coupon\type\RemoveXAmount::isRemovingPostage + */ + public function testIsNotRemovingPostage() + { + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + $actual = $coupon->isRemovingPostage(); + $this->assertFalse($actual); + } + + + /** + * Test if a Coupon has the effect expected (discount 10euros) + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + */ + public function testGetEffect() + { + $adapter = new CouponBaseAdapter(); + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + $expected = 10; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + /** + * Test Coupon rule setter + * + * @covers Thelia\Coupon\type\RemoveXAmount::setRules + * @covers Thelia\Coupon\type\RemoveXAmount::getRules + */ + public function testSetRulesValid() + { + // Given + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::EQUAL, + 20.00 + ); + $rule1 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::INFERIOR, + 100.23 + ); + $rule2 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::SUPERIOR, + 421.23 + ); + + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0, $rule1, $rule2))); + + // Then + $expected = 3; + $this->assertCount($expected, $coupon->getRules()->getRules()); + } + + /** + * Test Coupon rule setter + * + * @covers Thelia\Coupon\type\RemoveXAmount::setRules + * @expectedException \Thelia\Exception\InvalidRuleException + * + */ + public function testSetRulesInvalid() + { + // Given + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::EQUAL, + 20.00 + ); + $rule1 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::INFERIOR, + 100.23 + ); + $rule2 = $this; + + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0, $rule1, $rule2))); + } + + /** + * Test Coupon effect for rule Total Amount < 400 + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + * + */ + public function testGetEffectIfTotalAmountInferiorTo400Valid() + { + // Given + $adapter = new CouponBaseAdapter(); + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::INFERIOR, + 400.00 + ); + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0))); + + // Then + $expected = 10.00; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + /** + * Test Coupon effect for rule Total Amount <= 400 + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + * + */ + public function testGetEffectIfTotalAmountInferiorOrEqualTo400Valid() + { + // Given + $adapter = new CouponBaseAdapter(); + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::INFERIOR_OR_EQUAL, + 400.00 + ); + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0))); + + // Then + $expected = 10.00; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + /** + * Test Coupon effect for rule Total Amount == 400 + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + * + */ + public function testGetEffectIfTotalAmountEqualTo400Valid() + { + // Given + $adapter = new CouponBaseAdapter(); + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::EQUAL, + 400.00 + ); + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0))); + + // Then + $expected = 10.00; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + /** + * Test Coupon effect for rule Total Amount >= 400 + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + * + */ + public function testGetEffectIfTotalAmountSuperiorOrEqualTo400Valid() + { + // Given + $adapter = new CouponBaseAdapter(); + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::SUPERIOR_OR_EQUAL, + 400.00 + ); + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0))); + + // Then + $expected = 10.00; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + /** + * Test Coupon effect for rule Total Amount > 400 + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + * + */ + public function testGetEffectIfTotalAmountSuperiorTo400Valid() + { + // Given + $adapter = new CouponBaseAdapter(); + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::SUPERIOR, + 400.00 + ); + $coupon = CouponManagerTest::generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0))); + + // Then + $expected = 10.00; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + + /** + * Generate valid rule AvailableForTotalAmount + * according to given operator and amount + * + * @param string $operator Operators::CONST + * @param float $amount Amount with 2 decimals + * + * @return AvailableForTotalAmount + */ + protected function generateValidRuleAvailableForTotalAmountOperatorTo($operator, $amount) + { + $adapter = new CouponBaseAdapter(); + $validators = array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + $operator, + new PriceParam( + $adapter, + $amount, + 'EUR' + ) + ) + ); + + return new AvailableForTotalAmount($adapter, $validators); + } + +} diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentForCategoryYTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentForCategoryYTest.php new file mode 100644 index 000000000..1ea0c67bb --- /dev/null +++ b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentForCategoryYTest.php @@ -0,0 +1,63 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test RemoveXPercentForCategoryY Class + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RemoveXPercentForCategoryYTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + public function incompleteTest() + { + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php new file mode 100644 index 000000000..67d09341c --- /dev/null +++ b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php @@ -0,0 +1,451 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Coupon; + +use PHPUnit_Framework_TestCase; +use Thelia\Constraint\Rule\AvailableForTotalAmount; +use Thelia\Constraint\Rule\Operators; +use Thelia\Constraint\Validator\PriceParam; +use Thelia\Constraint\Validator\RuleValidator; +use Thelia\Coupon\Type\CouponInterface; +use Thelia\Coupon\Type\RemoveXPercent; + +require_once '../CouponManagerTest.php'; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Unit Test RemoveXPercent Class + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class RemoveXPercentTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + } + + /** + * Test if a Coupon can be Cumulative + * + * @covers Thelia\Coupon\type\RemoveXAmount::isCumulative + * + */ + public function testIsCumulative() + { + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, true, true); + + $actual = $coupon->isCumulative(); + $this->assertTrue($actual); + } + + /** + * Test if a Coupon can be non cumulative + * + * @covers Thelia\Coupon\type\RemoveXAmount::isCumulative + * + */ + public function testIsNotCumulative() + { + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + $actual = $coupon->isCumulative(); + $this->assertFalse($actual); + } + + + /** + * Test if a Coupon can remove postage + * + * @covers Thelia\Coupon\type\RemoveXAmount::isRemovingPostage + * + */ + public function testIsRemovingPostage() + { + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, true, true); + + $actual = $coupon->isRemovingPostage(); + $this->assertTrue($actual); + } + + /** + * Test if a Coupon won't remove postage if not set to + * + * @covers Thelia\Coupon\type\RemoveXAmount::isRemovingPostage + */ + public function testIsNotRemovingPostage() + { + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + $actual = $coupon->isRemovingPostage(); + $this->assertFalse($actual); + } + + + /** + * Test if a Coupon has the effect expected (discount 10euros) + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + */ + public function testGetEffect() + { + $adapter = $this->generateFakeAdapter(245); + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + $expected = 24.50; + $actual = $coupon->getDiscount($adapter); + $this->assertEquals($expected, $actual); + } + + /** + * Test Coupon rule setter + * + * @covers Thelia\Coupon\type\RemoveXAmount::setRules + * @covers Thelia\Coupon\type\RemoveXAmount::getRules + */ + public function testSetRulesValid() + { + // Given + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::EQUAL, + 20.00 + ); + $rule1 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::INFERIOR, + 100.23 + ); + $rule2 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::SUPERIOR, + 421.23 + ); + + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0, $rule1, $rule2))); + + // Then + $expected = 3; + $this->assertCount($expected, $coupon->getRules()->getRules()); + } + + /** + * Test Coupon rule setter + * + * @covers Thelia\Coupon\type\RemoveXAmount::setRules + * @expectedException \Thelia\Exception\InvalidRuleException + * + */ + public function testSetRulesInvalid() + { + // Given + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::EQUAL, + 20.00 + ); + $rule1 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::INFERIOR, + 100.23 + ); + $rule2 = $this; + + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0, $rule1, $rule2))); + } + + /** + * Test Coupon effect for rule Total Amount < 400 + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + * + */ + public function testGetEffectIfTotalAmountInferiorTo400Valid() + { + // Given + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::INFERIOR, + 400.00 + ); + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0))); + + // Then + $expected = 24.50; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + /** + * Test Coupon effect for rule Total Amount <= 400 + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + * + */ + public function testGetEffectIfTotalAmountInferiorOrEqualTo400Valid() + { + // Given + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::INFERIOR_OR_EQUAL, + 400.00 + ); + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0))); + + // Then + $expected = 24.50; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + /** + * Test Coupon effect for rule Total Amount == 400 + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + * + */ + public function testGetEffectIfTotalAmountEqualTo400Valid() + { + // Given + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::EQUAL, + 400.00 + ); + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0))); + + // Then + $expected = 24.50; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + /** + * Test Coupon effect for rule Total Amount >= 400 + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + * + */ + public function testGetEffectIfTotalAmountSuperiorOrEqualTo400Valid() + { + // Given + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::SUPERIOR_OR_EQUAL, + 400.00 + ); + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0))); + + // Then + $expected = 24.50; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + /** + * Test Coupon effect for rule Total Amount > 400 + * + * @covers Thelia\Coupon\type\RemoveXAmount::getEffect + * + */ + public function testGetEffectIfTotalAmountSuperiorTo400Valid() + { + // Given + $rule0 = $this->generateValidRuleAvailableForTotalAmountOperatorTo( + Operators::SUPERIOR, + 400.00 + ); + $coupon = $this->generateValidCoupon(null, null, null, null, null, null, null, null, false, false); + + // When + $coupon->setRules(new CouponRuleCollection(array($rule0))); + + // Then + $expected = 24.50; + $actual = $coupon->getDiscount(); + $this->assertEquals($expected, $actual); + } + + /** + * Generate valid CouponInterface + * + * @param string $code Coupon Code + * @param string $title Coupon Title + * @param string $shortDescription Coupon short + * description + * @param string $description Coupon description + * @param float $amount Coupon discount + * @param bool $isEnabled Is Coupon enabled + * @param \DateTime $expirationDate Coupon expiration date + * @param CouponRuleCollection $rules Coupon rules + * @param bool $isCumulative If is cumulative + * @param bool $isRemovingPostage If is removing postage + * @param bool $isAvailableOnSpecialOffers If is available on + * special offers or not + * @param int $maxUsage How many time a Coupon + * can be used + * + * @return CouponInterface + */ + public function generateValidCoupon( + $code = null, + $title = null, + $shortDescription = null, + $description = null, + $percent = null, + $isEnabled = null, + $expirationDate = null, + $rules = null, + $isCumulative = null, + $isRemovingPostage = null, + $isAvailableOnSpecialOffers = null, + $maxUsage = null + ) { + $adapter = $this->generateFakeAdapter(245); + + if ($code === null) { + $code = CouponManagerTest::VALID_CODE; + } + if ($title === null) { + $title = CouponManagerTest::VALID_TITLE; + } + if ($shortDescription === null) { + $shortDescription = CouponManagerTest::VALID_SHORT_DESCRIPTION; + } + if ($description === null) { + $description = CouponManagerTest::VALID_DESCRIPTION; + } + if ($percent === null) { + $percent = 10.00; + } + if ($isEnabled === null) { + $isEnabled = true; + } + if ($isCumulative === null) { + $isCumulative = true; + } + if ($isRemovingPostage === null) { + $isRemovingPostage = false; + } + if ($isAvailableOnSpecialOffers === null) { + $isAvailableOnSpecialOffers = true; + } + if ($maxUsage === null) { + $maxUsage = 40; + } + + if ($expirationDate === null) { + $expirationDate = new \DateTime(); + $expirationDate->setTimestamp(strtotime("today + 2 months")); + } + + $coupon = new RemoveXPercent($adapter, $code, $title, $shortDescription, $description, $percent, $isCumulative, $isRemovingPostage, $isAvailableOnSpecialOffers, $isEnabled, $maxUsage, $expirationDate); + + if ($rules === null) { + $rules = CouponManagerTest::generateValidRules(); + } + + $coupon->setRules($rules); + + return $coupon; + } + + + /** + * Generate valid rule AvailableForTotalAmount + * according to given operator and amount + * + * @param string $operator Operators::CONST + * @param float $amount Amount with 2 decimals + * + * @return AvailableForTotalAmount + */ + protected function generateValidRuleAvailableForTotalAmountOperatorTo($operator, $amount) + { + $adapter = new CouponBaseAdapter(); + $validators = array( + AvailableForTotalAmount::PARAM1_PRICE => new RuleValidator( + $operator, + new PriceParam( + $adapter, + $amount, + 'EUR' + ) + ) + ); + + return new AvailableForTotalAmount($adapter, $validators); + } + + /** + * Generate a fake Adapter + * + * @param float $cartTotalPrice Cart total price + * + * @return \PHPUnit_Framework_MockObject_MockObject + */ + public function generateFakeAdapter($cartTotalPrice) + { + $stubCouponBaseAdapter = $this->getMock( + 'Thelia\Coupon\CouponBaseAdapter', + array( + 'getCartTotalPrice' + ), + array() + ); + + $stubCouponBaseAdapter->expects($this->any()) + ->method('getCartTotalPrice') + ->will($this->returnValue(($cartTotalPrice))); + + return $stubCouponBaseAdapter; + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + +} diff --git a/core/lib/Thelia/Tests/Form/CartAddTest.php b/core/lib/Thelia/Tests/Form/CartAddTest.php old mode 100644 new mode 100755 diff --git a/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php b/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php new file mode 100755 index 000000000..6cd4bdf42 --- /dev/null +++ b/core/lib/Thelia/Tests/Rewriting/RewritingResolverTest.php @@ -0,0 +1,154 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Rewriting; + +use Thelia\Model\RewritingArgument; +use Thelia\Rewriting\RewritingResolver; +use Propel\Runtime\Collection\ObjectCollection; + +/** + * + * @author Etienne Roudeix + * + */ +class RewritingResolverTest extends \PHPUnit_Framework_TestCase +{ + protected function getMethod($name) + { + $class = new \ReflectionClass('\Thelia\Rewriting\RewritingResolver'); + $method = $class->getMethod($name); + $method->setAccessible(true); + + return $method; + } + + protected function getProperty($name) + { + $class = new \ReflectionClass('\Thelia\Rewriting\RewritingResolver'); + $property = $class->getProperty($name); + $property->setAccessible(true); + + return $property; + } + + /** + * @expectedException \Thelia\Exception\UrlRewritingException + * @expectedExceptionCode 800 + */ + public function testGetOtherParametersException() + { + $resolver = new RewritingResolver(); + + $method = $this->getMethod('getOtherParameters'); + $method->invoke($resolver); + } + + public function testGetOtherParameters() + { + $rewritingArguments = array( + array('Parameter' => 'foo0', 'Value' => 'bar0'), + array('Parameter' => 'foo1', 'Value' => 'bar1'), + array('Parameter' => 'foo2', 'Value' => 'bar2'), + ); + $searchResult = new ObjectCollection(); + $searchResult->setModel('\Thelia\Model\RewritingArgument'); + $searchResult->fromArray($rewritingArguments); + + $resolver = new RewritingResolver(); + + $search = $this->getProperty('search'); + $search->setValue($resolver, $searchResult); + + $method = $this->getMethod('getOtherParameters'); + $actual = $method->invoke($resolver); + + $expected = array( + 'foo0' => 'bar0', + 'foo1' => 'bar1', + 'foo2' => 'bar2', + ); + + $this->assertEquals($expected, $actual); + } + + /** + * @expectedException \Thelia\Exception\UrlRewritingException + * @expectedExceptionCode 404 + */ + public function testLoadException() + { + $collection = new ObjectCollection(); + $collection->setModel('\Thelia\Model\RewritingArgument'); + + $resolverQuery = $this->getMock('\Thelia\Model\RewritingUrlQuery', array('getResolverSearch')); + $resolverQuery->expects($this->any()) + ->method('getResolverSearch') + ->with('foo.html') + ->will($this->returnValue($collection)); + + $resolver = new RewritingResolver(); + + $rewritingUrlQuery = $this->getProperty('rewritingUrlQuery'); + $rewritingUrlQuery->setValue($resolver, $resolverQuery); + + $resolver->load('foo.html'); + } + + public function testLoad() + { + $collection = new ObjectCollection(); + $collection->setModel('\Thelia\Model\RewritingArgument'); + + for($i=0; $i<3; $i++) { + $ra = new RewritingArgument(); + $ra->setParameter('foo' . $i); + $ra->setValue('bar' . $i); + $ra->setVirtualColumn('ru_view', 'view'); + $ra->setVirtualColumn('ru_viewId', 'viewId'); + $ra->setVirtualColumn('ru_locale', 'locale'); + $ra->setVirtualColumn('ru_redirected_to_url', null); + + $collection->append($ra); + } + + + $resolverQuery = $this->getMock('\Thelia\Model\RewritingUrlQuery', array('getResolverSearch')); + $resolverQuery->expects($this->any()) + ->method('getResolverSearch') + ->with('foo.html') + ->will($this->returnValue($collection)); + + $resolver = new RewritingResolver(); + + $rewritingUrlQuery = $this->getProperty('rewritingUrlQuery'); + $rewritingUrlQuery->setValue($resolver, $resolverQuery); + + $resolver->load('foo.html'); + + $this->assertEquals('view', $resolver->view); + $this->assertEquals('viewId', $resolver->viewId); + $this->assertEquals('locale', $resolver->locale); + $this->assertEquals(array('foo0' => 'bar0', 'foo1' => 'bar1', 'foo2' => 'bar2'), $resolver->otherParameters); + } +} diff --git a/core/lib/Thelia/Tests/Rewriting/RewritingRetrieverTest.php b/core/lib/Thelia/Tests/Rewriting/RewritingRetrieverTest.php new file mode 100755 index 000000000..8723e0096 --- /dev/null +++ b/core/lib/Thelia/Tests/Rewriting/RewritingRetrieverTest.php @@ -0,0 +1,98 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Rewriting; + +use Thelia\Model\RewritingUrl; +use Thelia\Rewriting\RewritingRetriever; +use Thelia\Tools\URL; + +/** + * + * @author Etienne Roudeix + * + */ +class RewritingRetrieverTest extends \PHPUnit_Framework_TestCase +{ + protected function getMethod($name) + { + $class = new \ReflectionClass('\Thelia\Rewriting\RewritingRetriever'); + $method = $class->getMethod($name); + $method->setAccessible(true); + + return $method; + } + + protected function getProperty($name) + { + $class = new \ReflectionClass('\Thelia\Rewriting\RewritingRetriever'); + $property = $class->getProperty($name); + $property->setAccessible(true); + + return $property; + } + + public function testLoadViewUrl() + { + $searchResult = new RewritingUrl(); + $searchResult->setUrl('foo.html'); + + $retrieverQuery = $this->getMock('\Thelia\Model\RewritingUrlQuery', array('getViewUrlQuery')); + $retrieverQuery->expects($this->any()) + ->method('getViewUrlQuery') + ->with('view', 'fr_FR', 1) + ->will($this->returnValue($searchResult)); + + $retriever = new RewritingRetriever(); + + $rewritingUrlQuery = $this->getProperty('rewritingUrlQuery'); + $rewritingUrlQuery->setValue($retriever, $retrieverQuery); + + $retriever->loadViewUrl('view', 'fr_FR', 1); + + $this->assertEquals('foo.html', $retriever->rewrittenUrl); + $this->assertEquals(URL::getInstance()->viewUrl('view', array('locale' => 'fr_FR', 'view_id' => 1)), $retriever->url); + } + + public function testLoadSpecificUrl() + { + $searchResult = new RewritingUrl(); + $searchResult->setUrl('foo.html'); + + $retrieverQuery = $this->getMock('\Thelia\Model\RewritingUrlQuery', array('getSpecificUrlQuery')); + $retrieverQuery->expects($this->any()) + ->method('getSpecificUrlQuery') + ->with('view', 'fr_FR', 1, array('foo0' => 'bar0', 'foo1' => 'bar1')) + ->will($this->returnValue($searchResult)); + + $retriever = new RewritingRetriever(); + + $rewritingUrlQuery = $this->getProperty('rewritingUrlQuery'); + $rewritingUrlQuery->setValue($retriever, $retrieverQuery); + + $retriever->loadSpecificUrl('view', 'fr_FR', 1, array('foo0' => 'bar0', 'foo1' => 'bar1')); + + $this->assertEquals('foo.html', $retriever->rewrittenUrl); + $this->assertEquals(URL::getInstance()->viewUrl('view', array('foo0' => 'bar0', 'foo1' => 'bar1', 'locale' => 'fr_FR', 'view_id' => 1)), $retriever->url); + } +} diff --git a/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php b/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php new file mode 100755 index 000000000..fac6ca643 --- /dev/null +++ b/core/lib/Thelia/Tests/TaxEngine/CalculatorTest.php @@ -0,0 +1,169 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\TaxEngine; + +use Propel\Runtime\Collection\ObjectCollection; +use Thelia\Model\Country; +use Thelia\Model\CountryQuery; +use Thelia\Model\Product; +use Thelia\Model\ProductQuery; +use Thelia\Model\Tax; +use Thelia\TaxEngine\Calculator; + +/** + * + * @author Etienne Roudeix + * + */ +class CalculatorTest extends \PHPUnit_Framework_TestCase +{ + protected function getMethod($name) + { + $class = new \ReflectionClass('\Thelia\TaxEngine\Calculator'); + $method = $class->getMethod($name); + $method->setAccessible(true); + + return $method; + } + + protected function getProperty($name) + { + $class = new \ReflectionClass('\Thelia\TaxEngine\Calculator'); + $property = $class->getProperty($name); + $property->setAccessible(true); + + return $property; + } + + /** + * @expectedException \Thelia\Exception\TaxEngineException + * @expectedExceptionCode 501 + */ + public function testLoadEmptyProductException() + { + $calculator = new Calculator(); + $calculator->load(new Product(), CountryQuery::create()->findOne()); + } + + /** + * @expectedException \Thelia\Exception\TaxEngineException + * @expectedExceptionCode 502 + */ + public function testLoadEmptyCountryException() + { + $calculator = new Calculator(); + $calculator->load(ProductQuery::create()->findOne(), new Country()); + } + + public function testLoad() + { + $productQuery = ProductQuery::create()->findOneById(1); + $countryQuery = CountryQuery::create()->findOneById(64); + + $calculator = new Calculator(); + + $taxRuleQuery = $this->getMock('\Thelia\Model\TaxRuleQuery', array('getTaxCalculatorGroupedCollection')); + $taxRuleQuery->expects($this->once()) + ->method('getTaxCalculatorGroupedCollection') + ->with($productQuery, $countryQuery) + ->will($this->returnValue('foo')); + + $rewritingUrlQuery = $this->getProperty('taxRuleQuery'); + $rewritingUrlQuery->setValue($calculator, $taxRuleQuery); + + $calculator->load($productQuery, $countryQuery); + + $this->assertEquals( + $productQuery, + $this->getProperty('product')->getValue($calculator) + ); + $this->assertEquals( + $countryQuery, + $this->getProperty('country')->getValue($calculator) + ); + $this->assertEquals( + 'foo', + $this->getProperty('taxRulesGroupedCollection')->getValue($calculator) + ); + } + + /** + * @expectedException \Thelia\Exception\TaxEngineException + * @expectedExceptionCode 503 + */ + public function testGetTaxAmountBadTaxRulesCollection() + { + $calculator = new Calculator(); + $calculator->getTaxAmount(500); + } + + /** + * @expectedException \Thelia\Exception\TaxEngineException + * @expectedExceptionCode 601 + */ + public function testGetTaxAmountBadAmount() + { + $taxRulesGroupedCollection = new ObjectCollection(); + + $calculator = new Calculator(); + + $rewritingUrlQuery = $this->getProperty('taxRulesGroupedCollection'); + $rewritingUrlQuery->setValue($calculator, $taxRulesGroupedCollection); + + $calculator->getTaxAmount('foo'); + } + + public function testGetTaxAmountAndGetTaxedPrice() + { + $taxRulesGroupedCollection = new ObjectCollection(); + $taxRulesGroupedCollection->setModel('\Thelia\Model\Tax'); + + $tax = new Tax(); + $tax->setVirtualColumn('taxRateSum', 10); + + $taxRulesGroupedCollection->append($tax); + + $tax = new Tax(); + $tax->setVirtualColumn('taxRateSum', 8); + + $taxRulesGroupedCollection->append($tax); + + $calculator = new Calculator(); + + $rewritingUrlQuery = $this->getProperty('taxRulesGroupedCollection'); + $rewritingUrlQuery->setValue($calculator, $taxRulesGroupedCollection); + + $taxAmount = $calculator->getTaxAmount(500); + $taxedPrice = $calculator->getTaxedPrice(500); + + /* + * expect : + * tax 1 = 500*0.10 = 50 // amout with tax 1 : 550 + * tax 2 = 550*0.08 = 44 // amout with tax 2 : 594 + * total tax amount = 94 + */ + $this->assertEquals(94, $taxAmount); + $this->assertEquals(594, $taxedPrice); + } +} diff --git a/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php b/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php new file mode 100644 index 000000000..927f7cf62 --- /dev/null +++ b/core/lib/Thelia/Tests/TestCaseWithURLToolSetup.php @@ -0,0 +1,64 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests; + +/** + * This class provides URL Tool class initialisation + * + * @package Thelia\Tests\TestCaseWithURLSetup + */ +class TestCaseWithURLToolSetup extends \PHPUnit_Framework_TestCase { + + + public function __construct() { + $this->setupURLTool(); + } + + protected function setupURLTool() { + + $container = new \Symfony\Component\DependencyInjection\ContainerBuilder(); + + $context = new \Symfony\Component\Routing\RequestContext( + '/thelia/index.php', + 'GET', + 'localhost', + 'http', + 80, + 443, + '/path/to/action' + ); + + $router = $this->getMockBuilder("Symfony\Component\Routing\Router") + ->disableOriginalConstructor() + ->getMock(); + + $router->expects($this->any()) + ->method('getContext') + ->will($this->returnValue($context)); + + $container->set("router.admin", $router); + + new \Thelia\Tools\URL($container); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Tests/Tools/URLTest.php b/core/lib/Thelia/Tests/Tools/URLTest.php new file mode 100755 index 000000000..86804f5c0 --- /dev/null +++ b/core/lib/Thelia/Tests/Tools/URLTest.php @@ -0,0 +1,237 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Type; + +use Thelia\Tools\URL; + +/** + * + * @author Etienne Roudeix + * @author Franck Allimant + * + */ +class URLTest extends \PHPUnit_Framework_TestCase +{ + protected $context; + + public function setUp() + { + $container = new \Symfony\Component\DependencyInjection\ContainerBuilder(); + + $router = $this->getMockBuilder("Symfony\Component\Routing\Router") + ->disableOriginalConstructor() + ->getMock(); + + $this->context = new \Symfony\Component\Routing\RequestContext( + '/thelia/index.php', + 'GET', + 'localhost', + 'http', + 80, + 443, + '/path/to/action' + ); + + $router->expects($this->any()) + ->method('getContext') + ->will($this->returnValue($this->context)); + + $container->set("router.admin", $router); + + new \Thelia\Tools\URL($container); + } + + public function testGetIndexPage() { + + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->getIndexPage(); + $this->assertEquals('http://localhost/thelia/index.php', $url); + + $this->context->setBaseUrl('/thelia/'); + $url = \Thelia\Tools\URL::getInstance()->getIndexPage(); + $this->assertEquals('http://localhost/thelia/', $url); + + $this->context->setBaseUrl('/thelia'); + $url = \Thelia\Tools\URL::getInstance()->getIndexPage(); + $this->assertEquals('http://localhost/thelia', $url); + + $this->context->setBaseUrl('/'); + $url = \Thelia\Tools\URL::getInstance()->getIndexPage(); + $this->assertEquals('http://localhost/', $url); + } + + public function testGetBaseUrl() { + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->getBaseUrl(); + $this->assertEquals('http://localhost/thelia/index.php', $url); + + $this->context->setBaseUrl('/thelia/'); + $url = \Thelia\Tools\URL::getInstance()->getBaseUrl(); + $this->assertEquals('http://localhost/thelia/', $url); + + $this->context->setBaseUrl('/'); + $url = \Thelia\Tools\URL::getInstance()->getBaseUrl(); + $this->assertEquals('http://localhost/', $url); + } + + public function testAbsoluteUrl() { + $this->context->setBaseUrl('/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action'); + $this->assertEquals('http://localhost/path/to/action', $url); + + $this->context->setBaseUrl('/thelia/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action'); + $this->assertEquals('http://localhost/thelia/path/to/action', $url); + + $this->context->setBaseUrl('/thelia'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action'); + $this->assertEquals('http://localhost/thelia/path/to/action', $url); + + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action'); + $this->assertEquals('http://localhost/thelia/index.php/path/to/action', $url); + } + + public function testAbsoluteUrlOnAbsolutePath() { + + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action'); + $this->assertEquals('http://myhost/path/to/action', $url); + + $this->context->setBaseUrl('/thelia/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action'); + $this->assertEquals('http://myhost/path/to/action', $url); + + $this->context->setBaseUrl('/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action'); + $this->assertEquals('http://myhost/path/to/action', $url); + } + + public function testAbsoluteUrlOnAbsolutePathWithParameters() { + + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://myhost/path/to/action?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/thelia/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://myhost/path/to/action?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://myhost/path/to/action?p1=v1&p2=v2', $url); + } + + public function testAbsoluteUrlOnAbsolutePathWithParametersAddParameters() { + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action?p0=v0', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://myhost/path/to/action?p0=v0&p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/thelia/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action?p0=v0', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://myhost/path/to/action?p0=v0&p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action?p0=v0', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://myhost/path/to/action?p0=v0&p1=v1&p2=v2', $url); + } + + public function testAbsoluteUrlWithParameters() { + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://localhost/thelia/index.php/path/to/action?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/thelia/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://localhost/thelia/path/to/action?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/thelia'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://localhost/thelia/path/to/action?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/thelia'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('path/to/action', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://localhost/thelia/path/to/action?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://localhost/path/to/action?p1=v1&p2=v2', $url); + } + + public function testAbsoluteUrlPathOnly() { + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array(), URL::PATH_TO_FILE); + $this->assertEquals('http://localhost/thelia/path/to/action', $url); + } + + public function testAbsoluteUrlPathOnlyWithParameters() { + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE); + $this->assertEquals('http://localhost/thelia/path/to/action?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/thelia/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE); + $this->assertEquals('http://localhost/thelia/path/to/action?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE); + $this->assertEquals('http://localhost/path/to/action?p1=v1&p2=v2', $url); + + } + + public function testAbsoluteUrlFromIndexWithParameters() { + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://localhost/thelia/index.php/?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/thelia/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://localhost/thelia/?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2")); + $this->assertEquals('http://localhost/?p1=v1&p2=v2', $url); + + } + + public function testAbsoluteUrlPathOnlyFromIndexWithParameters() { + $this->context->setBaseUrl('/thelia/index.php'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE); + $this->assertEquals('http://localhost/thelia/?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/thelia/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE); + $this->assertEquals('http://localhost/thelia/?p1=v1&p2=v2', $url); + + $this->context->setBaseUrl('/'); + $url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE); + $this->assertEquals('http://localhost/?p1=v1&p2=v2', $url); + + } + + public function testRetrieve() + { + + } +} diff --git a/core/lib/Thelia/Tools/DateTimeFormat.php b/core/lib/Thelia/Tools/DateTimeFormat.php new file mode 100755 index 000000000..bd6161389 --- /dev/null +++ b/core/lib/Thelia/Tools/DateTimeFormat.php @@ -0,0 +1,66 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tools; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\DependencyInjection\ContainerInterface; + +class DateTimeFormat +{ + protected $request; + + public function __construct(Request $request) + { + $this->request = $request; + } + + public static function getInstance(Request $request) + { + return new DateTimeFormat($request); + } + + public function getFormat($output = null) + { + $lang = $this->request->getSession()->getLang(); + + $format = null; + + if($lang) { + switch ($output) { + case "date" : + $format = $lang->getDateFormat(); + break; + case "time" : + $format = $lang->getTimeFormat(); + break; + default: + case "datetime" : + $format = $lang->getDateTimeFormat(); + break; + } + } + + return $format; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Tools/I18n.php b/core/lib/Thelia/Tools/I18n.php new file mode 100644 index 000000000..4467bebcd --- /dev/null +++ b/core/lib/Thelia/Tools/I18n.php @@ -0,0 +1,57 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Tools; + +use Thelia\Model\Lang; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Helper for translations + * + * @package I18n + * @author Guillaume MOREL + * + */ +class I18n +{ + /** + * Create a \DateTime from a date picker form input + * The date format is the same as the one from the current User Session + * Ex : $lang = $session->getLang() + * + * @param Lang $lang Object containing date format + * @param string $date String to convert + * + * @return \DateTime + */ + public function getDateTimeFromForm(Lang $lang, $date) + { + $currentDateFormat = $lang->getDateFormat(); + + return \DateTime::createFromFormat($currentDateFormat, $date); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Tools/PhpUnitUtils.php b/core/lib/Thelia/Tools/PhpUnitUtils.php new file mode 100644 index 000000000..89bd3b148 --- /dev/null +++ b/core/lib/Thelia/Tools/PhpUnitUtils.php @@ -0,0 +1,55 @@ +. */ +/* */ +/**********************************************************************************/ + +namespace Thelia\Tools; + +/** + * Created by JetBrains PhpStorm. + * Date: 8/19/13 + * Time: 3:24 PM + * + * Helper for Unit Testing + * + * @package Coupon + * @author Guillaume MOREL + * + */ +class PhpUnitUtils +{ + /** + * Allow to call a protected methods + * + * @param Object $obj Class name + namespace + * @param string $name Method name + * @param array $args Method arguments + * + * @return mixed protected method result + */ + public static function callMethod($obj, $name, array $args) + { + $class = new \ReflectionClass(get_class($obj)); + $method = $class->getMethod($name); + $method->setAccessible(true); + return $method->invokeArgs($obj, $args); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Tools/Rest/ResponseRest.php b/core/lib/Thelia/Tools/Rest/ResponseRest.php new file mode 100644 index 000000000..8618d460f --- /dev/null +++ b/core/lib/Thelia/Tools/Rest/ResponseRest.php @@ -0,0 +1,83 @@ +format = $format; + $serializer = $this->getSerializer(); + + if (isset($data)) { + $this->setContent($serializer->serialize($data, $this->format)); + } + + $this->headers->set('Content-Type', 'application/' . $this->format); + } + + /** + * Set Content to be serialized in the response, array or object + * + * @param array $data array or object to be serialized + * + * @return $this + */ + public function setRestContent($data) + { + $serializer = $this->getSerializer(); + + if (isset($data)) { + $this->setContent($serializer->serialize($data, $this->format)); + } + + return $this; + } + + /** + * Get Serializer + * + * @return Serializer + */ + protected function getSerializer() + { + $encoders = array(new XmlEncoder(), new JsonEncoder()); + $normalizers = array(new GetSetMethodNormalizer()); + + return new Serializer($normalizers, $encoders); + } + +} diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php old mode 100644 new mode 100755 index 5a88fa922..e43591ffc --- a/core/lib/Thelia/Tools/URL.php +++ b/core/lib/Thelia/Tools/URL.php @@ -24,20 +24,88 @@ namespace Thelia\Tools; use Thelia\Model\ConfigQuery; +use Thelia\Rewriting\RewritingResolver; +use Thelia\Rewriting\RewritingRetriever; + +use Thelia\Core\HttpFoundation\Request; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\Routing\RequestContext; class URL { + protected $resolver = null; + protected $retriever = null; + + protected $requestContext; + const PATH_TO_FILE = true; const WITH_INDEX_PAGE = false; - public static function getIndexPage() + protected static $instance = null; + + public function __construct(ContainerInterface $container) { - return ConfigQuery::read('base_url', '/') . "index_dev.php"; // FIXME ! + // Allow singleton style calls once intanciated. + // For this to work, the URL service has to be instanciated very early. This is done manually + // in TheliaHttpKernel, by calling $this->container->get('thelia.url.manager'); + self::$instance = $this; + + $this->requestContext = $container->get('router.admin')->getContext(); + + $this->retriever = new RewritingRetriever(); + $this->resolver = new RewritingResolver(); + } + + /** + * Return this class instance, only once instanciated. + * + * @throws \RuntimeException if the class has not been instanciated. + * @return \Thelia\Tools\URL the instance. + */ + public static function getInstance() { + if (self::$instance == null) throw new \RuntimeException("URL instance is not initialized."); + + return self::$instance; + } + + /** + * Return the base URL, either the base_url defined in Config, or the URL + * of the current language, if 'one_domain_foreach_lang' is enabled. + * + * @return string the base URL, with a trailing '/' + */ + public function getBaseUrl() + { + if ($host = $this->requestContext->getHost()) { + + $scheme = $this->requestContext->getScheme(); + + $port = ''; + + if ('http' === $scheme && 80 != $this->requestContext->getHttpPort()) { + $port = ':'.$this->requestContext->getHttpPort(); + } elseif ('https' === $scheme && 443 != $this->requestContext->getHttpsPort()) { + $port = ':'.$this->requestContext->getHttpsPort(); + } + + $schemeAuthority = "$scheme://$host"."$port"; + } + + return $schemeAuthority.$this->requestContext->getBaseUrl(); + } + + /** + * @return string the index page, which is in fact the base URL. + */ + public function getIndexPage() + { + // The index page is the base URL :) + return $this->getBaseUrl(); } /** * Returns the Absolute URL for a given path relative to web root. By default, - * the index.php (or index_dev.php) script name is added to the URL, use + * the script name (index_dev.php) is added to the URL in dev_environment, use * $path_only = true to get a path without the index script. * * @param string $path the relative path @@ -46,18 +114,24 @@ class URL * * @return string The generated URL */ - public static function absoluteUrl($path, array $parameters = null, $path_only = self::WITH_INDEX_PAGE) + public function absoluteUrl($path, array $parameters = null, $path_only = self::WITH_INDEX_PAGE) { // Already absolute ? if (substr($path, 0, 4) != 'http') { - $root = $path_only == self::PATH_TO_FILE ? ConfigQuery::read('base_url', '/') : self::getIndexPage(); + $base_url = $this->getBaseUrl(); - $base = rtrim($root, '/') . '/' . ltrim($path, '/'); + // If only a path is requested, be sure to remove the script name (index.php or index_dev.php), if any. + if ($path_only == self::PATH_TO_FILE) { + // As the base_url always ends with '/', if we don't find / at the end, we have a script. + if (substr($base_url, -1) != '/') $base_url = dirname($base_url); + } + + // Normalize the given path + $base = rtrim($base_url, '/') . '/' . ltrim($path, '/'); } else $base = $path; - $queryString = ''; if (! is_null($parameters)) { @@ -69,6 +143,7 @@ class URL $sepChar = strstr($base, '?') === false ? '?' : '&'; if ('' !== $queryString = rtrim($queryString, "&")) $queryString = $sepChar . $queryString; + return $base . $queryString; } @@ -80,11 +155,11 @@ class URL * * @return string The generated URL */ - public static function adminViewUrl($viewName, array $parameters = array()) + public function adminViewUrl($viewName, array $parameters = array()) { - $path = sprintf("%s/admin/%s", self::getIndexPage(), $viewName); // FIXME ! view= should not be required, check routing parameters + $path = sprintf("%s/admin/%s", $this->getIndexPage(), $viewName); - return self::absoluteUrl($path, $parameters); + return $this->absoluteUrl($path, $parameters); } /** @@ -95,10 +170,87 @@ class URL * * @return string The generated URL */ - public static function viewUrl($viewName, array $parameters = array()) + public function viewUrl($viewName, array $parameters = array()) { - $path = sprintf("%s?view=%s", self::getIndexPage(), $viewName); + $path = sprintf("?view=%s", $viewName); - return self::absoluteUrl($path, $parameters); + return $this->absoluteUrl($path, $parameters); } -} + /** + * Retrieve a rewritten URL from a view, a view id and a locale + * + * @param $view + * @param $viewId + * @param $viewLocale + * + * @return RewritingRetriever You can access $url and $rewrittenUrl properties + */ + public function retrieve($view, $viewId, $viewLocale) + { + if(ConfigQuery::isRewritingEnable()) { + $this->retriever->loadViewUrl($view, $viewLocale, $viewId); + } else { + $allParametersWithoutView = array(); + $allParametersWithoutView['locale'] = $viewLocale; + if(null !== $viewId) { + $allParametersWithoutView[$view . '_id'] = $viewId; + } + $this->retriever->rewrittenUrl = null; + $this->retriever->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView); + } + + return $this->retriever; + } + + /** + * Retrieve a rewritten URL from the current GET parameters + * + * @param Request $request + * + * @return RewritingRetriever You can access $url and $rewrittenUrl properties or use toString method + */ + public function retrieveCurrent(Request $request) + { + if(ConfigQuery::isRewritingEnable()) { + $view = $request->attributes->get('_view', null); + $viewLocale = $request->query->get('locale', null); + $viewId = $view === null ? null : $request->query->get($view . '_id', null); + + $allOtherParameters = $request->query->all(); + if($view !== null) { + unset($allOtherParameters['view']); + if($viewId !== null) { + unset($allOtherParameters[$view . '_id']); + } + } + if($viewLocale !== null) { + unset($allOtherParameters['locale']); + } + + $this->retriever->loadSpecificUrl($view, $viewLocale, $viewId, $allOtherParameters); + } else { + $allParametersWithoutView = $viewOtherParameters; + $allParametersWithoutView['locale'] = $viewLocale; + if(null !== $viewId) { + $allParametersWithoutView[$view . '_id'] = $viewId; + } + $this->retriever->rewrittenUrl = null; + $this->retriever->url = URL::getInstance()->viewUrl($view, $allParametersWithoutView); + } + + return $this->retriever; + } + + /** + * Retrieve a rewritten URL from the current GET parameters or use toString method + * + * @param $url + * + * @return RewritingResolver + */ + public function resolve($url) + { + $this->resolver->load($url); + return $this->resolver; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Type/BooleanOrBothType.php b/core/lib/Thelia/Type/BooleanOrBothType.php old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Action.BaseAction.html b/documentation/api/classes/Thelia.Action.BaseAction.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Action.Cart.html b/documentation/api/classes/Thelia.Action.Cart.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Action.Category.html b/documentation/api/classes/Thelia.Action.Category.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Action.Customer.html b/documentation/api/classes/Thelia.Action.Customer.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Action.Exception.ActionException.html b/documentation/api/classes/Thelia.Action.Exception.ActionException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Action.Exception.FormValidationException.html b/documentation/api/classes/Thelia.Action.Exception.FormValidationException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Action.Exception.ProductNotFoundException.html b/documentation/api/classes/Thelia.Action.Exception.ProductNotFoundException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Action.Exception.StockNotFoundException.html b/documentation/api/classes/Thelia.Action.Exception.StockNotFoundException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Admin.Controller.AdminController.html b/documentation/api/classes/Thelia.Admin.Controller.AdminController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Admin.Controller.BaseAdminController.html b/documentation/api/classes/Thelia.Admin.Controller.BaseAdminController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Admin.Controller.CategoryController.html b/documentation/api/classes/Thelia.Admin.Controller.CategoryController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Admin.Controller.SessionController.html b/documentation/api/classes/Thelia.Admin.Controller.SessionController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Cart.CartTrait.html b/documentation/api/classes/Thelia.Cart.CartTrait.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Command.BaseModuleGenerate.html b/documentation/api/classes/Thelia.Command.BaseModuleGenerate.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Command.CacheClear.html b/documentation/api/classes/Thelia.Command.CacheClear.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Command.ContainerAwareCommand.html b/documentation/api/classes/Thelia.Command.ContainerAwareCommand.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Command.Install.html b/documentation/api/classes/Thelia.Command.Install.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Command.ModuleGenerateCommand.html b/documentation/api/classes/Thelia.Command.ModuleGenerateCommand.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Command.ModuleGenerateModelCommand.html b/documentation/api/classes/Thelia.Command.ModuleGenerateModelCommand.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Command.ModuleGenerateSqlCommand.html b/documentation/api/classes/Thelia.Command.ModuleGenerateSqlCommand.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Command.Output.TheliaConsoleOutput.html b/documentation/api/classes/Thelia.Command.Output.TheliaConsoleOutput.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Config.DatabaseConfiguration.html b/documentation/api/classes/Thelia.Config.DatabaseConfiguration.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Config.DefinePropel.html b/documentation/api/classes/Thelia.Config.DefinePropel.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.Admin.AdminController.html b/documentation/api/classes/Thelia.Controller.Admin.AdminController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.Admin.BaseAdminController.html b/documentation/api/classes/Thelia.Controller.Admin.BaseAdminController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.Admin.CategoryController.html b/documentation/api/classes/Thelia.Controller.Admin.CategoryController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.Admin.SessionController.html b/documentation/api/classes/Thelia.Controller.Admin.SessionController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.BaseController.html b/documentation/api/classes/Thelia.Controller.BaseController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.DefaultController.html b/documentation/api/classes/Thelia.Controller.DefaultController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.Front.BaseFrontController.html b/documentation/api/classes/Thelia.Controller.Front.BaseFrontController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.Front.CartController.html b/documentation/api/classes/Thelia.Controller.Front.CartController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.Front.CustomerController.html b/documentation/api/classes/Thelia.Controller.Front.CustomerController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.Front.DefaultController.html b/documentation/api/classes/Thelia.Controller.Front.DefaultController.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Controller.NullControllerInterface.html b/documentation/api/classes/Thelia.Controller.NullControllerInterface.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Application.html b/documentation/api/classes/Thelia.Core.Application.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Bundle.TheliaBundle.html b/documentation/api/classes/Thelia.Core.Bundle.TheliaBundle.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Context.html b/documentation/api/classes/Thelia.Core.Context.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Controller.ControllerResolver.html b/documentation/api/classes/Thelia.Core.Controller.ControllerResolver.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.DependencyInjection.Compiler.RegisterListenersPass.html b/documentation/api/classes/Thelia.Core.DependencyInjection.Compiler.RegisterListenersPass.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.DependencyInjection.Compiler.RegisterParserPluginPass.html b/documentation/api/classes/Thelia.Core.DependencyInjection.Compiler.RegisterParserPluginPass.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.DependencyInjection.Compiler.RegisterRouterPass.html b/documentation/api/classes/Thelia.Core.DependencyInjection.Compiler.RegisterRouterPass.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.DependencyInjection.Loader.XmlFileLoader.html b/documentation/api/classes/Thelia.Core.DependencyInjection.Loader.XmlFileLoader.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.ActionEvent.html b/documentation/api/classes/Thelia.Core.Event.ActionEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.CartEvent.html b/documentation/api/classes/Thelia.Core.Event.CartEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.CartItemEvent.html b/documentation/api/classes/Thelia.Core.Event.CartItemEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.CategoryEvent.html b/documentation/api/classes/Thelia.Core.Event.CategoryEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.CustomRefEvent.html b/documentation/api/classes/Thelia.Core.Event.CustomRefEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.CustomerEvent.html b/documentation/api/classes/Thelia.Core.Event.CustomerEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.DefaultActionEvent.html b/documentation/api/classes/Thelia.Core.Event.DefaultActionEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.Internal.CartEvent.html b/documentation/api/classes/Thelia.Core.Event.Internal.CartEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.Internal.CustomerEvent.html b/documentation/api/classes/Thelia.Core.Event.Internal.CustomerEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.Internal.InternalEvent.html b/documentation/api/classes/Thelia.Core.Event.Internal.InternalEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.InternalEvent.html b/documentation/api/classes/Thelia.Core.Event.InternalEvent.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Event.TheliaEvents.html b/documentation/api/classes/Thelia.Core.Event.TheliaEvents.html old mode 100644 new mode 100755 index 3491e4264..2d4072603 --- a/documentation/api/classes/Thelia.Core.Event.TheliaEvents.html +++ b/documentation/api/classes/Thelia.Core.Event.TheliaEvents.html @@ -1631,18 +1631,18 @@ ADMIN_LOGIN
BEFORE_CREATECUSTOMER
AFTER_CREATECUSTOMER
- BEFORE_CHANGECUSTOMER
- AFTER_CHANGECUSTOMER
+ BEFORE_UPDATECUSTOMER
+ AFTER_UPDATECUSTOMER
BEFORE_CREATECATEGORY
AFTER_CREATECATEGORY
BEFORE_DELETECATEGORY
AFTER_DELETECATEGORY
- AFTER_CHANGECATEGORY
+ AFTER_UPDATECATEGORY
CART_DUPLICATE
AFTER_CARTADDITEM
- AFTER_CARTCHANGEITEM
+ AFTER_CARTUPDATEITEM
CART_ADDITEM
- CART_CHANGEITEM
+ CART_UPDATEITEM
CART_DELETEITEM
@@ -1891,8 +1891,8 @@
-

BEFORE_CHANGECUSTOMER

-
BEFORE_CHANGECUSTOMER
+

BEFORE_UPDATECUSTOMER

+
BEFORE_UPDATECUSTOMER

Sent once the customer change form has been successfully validated, and before customer update in the database.

@@ -1913,8 +1913,8 @@
-

AFTER_CHANGECUSTOMER

-
AFTER_CHANGECUSTOMER
+

AFTER_UPDATECUSTOMER

+
AFTER_UPDATECUSTOMER

Sent just after a successful update of a customer in the database.

@@ -2023,8 +2023,8 @@
-

AFTER_CHANGECATEGORY

-
AFTER_CHANGECATEGORY
+

AFTER_UPDATECATEGORY

+
AFTER_UPDATECATEGORY

Sent just after a successful change of a category in the database.

@@ -2089,8 +2089,8 @@
-

AFTER_CARTCHANGEITEM

-
AFTER_CARTCHANGEITEM
+

AFTER_CARTUPDATEITEM

+
AFTER_CARTUPDATEITEM

sent when a cart item is modify

@@ -2133,8 +2133,8 @@
-

CART_CHANGEITEM

-
CART_CHANGEITEM
+

CART_UPDATEITEM

+
CART_UPDATEITEM

sent on modify article action

diff --git a/documentation/api/classes/Thelia.Core.EventListener.ControllerListener.html b/documentation/api/classes/Thelia.Core.EventListener.ControllerListener.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.EventListener.ViewListener.html b/documentation/api/classes/Thelia.Core.EventListener.ViewListener.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Factory.ActionEventFactory.html b/documentation/api/classes/Thelia.Core.Factory.ActionEventFactory.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.HttpFoundation.Request.html b/documentation/api/classes/Thelia.Core.HttpFoundation.Request.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.HttpFoundation.Session.Session.html b/documentation/api/classes/Thelia.Core.HttpFoundation.Session.Session.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.Authentication.AdminUsernamePasswordFormAuthenticator.html b/documentation/api/classes/Thelia.Core.Security.Authentication.AdminUsernamePasswordFormAuthenticator.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.Authentication.AuthenticatorInterface.html b/documentation/api/classes/Thelia.Core.Security.Authentication.AuthenticatorInterface.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.Authentication.CustomerUsernamePasswordFormAuthenticator.html b/documentation/api/classes/Thelia.Core.Security.Authentication.CustomerUsernamePasswordFormAuthenticator.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.Authentication.UsernamePasswordFormAuthenticator.html b/documentation/api/classes/Thelia.Core.Security.Authentication.UsernamePasswordFormAuthenticator.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.Exception.AuthenticationException.html b/documentation/api/classes/Thelia.Core.Security.Exception.AuthenticationException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.Exception.AuthorizationException.html b/documentation/api/classes/Thelia.Core.Security.Exception.AuthorizationException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.Exception.UsernameNotFoundException.html b/documentation/api/classes/Thelia.Core.Security.Exception.UsernameNotFoundException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.Exception.WrongPasswordException.html b/documentation/api/classes/Thelia.Core.Security.Exception.WrongPasswordException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.Role.Role.html b/documentation/api/classes/Thelia.Core.Security.Role.Role.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.Role.RoleInterface.html b/documentation/api/classes/Thelia.Core.Security.Role.RoleInterface.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.SecurityContext.html b/documentation/api/classes/Thelia.Core.Security.SecurityContext.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.User.UserInterface.html b/documentation/api/classes/Thelia.Core.Security.User.UserInterface.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.UserProvider.AdminUserProvider.html b/documentation/api/classes/Thelia.Core.Security.UserProvider.AdminUserProvider.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.UserProvider.CustomerUserProvider.html b/documentation/api/classes/Thelia.Core.Security.UserProvider.CustomerUserProvider.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Security.UserProvider.UserProviderInterface.html b/documentation/api/classes/Thelia.Core.Security.UserProvider.UserProviderInterface.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Assets.AsseticHelper.html b/documentation/api/classes/Thelia.Core.Template.Assets.AsseticHelper.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Element.BaseLoop.html b/documentation/api/classes/Thelia.Core.Template.Element.BaseLoop.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Element.Exception.ElementNotFoundException.html b/documentation/api/classes/Thelia.Core.Template.Element.Exception.ElementNotFoundException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Element.Exception.InvalidElementException.html b/documentation/api/classes/Thelia.Core.Template.Element.Exception.InvalidElementException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Element.LoopResult.html b/documentation/api/classes/Thelia.Core.Template.Element.LoopResult.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Element.LoopResultRow.html b/documentation/api/classes/Thelia.Core.Template.Element.LoopResultRow.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Exception.ResourceNotFoundException.html b/documentation/api/classes/Thelia.Core.Template.Exception.ResourceNotFoundException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Accessory.html b/documentation/api/classes/Thelia.Core.Template.Loop.Accessory.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Address.html b/documentation/api/classes/Thelia.Core.Template.Loop.Address.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Argument.Argument.html b/documentation/api/classes/Thelia.Core.Template.Loop.Argument.Argument.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Argument.ArgumentCollection.html b/documentation/api/classes/Thelia.Core.Template.Loop.Argument.ArgumentCollection.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Auth.html b/documentation/api/classes/Thelia.Core.Template.Loop.Auth.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Cart.html b/documentation/api/classes/Thelia.Core.Template.Loop.Cart.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Category.html b/documentation/api/classes/Thelia.Core.Template.Loop.Category.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.CategoryPath.html b/documentation/api/classes/Thelia.Core.Template.Loop.CategoryPath.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.CategoryTree.html b/documentation/api/classes/Thelia.Core.Template.Loop.CategoryTree.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Content.html b/documentation/api/classes/Thelia.Core.Template.Loop.Content.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Country.html b/documentation/api/classes/Thelia.Core.Template.Loop.Country.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Customer.html b/documentation/api/classes/Thelia.Core.Template.Loop.Customer.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Feature.html b/documentation/api/classes/Thelia.Core.Template.Loop.Feature.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.FeatureAvailable.html b/documentation/api/classes/Thelia.Core.Template.Loop.FeatureAvailable.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.FeatureValue.html b/documentation/api/classes/Thelia.Core.Template.Loop.FeatureValue.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Feed.html b/documentation/api/classes/Thelia.Core.Template.Loop.Feed.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Folder.html b/documentation/api/classes/Thelia.Core.Template.Loop.Folder.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Lang.html b/documentation/api/classes/Thelia.Core.Template.Loop.Lang.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Order.html b/documentation/api/classes/Thelia.Core.Template.Loop.Order.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.OrderStatus.html b/documentation/api/classes/Thelia.Core.Template.Loop.OrderStatus.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Product.html b/documentation/api/classes/Thelia.Core.Template.Loop.Product.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Loop.Title.html b/documentation/api/classes/Thelia.Core.Template.Loop.Title.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.ParserContext.html b/documentation/api/classes/Thelia.Core.Template.ParserContext.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.ParserInterface.html b/documentation/api/classes/Thelia.Core.Template.ParserInterface.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.AbstractSmartyPlugin.html b/documentation/api/classes/Thelia.Core.Template.Smarty.AbstractSmartyPlugin.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.Assets.SmartyAssetsManager.html b/documentation/api/classes/Thelia.Core.Template.Smarty.Assets.SmartyAssetsManager.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.Assetic.html b/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.Assetic.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.DataAccessFunctions.html b/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.DataAccessFunctions.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.Form.html b/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.Form.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.Module.html b/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.Module.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.Security.html b/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.Security.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.TheliaLoop.html b/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.TheliaLoop.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.TheliaSyntax.html b/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.TheliaSyntax.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.Translation.html b/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.Translation.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.UrlGenerator.html b/documentation/api/classes/Thelia.Core.Template.Smarty.Plugins.UrlGenerator.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.SmartyParser.html b/documentation/api/classes/Thelia.Core.Template.Smarty.SmartyParser.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Template.Smarty.SmartyPluginDescriptor.html b/documentation/api/classes/Thelia.Core.Template.Smarty.SmartyPluginDescriptor.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Thelia.html b/documentation/api/classes/Thelia.Core.Thelia.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.TheliaContainerBuilder.html b/documentation/api/classes/Thelia.Core.TheliaContainerBuilder.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.TheliaHttpKernel.html b/documentation/api/classes/Thelia.Core.TheliaHttpKernel.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Core.Translation.Translator.html b/documentation/api/classes/Thelia.Core.Translation.Translator.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Exception.InvalidCartException.html b/documentation/api/classes/Thelia.Exception.InvalidCartException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Exception.MemberAccessException.html b/documentation/api/classes/Thelia.Exception.MemberAccessException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.AdminLogin.html b/documentation/api/classes/Thelia.Form.AdminLogin.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.BaseForm.html b/documentation/api/classes/Thelia.Form.BaseForm.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.CartAdd.html b/documentation/api/classes/Thelia.Form.CartAdd.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.CategoryCreationForm.html b/documentation/api/classes/Thelia.Form.CategoryCreationForm.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.CategoryDeletionForm.html b/documentation/api/classes/Thelia.Form.CategoryDeletionForm.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.CustomerCreation.html b/documentation/api/classes/Thelia.Form.CustomerCreation.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.CustomerLogin.html b/documentation/api/classes/Thelia.Form.CustomerLogin.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.CustomerModification.html b/documentation/api/classes/Thelia.Form.CustomerModification.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.Exception.FormValidationException.html b/documentation/api/classes/Thelia.Form.Exception.FormValidationException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.Exception.ProductNotFoundException.html b/documentation/api/classes/Thelia.Form.Exception.ProductNotFoundException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Form.Exception.StockNotFoundException.html b/documentation/api/classes/Thelia.Form.Exception.StockNotFoundException.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Log.AbstractTlogDestination.html b/documentation/api/classes/Thelia.Log.AbstractTlogDestination.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Log.Destination.TlogDestinationFile.html b/documentation/api/classes/Thelia.Log.Destination.TlogDestinationFile.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Log.Destination.TlogDestinationHtml.html b/documentation/api/classes/Thelia.Log.Destination.TlogDestinationHtml.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Log.Destination.TlogDestinationNull.html b/documentation/api/classes/Thelia.Log.Destination.TlogDestinationNull.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Log.Destination.TlogDestinationText.html b/documentation/api/classes/Thelia.Log.Destination.TlogDestinationText.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Log.Tlog.html b/documentation/api/classes/Thelia.Log.Tlog.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Log.TlogDestinationConfig.html b/documentation/api/classes/Thelia.Log.TlogDestinationConfig.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Log.TlogInterface.html b/documentation/api/classes/Thelia.Log.TlogInterface.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Accessory.html b/documentation/api/classes/Thelia.Model.Accessory.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AccessoryQuery.html b/documentation/api/classes/Thelia.Model.AccessoryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Address.html b/documentation/api/classes/Thelia.Model.Address.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AddressQuery.html b/documentation/api/classes/Thelia.Model.AddressQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Admin.html b/documentation/api/classes/Thelia.Model.Admin.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AdminGroup.html b/documentation/api/classes/Thelia.Model.AdminGroup.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AdminGroupQuery.html b/documentation/api/classes/Thelia.Model.AdminGroupQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AdminLog.html b/documentation/api/classes/Thelia.Model.AdminLog.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AdminLogQuery.html b/documentation/api/classes/Thelia.Model.AdminLogQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AdminQuery.html b/documentation/api/classes/Thelia.Model.AdminQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Area.html b/documentation/api/classes/Thelia.Model.Area.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AreaQuery.html b/documentation/api/classes/Thelia.Model.AreaQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Attribute.html b/documentation/api/classes/Thelia.Model.Attribute.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeAv.html b/documentation/api/classes/Thelia.Model.AttributeAv.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeAvI18n.html b/documentation/api/classes/Thelia.Model.AttributeAvI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeAvI18nQuery.html b/documentation/api/classes/Thelia.Model.AttributeAvI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeAvQuery.html b/documentation/api/classes/Thelia.Model.AttributeAvQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeCategory.html b/documentation/api/classes/Thelia.Model.AttributeCategory.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeCategoryQuery.html b/documentation/api/classes/Thelia.Model.AttributeCategoryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeCombination.html b/documentation/api/classes/Thelia.Model.AttributeCombination.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeCombinationQuery.html b/documentation/api/classes/Thelia.Model.AttributeCombinationQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeI18n.html b/documentation/api/classes/Thelia.Model.AttributeI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeI18nQuery.html b/documentation/api/classes/Thelia.Model.AttributeI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.AttributeQuery.html b/documentation/api/classes/Thelia.Model.AttributeQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Accessory.html b/documentation/api/classes/Thelia.Model.Base.Accessory.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AccessoryQuery.html b/documentation/api/classes/Thelia.Model.Base.AccessoryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Address.html b/documentation/api/classes/Thelia.Model.Base.Address.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AddressQuery.html b/documentation/api/classes/Thelia.Model.Base.AddressQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Admin.html b/documentation/api/classes/Thelia.Model.Base.Admin.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AdminGroup.html b/documentation/api/classes/Thelia.Model.Base.AdminGroup.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AdminGroupQuery.html b/documentation/api/classes/Thelia.Model.Base.AdminGroupQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AdminLog.html b/documentation/api/classes/Thelia.Model.Base.AdminLog.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AdminLogQuery.html b/documentation/api/classes/Thelia.Model.Base.AdminLogQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AdminQuery.html b/documentation/api/classes/Thelia.Model.Base.AdminQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Area.html b/documentation/api/classes/Thelia.Model.Base.Area.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AreaQuery.html b/documentation/api/classes/Thelia.Model.Base.AreaQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Attribute.html b/documentation/api/classes/Thelia.Model.Base.Attribute.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeAv.html b/documentation/api/classes/Thelia.Model.Base.AttributeAv.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeAvI18n.html b/documentation/api/classes/Thelia.Model.Base.AttributeAvI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeAvI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.AttributeAvI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeAvQuery.html b/documentation/api/classes/Thelia.Model.Base.AttributeAvQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeCategory.html b/documentation/api/classes/Thelia.Model.Base.AttributeCategory.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeCategoryQuery.html b/documentation/api/classes/Thelia.Model.Base.AttributeCategoryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeCombination.html b/documentation/api/classes/Thelia.Model.Base.AttributeCombination.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeCombinationQuery.html b/documentation/api/classes/Thelia.Model.Base.AttributeCombinationQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeI18n.html b/documentation/api/classes/Thelia.Model.Base.AttributeI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.AttributeI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.AttributeQuery.html b/documentation/api/classes/Thelia.Model.Base.AttributeQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Cart.html b/documentation/api/classes/Thelia.Model.Base.Cart.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CartItem.html b/documentation/api/classes/Thelia.Model.Base.CartItem.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CartItemQuery.html b/documentation/api/classes/Thelia.Model.Base.CartItemQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CartQuery.html b/documentation/api/classes/Thelia.Model.Base.CartQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Category.html b/documentation/api/classes/Thelia.Model.Base.Category.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryDocument.html b/documentation/api/classes/Thelia.Model.Base.CategoryDocument.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryDocumentI18n.html b/documentation/api/classes/Thelia.Model.Base.CategoryDocumentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryDocumentI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.CategoryDocumentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryDocumentQuery.html b/documentation/api/classes/Thelia.Model.Base.CategoryDocumentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryI18n.html b/documentation/api/classes/Thelia.Model.Base.CategoryI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.CategoryI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryImage.html b/documentation/api/classes/Thelia.Model.Base.CategoryImage.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryImageI18n.html b/documentation/api/classes/Thelia.Model.Base.CategoryImageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryImageI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.CategoryImageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryImageQuery.html b/documentation/api/classes/Thelia.Model.Base.CategoryImageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryQuery.html b/documentation/api/classes/Thelia.Model.Base.CategoryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryVersion.html b/documentation/api/classes/Thelia.Model.Base.CategoryVersion.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CategoryVersionQuery.html b/documentation/api/classes/Thelia.Model.Base.CategoryVersionQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Config.html b/documentation/api/classes/Thelia.Model.Base.Config.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ConfigI18n.html b/documentation/api/classes/Thelia.Model.Base.ConfigI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ConfigI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.ConfigI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ConfigQuery.html b/documentation/api/classes/Thelia.Model.Base.ConfigQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Content.html b/documentation/api/classes/Thelia.Model.Base.Content.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentAssoc.html b/documentation/api/classes/Thelia.Model.Base.ContentAssoc.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentAssocQuery.html b/documentation/api/classes/Thelia.Model.Base.ContentAssocQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentDocument.html b/documentation/api/classes/Thelia.Model.Base.ContentDocument.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentDocumentI18n.html b/documentation/api/classes/Thelia.Model.Base.ContentDocumentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentDocumentI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.ContentDocumentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentDocumentQuery.html b/documentation/api/classes/Thelia.Model.Base.ContentDocumentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentFolder.html b/documentation/api/classes/Thelia.Model.Base.ContentFolder.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentFolderQuery.html b/documentation/api/classes/Thelia.Model.Base.ContentFolderQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentI18n.html b/documentation/api/classes/Thelia.Model.Base.ContentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.ContentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentImage.html b/documentation/api/classes/Thelia.Model.Base.ContentImage.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentImageI18n.html b/documentation/api/classes/Thelia.Model.Base.ContentImageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentImageI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.ContentImageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentImageQuery.html b/documentation/api/classes/Thelia.Model.Base.ContentImageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentQuery.html b/documentation/api/classes/Thelia.Model.Base.ContentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentVersion.html b/documentation/api/classes/Thelia.Model.Base.ContentVersion.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ContentVersionQuery.html b/documentation/api/classes/Thelia.Model.Base.ContentVersionQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Country.html b/documentation/api/classes/Thelia.Model.Base.Country.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CountryI18n.html b/documentation/api/classes/Thelia.Model.Base.CountryI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CountryI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.CountryI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CountryQuery.html b/documentation/api/classes/Thelia.Model.Base.CountryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Coupon.html b/documentation/api/classes/Thelia.Model.Base.Coupon.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CouponOrder.html b/documentation/api/classes/Thelia.Model.Base.CouponOrder.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CouponOrderQuery.html b/documentation/api/classes/Thelia.Model.Base.CouponOrderQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CouponQuery.html b/documentation/api/classes/Thelia.Model.Base.CouponQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CouponRule.html b/documentation/api/classes/Thelia.Model.Base.CouponRule.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CouponRuleQuery.html b/documentation/api/classes/Thelia.Model.Base.CouponRuleQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Currency.html b/documentation/api/classes/Thelia.Model.Base.Currency.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CurrencyI18n.html b/documentation/api/classes/Thelia.Model.Base.CurrencyI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CurrencyI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.CurrencyI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CurrencyQuery.html b/documentation/api/classes/Thelia.Model.Base.CurrencyQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Customer.html b/documentation/api/classes/Thelia.Model.Base.Customer.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CustomerQuery.html b/documentation/api/classes/Thelia.Model.Base.CustomerQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CustomerTitle.html b/documentation/api/classes/Thelia.Model.Base.CustomerTitle.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CustomerTitleI18n.html b/documentation/api/classes/Thelia.Model.Base.CustomerTitleI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CustomerTitleI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.CustomerTitleI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.CustomerTitleQuery.html b/documentation/api/classes/Thelia.Model.Base.CustomerTitleQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Delivzone.html b/documentation/api/classes/Thelia.Model.Base.Delivzone.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.DelivzoneQuery.html b/documentation/api/classes/Thelia.Model.Base.DelivzoneQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Document.html b/documentation/api/classes/Thelia.Model.Base.Document.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.DocumentI18n.html b/documentation/api/classes/Thelia.Model.Base.DocumentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.DocumentI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.DocumentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.DocumentQuery.html b/documentation/api/classes/Thelia.Model.Base.DocumentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Feature.html b/documentation/api/classes/Thelia.Model.Base.Feature.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureAv.html b/documentation/api/classes/Thelia.Model.Base.FeatureAv.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureAvI18n.html b/documentation/api/classes/Thelia.Model.Base.FeatureAvI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureAvI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.FeatureAvI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureAvQuery.html b/documentation/api/classes/Thelia.Model.Base.FeatureAvQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureCategory.html b/documentation/api/classes/Thelia.Model.Base.FeatureCategory.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureCategoryQuery.html b/documentation/api/classes/Thelia.Model.Base.FeatureCategoryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureI18n.html b/documentation/api/classes/Thelia.Model.Base.FeatureI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.FeatureI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureProduct.html b/documentation/api/classes/Thelia.Model.Base.FeatureProduct.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureProductQuery.html b/documentation/api/classes/Thelia.Model.Base.FeatureProductQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FeatureQuery.html b/documentation/api/classes/Thelia.Model.Base.FeatureQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Folder.html b/documentation/api/classes/Thelia.Model.Base.Folder.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderDocument.html b/documentation/api/classes/Thelia.Model.Base.FolderDocument.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderDocumentI18n.html b/documentation/api/classes/Thelia.Model.Base.FolderDocumentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderDocumentI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.FolderDocumentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderDocumentQuery.html b/documentation/api/classes/Thelia.Model.Base.FolderDocumentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderI18n.html b/documentation/api/classes/Thelia.Model.Base.FolderI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.FolderI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderImage.html b/documentation/api/classes/Thelia.Model.Base.FolderImage.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderImageI18n.html b/documentation/api/classes/Thelia.Model.Base.FolderImageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderImageI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.FolderImageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderImageQuery.html b/documentation/api/classes/Thelia.Model.Base.FolderImageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderQuery.html b/documentation/api/classes/Thelia.Model.Base.FolderQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderVersion.html b/documentation/api/classes/Thelia.Model.Base.FolderVersion.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.FolderVersionQuery.html b/documentation/api/classes/Thelia.Model.Base.FolderVersionQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Group.html b/documentation/api/classes/Thelia.Model.Base.Group.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.GroupI18n.html b/documentation/api/classes/Thelia.Model.Base.GroupI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.GroupI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.GroupI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.GroupModule.html b/documentation/api/classes/Thelia.Model.Base.GroupModule.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.GroupModuleQuery.html b/documentation/api/classes/Thelia.Model.Base.GroupModuleQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.GroupQuery.html b/documentation/api/classes/Thelia.Model.Base.GroupQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.GroupResource.html b/documentation/api/classes/Thelia.Model.Base.GroupResource.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.GroupResourceQuery.html b/documentation/api/classes/Thelia.Model.Base.GroupResourceQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Image.html b/documentation/api/classes/Thelia.Model.Base.Image.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ImageI18n.html b/documentation/api/classes/Thelia.Model.Base.ImageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ImageI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.ImageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ImageQuery.html b/documentation/api/classes/Thelia.Model.Base.ImageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Lang.html b/documentation/api/classes/Thelia.Model.Base.Lang.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.LangQuery.html b/documentation/api/classes/Thelia.Model.Base.LangQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Message.html b/documentation/api/classes/Thelia.Model.Base.Message.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.MessageI18n.html b/documentation/api/classes/Thelia.Model.Base.MessageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.MessageI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.MessageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.MessageQuery.html b/documentation/api/classes/Thelia.Model.Base.MessageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.MessageVersion.html b/documentation/api/classes/Thelia.Model.Base.MessageVersion.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.MessageVersionQuery.html b/documentation/api/classes/Thelia.Model.Base.MessageVersionQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Module.html b/documentation/api/classes/Thelia.Model.Base.Module.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ModuleI18n.html b/documentation/api/classes/Thelia.Model.Base.ModuleI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ModuleI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.ModuleI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ModuleQuery.html b/documentation/api/classes/Thelia.Model.Base.ModuleQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Order.html b/documentation/api/classes/Thelia.Model.Base.Order.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderAddress.html b/documentation/api/classes/Thelia.Model.Base.OrderAddress.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderAddressQuery.html b/documentation/api/classes/Thelia.Model.Base.OrderAddressQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderFeature.html b/documentation/api/classes/Thelia.Model.Base.OrderFeature.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderFeatureQuery.html b/documentation/api/classes/Thelia.Model.Base.OrderFeatureQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderProduct.html b/documentation/api/classes/Thelia.Model.Base.OrderProduct.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderProductQuery.html b/documentation/api/classes/Thelia.Model.Base.OrderProductQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderQuery.html b/documentation/api/classes/Thelia.Model.Base.OrderQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderStatus.html b/documentation/api/classes/Thelia.Model.Base.OrderStatus.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderStatusI18n.html b/documentation/api/classes/Thelia.Model.Base.OrderStatusI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderStatusI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.OrderStatusI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.OrderStatusQuery.html b/documentation/api/classes/Thelia.Model.Base.OrderStatusQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Product.html b/documentation/api/classes/Thelia.Model.Base.Product.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductCategory.html b/documentation/api/classes/Thelia.Model.Base.ProductCategory.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductCategoryQuery.html b/documentation/api/classes/Thelia.Model.Base.ProductCategoryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductDocument.html b/documentation/api/classes/Thelia.Model.Base.ProductDocument.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductDocumentI18n.html b/documentation/api/classes/Thelia.Model.Base.ProductDocumentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductDocumentI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.ProductDocumentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductDocumentQuery.html b/documentation/api/classes/Thelia.Model.Base.ProductDocumentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductI18n.html b/documentation/api/classes/Thelia.Model.Base.ProductI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.ProductI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductPrice.html b/documentation/api/classes/Thelia.Model.Base.ProductPrice.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductPriceQuery.html b/documentation/api/classes/Thelia.Model.Base.ProductPriceQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductQuery.html b/documentation/api/classes/Thelia.Model.Base.ProductQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductSaleElements.html b/documentation/api/classes/Thelia.Model.Base.ProductSaleElements.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductSaleElementsQuery.html b/documentation/api/classes/Thelia.Model.Base.ProductSaleElementsQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductVersion.html b/documentation/api/classes/Thelia.Model.Base.ProductVersion.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProductVersionQuery.html b/documentation/api/classes/Thelia.Model.Base.ProductVersionQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProdutImage.html b/documentation/api/classes/Thelia.Model.Base.ProdutImage.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProdutImageI18n.html b/documentation/api/classes/Thelia.Model.Base.ProdutImageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProdutImageI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.ProdutImageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ProdutImageQuery.html b/documentation/api/classes/Thelia.Model.Base.ProdutImageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Resource.html b/documentation/api/classes/Thelia.Model.Base.Resource.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ResourceI18n.html b/documentation/api/classes/Thelia.Model.Base.ResourceI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ResourceI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.ResourceI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.ResourceQuery.html b/documentation/api/classes/Thelia.Model.Base.ResourceQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Rewriting.html b/documentation/api/classes/Thelia.Model.Base.Rewriting.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.RewritingQuery.html b/documentation/api/classes/Thelia.Model.Base.RewritingQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.Tax.html b/documentation/api/classes/Thelia.Model.Base.Tax.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.TaxI18n.html b/documentation/api/classes/Thelia.Model.Base.TaxI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.TaxI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.TaxI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.TaxQuery.html b/documentation/api/classes/Thelia.Model.Base.TaxQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.TaxRule.html b/documentation/api/classes/Thelia.Model.Base.TaxRule.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.TaxRuleCountry.html b/documentation/api/classes/Thelia.Model.Base.TaxRuleCountry.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.TaxRuleCountryQuery.html b/documentation/api/classes/Thelia.Model.Base.TaxRuleCountryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.TaxRuleI18n.html b/documentation/api/classes/Thelia.Model.Base.TaxRuleI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.TaxRuleI18nQuery.html b/documentation/api/classes/Thelia.Model.Base.TaxRuleI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Base.TaxRuleQuery.html b/documentation/api/classes/Thelia.Model.Base.TaxRuleQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Cart.html b/documentation/api/classes/Thelia.Model.Cart.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CartItem.html b/documentation/api/classes/Thelia.Model.CartItem.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CartItemQuery.html b/documentation/api/classes/Thelia.Model.CartItemQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CartQuery.html b/documentation/api/classes/Thelia.Model.CartQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Category.html b/documentation/api/classes/Thelia.Model.Category.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryDocument.html b/documentation/api/classes/Thelia.Model.CategoryDocument.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryDocumentI18n.html b/documentation/api/classes/Thelia.Model.CategoryDocumentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryDocumentI18nQuery.html b/documentation/api/classes/Thelia.Model.CategoryDocumentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryDocumentQuery.html b/documentation/api/classes/Thelia.Model.CategoryDocumentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryI18n.html b/documentation/api/classes/Thelia.Model.CategoryI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryI18nQuery.html b/documentation/api/classes/Thelia.Model.CategoryI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryImage.html b/documentation/api/classes/Thelia.Model.CategoryImage.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryImageI18n.html b/documentation/api/classes/Thelia.Model.CategoryImageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryImageI18nQuery.html b/documentation/api/classes/Thelia.Model.CategoryImageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryImageQuery.html b/documentation/api/classes/Thelia.Model.CategoryImageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryQuery.html b/documentation/api/classes/Thelia.Model.CategoryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryVersion.html b/documentation/api/classes/Thelia.Model.CategoryVersion.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CategoryVersionQuery.html b/documentation/api/classes/Thelia.Model.CategoryVersionQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Config.html b/documentation/api/classes/Thelia.Model.Config.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ConfigI18n.html b/documentation/api/classes/Thelia.Model.ConfigI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ConfigI18nQuery.html b/documentation/api/classes/Thelia.Model.ConfigI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ConfigQuery.html b/documentation/api/classes/Thelia.Model.ConfigQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Content.html b/documentation/api/classes/Thelia.Model.Content.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentAssoc.html b/documentation/api/classes/Thelia.Model.ContentAssoc.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentAssocQuery.html b/documentation/api/classes/Thelia.Model.ContentAssocQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentDocument.html b/documentation/api/classes/Thelia.Model.ContentDocument.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentDocumentI18n.html b/documentation/api/classes/Thelia.Model.ContentDocumentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentDocumentI18nQuery.html b/documentation/api/classes/Thelia.Model.ContentDocumentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentDocumentQuery.html b/documentation/api/classes/Thelia.Model.ContentDocumentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentFolder.html b/documentation/api/classes/Thelia.Model.ContentFolder.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentFolderQuery.html b/documentation/api/classes/Thelia.Model.ContentFolderQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentI18n.html b/documentation/api/classes/Thelia.Model.ContentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentI18nQuery.html b/documentation/api/classes/Thelia.Model.ContentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentImage.html b/documentation/api/classes/Thelia.Model.ContentImage.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentImageI18n.html b/documentation/api/classes/Thelia.Model.ContentImageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentImageI18nQuery.html b/documentation/api/classes/Thelia.Model.ContentImageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentImageQuery.html b/documentation/api/classes/Thelia.Model.ContentImageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentQuery.html b/documentation/api/classes/Thelia.Model.ContentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentVersion.html b/documentation/api/classes/Thelia.Model.ContentVersion.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ContentVersionQuery.html b/documentation/api/classes/Thelia.Model.ContentVersionQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Country.html b/documentation/api/classes/Thelia.Model.Country.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CountryI18n.html b/documentation/api/classes/Thelia.Model.CountryI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CountryI18nQuery.html b/documentation/api/classes/Thelia.Model.CountryI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CountryQuery.html b/documentation/api/classes/Thelia.Model.CountryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Coupon.html b/documentation/api/classes/Thelia.Model.Coupon.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CouponOrder.html b/documentation/api/classes/Thelia.Model.CouponOrder.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CouponOrderQuery.html b/documentation/api/classes/Thelia.Model.CouponOrderQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CouponQuery.html b/documentation/api/classes/Thelia.Model.CouponQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CouponRule.html b/documentation/api/classes/Thelia.Model.CouponRule.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CouponRuleQuery.html b/documentation/api/classes/Thelia.Model.CouponRuleQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Currency.html b/documentation/api/classes/Thelia.Model.Currency.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CurrencyI18n.html b/documentation/api/classes/Thelia.Model.CurrencyI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CurrencyI18nQuery.html b/documentation/api/classes/Thelia.Model.CurrencyI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CurrencyQuery.html b/documentation/api/classes/Thelia.Model.CurrencyQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Customer.html b/documentation/api/classes/Thelia.Model.Customer.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CustomerQuery.html b/documentation/api/classes/Thelia.Model.CustomerQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CustomerTitle.html b/documentation/api/classes/Thelia.Model.CustomerTitle.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CustomerTitleI18n.html b/documentation/api/classes/Thelia.Model.CustomerTitleI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CustomerTitleI18nQuery.html b/documentation/api/classes/Thelia.Model.CustomerTitleI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.CustomerTitleQuery.html b/documentation/api/classes/Thelia.Model.CustomerTitleQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Delivzone.html b/documentation/api/classes/Thelia.Model.Delivzone.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.DelivzoneQuery.html b/documentation/api/classes/Thelia.Model.DelivzoneQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Document.html b/documentation/api/classes/Thelia.Model.Document.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.DocumentI18n.html b/documentation/api/classes/Thelia.Model.DocumentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.DocumentI18nQuery.html b/documentation/api/classes/Thelia.Model.DocumentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.DocumentQuery.html b/documentation/api/classes/Thelia.Model.DocumentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Feature.html b/documentation/api/classes/Thelia.Model.Feature.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureAv.html b/documentation/api/classes/Thelia.Model.FeatureAv.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureAvI18n.html b/documentation/api/classes/Thelia.Model.FeatureAvI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureAvI18nQuery.html b/documentation/api/classes/Thelia.Model.FeatureAvI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureAvQuery.html b/documentation/api/classes/Thelia.Model.FeatureAvQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureCategory.html b/documentation/api/classes/Thelia.Model.FeatureCategory.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureCategoryQuery.html b/documentation/api/classes/Thelia.Model.FeatureCategoryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureI18n.html b/documentation/api/classes/Thelia.Model.FeatureI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureI18nQuery.html b/documentation/api/classes/Thelia.Model.FeatureI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureProduct.html b/documentation/api/classes/Thelia.Model.FeatureProduct.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureProductQuery.html b/documentation/api/classes/Thelia.Model.FeatureProductQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FeatureQuery.html b/documentation/api/classes/Thelia.Model.FeatureQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Folder.html b/documentation/api/classes/Thelia.Model.Folder.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderDocument.html b/documentation/api/classes/Thelia.Model.FolderDocument.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderDocumentI18n.html b/documentation/api/classes/Thelia.Model.FolderDocumentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderDocumentI18nQuery.html b/documentation/api/classes/Thelia.Model.FolderDocumentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderDocumentQuery.html b/documentation/api/classes/Thelia.Model.FolderDocumentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderI18n.html b/documentation/api/classes/Thelia.Model.FolderI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderI18nQuery.html b/documentation/api/classes/Thelia.Model.FolderI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderImage.html b/documentation/api/classes/Thelia.Model.FolderImage.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderImageI18n.html b/documentation/api/classes/Thelia.Model.FolderImageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderImageI18nQuery.html b/documentation/api/classes/Thelia.Model.FolderImageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderImageQuery.html b/documentation/api/classes/Thelia.Model.FolderImageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderQuery.html b/documentation/api/classes/Thelia.Model.FolderQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderVersion.html b/documentation/api/classes/Thelia.Model.FolderVersion.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.FolderVersionQuery.html b/documentation/api/classes/Thelia.Model.FolderVersionQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Group.html b/documentation/api/classes/Thelia.Model.Group.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.GroupI18n.html b/documentation/api/classes/Thelia.Model.GroupI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.GroupI18nQuery.html b/documentation/api/classes/Thelia.Model.GroupI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.GroupModule.html b/documentation/api/classes/Thelia.Model.GroupModule.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.GroupModuleQuery.html b/documentation/api/classes/Thelia.Model.GroupModuleQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.GroupQuery.html b/documentation/api/classes/Thelia.Model.GroupQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.GroupResource.html b/documentation/api/classes/Thelia.Model.GroupResource.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.GroupResourceQuery.html b/documentation/api/classes/Thelia.Model.GroupResourceQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Image.html b/documentation/api/classes/Thelia.Model.Image.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ImageI18n.html b/documentation/api/classes/Thelia.Model.ImageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ImageI18nQuery.html b/documentation/api/classes/Thelia.Model.ImageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ImageQuery.html b/documentation/api/classes/Thelia.Model.ImageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Lang.html b/documentation/api/classes/Thelia.Model.Lang.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.LangQuery.html b/documentation/api/classes/Thelia.Model.LangQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AccessoryTableMap.html b/documentation/api/classes/Thelia.Model.Map.AccessoryTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AddressTableMap.html b/documentation/api/classes/Thelia.Model.Map.AddressTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AdminGroupTableMap.html b/documentation/api/classes/Thelia.Model.Map.AdminGroupTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AdminLogTableMap.html b/documentation/api/classes/Thelia.Model.Map.AdminLogTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AdminTableMap.html b/documentation/api/classes/Thelia.Model.Map.AdminTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AreaTableMap.html b/documentation/api/classes/Thelia.Model.Map.AreaTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AttributeAvI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.AttributeAvI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AttributeAvTableMap.html b/documentation/api/classes/Thelia.Model.Map.AttributeAvTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AttributeCategoryTableMap.html b/documentation/api/classes/Thelia.Model.Map.AttributeCategoryTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AttributeCombinationTableMap.html b/documentation/api/classes/Thelia.Model.Map.AttributeCombinationTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AttributeI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.AttributeI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.AttributeTableMap.html b/documentation/api/classes/Thelia.Model.Map.AttributeTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CartItemTableMap.html b/documentation/api/classes/Thelia.Model.Map.CartItemTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CartTableMap.html b/documentation/api/classes/Thelia.Model.Map.CartTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CategoryDocumentI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.CategoryDocumentI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CategoryDocumentTableMap.html b/documentation/api/classes/Thelia.Model.Map.CategoryDocumentTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CategoryI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.CategoryI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CategoryImageI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.CategoryImageI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CategoryImageTableMap.html b/documentation/api/classes/Thelia.Model.Map.CategoryImageTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CategoryTableMap.html b/documentation/api/classes/Thelia.Model.Map.CategoryTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CategoryVersionTableMap.html b/documentation/api/classes/Thelia.Model.Map.CategoryVersionTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ConfigI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.ConfigI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ConfigTableMap.html b/documentation/api/classes/Thelia.Model.Map.ConfigTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ContentAssocTableMap.html b/documentation/api/classes/Thelia.Model.Map.ContentAssocTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ContentDocumentI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.ContentDocumentI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ContentDocumentTableMap.html b/documentation/api/classes/Thelia.Model.Map.ContentDocumentTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ContentFolderTableMap.html b/documentation/api/classes/Thelia.Model.Map.ContentFolderTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ContentI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.ContentI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ContentImageI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.ContentImageI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ContentImageTableMap.html b/documentation/api/classes/Thelia.Model.Map.ContentImageTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ContentTableMap.html b/documentation/api/classes/Thelia.Model.Map.ContentTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ContentVersionTableMap.html b/documentation/api/classes/Thelia.Model.Map.ContentVersionTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CountryI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.CountryI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CountryTableMap.html b/documentation/api/classes/Thelia.Model.Map.CountryTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CouponOrderTableMap.html b/documentation/api/classes/Thelia.Model.Map.CouponOrderTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CouponRuleTableMap.html b/documentation/api/classes/Thelia.Model.Map.CouponRuleTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CouponTableMap.html b/documentation/api/classes/Thelia.Model.Map.CouponTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CurrencyI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.CurrencyI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CurrencyTableMap.html b/documentation/api/classes/Thelia.Model.Map.CurrencyTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CustomerTableMap.html b/documentation/api/classes/Thelia.Model.Map.CustomerTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CustomerTitleI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.CustomerTitleI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.CustomerTitleTableMap.html b/documentation/api/classes/Thelia.Model.Map.CustomerTitleTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.DelivzoneTableMap.html b/documentation/api/classes/Thelia.Model.Map.DelivzoneTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.DocumentI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.DocumentI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.DocumentTableMap.html b/documentation/api/classes/Thelia.Model.Map.DocumentTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FeatureAvI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.FeatureAvI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FeatureAvTableMap.html b/documentation/api/classes/Thelia.Model.Map.FeatureAvTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FeatureCategoryTableMap.html b/documentation/api/classes/Thelia.Model.Map.FeatureCategoryTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FeatureI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.FeatureI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FeatureProductTableMap.html b/documentation/api/classes/Thelia.Model.Map.FeatureProductTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FeatureTableMap.html b/documentation/api/classes/Thelia.Model.Map.FeatureTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FolderDocumentI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.FolderDocumentI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FolderDocumentTableMap.html b/documentation/api/classes/Thelia.Model.Map.FolderDocumentTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FolderI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.FolderI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FolderImageI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.FolderImageI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FolderImageTableMap.html b/documentation/api/classes/Thelia.Model.Map.FolderImageTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FolderTableMap.html b/documentation/api/classes/Thelia.Model.Map.FolderTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.FolderVersionTableMap.html b/documentation/api/classes/Thelia.Model.Map.FolderVersionTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.GroupI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.GroupI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.GroupModuleTableMap.html b/documentation/api/classes/Thelia.Model.Map.GroupModuleTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.GroupResourceTableMap.html b/documentation/api/classes/Thelia.Model.Map.GroupResourceTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.GroupTableMap.html b/documentation/api/classes/Thelia.Model.Map.GroupTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ImageI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.ImageI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ImageTableMap.html b/documentation/api/classes/Thelia.Model.Map.ImageTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.LangTableMap.html b/documentation/api/classes/Thelia.Model.Map.LangTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.MessageI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.MessageI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.MessageTableMap.html b/documentation/api/classes/Thelia.Model.Map.MessageTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.MessageVersionTableMap.html b/documentation/api/classes/Thelia.Model.Map.MessageVersionTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ModuleI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.ModuleI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ModuleTableMap.html b/documentation/api/classes/Thelia.Model.Map.ModuleTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.OrderAddressTableMap.html b/documentation/api/classes/Thelia.Model.Map.OrderAddressTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.OrderFeatureTableMap.html b/documentation/api/classes/Thelia.Model.Map.OrderFeatureTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.OrderProductTableMap.html b/documentation/api/classes/Thelia.Model.Map.OrderProductTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.OrderStatusI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.OrderStatusI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.OrderStatusTableMap.html b/documentation/api/classes/Thelia.Model.Map.OrderStatusTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.OrderTableMap.html b/documentation/api/classes/Thelia.Model.Map.OrderTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ProductCategoryTableMap.html b/documentation/api/classes/Thelia.Model.Map.ProductCategoryTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ProductDocumentI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.ProductDocumentI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ProductDocumentTableMap.html b/documentation/api/classes/Thelia.Model.Map.ProductDocumentTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ProductI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.ProductI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ProductPriceTableMap.html b/documentation/api/classes/Thelia.Model.Map.ProductPriceTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ProductSaleElementsTableMap.html b/documentation/api/classes/Thelia.Model.Map.ProductSaleElementsTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ProductTableMap.html b/documentation/api/classes/Thelia.Model.Map.ProductTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ProductVersionTableMap.html b/documentation/api/classes/Thelia.Model.Map.ProductVersionTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ProdutImageI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.ProdutImageI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ProdutImageTableMap.html b/documentation/api/classes/Thelia.Model.Map.ProdutImageTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ResourceI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.ResourceI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.ResourceTableMap.html b/documentation/api/classes/Thelia.Model.Map.ResourceTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.RewritingTableMap.html b/documentation/api/classes/Thelia.Model.Map.RewritingTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.TaxI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.TaxI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.TaxRuleCountryTableMap.html b/documentation/api/classes/Thelia.Model.Map.TaxRuleCountryTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.TaxRuleI18nTableMap.html b/documentation/api/classes/Thelia.Model.Map.TaxRuleI18nTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.TaxRuleTableMap.html b/documentation/api/classes/Thelia.Model.Map.TaxRuleTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Map.TaxTableMap.html b/documentation/api/classes/Thelia.Model.Map.TaxTableMap.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Message.html b/documentation/api/classes/Thelia.Model.Message.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.MessageI18n.html b/documentation/api/classes/Thelia.Model.MessageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.MessageI18nQuery.html b/documentation/api/classes/Thelia.Model.MessageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.MessageQuery.html b/documentation/api/classes/Thelia.Model.MessageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.MessageVersion.html b/documentation/api/classes/Thelia.Model.MessageVersion.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.MessageVersionQuery.html b/documentation/api/classes/Thelia.Model.MessageVersionQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Module.html b/documentation/api/classes/Thelia.Model.Module.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ModuleI18n.html b/documentation/api/classes/Thelia.Model.ModuleI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ModuleI18nQuery.html b/documentation/api/classes/Thelia.Model.ModuleI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ModuleQuery.html b/documentation/api/classes/Thelia.Model.ModuleQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Order.html b/documentation/api/classes/Thelia.Model.Order.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderAddress.html b/documentation/api/classes/Thelia.Model.OrderAddress.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderAddressQuery.html b/documentation/api/classes/Thelia.Model.OrderAddressQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderFeature.html b/documentation/api/classes/Thelia.Model.OrderFeature.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderFeatureQuery.html b/documentation/api/classes/Thelia.Model.OrderFeatureQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderProduct.html b/documentation/api/classes/Thelia.Model.OrderProduct.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderProductQuery.html b/documentation/api/classes/Thelia.Model.OrderProductQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderQuery.html b/documentation/api/classes/Thelia.Model.OrderQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderStatus.html b/documentation/api/classes/Thelia.Model.OrderStatus.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderStatusI18n.html b/documentation/api/classes/Thelia.Model.OrderStatusI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderStatusI18nQuery.html b/documentation/api/classes/Thelia.Model.OrderStatusI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.OrderStatusQuery.html b/documentation/api/classes/Thelia.Model.OrderStatusQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Product.html b/documentation/api/classes/Thelia.Model.Product.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductCategory.html b/documentation/api/classes/Thelia.Model.ProductCategory.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductCategoryQuery.html b/documentation/api/classes/Thelia.Model.ProductCategoryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductDocument.html b/documentation/api/classes/Thelia.Model.ProductDocument.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductDocumentI18n.html b/documentation/api/classes/Thelia.Model.ProductDocumentI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductDocumentI18nQuery.html b/documentation/api/classes/Thelia.Model.ProductDocumentI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductDocumentQuery.html b/documentation/api/classes/Thelia.Model.ProductDocumentQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductI18n.html b/documentation/api/classes/Thelia.Model.ProductI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductI18nQuery.html b/documentation/api/classes/Thelia.Model.ProductI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductPrice.html b/documentation/api/classes/Thelia.Model.ProductPrice.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductPriceQuery.html b/documentation/api/classes/Thelia.Model.ProductPriceQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductQuery.html b/documentation/api/classes/Thelia.Model.ProductQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductSaleElements.html b/documentation/api/classes/Thelia.Model.ProductSaleElements.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductSaleElementsQuery.html b/documentation/api/classes/Thelia.Model.ProductSaleElementsQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductVersion.html b/documentation/api/classes/Thelia.Model.ProductVersion.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProductVersionQuery.html b/documentation/api/classes/Thelia.Model.ProductVersionQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProdutImage.html b/documentation/api/classes/Thelia.Model.ProdutImage.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProdutImageI18n.html b/documentation/api/classes/Thelia.Model.ProdutImageI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProdutImageI18nQuery.html b/documentation/api/classes/Thelia.Model.ProdutImageI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ProdutImageQuery.html b/documentation/api/classes/Thelia.Model.ProdutImageQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Resource.html b/documentation/api/classes/Thelia.Model.Resource.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ResourceI18n.html b/documentation/api/classes/Thelia.Model.ResourceI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ResourceI18nQuery.html b/documentation/api/classes/Thelia.Model.ResourceI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.ResourceQuery.html b/documentation/api/classes/Thelia.Model.ResourceQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Rewriting.html b/documentation/api/classes/Thelia.Model.Rewriting.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.RewritingQuery.html b/documentation/api/classes/Thelia.Model.RewritingQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.Tax.html b/documentation/api/classes/Thelia.Model.Tax.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.TaxI18n.html b/documentation/api/classes/Thelia.Model.TaxI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.TaxI18nQuery.html b/documentation/api/classes/Thelia.Model.TaxI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.TaxQuery.html b/documentation/api/classes/Thelia.Model.TaxQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.TaxRule.html b/documentation/api/classes/Thelia.Model.TaxRule.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.TaxRuleCountry.html b/documentation/api/classes/Thelia.Model.TaxRuleCountry.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.TaxRuleCountryQuery.html b/documentation/api/classes/Thelia.Model.TaxRuleCountryQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.TaxRuleI18n.html b/documentation/api/classes/Thelia.Model.TaxRuleI18n.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.TaxRuleI18nQuery.html b/documentation/api/classes/Thelia.Model.TaxRuleI18nQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Model.TaxRuleQuery.html b/documentation/api/classes/Thelia.Model.TaxRuleQuery.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Module.BaseModule.html b/documentation/api/classes/Thelia.Module.BaseModule.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Routing.Matcher.DefaultMatcher.html b/documentation/api/classes/Thelia.Routing.Matcher.DefaultMatcher.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Routing.NullUrlGenerator.html b/documentation/api/classes/Thelia.Routing.NullUrlGenerator.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Routing.TheliaMatcherCollection.html b/documentation/api/classes/Thelia.Routing.TheliaMatcherCollection.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Action.CartTest.html b/documentation/api/classes/Thelia.Tests.Action.CartTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Command.BaseCommandTest.html b/documentation/api/classes/Thelia.Tests.Command.BaseCommandTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Command.CacheClearTest.html b/documentation/api/classes/Thelia.Tests.Command.CacheClearTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Command.ModuleGenerateCommandTest.html b/documentation/api/classes/Thelia.Tests.Command.ModuleGenerateCommandTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Controller.DefaultControllerTest.html b/documentation/api/classes/Thelia.Tests.Controller.DefaultControllerTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.HttpFoundation.RequestTest.html b/documentation/api/classes/Thelia.Tests.Core.HttpFoundation.RequestTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.HttpFoundation.Session.SessionTest.html b/documentation/api/classes/Thelia.Tests.Core.HttpFoundation.Session.SessionTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Element.BaseLoopTestor.html b/documentation/api/classes/Thelia.Tests.Core.Template.Element.BaseLoopTestor.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.AccessoryTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.AccessoryTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.AddressTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.AddressTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.Argument.ArgumentTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.Argument.ArgumentTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.CategoryTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.CategoryTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.ContentTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.ContentTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.CountryTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.CountryTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.CustomerTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.CustomerTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.FeatureAvailableTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.FeatureAvailableTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.FeatureTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.FeatureTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.FeatureValueTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.FeatureValueTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.FolderTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.FolderTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Core.Template.Loop.TitleTest.html b/documentation/api/classes/Thelia.Tests.Core.Template.Loop.TitleTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Form.CartAddTest.html b/documentation/api/classes/Thelia.Tests.Form.CartAddTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Log.TlogTest.html b/documentation/api/classes/Thelia.Tests.Log.TlogTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.AlphaNumStringListTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.AlphaNumStringListTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.AlphaNumStringTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.AlphaNumStringTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.AnyTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.AnyTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.BooleanTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.BooleanTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.EnumListTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.EnumListTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.EnumTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.EnumTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.FloatTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.FloatTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.IntListTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.IntListTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.IntToCombinedIntsListTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.IntToCombinedIntsListTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.IntToCombinedStringsListTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.IntToCombinedStringsListTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.IntTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.IntTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.JsonTypeTest.html b/documentation/api/classes/Thelia.Tests.Type.JsonTypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tests.Type.TypeTest.html b/documentation/api/classes/Thelia.Tests.Type.TypeTest.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tools.DIGenerator.html b/documentation/api/classes/Thelia.Tools.DIGenerator.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tools.Redirect.html b/documentation/api/classes/Thelia.Tools.Redirect.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Tools.URL.html b/documentation/api/classes/Thelia.Tools.URL.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.AlphaNumStringListType.html b/documentation/api/classes/Thelia.Type.AlphaNumStringListType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.AlphaNumStringType.html b/documentation/api/classes/Thelia.Type.AlphaNumStringType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.AnyType.html b/documentation/api/classes/Thelia.Type.AnyType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.BooleanOrBothType.html b/documentation/api/classes/Thelia.Type.BooleanOrBothType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.BooleanType.html b/documentation/api/classes/Thelia.Type.BooleanType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.EnumListType.html b/documentation/api/classes/Thelia.Type.EnumListType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.EnumType.html b/documentation/api/classes/Thelia.Type.EnumType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.FloatType.html b/documentation/api/classes/Thelia.Type.FloatType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.IntListType.html b/documentation/api/classes/Thelia.Type.IntListType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.IntToCombinedIntsListType.html b/documentation/api/classes/Thelia.Type.IntToCombinedIntsListType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.IntToCombinedStringsListType.html b/documentation/api/classes/Thelia.Type.IntToCombinedStringsListType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.IntType.html b/documentation/api/classes/Thelia.Type.IntType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.JsonType.html b/documentation/api/classes/Thelia.Type.JsonType.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.TypeCollection.html b/documentation/api/classes/Thelia.Type.TypeCollection.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/Thelia.Type.TypeInterface.html b/documentation/api/classes/Thelia.Type.TypeInterface.html old mode 100644 new mode 100755 diff --git a/documentation/api/classes/TpexConfig.html b/documentation/api/classes/TpexConfig.html old mode 100644 new mode 100755 diff --git a/documentation/api/css/jquery.iviewer.css b/documentation/api/css/jquery.iviewer.css old mode 100644 new mode 100755 diff --git a/documentation/api/css/phpdocumentor-clean-icons/Read Me.txt b/documentation/api/css/phpdocumentor-clean-icons/Read Me.txt old mode 100644 new mode 100755 diff --git a/documentation/api/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.dev.svg b/documentation/api/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.dev.svg old mode 100644 new mode 100755 diff --git a/documentation/api/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.eot b/documentation/api/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.eot old mode 100644 new mode 100755 diff --git a/documentation/api/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.svg b/documentation/api/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.svg old mode 100644 new mode 100755 diff --git a/documentation/api/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.ttf b/documentation/api/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.ttf old mode 100644 new mode 100755 diff --git a/documentation/api/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.woff b/documentation/api/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.woff old mode 100644 new mode 100755 diff --git a/documentation/api/css/phpdocumentor-clean-icons/lte-ie7.js b/documentation/api/css/phpdocumentor-clean-icons/lte-ie7.js old mode 100644 new mode 100755 diff --git a/documentation/api/css/phpdocumentor-clean-icons/style.css b/documentation/api/css/phpdocumentor-clean-icons/style.css old mode 100644 new mode 100755 diff --git a/documentation/api/css/prism.css b/documentation/api/css/prism.css old mode 100644 new mode 100755 diff --git a/documentation/api/css/template.css b/documentation/api/css/template.css old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action.BaseAction.php.html b/documentation/api/files/Action.BaseAction.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action.Cart.php.html b/documentation/api/files/Action.Cart.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action.Category.php.html b/documentation/api/files/Action.Category.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action.Customer.php.html b/documentation/api/files/Action.Customer.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action.Exception.ActionException.php.html b/documentation/api/files/Action.Exception.ActionException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action.Exception.FormValidationException.php.html b/documentation/api/files/Action.Exception.FormValidationException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action.Exception.ProductNotFoundException.php.html b/documentation/api/files/Action.Exception.ProductNotFoundException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action.Exception.StockNotFoundException.php.html b/documentation/api/files/Action.Exception.StockNotFoundException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action/BaseAction.php.txt b/documentation/api/files/Action/BaseAction.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action/Cart.php.txt b/documentation/api/files/Action/Cart.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action/Category.php.txt b/documentation/api/files/Action/Category.php.txt old mode 100644 new mode 100755 index a47d51c75..ddd3362a5 --- a/documentation/api/files/Action/Category.php.txt +++ b/documentation/api/files/Action/Category.php.txt @@ -109,7 +109,7 @@ class Category extends BaseAction implements EventSubscriberInterface $customer = CustomerQuery::create()->findPk(1); try { $customerEvent = new CustomerEvent($customer); - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CHANGECUSTOMER, $customerEvent); + $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_UPDATECUSTOMER, $customerEvent); $data = $form->getData(); @@ -127,7 +127,7 @@ class Category extends BaseAction implements EventSubscriberInterface ); $customerEvent->customer = $customer; - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECUSTOMER, $customerEvent); + $event->getDispatcher()->dispatch(TheliaEvents::AFTER_UPDATECUSTOMER, $customerEvent); // Update the logged-in user, and redirect to the success URL (exits) // We don-t send the login event, as the customer si already logged. @@ -227,7 +227,7 @@ class Category extends BaseAction implements EventSubscriberInterface $categoryEvent = new CategoryEvent($category); - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECATEGORY, $categoryEvent); + $event->getDispatcher()->dispatch(TheliaEvents::AFTER_UPDATECATEGORY, $categoryEvent); } } diff --git a/documentation/api/files/Action/Customer.php.txt b/documentation/api/files/Action/Customer.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action/Exception/ActionException.php.txt b/documentation/api/files/Action/Exception/ActionException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action/Exception/FormValidationException.php.txt b/documentation/api/files/Action/Exception/FormValidationException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action/Exception/ProductNotFoundException.php.txt b/documentation/api/files/Action/Exception/ProductNotFoundException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Action/Exception/StockNotFoundException.php.txt b/documentation/api/files/Action/Exception/StockNotFoundException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Admin.Controller.AdminController.php.html b/documentation/api/files/Admin.Controller.AdminController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Admin.Controller.BaseAdminController.php.html b/documentation/api/files/Admin.Controller.BaseAdminController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Admin.Controller.CategoryController.php.html b/documentation/api/files/Admin.Controller.CategoryController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Admin.Controller.SessionController.php.html b/documentation/api/files/Admin.Controller.SessionController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Admin/Controller/AdminController.php.txt b/documentation/api/files/Admin/Controller/AdminController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Admin/Controller/BaseAdminController.php.txt b/documentation/api/files/Admin/Controller/BaseAdminController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Admin/Controller/CategoryController.php.txt b/documentation/api/files/Admin/Controller/CategoryController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Admin/Controller/SessionController.php.txt b/documentation/api/files/Admin/Controller/SessionController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Cart.CartTrait.php.html b/documentation/api/files/Cart.CartTrait.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Cart/CartTrait.php.txt b/documentation/api/files/Cart/CartTrait.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command.BaseModuleGenerate.php.html b/documentation/api/files/Command.BaseModuleGenerate.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command.CacheClear.php.html b/documentation/api/files/Command.CacheClear.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command.ContainerAwareCommand.php.html b/documentation/api/files/Command.ContainerAwareCommand.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command.Install.php.html b/documentation/api/files/Command.Install.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command.ModuleGenerateCommand.php.html b/documentation/api/files/Command.ModuleGenerateCommand.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command.ModuleGenerateModelCommand.php.html b/documentation/api/files/Command.ModuleGenerateModelCommand.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command.ModuleGenerateSqlCommand.php.html b/documentation/api/files/Command.ModuleGenerateSqlCommand.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command.Output.TheliaConsoleOutput.php.html b/documentation/api/files/Command.Output.TheliaConsoleOutput.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command.Skeleton.Module.Class.php.html b/documentation/api/files/Command.Skeleton.Module.Class.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command/BaseModuleGenerate.php.txt b/documentation/api/files/Command/BaseModuleGenerate.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command/CacheClear.php.txt b/documentation/api/files/Command/CacheClear.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command/ContainerAwareCommand.php.txt b/documentation/api/files/Command/ContainerAwareCommand.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command/Install.php.txt b/documentation/api/files/Command/Install.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command/ModuleGenerateCommand.php.txt b/documentation/api/files/Command/ModuleGenerateCommand.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command/ModuleGenerateModelCommand.php.txt b/documentation/api/files/Command/ModuleGenerateModelCommand.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command/ModuleGenerateSqlCommand.php.txt b/documentation/api/files/Command/ModuleGenerateSqlCommand.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command/Output/TheliaConsoleOutput.php.txt b/documentation/api/files/Command/Output/TheliaConsoleOutput.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Command/Skeleton/Module/Class.php.txt b/documentation/api/files/Command/Skeleton/Module/Class.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Config.DatabaseConfiguration.php.html b/documentation/api/files/Config.DatabaseConfiguration.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Config.DefinePropel.php.html b/documentation/api/files/Config.DefinePropel.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Config/DatabaseConfiguration.php.txt b/documentation/api/files/Config/DatabaseConfiguration.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Config/DefinePropel.php.txt b/documentation/api/files/Config/DefinePropel.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.Admin.AdminController.php.html b/documentation/api/files/Controller.Admin.AdminController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.Admin.BaseAdminController.php.html b/documentation/api/files/Controller.Admin.BaseAdminController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.Admin.CategoryController.php.html b/documentation/api/files/Controller.Admin.CategoryController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.Admin.SessionController.php.html b/documentation/api/files/Controller.Admin.SessionController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.BaseController.php.html b/documentation/api/files/Controller.BaseController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.DefaultController.php.html b/documentation/api/files/Controller.DefaultController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.Front.BaseFrontController.php.html b/documentation/api/files/Controller.Front.BaseFrontController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.Front.CartController.php.html b/documentation/api/files/Controller.Front.CartController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.Front.CustomerController.php.html b/documentation/api/files/Controller.Front.CustomerController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.Front.DefaultController.php.html b/documentation/api/files/Controller.Front.DefaultController.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller.NullControllerInterface.php.html b/documentation/api/files/Controller.NullControllerInterface.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller/Admin/AdminController.php.txt b/documentation/api/files/Controller/Admin/AdminController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller/Admin/BaseAdminController.php.txt b/documentation/api/files/Controller/Admin/BaseAdminController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller/Admin/CategoryController.php.txt b/documentation/api/files/Controller/Admin/CategoryController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller/Admin/SessionController.php.txt b/documentation/api/files/Controller/Admin/SessionController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller/BaseController.php.txt b/documentation/api/files/Controller/BaseController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller/DefaultController.php.txt b/documentation/api/files/Controller/DefaultController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller/Front/BaseFrontController.php.txt b/documentation/api/files/Controller/Front/BaseFrontController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller/Front/CartController.php.txt b/documentation/api/files/Controller/Front/CartController.php.txt old mode 100644 new mode 100755 index c800070e2..de27c7be4 --- a/documentation/api/files/Controller/Front/CartController.php.txt +++ b/documentation/api/files/Controller/Front/CartController.php.txt @@ -74,7 +74,7 @@ class CartController extends BaseFrontController $cartEvent->setQuantity($this->getRequest()->get("quantity")); try { - $this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent); + $this->getDispatcher()->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent); $this->redirectSuccess(); } catch(PropelException $e) { diff --git a/documentation/api/files/Controller/Front/CustomerController.php.txt b/documentation/api/files/Controller/Front/CustomerController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller/Front/DefaultController.php.txt b/documentation/api/files/Controller/Front/DefaultController.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Controller/NullControllerInterface.php.txt b/documentation/api/files/Controller/NullControllerInterface.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Application.php.html b/documentation/api/files/Core.Application.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Bundle.TheliaBundle.php.html b/documentation/api/files/Core.Bundle.TheliaBundle.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Context.php.html b/documentation/api/files/Core.Context.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Controller.ControllerResolver.php.html b/documentation/api/files/Core.Controller.ControllerResolver.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.DependencyInjection.Compiler.RegisterListenersPass.php.html b/documentation/api/files/Core.DependencyInjection.Compiler.RegisterListenersPass.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.DependencyInjection.Compiler.RegisterParserPluginPass.php.html b/documentation/api/files/Core.DependencyInjection.Compiler.RegisterParserPluginPass.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.DependencyInjection.Compiler.RegisterRouterPass.php.html b/documentation/api/files/Core.DependencyInjection.Compiler.RegisterRouterPass.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.DependencyInjection.Loader.XmlFileLoader.php.html b/documentation/api/files/Core.DependencyInjection.Loader.XmlFileLoader.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.ActionEvent.php.html b/documentation/api/files/Core.Event.ActionEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.CartEvent.php.html b/documentation/api/files/Core.Event.CartEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.CartItemEvent.php.html b/documentation/api/files/Core.Event.CartItemEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.CategoryEvent.php.html b/documentation/api/files/Core.Event.CategoryEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.CustomRefEvent.php.html b/documentation/api/files/Core.Event.CustomRefEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.CustomerEvent.php.html b/documentation/api/files/Core.Event.CustomerEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.DefaultActionEvent.php.html b/documentation/api/files/Core.Event.DefaultActionEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.Internal.CartEvent.php.html b/documentation/api/files/Core.Event.Internal.CartEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.Internal.CustomerEvent.php.html b/documentation/api/files/Core.Event.Internal.CustomerEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.Internal.InternalEvent.php.html b/documentation/api/files/Core.Event.Internal.InternalEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.InternalEvent.php.html b/documentation/api/files/Core.Event.InternalEvent.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Event.TheliaEvents.php.html b/documentation/api/files/Core.Event.TheliaEvents.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.EventListener.ControllerListener.php.html b/documentation/api/files/Core.EventListener.ControllerListener.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.EventListener.ViewListener.php.html b/documentation/api/files/Core.EventListener.ViewListener.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Factory.ActionEventFactory.php.html b/documentation/api/files/Core.Factory.ActionEventFactory.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.HttpFoundation.Request.php.html b/documentation/api/files/Core.HttpFoundation.Request.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.HttpFoundation.Session.Session.php.html b/documentation/api/files/Core.HttpFoundation.Session.Session.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.Authentication.AdminUsernamePasswordFormAuthenticator.php.html b/documentation/api/files/Core.Security.Authentication.AdminUsernamePasswordFormAuthenticator.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.Authentication.AuthenticatorInterface.php.html b/documentation/api/files/Core.Security.Authentication.AuthenticatorInterface.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.Authentication.CustomerUsernamePasswordFormAuthenticator.php.html b/documentation/api/files/Core.Security.Authentication.CustomerUsernamePasswordFormAuthenticator.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.Authentication.UsernamePasswordFormAuthenticator.php.html b/documentation/api/files/Core.Security.Authentication.UsernamePasswordFormAuthenticator.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.Exception.AuthenticationException.php.html b/documentation/api/files/Core.Security.Exception.AuthenticationException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.Exception.AuthorizationException.php.html b/documentation/api/files/Core.Security.Exception.AuthorizationException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.Exception.UsernameNotFoundException.php.html b/documentation/api/files/Core.Security.Exception.UsernameNotFoundException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.Exception.WrongPasswordException.php.html b/documentation/api/files/Core.Security.Exception.WrongPasswordException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.Role.Role.php.html b/documentation/api/files/Core.Security.Role.Role.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.Role.RoleInterface.php.html b/documentation/api/files/Core.Security.Role.RoleInterface.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.SecurityContext.php.html b/documentation/api/files/Core.Security.SecurityContext.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.User.UserInterface.php.html b/documentation/api/files/Core.Security.User.UserInterface.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.UserProvider.AdminUserProvider.php.html b/documentation/api/files/Core.Security.UserProvider.AdminUserProvider.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.UserProvider.CustomerUserProvider.php.html b/documentation/api/files/Core.Security.UserProvider.CustomerUserProvider.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Security.UserProvider.UserProviderInterface.php.html b/documentation/api/files/Core.Security.UserProvider.UserProviderInterface.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Assets.AsseticHelper.php.html b/documentation/api/files/Core.Template.Assets.AsseticHelper.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Element.BaseLoop.php.html b/documentation/api/files/Core.Template.Element.BaseLoop.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Element.Exception.ElementNotFoundException.php.html b/documentation/api/files/Core.Template.Element.Exception.ElementNotFoundException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Element.Exception.InvalidElementException.php.html b/documentation/api/files/Core.Template.Element.Exception.InvalidElementException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Element.LoopResult.php.html b/documentation/api/files/Core.Template.Element.LoopResult.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Element.LoopResultRow.php.html b/documentation/api/files/Core.Template.Element.LoopResultRow.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Exception.ResourceNotFoundException.php.html b/documentation/api/files/Core.Template.Exception.ResourceNotFoundException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Accessory.php.html b/documentation/api/files/Core.Template.Loop.Accessory.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Address.php.html b/documentation/api/files/Core.Template.Loop.Address.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Argument.Argument.php.html b/documentation/api/files/Core.Template.Loop.Argument.Argument.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Argument.ArgumentCollection.php.html b/documentation/api/files/Core.Template.Loop.Argument.ArgumentCollection.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Auth.php.html b/documentation/api/files/Core.Template.Loop.Auth.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Cart.php.html b/documentation/api/files/Core.Template.Loop.Cart.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Category.php.html b/documentation/api/files/Core.Template.Loop.Category.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.CategoryPath.php.html b/documentation/api/files/Core.Template.Loop.CategoryPath.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.CategoryTree.php.html b/documentation/api/files/Core.Template.Loop.CategoryTree.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Content.php.html b/documentation/api/files/Core.Template.Loop.Content.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Country.php.html b/documentation/api/files/Core.Template.Loop.Country.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Customer.php.html b/documentation/api/files/Core.Template.Loop.Customer.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Feature.php.html b/documentation/api/files/Core.Template.Loop.Feature.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.FeatureAvailable.php.html b/documentation/api/files/Core.Template.Loop.FeatureAvailable.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.FeatureValue.php.html b/documentation/api/files/Core.Template.Loop.FeatureValue.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Feed.php.html b/documentation/api/files/Core.Template.Loop.Feed.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Folder.php.html b/documentation/api/files/Core.Template.Loop.Folder.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Lang.php.html b/documentation/api/files/Core.Template.Loop.Lang.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Order.php.html b/documentation/api/files/Core.Template.Loop.Order.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.OrderStatus.php.html b/documentation/api/files/Core.Template.Loop.OrderStatus.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Product.php.html b/documentation/api/files/Core.Template.Loop.Product.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Loop.Title.php.html b/documentation/api/files/Core.Template.Loop.Title.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.ParserContext.php.html b/documentation/api/files/Core.Template.ParserContext.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.ParserInterface.php.html b/documentation/api/files/Core.Template.ParserInterface.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.AbstractSmartyPlugin.php.html b/documentation/api/files/Core.Template.Smarty.AbstractSmartyPlugin.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.Assets.SmartyAssetsManager.php.html b/documentation/api/files/Core.Template.Smarty.Assets.SmartyAssetsManager.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.Plugins.Assetic.php.html b/documentation/api/files/Core.Template.Smarty.Plugins.Assetic.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.Plugins.DataAccessFunctions.php.html b/documentation/api/files/Core.Template.Smarty.Plugins.DataAccessFunctions.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.Plugins.Form.php.html b/documentation/api/files/Core.Template.Smarty.Plugins.Form.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.Plugins.Module.php.html b/documentation/api/files/Core.Template.Smarty.Plugins.Module.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.Plugins.Security.php.html b/documentation/api/files/Core.Template.Smarty.Plugins.Security.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.Plugins.TheliaLoop.php.html b/documentation/api/files/Core.Template.Smarty.Plugins.TheliaLoop.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.Plugins.TheliaSyntax.php.html b/documentation/api/files/Core.Template.Smarty.Plugins.TheliaSyntax.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.Plugins.Translation.php.html b/documentation/api/files/Core.Template.Smarty.Plugins.Translation.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.Plugins.UrlGenerator.php.html b/documentation/api/files/Core.Template.Smarty.Plugins.UrlGenerator.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.SmartyParser.php.html b/documentation/api/files/Core.Template.Smarty.SmartyParser.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Template.Smarty.SmartyPluginDescriptor.php.html b/documentation/api/files/Core.Template.Smarty.SmartyPluginDescriptor.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Thelia.php.html b/documentation/api/files/Core.Thelia.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.TheliaContainerBuilder.php.html b/documentation/api/files/Core.TheliaContainerBuilder.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.TheliaHttpKernel.php.html b/documentation/api/files/Core.TheliaHttpKernel.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core.Translation.Translator.php.html b/documentation/api/files/Core.Translation.Translator.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Application.php.txt b/documentation/api/files/Core/Application.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Bundle/TheliaBundle.php.txt b/documentation/api/files/Core/Bundle/TheliaBundle.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Context.php.txt b/documentation/api/files/Core/Context.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Controller/ControllerResolver.php.txt b/documentation/api/files/Core/Controller/ControllerResolver.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/DependencyInjection/Compiler/RegisterListenersPass.php.txt b/documentation/api/files/Core/DependencyInjection/Compiler/RegisterListenersPass.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php.txt b/documentation/api/files/Core/DependencyInjection/Compiler/RegisterParserPluginPass.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/DependencyInjection/Compiler/RegisterRouterPass.php.txt b/documentation/api/files/Core/DependencyInjection/Compiler/RegisterRouterPass.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/DependencyInjection/Loader/XmlFileLoader.php.txt b/documentation/api/files/Core/DependencyInjection/Loader/XmlFileLoader.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/ActionEvent.php.txt b/documentation/api/files/Core/Event/ActionEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/CartEvent.php.txt b/documentation/api/files/Core/Event/CartEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/CartItemEvent.php.txt b/documentation/api/files/Core/Event/CartItemEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/CategoryEvent.php.txt b/documentation/api/files/Core/Event/CategoryEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/CustomRefEvent.php.txt b/documentation/api/files/Core/Event/CustomRefEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/CustomerEvent.php.txt b/documentation/api/files/Core/Event/CustomerEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/DefaultActionEvent.php.txt b/documentation/api/files/Core/Event/DefaultActionEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/Internal/CartEvent.php.txt b/documentation/api/files/Core/Event/Internal/CartEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/Internal/CustomerEvent.php.txt b/documentation/api/files/Core/Event/Internal/CustomerEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/Internal/InternalEvent.php.txt b/documentation/api/files/Core/Event/Internal/InternalEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/InternalEvent.php.txt b/documentation/api/files/Core/Event/InternalEvent.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Event/TheliaEvents.php.txt b/documentation/api/files/Core/Event/TheliaEvents.php.txt old mode 100644 new mode 100755 index 7ddc0b786..ca95903a8 --- a/documentation/api/files/Core/Event/TheliaEvents.php.txt +++ b/documentation/api/files/Core/Event/TheliaEvents.php.txt @@ -78,11 +78,11 @@ final class TheliaEvents /** * Sent once the customer change form has been successfully validated, and before customer update in the database. */ - const BEFORE_CHANGECUSTOMER = "action.before_changecustomer"; + const BEFORE_UPDATECUSTOMER = "action.before_changecustomer"; /** * Sent just after a successful update of a customer in the database. */ - const AFTER_CHANGECUSTOMER = "action.after_changecustomer"; + const AFTER_UPDATECUSTOMER = "action.after_changecustomer"; /** * Sent once the category creation form has been successfully validated, and before category insertion in the database. @@ -106,7 +106,7 @@ final class TheliaEvents /** * Sent just after a successful change of a category in the database. */ - const AFTER_CHANGECATEGORY = "action.after_changecategory"; + const AFTER_UPDATECATEGORY = "action.after_changecategory"; /** * sent when a new existing cat id duplicated. This append when current customer is different from current cart @@ -121,7 +121,7 @@ final class TheliaEvents /** * sent when a cart item is modify */ - const AFTER_CARTCHANGEITEM = "cart.modifyItem"; + const AFTER_CARTUPDATEITEM = "cart.modifyItem"; /** * sent for addArticle action @@ -131,7 +131,7 @@ final class TheliaEvents /** * sent on modify article action */ - const CART_CHANGEITEM = "action.changeArticle"; + const CART_UPDATEITEM = "action.changeArticle"; const CART_DELETEITEM = "action.deleteArticle"; } diff --git a/documentation/api/files/Core/EventListener/ControllerListener.php.txt b/documentation/api/files/Core/EventListener/ControllerListener.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/EventListener/ViewListener.php.txt b/documentation/api/files/Core/EventListener/ViewListener.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Factory/ActionEventFactory.php.txt b/documentation/api/files/Core/Factory/ActionEventFactory.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/HttpFoundation/Request.php.txt b/documentation/api/files/Core/HttpFoundation/Request.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/HttpFoundation/Session/Session.php.txt b/documentation/api/files/Core/HttpFoundation/Session/Session.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php.txt b/documentation/api/files/Core/Security/Authentication/AdminUsernamePasswordFormAuthenticator.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/Authentication/AuthenticatorInterface.php.txt b/documentation/api/files/Core/Security/Authentication/AuthenticatorInterface.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php.txt b/documentation/api/files/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php.txt b/documentation/api/files/Core/Security/Authentication/UsernamePasswordFormAuthenticator.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/Exception/AuthenticationException.php.txt b/documentation/api/files/Core/Security/Exception/AuthenticationException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/Exception/AuthorizationException.php.txt b/documentation/api/files/Core/Security/Exception/AuthorizationException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/Exception/UsernameNotFoundException.php.txt b/documentation/api/files/Core/Security/Exception/UsernameNotFoundException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/Exception/WrongPasswordException.php.txt b/documentation/api/files/Core/Security/Exception/WrongPasswordException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/Role/Role.php.txt b/documentation/api/files/Core/Security/Role/Role.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/Role/RoleInterface.php.txt b/documentation/api/files/Core/Security/Role/RoleInterface.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/SecurityContext.php.txt b/documentation/api/files/Core/Security/SecurityContext.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/User/UserInterface.php.txt b/documentation/api/files/Core/Security/User/UserInterface.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/UserProvider/AdminUserProvider.php.txt b/documentation/api/files/Core/Security/UserProvider/AdminUserProvider.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/UserProvider/CustomerUserProvider.php.txt b/documentation/api/files/Core/Security/UserProvider/CustomerUserProvider.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Security/UserProvider/UserProviderInterface.php.txt b/documentation/api/files/Core/Security/UserProvider/UserProviderInterface.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Assets/AsseticHelper.php.txt b/documentation/api/files/Core/Template/Assets/AsseticHelper.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Element/BaseLoop.php.txt b/documentation/api/files/Core/Template/Element/BaseLoop.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Element/Exception/ElementNotFoundException.php.txt b/documentation/api/files/Core/Template/Element/Exception/ElementNotFoundException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Element/Exception/InvalidElementException.php.txt b/documentation/api/files/Core/Template/Element/Exception/InvalidElementException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Element/LoopResult.php.txt b/documentation/api/files/Core/Template/Element/LoopResult.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Element/LoopResultRow.php.txt b/documentation/api/files/Core/Template/Element/LoopResultRow.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Exception/ResourceNotFoundException.php.txt b/documentation/api/files/Core/Template/Exception/ResourceNotFoundException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Accessory.php.txt b/documentation/api/files/Core/Template/Loop/Accessory.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Address.php.txt b/documentation/api/files/Core/Template/Loop/Address.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Argument/Argument.php.txt b/documentation/api/files/Core/Template/Loop/Argument/Argument.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Argument/ArgumentCollection.php.txt b/documentation/api/files/Core/Template/Loop/Argument/ArgumentCollection.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Auth.php.txt b/documentation/api/files/Core/Template/Loop/Auth.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Cart.php.txt b/documentation/api/files/Core/Template/Loop/Cart.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Category.php.txt b/documentation/api/files/Core/Template/Loop/Category.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/CategoryPath.php.txt b/documentation/api/files/Core/Template/Loop/CategoryPath.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/CategoryTree.php.txt b/documentation/api/files/Core/Template/Loop/CategoryTree.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Content.php.txt b/documentation/api/files/Core/Template/Loop/Content.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Country.php.txt b/documentation/api/files/Core/Template/Loop/Country.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Customer.php.txt b/documentation/api/files/Core/Template/Loop/Customer.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Feature.php.txt b/documentation/api/files/Core/Template/Loop/Feature.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/FeatureAvailable.php.txt b/documentation/api/files/Core/Template/Loop/FeatureAvailable.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/FeatureValue.php.txt b/documentation/api/files/Core/Template/Loop/FeatureValue.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Feed.php.txt b/documentation/api/files/Core/Template/Loop/Feed.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Folder.php.txt b/documentation/api/files/Core/Template/Loop/Folder.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Lang.php.txt b/documentation/api/files/Core/Template/Loop/Lang.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Order.php.txt b/documentation/api/files/Core/Template/Loop/Order.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/OrderStatus.php.txt b/documentation/api/files/Core/Template/Loop/OrderStatus.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Product.php.txt b/documentation/api/files/Core/Template/Loop/Product.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Loop/Title.php.txt b/documentation/api/files/Core/Template/Loop/Title.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/ParserContext.php.txt b/documentation/api/files/Core/Template/ParserContext.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/ParserInterface.php.txt b/documentation/api/files/Core/Template/ParserInterface.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/AbstractSmartyPlugin.php.txt b/documentation/api/files/Core/Template/Smarty/AbstractSmartyPlugin.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/Assets/SmartyAssetsManager.php.txt b/documentation/api/files/Core/Template/Smarty/Assets/SmartyAssetsManager.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/Plugins/Assetic.php.txt b/documentation/api/files/Core/Template/Smarty/Plugins/Assetic.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/Plugins/DataAccessFunctions.php.txt b/documentation/api/files/Core/Template/Smarty/Plugins/DataAccessFunctions.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/Plugins/Form.php.txt b/documentation/api/files/Core/Template/Smarty/Plugins/Form.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/Plugins/Module.php.txt b/documentation/api/files/Core/Template/Smarty/Plugins/Module.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/Plugins/Security.php.txt b/documentation/api/files/Core/Template/Smarty/Plugins/Security.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/Plugins/TheliaLoop.php.txt b/documentation/api/files/Core/Template/Smarty/Plugins/TheliaLoop.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/Plugins/TheliaSyntax.php.txt b/documentation/api/files/Core/Template/Smarty/Plugins/TheliaSyntax.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/Plugins/Translation.php.txt b/documentation/api/files/Core/Template/Smarty/Plugins/Translation.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/Plugins/UrlGenerator.php.txt b/documentation/api/files/Core/Template/Smarty/Plugins/UrlGenerator.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/SmartyParser.php.txt b/documentation/api/files/Core/Template/Smarty/SmartyParser.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Template/Smarty/SmartyPluginDescriptor.php.txt b/documentation/api/files/Core/Template/Smarty/SmartyPluginDescriptor.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Thelia.php.txt b/documentation/api/files/Core/Thelia.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/TheliaContainerBuilder.php.txt b/documentation/api/files/Core/TheliaContainerBuilder.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/TheliaHttpKernel.php.txt b/documentation/api/files/Core/TheliaHttpKernel.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Core/Translation/Translator.php.txt b/documentation/api/files/Core/Translation/Translator.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Exception.InvalidCartException.php.html b/documentation/api/files/Exception.InvalidCartException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Exception.MemberAccessException.php.html b/documentation/api/files/Exception.MemberAccessException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Exception/InvalidCartException.php.txt b/documentation/api/files/Exception/InvalidCartException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Exception/MemberAccessException.php.txt b/documentation/api/files/Exception/MemberAccessException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.AdminLogin.php.html b/documentation/api/files/Form.AdminLogin.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.BaseForm.php.html b/documentation/api/files/Form.BaseForm.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.CartAdd.php.html b/documentation/api/files/Form.CartAdd.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.CategoryCreationForm.php.html b/documentation/api/files/Form.CategoryCreationForm.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.CategoryDeletionForm.php.html b/documentation/api/files/Form.CategoryDeletionForm.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.CustomerCreation.php.html b/documentation/api/files/Form.CustomerCreation.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.CustomerLogin.php.html b/documentation/api/files/Form.CustomerLogin.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.CustomerModification.php.html b/documentation/api/files/Form.CustomerModification.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.Exception.FormValidationException.php.html b/documentation/api/files/Form.Exception.FormValidationException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.Exception.ProductNotFoundException.php.html b/documentation/api/files/Form.Exception.ProductNotFoundException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form.Exception.StockNotFoundException.php.html b/documentation/api/files/Form.Exception.StockNotFoundException.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/AdminLogin.php.txt b/documentation/api/files/Form/AdminLogin.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/BaseForm.php.txt b/documentation/api/files/Form/BaseForm.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/CartAdd.php.txt b/documentation/api/files/Form/CartAdd.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/CategoryCreationForm.php.txt b/documentation/api/files/Form/CategoryCreationForm.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/CategoryDeletionForm.php.txt b/documentation/api/files/Form/CategoryDeletionForm.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/CustomerCreation.php.txt b/documentation/api/files/Form/CustomerCreation.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/CustomerLogin.php.txt b/documentation/api/files/Form/CustomerLogin.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/CustomerModification.php.txt b/documentation/api/files/Form/CustomerModification.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/Exception/FormValidationException.php.txt b/documentation/api/files/Form/Exception/FormValidationException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/Exception/ProductNotFoundException.php.txt b/documentation/api/files/Form/Exception/ProductNotFoundException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Form/Exception/StockNotFoundException.php.txt b/documentation/api/files/Form/Exception/StockNotFoundException.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log.AbstractTlogDestination.php.html b/documentation/api/files/Log.AbstractTlogDestination.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log.Destination.TlogDestinationFile.php.html b/documentation/api/files/Log.Destination.TlogDestinationFile.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log.Destination.TlogDestinationHtml.php.html b/documentation/api/files/Log.Destination.TlogDestinationHtml.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log.Destination.TlogDestinationNull.php.html b/documentation/api/files/Log.Destination.TlogDestinationNull.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log.Destination.TlogDestinationText.php.html b/documentation/api/files/Log.Destination.TlogDestinationText.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log.Tlog.php.html b/documentation/api/files/Log.Tlog.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log.TlogDestinationConfig.php.html b/documentation/api/files/Log.TlogDestinationConfig.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log.TlogInterface.php.html b/documentation/api/files/Log.TlogInterface.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log/AbstractTlogDestination.php.txt b/documentation/api/files/Log/AbstractTlogDestination.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log/Destination/TlogDestinationFile.php.txt b/documentation/api/files/Log/Destination/TlogDestinationFile.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log/Destination/TlogDestinationHtml.php.txt b/documentation/api/files/Log/Destination/TlogDestinationHtml.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log/Destination/TlogDestinationNull.php.txt b/documentation/api/files/Log/Destination/TlogDestinationNull.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log/Destination/TlogDestinationText.php.txt b/documentation/api/files/Log/Destination/TlogDestinationText.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log/Tlog.php.txt b/documentation/api/files/Log/Tlog.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log/TlogDestinationConfig.php.txt b/documentation/api/files/Log/TlogDestinationConfig.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Log/TlogInterface.php.txt b/documentation/api/files/Log/TlogInterface.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Accessory.php.html b/documentation/api/files/Model.Accessory.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AccessoryQuery.php.html b/documentation/api/files/Model.AccessoryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Address.php.html b/documentation/api/files/Model.Address.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AddressQuery.php.html b/documentation/api/files/Model.AddressQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Admin.php.html b/documentation/api/files/Model.Admin.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AdminGroup.php.html b/documentation/api/files/Model.AdminGroup.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AdminGroupQuery.php.html b/documentation/api/files/Model.AdminGroupQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AdminLog.php.html b/documentation/api/files/Model.AdminLog.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AdminLogQuery.php.html b/documentation/api/files/Model.AdminLogQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AdminQuery.php.html b/documentation/api/files/Model.AdminQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Area.php.html b/documentation/api/files/Model.Area.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AreaQuery.php.html b/documentation/api/files/Model.AreaQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Attribute.php.html b/documentation/api/files/Model.Attribute.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeAv.php.html b/documentation/api/files/Model.AttributeAv.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeAvI18n.php.html b/documentation/api/files/Model.AttributeAvI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeAvI18nQuery.php.html b/documentation/api/files/Model.AttributeAvI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeAvQuery.php.html b/documentation/api/files/Model.AttributeAvQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeCategory.php.html b/documentation/api/files/Model.AttributeCategory.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeCategoryQuery.php.html b/documentation/api/files/Model.AttributeCategoryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeCombination.php.html b/documentation/api/files/Model.AttributeCombination.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeCombinationQuery.php.html b/documentation/api/files/Model.AttributeCombinationQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeI18n.php.html b/documentation/api/files/Model.AttributeI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeI18nQuery.php.html b/documentation/api/files/Model.AttributeI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.AttributeQuery.php.html b/documentation/api/files/Model.AttributeQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Accessory.php.html b/documentation/api/files/Model.Base.Accessory.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AccessoryQuery.php.html b/documentation/api/files/Model.Base.AccessoryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Address.php.html b/documentation/api/files/Model.Base.Address.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AddressQuery.php.html b/documentation/api/files/Model.Base.AddressQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Admin.php.html b/documentation/api/files/Model.Base.Admin.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AdminGroup.php.html b/documentation/api/files/Model.Base.AdminGroup.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AdminGroupQuery.php.html b/documentation/api/files/Model.Base.AdminGroupQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AdminLog.php.html b/documentation/api/files/Model.Base.AdminLog.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AdminLogQuery.php.html b/documentation/api/files/Model.Base.AdminLogQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AdminQuery.php.html b/documentation/api/files/Model.Base.AdminQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Area.php.html b/documentation/api/files/Model.Base.Area.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AreaQuery.php.html b/documentation/api/files/Model.Base.AreaQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Attribute.php.html b/documentation/api/files/Model.Base.Attribute.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeAv.php.html b/documentation/api/files/Model.Base.AttributeAv.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeAvI18n.php.html b/documentation/api/files/Model.Base.AttributeAvI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeAvI18nQuery.php.html b/documentation/api/files/Model.Base.AttributeAvI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeAvQuery.php.html b/documentation/api/files/Model.Base.AttributeAvQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeCategory.php.html b/documentation/api/files/Model.Base.AttributeCategory.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeCategoryQuery.php.html b/documentation/api/files/Model.Base.AttributeCategoryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeCombination.php.html b/documentation/api/files/Model.Base.AttributeCombination.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeCombinationQuery.php.html b/documentation/api/files/Model.Base.AttributeCombinationQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeI18n.php.html b/documentation/api/files/Model.Base.AttributeI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeI18nQuery.php.html b/documentation/api/files/Model.Base.AttributeI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.AttributeQuery.php.html b/documentation/api/files/Model.Base.AttributeQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Cart.php.html b/documentation/api/files/Model.Base.Cart.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CartItem.php.html b/documentation/api/files/Model.Base.CartItem.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CartItemQuery.php.html b/documentation/api/files/Model.Base.CartItemQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CartQuery.php.html b/documentation/api/files/Model.Base.CartQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Category.php.html b/documentation/api/files/Model.Base.Category.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryDocument.php.html b/documentation/api/files/Model.Base.CategoryDocument.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryDocumentI18n.php.html b/documentation/api/files/Model.Base.CategoryDocumentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryDocumentI18nQuery.php.html b/documentation/api/files/Model.Base.CategoryDocumentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryDocumentQuery.php.html b/documentation/api/files/Model.Base.CategoryDocumentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryI18n.php.html b/documentation/api/files/Model.Base.CategoryI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryI18nQuery.php.html b/documentation/api/files/Model.Base.CategoryI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryImage.php.html b/documentation/api/files/Model.Base.CategoryImage.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryImageI18n.php.html b/documentation/api/files/Model.Base.CategoryImageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryImageI18nQuery.php.html b/documentation/api/files/Model.Base.CategoryImageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryImageQuery.php.html b/documentation/api/files/Model.Base.CategoryImageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryQuery.php.html b/documentation/api/files/Model.Base.CategoryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryVersion.php.html b/documentation/api/files/Model.Base.CategoryVersion.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CategoryVersionQuery.php.html b/documentation/api/files/Model.Base.CategoryVersionQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Config.php.html b/documentation/api/files/Model.Base.Config.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ConfigI18n.php.html b/documentation/api/files/Model.Base.ConfigI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ConfigI18nQuery.php.html b/documentation/api/files/Model.Base.ConfigI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ConfigQuery.php.html b/documentation/api/files/Model.Base.ConfigQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Content.php.html b/documentation/api/files/Model.Base.Content.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentAssoc.php.html b/documentation/api/files/Model.Base.ContentAssoc.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentAssocQuery.php.html b/documentation/api/files/Model.Base.ContentAssocQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentDocument.php.html b/documentation/api/files/Model.Base.ContentDocument.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentDocumentI18n.php.html b/documentation/api/files/Model.Base.ContentDocumentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentDocumentI18nQuery.php.html b/documentation/api/files/Model.Base.ContentDocumentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentDocumentQuery.php.html b/documentation/api/files/Model.Base.ContentDocumentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentFolder.php.html b/documentation/api/files/Model.Base.ContentFolder.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentFolderQuery.php.html b/documentation/api/files/Model.Base.ContentFolderQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentI18n.php.html b/documentation/api/files/Model.Base.ContentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentI18nQuery.php.html b/documentation/api/files/Model.Base.ContentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentImage.php.html b/documentation/api/files/Model.Base.ContentImage.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentImageI18n.php.html b/documentation/api/files/Model.Base.ContentImageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentImageI18nQuery.php.html b/documentation/api/files/Model.Base.ContentImageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentImageQuery.php.html b/documentation/api/files/Model.Base.ContentImageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentQuery.php.html b/documentation/api/files/Model.Base.ContentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentVersion.php.html b/documentation/api/files/Model.Base.ContentVersion.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ContentVersionQuery.php.html b/documentation/api/files/Model.Base.ContentVersionQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Country.php.html b/documentation/api/files/Model.Base.Country.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CountryI18n.php.html b/documentation/api/files/Model.Base.CountryI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CountryI18nQuery.php.html b/documentation/api/files/Model.Base.CountryI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CountryQuery.php.html b/documentation/api/files/Model.Base.CountryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Coupon.php.html b/documentation/api/files/Model.Base.Coupon.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CouponOrder.php.html b/documentation/api/files/Model.Base.CouponOrder.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CouponOrderQuery.php.html b/documentation/api/files/Model.Base.CouponOrderQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CouponQuery.php.html b/documentation/api/files/Model.Base.CouponQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CouponRule.php.html b/documentation/api/files/Model.Base.CouponRule.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CouponRuleQuery.php.html b/documentation/api/files/Model.Base.CouponRuleQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Currency.php.html b/documentation/api/files/Model.Base.Currency.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CurrencyI18n.php.html b/documentation/api/files/Model.Base.CurrencyI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CurrencyI18nQuery.php.html b/documentation/api/files/Model.Base.CurrencyI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CurrencyQuery.php.html b/documentation/api/files/Model.Base.CurrencyQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Customer.php.html b/documentation/api/files/Model.Base.Customer.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CustomerQuery.php.html b/documentation/api/files/Model.Base.CustomerQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CustomerTitle.php.html b/documentation/api/files/Model.Base.CustomerTitle.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CustomerTitleI18n.php.html b/documentation/api/files/Model.Base.CustomerTitleI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CustomerTitleI18nQuery.php.html b/documentation/api/files/Model.Base.CustomerTitleI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.CustomerTitleQuery.php.html b/documentation/api/files/Model.Base.CustomerTitleQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Delivzone.php.html b/documentation/api/files/Model.Base.Delivzone.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.DelivzoneQuery.php.html b/documentation/api/files/Model.Base.DelivzoneQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Document.php.html b/documentation/api/files/Model.Base.Document.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.DocumentI18n.php.html b/documentation/api/files/Model.Base.DocumentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.DocumentI18nQuery.php.html b/documentation/api/files/Model.Base.DocumentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.DocumentQuery.php.html b/documentation/api/files/Model.Base.DocumentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Feature.php.html b/documentation/api/files/Model.Base.Feature.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureAv.php.html b/documentation/api/files/Model.Base.FeatureAv.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureAvI18n.php.html b/documentation/api/files/Model.Base.FeatureAvI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureAvI18nQuery.php.html b/documentation/api/files/Model.Base.FeatureAvI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureAvQuery.php.html b/documentation/api/files/Model.Base.FeatureAvQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureCategory.php.html b/documentation/api/files/Model.Base.FeatureCategory.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureCategoryQuery.php.html b/documentation/api/files/Model.Base.FeatureCategoryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureI18n.php.html b/documentation/api/files/Model.Base.FeatureI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureI18nQuery.php.html b/documentation/api/files/Model.Base.FeatureI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureProduct.php.html b/documentation/api/files/Model.Base.FeatureProduct.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureProductQuery.php.html b/documentation/api/files/Model.Base.FeatureProductQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FeatureQuery.php.html b/documentation/api/files/Model.Base.FeatureQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Folder.php.html b/documentation/api/files/Model.Base.Folder.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderDocument.php.html b/documentation/api/files/Model.Base.FolderDocument.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderDocumentI18n.php.html b/documentation/api/files/Model.Base.FolderDocumentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderDocumentI18nQuery.php.html b/documentation/api/files/Model.Base.FolderDocumentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderDocumentQuery.php.html b/documentation/api/files/Model.Base.FolderDocumentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderI18n.php.html b/documentation/api/files/Model.Base.FolderI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderI18nQuery.php.html b/documentation/api/files/Model.Base.FolderI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderImage.php.html b/documentation/api/files/Model.Base.FolderImage.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderImageI18n.php.html b/documentation/api/files/Model.Base.FolderImageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderImageI18nQuery.php.html b/documentation/api/files/Model.Base.FolderImageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderImageQuery.php.html b/documentation/api/files/Model.Base.FolderImageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderQuery.php.html b/documentation/api/files/Model.Base.FolderQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderVersion.php.html b/documentation/api/files/Model.Base.FolderVersion.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.FolderVersionQuery.php.html b/documentation/api/files/Model.Base.FolderVersionQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Group.php.html b/documentation/api/files/Model.Base.Group.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.GroupI18n.php.html b/documentation/api/files/Model.Base.GroupI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.GroupI18nQuery.php.html b/documentation/api/files/Model.Base.GroupI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.GroupModule.php.html b/documentation/api/files/Model.Base.GroupModule.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.GroupModuleQuery.php.html b/documentation/api/files/Model.Base.GroupModuleQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.GroupQuery.php.html b/documentation/api/files/Model.Base.GroupQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.GroupResource.php.html b/documentation/api/files/Model.Base.GroupResource.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.GroupResourceQuery.php.html b/documentation/api/files/Model.Base.GroupResourceQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Image.php.html b/documentation/api/files/Model.Base.Image.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ImageI18n.php.html b/documentation/api/files/Model.Base.ImageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ImageI18nQuery.php.html b/documentation/api/files/Model.Base.ImageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ImageQuery.php.html b/documentation/api/files/Model.Base.ImageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Lang.php.html b/documentation/api/files/Model.Base.Lang.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.LangQuery.php.html b/documentation/api/files/Model.Base.LangQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Message.php.html b/documentation/api/files/Model.Base.Message.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.MessageI18n.php.html b/documentation/api/files/Model.Base.MessageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.MessageI18nQuery.php.html b/documentation/api/files/Model.Base.MessageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.MessageQuery.php.html b/documentation/api/files/Model.Base.MessageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.MessageVersion.php.html b/documentation/api/files/Model.Base.MessageVersion.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.MessageVersionQuery.php.html b/documentation/api/files/Model.Base.MessageVersionQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Module.php.html b/documentation/api/files/Model.Base.Module.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ModuleI18n.php.html b/documentation/api/files/Model.Base.ModuleI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ModuleI18nQuery.php.html b/documentation/api/files/Model.Base.ModuleI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ModuleQuery.php.html b/documentation/api/files/Model.Base.ModuleQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Order.php.html b/documentation/api/files/Model.Base.Order.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderAddress.php.html b/documentation/api/files/Model.Base.OrderAddress.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderAddressQuery.php.html b/documentation/api/files/Model.Base.OrderAddressQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderFeature.php.html b/documentation/api/files/Model.Base.OrderFeature.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderFeatureQuery.php.html b/documentation/api/files/Model.Base.OrderFeatureQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderProduct.php.html b/documentation/api/files/Model.Base.OrderProduct.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderProductQuery.php.html b/documentation/api/files/Model.Base.OrderProductQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderQuery.php.html b/documentation/api/files/Model.Base.OrderQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderStatus.php.html b/documentation/api/files/Model.Base.OrderStatus.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderStatusI18n.php.html b/documentation/api/files/Model.Base.OrderStatusI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderStatusI18nQuery.php.html b/documentation/api/files/Model.Base.OrderStatusI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.OrderStatusQuery.php.html b/documentation/api/files/Model.Base.OrderStatusQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Product.php.html b/documentation/api/files/Model.Base.Product.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductCategory.php.html b/documentation/api/files/Model.Base.ProductCategory.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductCategoryQuery.php.html b/documentation/api/files/Model.Base.ProductCategoryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductDocument.php.html b/documentation/api/files/Model.Base.ProductDocument.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductDocumentI18n.php.html b/documentation/api/files/Model.Base.ProductDocumentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductDocumentI18nQuery.php.html b/documentation/api/files/Model.Base.ProductDocumentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductDocumentQuery.php.html b/documentation/api/files/Model.Base.ProductDocumentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductI18n.php.html b/documentation/api/files/Model.Base.ProductI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductI18nQuery.php.html b/documentation/api/files/Model.Base.ProductI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductPrice.php.html b/documentation/api/files/Model.Base.ProductPrice.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductPriceQuery.php.html b/documentation/api/files/Model.Base.ProductPriceQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductQuery.php.html b/documentation/api/files/Model.Base.ProductQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductSaleElements.php.html b/documentation/api/files/Model.Base.ProductSaleElements.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductSaleElementsQuery.php.html b/documentation/api/files/Model.Base.ProductSaleElementsQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductVersion.php.html b/documentation/api/files/Model.Base.ProductVersion.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProductVersionQuery.php.html b/documentation/api/files/Model.Base.ProductVersionQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProdutImage.php.html b/documentation/api/files/Model.Base.ProdutImage.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProdutImageI18n.php.html b/documentation/api/files/Model.Base.ProdutImageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProdutImageI18nQuery.php.html b/documentation/api/files/Model.Base.ProdutImageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ProdutImageQuery.php.html b/documentation/api/files/Model.Base.ProdutImageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Resource.php.html b/documentation/api/files/Model.Base.Resource.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ResourceI18n.php.html b/documentation/api/files/Model.Base.ResourceI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ResourceI18nQuery.php.html b/documentation/api/files/Model.Base.ResourceI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.ResourceQuery.php.html b/documentation/api/files/Model.Base.ResourceQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Rewriting.php.html b/documentation/api/files/Model.Base.Rewriting.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.RewritingQuery.php.html b/documentation/api/files/Model.Base.RewritingQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.Tax.php.html b/documentation/api/files/Model.Base.Tax.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.TaxI18n.php.html b/documentation/api/files/Model.Base.TaxI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.TaxI18nQuery.php.html b/documentation/api/files/Model.Base.TaxI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.TaxQuery.php.html b/documentation/api/files/Model.Base.TaxQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.TaxRule.php.html b/documentation/api/files/Model.Base.TaxRule.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.TaxRuleCountry.php.html b/documentation/api/files/Model.Base.TaxRuleCountry.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.TaxRuleCountryQuery.php.html b/documentation/api/files/Model.Base.TaxRuleCountryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.TaxRuleI18n.php.html b/documentation/api/files/Model.Base.TaxRuleI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.TaxRuleI18nQuery.php.html b/documentation/api/files/Model.Base.TaxRuleI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Base.TaxRuleQuery.php.html b/documentation/api/files/Model.Base.TaxRuleQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Cart.php.html b/documentation/api/files/Model.Cart.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CartItem.php.html b/documentation/api/files/Model.CartItem.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CartItemQuery.php.html b/documentation/api/files/Model.CartItemQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CartQuery.php.html b/documentation/api/files/Model.CartQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Category.php.html b/documentation/api/files/Model.Category.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryDocument.php.html b/documentation/api/files/Model.CategoryDocument.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryDocumentI18n.php.html b/documentation/api/files/Model.CategoryDocumentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryDocumentI18nQuery.php.html b/documentation/api/files/Model.CategoryDocumentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryDocumentQuery.php.html b/documentation/api/files/Model.CategoryDocumentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryI18n.php.html b/documentation/api/files/Model.CategoryI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryI18nQuery.php.html b/documentation/api/files/Model.CategoryI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryImage.php.html b/documentation/api/files/Model.CategoryImage.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryImageI18n.php.html b/documentation/api/files/Model.CategoryImageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryImageI18nQuery.php.html b/documentation/api/files/Model.CategoryImageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryImageQuery.php.html b/documentation/api/files/Model.CategoryImageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryQuery.php.html b/documentation/api/files/Model.CategoryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryVersion.php.html b/documentation/api/files/Model.CategoryVersion.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CategoryVersionQuery.php.html b/documentation/api/files/Model.CategoryVersionQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Config.php.html b/documentation/api/files/Model.Config.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ConfigI18n.php.html b/documentation/api/files/Model.ConfigI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ConfigI18nQuery.php.html b/documentation/api/files/Model.ConfigI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ConfigQuery.php.html b/documentation/api/files/Model.ConfigQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Content.php.html b/documentation/api/files/Model.Content.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentAssoc.php.html b/documentation/api/files/Model.ContentAssoc.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentAssocQuery.php.html b/documentation/api/files/Model.ContentAssocQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentDocument.php.html b/documentation/api/files/Model.ContentDocument.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentDocumentI18n.php.html b/documentation/api/files/Model.ContentDocumentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentDocumentI18nQuery.php.html b/documentation/api/files/Model.ContentDocumentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentDocumentQuery.php.html b/documentation/api/files/Model.ContentDocumentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentFolder.php.html b/documentation/api/files/Model.ContentFolder.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentFolderQuery.php.html b/documentation/api/files/Model.ContentFolderQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentI18n.php.html b/documentation/api/files/Model.ContentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentI18nQuery.php.html b/documentation/api/files/Model.ContentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentImage.php.html b/documentation/api/files/Model.ContentImage.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentImageI18n.php.html b/documentation/api/files/Model.ContentImageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentImageI18nQuery.php.html b/documentation/api/files/Model.ContentImageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentImageQuery.php.html b/documentation/api/files/Model.ContentImageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentQuery.php.html b/documentation/api/files/Model.ContentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentVersion.php.html b/documentation/api/files/Model.ContentVersion.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ContentVersionQuery.php.html b/documentation/api/files/Model.ContentVersionQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Country.php.html b/documentation/api/files/Model.Country.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CountryI18n.php.html b/documentation/api/files/Model.CountryI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CountryI18nQuery.php.html b/documentation/api/files/Model.CountryI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CountryQuery.php.html b/documentation/api/files/Model.CountryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Coupon.php.html b/documentation/api/files/Model.Coupon.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CouponOrder.php.html b/documentation/api/files/Model.CouponOrder.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CouponOrderQuery.php.html b/documentation/api/files/Model.CouponOrderQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CouponQuery.php.html b/documentation/api/files/Model.CouponQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CouponRule.php.html b/documentation/api/files/Model.CouponRule.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CouponRuleQuery.php.html b/documentation/api/files/Model.CouponRuleQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Currency.php.html b/documentation/api/files/Model.Currency.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CurrencyI18n.php.html b/documentation/api/files/Model.CurrencyI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CurrencyI18nQuery.php.html b/documentation/api/files/Model.CurrencyI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CurrencyQuery.php.html b/documentation/api/files/Model.CurrencyQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Customer.php.html b/documentation/api/files/Model.Customer.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CustomerQuery.php.html b/documentation/api/files/Model.CustomerQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CustomerTitle.php.html b/documentation/api/files/Model.CustomerTitle.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CustomerTitleI18n.php.html b/documentation/api/files/Model.CustomerTitleI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CustomerTitleI18nQuery.php.html b/documentation/api/files/Model.CustomerTitleI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.CustomerTitleQuery.php.html b/documentation/api/files/Model.CustomerTitleQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Delivzone.php.html b/documentation/api/files/Model.Delivzone.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.DelivzoneQuery.php.html b/documentation/api/files/Model.DelivzoneQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Document.php.html b/documentation/api/files/Model.Document.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.DocumentI18n.php.html b/documentation/api/files/Model.DocumentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.DocumentI18nQuery.php.html b/documentation/api/files/Model.DocumentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.DocumentQuery.php.html b/documentation/api/files/Model.DocumentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Feature.php.html b/documentation/api/files/Model.Feature.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureAv.php.html b/documentation/api/files/Model.FeatureAv.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureAvI18n.php.html b/documentation/api/files/Model.FeatureAvI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureAvI18nQuery.php.html b/documentation/api/files/Model.FeatureAvI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureAvQuery.php.html b/documentation/api/files/Model.FeatureAvQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureCategory.php.html b/documentation/api/files/Model.FeatureCategory.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureCategoryQuery.php.html b/documentation/api/files/Model.FeatureCategoryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureI18n.php.html b/documentation/api/files/Model.FeatureI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureI18nQuery.php.html b/documentation/api/files/Model.FeatureI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureProduct.php.html b/documentation/api/files/Model.FeatureProduct.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureProductQuery.php.html b/documentation/api/files/Model.FeatureProductQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FeatureQuery.php.html b/documentation/api/files/Model.FeatureQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Folder.php.html b/documentation/api/files/Model.Folder.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderDocument.php.html b/documentation/api/files/Model.FolderDocument.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderDocumentI18n.php.html b/documentation/api/files/Model.FolderDocumentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderDocumentI18nQuery.php.html b/documentation/api/files/Model.FolderDocumentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderDocumentQuery.php.html b/documentation/api/files/Model.FolderDocumentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderI18n.php.html b/documentation/api/files/Model.FolderI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderI18nQuery.php.html b/documentation/api/files/Model.FolderI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderImage.php.html b/documentation/api/files/Model.FolderImage.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderImageI18n.php.html b/documentation/api/files/Model.FolderImageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderImageI18nQuery.php.html b/documentation/api/files/Model.FolderImageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderImageQuery.php.html b/documentation/api/files/Model.FolderImageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderQuery.php.html b/documentation/api/files/Model.FolderQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderVersion.php.html b/documentation/api/files/Model.FolderVersion.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.FolderVersionQuery.php.html b/documentation/api/files/Model.FolderVersionQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Group.php.html b/documentation/api/files/Model.Group.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.GroupI18n.php.html b/documentation/api/files/Model.GroupI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.GroupI18nQuery.php.html b/documentation/api/files/Model.GroupI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.GroupModule.php.html b/documentation/api/files/Model.GroupModule.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.GroupModuleQuery.php.html b/documentation/api/files/Model.GroupModuleQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.GroupQuery.php.html b/documentation/api/files/Model.GroupQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.GroupResource.php.html b/documentation/api/files/Model.GroupResource.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.GroupResourceQuery.php.html b/documentation/api/files/Model.GroupResourceQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Image.php.html b/documentation/api/files/Model.Image.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ImageI18n.php.html b/documentation/api/files/Model.ImageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ImageI18nQuery.php.html b/documentation/api/files/Model.ImageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ImageQuery.php.html b/documentation/api/files/Model.ImageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Lang.php.html b/documentation/api/files/Model.Lang.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.LangQuery.php.html b/documentation/api/files/Model.LangQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AccessoryTableMap.php.html b/documentation/api/files/Model.Map.AccessoryTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AddressTableMap.php.html b/documentation/api/files/Model.Map.AddressTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AdminGroupTableMap.php.html b/documentation/api/files/Model.Map.AdminGroupTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AdminLogTableMap.php.html b/documentation/api/files/Model.Map.AdminLogTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AdminTableMap.php.html b/documentation/api/files/Model.Map.AdminTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AreaTableMap.php.html b/documentation/api/files/Model.Map.AreaTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AttributeAvI18nTableMap.php.html b/documentation/api/files/Model.Map.AttributeAvI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AttributeAvTableMap.php.html b/documentation/api/files/Model.Map.AttributeAvTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AttributeCategoryTableMap.php.html b/documentation/api/files/Model.Map.AttributeCategoryTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AttributeCombinationTableMap.php.html b/documentation/api/files/Model.Map.AttributeCombinationTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AttributeI18nTableMap.php.html b/documentation/api/files/Model.Map.AttributeI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.AttributeTableMap.php.html b/documentation/api/files/Model.Map.AttributeTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CartItemTableMap.php.html b/documentation/api/files/Model.Map.CartItemTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CartTableMap.php.html b/documentation/api/files/Model.Map.CartTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CategoryDocumentI18nTableMap.php.html b/documentation/api/files/Model.Map.CategoryDocumentI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CategoryDocumentTableMap.php.html b/documentation/api/files/Model.Map.CategoryDocumentTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CategoryI18nTableMap.php.html b/documentation/api/files/Model.Map.CategoryI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CategoryImageI18nTableMap.php.html b/documentation/api/files/Model.Map.CategoryImageI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CategoryImageTableMap.php.html b/documentation/api/files/Model.Map.CategoryImageTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CategoryTableMap.php.html b/documentation/api/files/Model.Map.CategoryTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CategoryVersionTableMap.php.html b/documentation/api/files/Model.Map.CategoryVersionTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ConfigI18nTableMap.php.html b/documentation/api/files/Model.Map.ConfigI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ConfigTableMap.php.html b/documentation/api/files/Model.Map.ConfigTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ContentAssocTableMap.php.html b/documentation/api/files/Model.Map.ContentAssocTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ContentDocumentI18nTableMap.php.html b/documentation/api/files/Model.Map.ContentDocumentI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ContentDocumentTableMap.php.html b/documentation/api/files/Model.Map.ContentDocumentTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ContentFolderTableMap.php.html b/documentation/api/files/Model.Map.ContentFolderTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ContentI18nTableMap.php.html b/documentation/api/files/Model.Map.ContentI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ContentImageI18nTableMap.php.html b/documentation/api/files/Model.Map.ContentImageI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ContentImageTableMap.php.html b/documentation/api/files/Model.Map.ContentImageTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ContentTableMap.php.html b/documentation/api/files/Model.Map.ContentTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ContentVersionTableMap.php.html b/documentation/api/files/Model.Map.ContentVersionTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CountryI18nTableMap.php.html b/documentation/api/files/Model.Map.CountryI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CountryTableMap.php.html b/documentation/api/files/Model.Map.CountryTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CouponOrderTableMap.php.html b/documentation/api/files/Model.Map.CouponOrderTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CouponRuleTableMap.php.html b/documentation/api/files/Model.Map.CouponRuleTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CouponTableMap.php.html b/documentation/api/files/Model.Map.CouponTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CurrencyI18nTableMap.php.html b/documentation/api/files/Model.Map.CurrencyI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CurrencyTableMap.php.html b/documentation/api/files/Model.Map.CurrencyTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CustomerTableMap.php.html b/documentation/api/files/Model.Map.CustomerTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CustomerTitleI18nTableMap.php.html b/documentation/api/files/Model.Map.CustomerTitleI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.CustomerTitleTableMap.php.html b/documentation/api/files/Model.Map.CustomerTitleTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.DelivzoneTableMap.php.html b/documentation/api/files/Model.Map.DelivzoneTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.DocumentI18nTableMap.php.html b/documentation/api/files/Model.Map.DocumentI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.DocumentTableMap.php.html b/documentation/api/files/Model.Map.DocumentTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FeatureAvI18nTableMap.php.html b/documentation/api/files/Model.Map.FeatureAvI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FeatureAvTableMap.php.html b/documentation/api/files/Model.Map.FeatureAvTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FeatureCategoryTableMap.php.html b/documentation/api/files/Model.Map.FeatureCategoryTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FeatureI18nTableMap.php.html b/documentation/api/files/Model.Map.FeatureI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FeatureProductTableMap.php.html b/documentation/api/files/Model.Map.FeatureProductTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FeatureTableMap.php.html b/documentation/api/files/Model.Map.FeatureTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FolderDocumentI18nTableMap.php.html b/documentation/api/files/Model.Map.FolderDocumentI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FolderDocumentTableMap.php.html b/documentation/api/files/Model.Map.FolderDocumentTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FolderI18nTableMap.php.html b/documentation/api/files/Model.Map.FolderI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FolderImageI18nTableMap.php.html b/documentation/api/files/Model.Map.FolderImageI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FolderImageTableMap.php.html b/documentation/api/files/Model.Map.FolderImageTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FolderTableMap.php.html b/documentation/api/files/Model.Map.FolderTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.FolderVersionTableMap.php.html b/documentation/api/files/Model.Map.FolderVersionTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.GroupI18nTableMap.php.html b/documentation/api/files/Model.Map.GroupI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.GroupModuleTableMap.php.html b/documentation/api/files/Model.Map.GroupModuleTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.GroupResourceTableMap.php.html b/documentation/api/files/Model.Map.GroupResourceTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.GroupTableMap.php.html b/documentation/api/files/Model.Map.GroupTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ImageI18nTableMap.php.html b/documentation/api/files/Model.Map.ImageI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ImageTableMap.php.html b/documentation/api/files/Model.Map.ImageTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.LangTableMap.php.html b/documentation/api/files/Model.Map.LangTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.MessageI18nTableMap.php.html b/documentation/api/files/Model.Map.MessageI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.MessageTableMap.php.html b/documentation/api/files/Model.Map.MessageTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.MessageVersionTableMap.php.html b/documentation/api/files/Model.Map.MessageVersionTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ModuleI18nTableMap.php.html b/documentation/api/files/Model.Map.ModuleI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ModuleTableMap.php.html b/documentation/api/files/Model.Map.ModuleTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.OrderAddressTableMap.php.html b/documentation/api/files/Model.Map.OrderAddressTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.OrderFeatureTableMap.php.html b/documentation/api/files/Model.Map.OrderFeatureTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.OrderProductTableMap.php.html b/documentation/api/files/Model.Map.OrderProductTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.OrderStatusI18nTableMap.php.html b/documentation/api/files/Model.Map.OrderStatusI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.OrderStatusTableMap.php.html b/documentation/api/files/Model.Map.OrderStatusTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.OrderTableMap.php.html b/documentation/api/files/Model.Map.OrderTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ProductCategoryTableMap.php.html b/documentation/api/files/Model.Map.ProductCategoryTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ProductDocumentI18nTableMap.php.html b/documentation/api/files/Model.Map.ProductDocumentI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ProductDocumentTableMap.php.html b/documentation/api/files/Model.Map.ProductDocumentTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ProductI18nTableMap.php.html b/documentation/api/files/Model.Map.ProductI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ProductPriceTableMap.php.html b/documentation/api/files/Model.Map.ProductPriceTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ProductSaleElementsTableMap.php.html b/documentation/api/files/Model.Map.ProductSaleElementsTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ProductTableMap.php.html b/documentation/api/files/Model.Map.ProductTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ProductVersionTableMap.php.html b/documentation/api/files/Model.Map.ProductVersionTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ProdutImageI18nTableMap.php.html b/documentation/api/files/Model.Map.ProdutImageI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ProdutImageTableMap.php.html b/documentation/api/files/Model.Map.ProdutImageTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ResourceI18nTableMap.php.html b/documentation/api/files/Model.Map.ResourceI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.ResourceTableMap.php.html b/documentation/api/files/Model.Map.ResourceTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.RewritingTableMap.php.html b/documentation/api/files/Model.Map.RewritingTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.TaxI18nTableMap.php.html b/documentation/api/files/Model.Map.TaxI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.TaxRuleCountryTableMap.php.html b/documentation/api/files/Model.Map.TaxRuleCountryTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.TaxRuleI18nTableMap.php.html b/documentation/api/files/Model.Map.TaxRuleI18nTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.TaxRuleTableMap.php.html b/documentation/api/files/Model.Map.TaxRuleTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Map.TaxTableMap.php.html b/documentation/api/files/Model.Map.TaxTableMap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Message.php.html b/documentation/api/files/Model.Message.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.MessageI18n.php.html b/documentation/api/files/Model.MessageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.MessageI18nQuery.php.html b/documentation/api/files/Model.MessageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.MessageQuery.php.html b/documentation/api/files/Model.MessageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.MessageVersion.php.html b/documentation/api/files/Model.MessageVersion.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.MessageVersionQuery.php.html b/documentation/api/files/Model.MessageVersionQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Module.php.html b/documentation/api/files/Model.Module.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ModuleI18n.php.html b/documentation/api/files/Model.ModuleI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ModuleI18nQuery.php.html b/documentation/api/files/Model.ModuleI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ModuleQuery.php.html b/documentation/api/files/Model.ModuleQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Order.php.html b/documentation/api/files/Model.Order.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderAddress.php.html b/documentation/api/files/Model.OrderAddress.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderAddressQuery.php.html b/documentation/api/files/Model.OrderAddressQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderFeature.php.html b/documentation/api/files/Model.OrderFeature.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderFeatureQuery.php.html b/documentation/api/files/Model.OrderFeatureQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderProduct.php.html b/documentation/api/files/Model.OrderProduct.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderProductQuery.php.html b/documentation/api/files/Model.OrderProductQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderQuery.php.html b/documentation/api/files/Model.OrderQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderStatus.php.html b/documentation/api/files/Model.OrderStatus.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderStatusI18n.php.html b/documentation/api/files/Model.OrderStatusI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderStatusI18nQuery.php.html b/documentation/api/files/Model.OrderStatusI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.OrderStatusQuery.php.html b/documentation/api/files/Model.OrderStatusQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Product.php.html b/documentation/api/files/Model.Product.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductCategory.php.html b/documentation/api/files/Model.ProductCategory.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductCategoryQuery.php.html b/documentation/api/files/Model.ProductCategoryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductDocument.php.html b/documentation/api/files/Model.ProductDocument.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductDocumentI18n.php.html b/documentation/api/files/Model.ProductDocumentI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductDocumentI18nQuery.php.html b/documentation/api/files/Model.ProductDocumentI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductDocumentQuery.php.html b/documentation/api/files/Model.ProductDocumentQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductI18n.php.html b/documentation/api/files/Model.ProductI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductI18nQuery.php.html b/documentation/api/files/Model.ProductI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductPrice.php.html b/documentation/api/files/Model.ProductPrice.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductPriceQuery.php.html b/documentation/api/files/Model.ProductPriceQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductQuery.php.html b/documentation/api/files/Model.ProductQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductSaleElements.php.html b/documentation/api/files/Model.ProductSaleElements.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductSaleElementsQuery.php.html b/documentation/api/files/Model.ProductSaleElementsQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductVersion.php.html b/documentation/api/files/Model.ProductVersion.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProductVersionQuery.php.html b/documentation/api/files/Model.ProductVersionQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProdutImage.php.html b/documentation/api/files/Model.ProdutImage.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProdutImageI18n.php.html b/documentation/api/files/Model.ProdutImageI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProdutImageI18nQuery.php.html b/documentation/api/files/Model.ProdutImageI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ProdutImageQuery.php.html b/documentation/api/files/Model.ProdutImageQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Resource.php.html b/documentation/api/files/Model.Resource.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ResourceI18n.php.html b/documentation/api/files/Model.ResourceI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ResourceI18nQuery.php.html b/documentation/api/files/Model.ResourceI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.ResourceQuery.php.html b/documentation/api/files/Model.ResourceQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Rewriting.php.html b/documentation/api/files/Model.Rewriting.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.RewritingQuery.php.html b/documentation/api/files/Model.RewritingQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.Tax.php.html b/documentation/api/files/Model.Tax.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.TaxI18n.php.html b/documentation/api/files/Model.TaxI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.TaxI18nQuery.php.html b/documentation/api/files/Model.TaxI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.TaxQuery.php.html b/documentation/api/files/Model.TaxQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.TaxRule.php.html b/documentation/api/files/Model.TaxRule.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.TaxRuleCountry.php.html b/documentation/api/files/Model.TaxRuleCountry.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.TaxRuleCountryQuery.php.html b/documentation/api/files/Model.TaxRuleCountryQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.TaxRuleI18n.php.html b/documentation/api/files/Model.TaxRuleI18n.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.TaxRuleI18nQuery.php.html b/documentation/api/files/Model.TaxRuleI18nQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model.TaxRuleQuery.php.html b/documentation/api/files/Model.TaxRuleQuery.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Accessory.php.txt b/documentation/api/files/Model/Accessory.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AccessoryQuery.php.txt b/documentation/api/files/Model/AccessoryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Address.php.txt b/documentation/api/files/Model/Address.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AddressQuery.php.txt b/documentation/api/files/Model/AddressQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Admin.php.txt b/documentation/api/files/Model/Admin.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AdminGroup.php.txt b/documentation/api/files/Model/AdminGroup.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AdminGroupQuery.php.txt b/documentation/api/files/Model/AdminGroupQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AdminLog.php.txt b/documentation/api/files/Model/AdminLog.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AdminLogQuery.php.txt b/documentation/api/files/Model/AdminLogQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AdminQuery.php.txt b/documentation/api/files/Model/AdminQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Area.php.txt b/documentation/api/files/Model/Area.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AreaQuery.php.txt b/documentation/api/files/Model/AreaQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Attribute.php.txt b/documentation/api/files/Model/Attribute.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeAv.php.txt b/documentation/api/files/Model/AttributeAv.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeAvI18n.php.txt b/documentation/api/files/Model/AttributeAvI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeAvI18nQuery.php.txt b/documentation/api/files/Model/AttributeAvI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeAvQuery.php.txt b/documentation/api/files/Model/AttributeAvQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeCategory.php.txt b/documentation/api/files/Model/AttributeCategory.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeCategoryQuery.php.txt b/documentation/api/files/Model/AttributeCategoryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeCombination.php.txt b/documentation/api/files/Model/AttributeCombination.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeCombinationQuery.php.txt b/documentation/api/files/Model/AttributeCombinationQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeI18n.php.txt b/documentation/api/files/Model/AttributeI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeI18nQuery.php.txt b/documentation/api/files/Model/AttributeI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/AttributeQuery.php.txt b/documentation/api/files/Model/AttributeQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Accessory.php.txt b/documentation/api/files/Model/Base/Accessory.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AccessoryQuery.php.txt b/documentation/api/files/Model/Base/AccessoryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Address.php.txt b/documentation/api/files/Model/Base/Address.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AddressQuery.php.txt b/documentation/api/files/Model/Base/AddressQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Admin.php.txt b/documentation/api/files/Model/Base/Admin.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AdminGroup.php.txt b/documentation/api/files/Model/Base/AdminGroup.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AdminGroupQuery.php.txt b/documentation/api/files/Model/Base/AdminGroupQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AdminLog.php.txt b/documentation/api/files/Model/Base/AdminLog.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AdminLogQuery.php.txt b/documentation/api/files/Model/Base/AdminLogQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AdminQuery.php.txt b/documentation/api/files/Model/Base/AdminQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Area.php.txt b/documentation/api/files/Model/Base/Area.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AreaQuery.php.txt b/documentation/api/files/Model/Base/AreaQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Attribute.php.txt b/documentation/api/files/Model/Base/Attribute.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeAv.php.txt b/documentation/api/files/Model/Base/AttributeAv.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeAvI18n.php.txt b/documentation/api/files/Model/Base/AttributeAvI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeAvI18nQuery.php.txt b/documentation/api/files/Model/Base/AttributeAvI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeAvQuery.php.txt b/documentation/api/files/Model/Base/AttributeAvQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeCategory.php.txt b/documentation/api/files/Model/Base/AttributeCategory.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeCategoryQuery.php.txt b/documentation/api/files/Model/Base/AttributeCategoryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeCombination.php.txt b/documentation/api/files/Model/Base/AttributeCombination.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeCombinationQuery.php.txt b/documentation/api/files/Model/Base/AttributeCombinationQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeI18n.php.txt b/documentation/api/files/Model/Base/AttributeI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeI18nQuery.php.txt b/documentation/api/files/Model/Base/AttributeI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/AttributeQuery.php.txt b/documentation/api/files/Model/Base/AttributeQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Cart.php.txt b/documentation/api/files/Model/Base/Cart.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CartItem.php.txt b/documentation/api/files/Model/Base/CartItem.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CartItemQuery.php.txt b/documentation/api/files/Model/Base/CartItemQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CartQuery.php.txt b/documentation/api/files/Model/Base/CartQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Category.php.txt b/documentation/api/files/Model/Base/Category.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryDocument.php.txt b/documentation/api/files/Model/Base/CategoryDocument.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryDocumentI18n.php.txt b/documentation/api/files/Model/Base/CategoryDocumentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryDocumentI18nQuery.php.txt b/documentation/api/files/Model/Base/CategoryDocumentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryDocumentQuery.php.txt b/documentation/api/files/Model/Base/CategoryDocumentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryI18n.php.txt b/documentation/api/files/Model/Base/CategoryI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryI18nQuery.php.txt b/documentation/api/files/Model/Base/CategoryI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryImage.php.txt b/documentation/api/files/Model/Base/CategoryImage.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryImageI18n.php.txt b/documentation/api/files/Model/Base/CategoryImageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryImageI18nQuery.php.txt b/documentation/api/files/Model/Base/CategoryImageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryImageQuery.php.txt b/documentation/api/files/Model/Base/CategoryImageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryQuery.php.txt b/documentation/api/files/Model/Base/CategoryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryVersion.php.txt b/documentation/api/files/Model/Base/CategoryVersion.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CategoryVersionQuery.php.txt b/documentation/api/files/Model/Base/CategoryVersionQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Config.php.txt b/documentation/api/files/Model/Base/Config.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ConfigI18n.php.txt b/documentation/api/files/Model/Base/ConfigI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ConfigI18nQuery.php.txt b/documentation/api/files/Model/Base/ConfigI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ConfigQuery.php.txt b/documentation/api/files/Model/Base/ConfigQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Content.php.txt b/documentation/api/files/Model/Base/Content.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentAssoc.php.txt b/documentation/api/files/Model/Base/ContentAssoc.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentAssocQuery.php.txt b/documentation/api/files/Model/Base/ContentAssocQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentDocument.php.txt b/documentation/api/files/Model/Base/ContentDocument.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentDocumentI18n.php.txt b/documentation/api/files/Model/Base/ContentDocumentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentDocumentI18nQuery.php.txt b/documentation/api/files/Model/Base/ContentDocumentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentDocumentQuery.php.txt b/documentation/api/files/Model/Base/ContentDocumentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentFolder.php.txt b/documentation/api/files/Model/Base/ContentFolder.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentFolderQuery.php.txt b/documentation/api/files/Model/Base/ContentFolderQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentI18n.php.txt b/documentation/api/files/Model/Base/ContentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentI18nQuery.php.txt b/documentation/api/files/Model/Base/ContentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentImage.php.txt b/documentation/api/files/Model/Base/ContentImage.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentImageI18n.php.txt b/documentation/api/files/Model/Base/ContentImageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentImageI18nQuery.php.txt b/documentation/api/files/Model/Base/ContentImageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentImageQuery.php.txt b/documentation/api/files/Model/Base/ContentImageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentQuery.php.txt b/documentation/api/files/Model/Base/ContentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentVersion.php.txt b/documentation/api/files/Model/Base/ContentVersion.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ContentVersionQuery.php.txt b/documentation/api/files/Model/Base/ContentVersionQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Country.php.txt b/documentation/api/files/Model/Base/Country.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CountryI18n.php.txt b/documentation/api/files/Model/Base/CountryI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CountryI18nQuery.php.txt b/documentation/api/files/Model/Base/CountryI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CountryQuery.php.txt b/documentation/api/files/Model/Base/CountryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Coupon.php.txt b/documentation/api/files/Model/Base/Coupon.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CouponOrder.php.txt b/documentation/api/files/Model/Base/CouponOrder.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CouponOrderQuery.php.txt b/documentation/api/files/Model/Base/CouponOrderQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CouponQuery.php.txt b/documentation/api/files/Model/Base/CouponQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CouponRule.php.txt b/documentation/api/files/Model/Base/CouponRule.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CouponRuleQuery.php.txt b/documentation/api/files/Model/Base/CouponRuleQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Currency.php.txt b/documentation/api/files/Model/Base/Currency.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CurrencyI18n.php.txt b/documentation/api/files/Model/Base/CurrencyI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CurrencyI18nQuery.php.txt b/documentation/api/files/Model/Base/CurrencyI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CurrencyQuery.php.txt b/documentation/api/files/Model/Base/CurrencyQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Customer.php.txt b/documentation/api/files/Model/Base/Customer.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CustomerQuery.php.txt b/documentation/api/files/Model/Base/CustomerQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CustomerTitle.php.txt b/documentation/api/files/Model/Base/CustomerTitle.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CustomerTitleI18n.php.txt b/documentation/api/files/Model/Base/CustomerTitleI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CustomerTitleI18nQuery.php.txt b/documentation/api/files/Model/Base/CustomerTitleI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/CustomerTitleQuery.php.txt b/documentation/api/files/Model/Base/CustomerTitleQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Delivzone.php.txt b/documentation/api/files/Model/Base/Delivzone.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/DelivzoneQuery.php.txt b/documentation/api/files/Model/Base/DelivzoneQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Document.php.txt b/documentation/api/files/Model/Base/Document.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/DocumentI18n.php.txt b/documentation/api/files/Model/Base/DocumentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/DocumentI18nQuery.php.txt b/documentation/api/files/Model/Base/DocumentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/DocumentQuery.php.txt b/documentation/api/files/Model/Base/DocumentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Feature.php.txt b/documentation/api/files/Model/Base/Feature.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureAv.php.txt b/documentation/api/files/Model/Base/FeatureAv.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureAvI18n.php.txt b/documentation/api/files/Model/Base/FeatureAvI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureAvI18nQuery.php.txt b/documentation/api/files/Model/Base/FeatureAvI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureAvQuery.php.txt b/documentation/api/files/Model/Base/FeatureAvQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureCategory.php.txt b/documentation/api/files/Model/Base/FeatureCategory.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureCategoryQuery.php.txt b/documentation/api/files/Model/Base/FeatureCategoryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureI18n.php.txt b/documentation/api/files/Model/Base/FeatureI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureI18nQuery.php.txt b/documentation/api/files/Model/Base/FeatureI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureProduct.php.txt b/documentation/api/files/Model/Base/FeatureProduct.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureProductQuery.php.txt b/documentation/api/files/Model/Base/FeatureProductQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FeatureQuery.php.txt b/documentation/api/files/Model/Base/FeatureQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Folder.php.txt b/documentation/api/files/Model/Base/Folder.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderDocument.php.txt b/documentation/api/files/Model/Base/FolderDocument.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderDocumentI18n.php.txt b/documentation/api/files/Model/Base/FolderDocumentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderDocumentI18nQuery.php.txt b/documentation/api/files/Model/Base/FolderDocumentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderDocumentQuery.php.txt b/documentation/api/files/Model/Base/FolderDocumentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderI18n.php.txt b/documentation/api/files/Model/Base/FolderI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderI18nQuery.php.txt b/documentation/api/files/Model/Base/FolderI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderImage.php.txt b/documentation/api/files/Model/Base/FolderImage.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderImageI18n.php.txt b/documentation/api/files/Model/Base/FolderImageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderImageI18nQuery.php.txt b/documentation/api/files/Model/Base/FolderImageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderImageQuery.php.txt b/documentation/api/files/Model/Base/FolderImageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderQuery.php.txt b/documentation/api/files/Model/Base/FolderQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderVersion.php.txt b/documentation/api/files/Model/Base/FolderVersion.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/FolderVersionQuery.php.txt b/documentation/api/files/Model/Base/FolderVersionQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Group.php.txt b/documentation/api/files/Model/Base/Group.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/GroupI18n.php.txt b/documentation/api/files/Model/Base/GroupI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/GroupI18nQuery.php.txt b/documentation/api/files/Model/Base/GroupI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/GroupModule.php.txt b/documentation/api/files/Model/Base/GroupModule.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/GroupModuleQuery.php.txt b/documentation/api/files/Model/Base/GroupModuleQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/GroupQuery.php.txt b/documentation/api/files/Model/Base/GroupQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/GroupResource.php.txt b/documentation/api/files/Model/Base/GroupResource.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/GroupResourceQuery.php.txt b/documentation/api/files/Model/Base/GroupResourceQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Image.php.txt b/documentation/api/files/Model/Base/Image.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ImageI18n.php.txt b/documentation/api/files/Model/Base/ImageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ImageI18nQuery.php.txt b/documentation/api/files/Model/Base/ImageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ImageQuery.php.txt b/documentation/api/files/Model/Base/ImageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Lang.php.txt b/documentation/api/files/Model/Base/Lang.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/LangQuery.php.txt b/documentation/api/files/Model/Base/LangQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Message.php.txt b/documentation/api/files/Model/Base/Message.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/MessageI18n.php.txt b/documentation/api/files/Model/Base/MessageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/MessageI18nQuery.php.txt b/documentation/api/files/Model/Base/MessageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/MessageQuery.php.txt b/documentation/api/files/Model/Base/MessageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/MessageVersion.php.txt b/documentation/api/files/Model/Base/MessageVersion.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/MessageVersionQuery.php.txt b/documentation/api/files/Model/Base/MessageVersionQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Module.php.txt b/documentation/api/files/Model/Base/Module.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ModuleI18n.php.txt b/documentation/api/files/Model/Base/ModuleI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ModuleI18nQuery.php.txt b/documentation/api/files/Model/Base/ModuleI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ModuleQuery.php.txt b/documentation/api/files/Model/Base/ModuleQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Order.php.txt b/documentation/api/files/Model/Base/Order.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderAddress.php.txt b/documentation/api/files/Model/Base/OrderAddress.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderAddressQuery.php.txt b/documentation/api/files/Model/Base/OrderAddressQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderFeature.php.txt b/documentation/api/files/Model/Base/OrderFeature.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderFeatureQuery.php.txt b/documentation/api/files/Model/Base/OrderFeatureQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderProduct.php.txt b/documentation/api/files/Model/Base/OrderProduct.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderProductQuery.php.txt b/documentation/api/files/Model/Base/OrderProductQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderQuery.php.txt b/documentation/api/files/Model/Base/OrderQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderStatus.php.txt b/documentation/api/files/Model/Base/OrderStatus.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderStatusI18n.php.txt b/documentation/api/files/Model/Base/OrderStatusI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderStatusI18nQuery.php.txt b/documentation/api/files/Model/Base/OrderStatusI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/OrderStatusQuery.php.txt b/documentation/api/files/Model/Base/OrderStatusQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Product.php.txt b/documentation/api/files/Model/Base/Product.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductCategory.php.txt b/documentation/api/files/Model/Base/ProductCategory.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductCategoryQuery.php.txt b/documentation/api/files/Model/Base/ProductCategoryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductDocument.php.txt b/documentation/api/files/Model/Base/ProductDocument.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductDocumentI18n.php.txt b/documentation/api/files/Model/Base/ProductDocumentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductDocumentI18nQuery.php.txt b/documentation/api/files/Model/Base/ProductDocumentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductDocumentQuery.php.txt b/documentation/api/files/Model/Base/ProductDocumentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductI18n.php.txt b/documentation/api/files/Model/Base/ProductI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductI18nQuery.php.txt b/documentation/api/files/Model/Base/ProductI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductPrice.php.txt b/documentation/api/files/Model/Base/ProductPrice.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductPriceQuery.php.txt b/documentation/api/files/Model/Base/ProductPriceQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductQuery.php.txt b/documentation/api/files/Model/Base/ProductQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductSaleElements.php.txt b/documentation/api/files/Model/Base/ProductSaleElements.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductSaleElementsQuery.php.txt b/documentation/api/files/Model/Base/ProductSaleElementsQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductVersion.php.txt b/documentation/api/files/Model/Base/ProductVersion.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProductVersionQuery.php.txt b/documentation/api/files/Model/Base/ProductVersionQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProdutImage.php.txt b/documentation/api/files/Model/Base/ProdutImage.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProdutImageI18n.php.txt b/documentation/api/files/Model/Base/ProdutImageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProdutImageI18nQuery.php.txt b/documentation/api/files/Model/Base/ProdutImageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ProdutImageQuery.php.txt b/documentation/api/files/Model/Base/ProdutImageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Resource.php.txt b/documentation/api/files/Model/Base/Resource.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ResourceI18n.php.txt b/documentation/api/files/Model/Base/ResourceI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ResourceI18nQuery.php.txt b/documentation/api/files/Model/Base/ResourceI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/ResourceQuery.php.txt b/documentation/api/files/Model/Base/ResourceQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Rewriting.php.txt b/documentation/api/files/Model/Base/Rewriting.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/RewritingQuery.php.txt b/documentation/api/files/Model/Base/RewritingQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/Tax.php.txt b/documentation/api/files/Model/Base/Tax.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/TaxI18n.php.txt b/documentation/api/files/Model/Base/TaxI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/TaxI18nQuery.php.txt b/documentation/api/files/Model/Base/TaxI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/TaxQuery.php.txt b/documentation/api/files/Model/Base/TaxQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/TaxRule.php.txt b/documentation/api/files/Model/Base/TaxRule.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/TaxRuleCountry.php.txt b/documentation/api/files/Model/Base/TaxRuleCountry.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/TaxRuleCountryQuery.php.txt b/documentation/api/files/Model/Base/TaxRuleCountryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/TaxRuleI18n.php.txt b/documentation/api/files/Model/Base/TaxRuleI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/TaxRuleI18nQuery.php.txt b/documentation/api/files/Model/Base/TaxRuleI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Base/TaxRuleQuery.php.txt b/documentation/api/files/Model/Base/TaxRuleQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Cart.php.txt b/documentation/api/files/Model/Cart.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CartItem.php.txt b/documentation/api/files/Model/CartItem.php.txt old mode 100644 new mode 100755 index a9671b57b..d956fd25d --- a/documentation/api/files/Model/CartItem.php.txt +++ b/documentation/api/files/Model/CartItem.php.txt @@ -32,7 +32,7 @@ class CartItem extends BaseCartItem if ($this->dispatcher) { $cartEvent = new CartEvent($this->getCart()); - $this->dispatcher->dispatch(TheliaEvents::AFTER_CARTCHANGEITEM, $cartEvent); + $this->dispatcher->dispatch(TheliaEvents::AFTER_CARTUPDATEITEM, $cartEvent); } } diff --git a/documentation/api/files/Model/CartItemQuery.php.txt b/documentation/api/files/Model/CartItemQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CartQuery.php.txt b/documentation/api/files/Model/CartQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Category.php.txt b/documentation/api/files/Model/Category.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryDocument.php.txt b/documentation/api/files/Model/CategoryDocument.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryDocumentI18n.php.txt b/documentation/api/files/Model/CategoryDocumentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryDocumentI18nQuery.php.txt b/documentation/api/files/Model/CategoryDocumentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryDocumentQuery.php.txt b/documentation/api/files/Model/CategoryDocumentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryI18n.php.txt b/documentation/api/files/Model/CategoryI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryI18nQuery.php.txt b/documentation/api/files/Model/CategoryI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryImage.php.txt b/documentation/api/files/Model/CategoryImage.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryImageI18n.php.txt b/documentation/api/files/Model/CategoryImageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryImageI18nQuery.php.txt b/documentation/api/files/Model/CategoryImageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryImageQuery.php.txt b/documentation/api/files/Model/CategoryImageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryQuery.php.txt b/documentation/api/files/Model/CategoryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryVersion.php.txt b/documentation/api/files/Model/CategoryVersion.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CategoryVersionQuery.php.txt b/documentation/api/files/Model/CategoryVersionQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Config.php.txt b/documentation/api/files/Model/Config.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ConfigI18n.php.txt b/documentation/api/files/Model/ConfigI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ConfigI18nQuery.php.txt b/documentation/api/files/Model/ConfigI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ConfigQuery.php.txt b/documentation/api/files/Model/ConfigQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Content.php.txt b/documentation/api/files/Model/Content.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentAssoc.php.txt b/documentation/api/files/Model/ContentAssoc.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentAssocQuery.php.txt b/documentation/api/files/Model/ContentAssocQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentDocument.php.txt b/documentation/api/files/Model/ContentDocument.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentDocumentI18n.php.txt b/documentation/api/files/Model/ContentDocumentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentDocumentI18nQuery.php.txt b/documentation/api/files/Model/ContentDocumentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentDocumentQuery.php.txt b/documentation/api/files/Model/ContentDocumentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentFolder.php.txt b/documentation/api/files/Model/ContentFolder.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentFolderQuery.php.txt b/documentation/api/files/Model/ContentFolderQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentI18n.php.txt b/documentation/api/files/Model/ContentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentI18nQuery.php.txt b/documentation/api/files/Model/ContentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentImage.php.txt b/documentation/api/files/Model/ContentImage.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentImageI18n.php.txt b/documentation/api/files/Model/ContentImageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentImageI18nQuery.php.txt b/documentation/api/files/Model/ContentImageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentImageQuery.php.txt b/documentation/api/files/Model/ContentImageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentQuery.php.txt b/documentation/api/files/Model/ContentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentVersion.php.txt b/documentation/api/files/Model/ContentVersion.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ContentVersionQuery.php.txt b/documentation/api/files/Model/ContentVersionQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Country.php.txt b/documentation/api/files/Model/Country.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CountryI18n.php.txt b/documentation/api/files/Model/CountryI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CountryI18nQuery.php.txt b/documentation/api/files/Model/CountryI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CountryQuery.php.txt b/documentation/api/files/Model/CountryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Coupon.php.txt b/documentation/api/files/Model/Coupon.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CouponOrder.php.txt b/documentation/api/files/Model/CouponOrder.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CouponOrderQuery.php.txt b/documentation/api/files/Model/CouponOrderQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CouponQuery.php.txt b/documentation/api/files/Model/CouponQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CouponRule.php.txt b/documentation/api/files/Model/CouponRule.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CouponRuleQuery.php.txt b/documentation/api/files/Model/CouponRuleQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Currency.php.txt b/documentation/api/files/Model/Currency.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CurrencyI18n.php.txt b/documentation/api/files/Model/CurrencyI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CurrencyI18nQuery.php.txt b/documentation/api/files/Model/CurrencyI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CurrencyQuery.php.txt b/documentation/api/files/Model/CurrencyQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Customer.php.txt b/documentation/api/files/Model/Customer.php.txt old mode 100644 new mode 100755 index cbd507bf4..a220fd0c8 --- a/documentation/api/files/Model/Customer.php.txt +++ b/documentation/api/files/Model/Customer.php.txt @@ -125,7 +125,7 @@ class Customer extends BaseCustomer implements UserInterface public function preUpdate(ConnectionInterface $con = null) { $customerEvent = new CustomerEvent($this); - $this->dispatchEvent(TheliaEvents::BEFORE_CHANGECUSTOMER, $customerEvent); + $this->dispatchEvent(TheliaEvents::BEFORE_UPDATECUSTOMER, $customerEvent); return true; } @@ -133,7 +133,7 @@ class Customer extends BaseCustomer implements UserInterface public function postUpdate(ConnectionInterface $con = null) { $customerEvent = new CustomerEvent($this); - $this->dispatchEvent(TheliaEvents::AFTER_CHANGECUSTOMER, $customerEvent); + $this->dispatchEvent(TheliaEvents::AFTER_UPDATECUSTOMER, $customerEvent); } protected function dispatchEvent($eventName, CustomerEvent $customerEvent) diff --git a/documentation/api/files/Model/CustomerQuery.php.txt b/documentation/api/files/Model/CustomerQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CustomerTitle.php.txt b/documentation/api/files/Model/CustomerTitle.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CustomerTitleI18n.php.txt b/documentation/api/files/Model/CustomerTitleI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CustomerTitleI18nQuery.php.txt b/documentation/api/files/Model/CustomerTitleI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/CustomerTitleQuery.php.txt b/documentation/api/files/Model/CustomerTitleQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Delivzone.php.txt b/documentation/api/files/Model/Delivzone.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/DelivzoneQuery.php.txt b/documentation/api/files/Model/DelivzoneQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Document.php.txt b/documentation/api/files/Model/Document.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/DocumentI18n.php.txt b/documentation/api/files/Model/DocumentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/DocumentI18nQuery.php.txt b/documentation/api/files/Model/DocumentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/DocumentQuery.php.txt b/documentation/api/files/Model/DocumentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Feature.php.txt b/documentation/api/files/Model/Feature.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureAv.php.txt b/documentation/api/files/Model/FeatureAv.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureAvI18n.php.txt b/documentation/api/files/Model/FeatureAvI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureAvI18nQuery.php.txt b/documentation/api/files/Model/FeatureAvI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureAvQuery.php.txt b/documentation/api/files/Model/FeatureAvQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureCategory.php.txt b/documentation/api/files/Model/FeatureCategory.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureCategoryQuery.php.txt b/documentation/api/files/Model/FeatureCategoryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureI18n.php.txt b/documentation/api/files/Model/FeatureI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureI18nQuery.php.txt b/documentation/api/files/Model/FeatureI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureProduct.php.txt b/documentation/api/files/Model/FeatureProduct.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureProductQuery.php.txt b/documentation/api/files/Model/FeatureProductQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FeatureQuery.php.txt b/documentation/api/files/Model/FeatureQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Folder.php.txt b/documentation/api/files/Model/Folder.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderDocument.php.txt b/documentation/api/files/Model/FolderDocument.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderDocumentI18n.php.txt b/documentation/api/files/Model/FolderDocumentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderDocumentI18nQuery.php.txt b/documentation/api/files/Model/FolderDocumentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderDocumentQuery.php.txt b/documentation/api/files/Model/FolderDocumentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderI18n.php.txt b/documentation/api/files/Model/FolderI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderI18nQuery.php.txt b/documentation/api/files/Model/FolderI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderImage.php.txt b/documentation/api/files/Model/FolderImage.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderImageI18n.php.txt b/documentation/api/files/Model/FolderImageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderImageI18nQuery.php.txt b/documentation/api/files/Model/FolderImageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderImageQuery.php.txt b/documentation/api/files/Model/FolderImageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderQuery.php.txt b/documentation/api/files/Model/FolderQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderVersion.php.txt b/documentation/api/files/Model/FolderVersion.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/FolderVersionQuery.php.txt b/documentation/api/files/Model/FolderVersionQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Group.php.txt b/documentation/api/files/Model/Group.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/GroupI18n.php.txt b/documentation/api/files/Model/GroupI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/GroupI18nQuery.php.txt b/documentation/api/files/Model/GroupI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/GroupModule.php.txt b/documentation/api/files/Model/GroupModule.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/GroupModuleQuery.php.txt b/documentation/api/files/Model/GroupModuleQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/GroupQuery.php.txt b/documentation/api/files/Model/GroupQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/GroupResource.php.txt b/documentation/api/files/Model/GroupResource.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/GroupResourceQuery.php.txt b/documentation/api/files/Model/GroupResourceQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Image.php.txt b/documentation/api/files/Model/Image.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ImageI18n.php.txt b/documentation/api/files/Model/ImageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ImageI18nQuery.php.txt b/documentation/api/files/Model/ImageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ImageQuery.php.txt b/documentation/api/files/Model/ImageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Lang.php.txt b/documentation/api/files/Model/Lang.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/LangQuery.php.txt b/documentation/api/files/Model/LangQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AccessoryTableMap.php.txt b/documentation/api/files/Model/Map/AccessoryTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AddressTableMap.php.txt b/documentation/api/files/Model/Map/AddressTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AdminGroupTableMap.php.txt b/documentation/api/files/Model/Map/AdminGroupTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AdminLogTableMap.php.txt b/documentation/api/files/Model/Map/AdminLogTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AdminTableMap.php.txt b/documentation/api/files/Model/Map/AdminTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AreaTableMap.php.txt b/documentation/api/files/Model/Map/AreaTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AttributeAvI18nTableMap.php.txt b/documentation/api/files/Model/Map/AttributeAvI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AttributeAvTableMap.php.txt b/documentation/api/files/Model/Map/AttributeAvTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AttributeCategoryTableMap.php.txt b/documentation/api/files/Model/Map/AttributeCategoryTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AttributeCombinationTableMap.php.txt b/documentation/api/files/Model/Map/AttributeCombinationTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AttributeI18nTableMap.php.txt b/documentation/api/files/Model/Map/AttributeI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/AttributeTableMap.php.txt b/documentation/api/files/Model/Map/AttributeTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CartItemTableMap.php.txt b/documentation/api/files/Model/Map/CartItemTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CartTableMap.php.txt b/documentation/api/files/Model/Map/CartTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CategoryDocumentI18nTableMap.php.txt b/documentation/api/files/Model/Map/CategoryDocumentI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CategoryDocumentTableMap.php.txt b/documentation/api/files/Model/Map/CategoryDocumentTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CategoryI18nTableMap.php.txt b/documentation/api/files/Model/Map/CategoryI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CategoryImageI18nTableMap.php.txt b/documentation/api/files/Model/Map/CategoryImageI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CategoryImageTableMap.php.txt b/documentation/api/files/Model/Map/CategoryImageTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CategoryTableMap.php.txt b/documentation/api/files/Model/Map/CategoryTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CategoryVersionTableMap.php.txt b/documentation/api/files/Model/Map/CategoryVersionTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ConfigI18nTableMap.php.txt b/documentation/api/files/Model/Map/ConfigI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ConfigTableMap.php.txt b/documentation/api/files/Model/Map/ConfigTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ContentAssocTableMap.php.txt b/documentation/api/files/Model/Map/ContentAssocTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ContentDocumentI18nTableMap.php.txt b/documentation/api/files/Model/Map/ContentDocumentI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ContentDocumentTableMap.php.txt b/documentation/api/files/Model/Map/ContentDocumentTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ContentFolderTableMap.php.txt b/documentation/api/files/Model/Map/ContentFolderTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ContentI18nTableMap.php.txt b/documentation/api/files/Model/Map/ContentI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ContentImageI18nTableMap.php.txt b/documentation/api/files/Model/Map/ContentImageI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ContentImageTableMap.php.txt b/documentation/api/files/Model/Map/ContentImageTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ContentTableMap.php.txt b/documentation/api/files/Model/Map/ContentTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ContentVersionTableMap.php.txt b/documentation/api/files/Model/Map/ContentVersionTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CountryI18nTableMap.php.txt b/documentation/api/files/Model/Map/CountryI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CountryTableMap.php.txt b/documentation/api/files/Model/Map/CountryTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CouponOrderTableMap.php.txt b/documentation/api/files/Model/Map/CouponOrderTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CouponRuleTableMap.php.txt b/documentation/api/files/Model/Map/CouponRuleTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CouponTableMap.php.txt b/documentation/api/files/Model/Map/CouponTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CurrencyI18nTableMap.php.txt b/documentation/api/files/Model/Map/CurrencyI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CurrencyTableMap.php.txt b/documentation/api/files/Model/Map/CurrencyTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CustomerTableMap.php.txt b/documentation/api/files/Model/Map/CustomerTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CustomerTitleI18nTableMap.php.txt b/documentation/api/files/Model/Map/CustomerTitleI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/CustomerTitleTableMap.php.txt b/documentation/api/files/Model/Map/CustomerTitleTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/DelivzoneTableMap.php.txt b/documentation/api/files/Model/Map/DelivzoneTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/DocumentI18nTableMap.php.txt b/documentation/api/files/Model/Map/DocumentI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/DocumentTableMap.php.txt b/documentation/api/files/Model/Map/DocumentTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FeatureAvI18nTableMap.php.txt b/documentation/api/files/Model/Map/FeatureAvI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FeatureAvTableMap.php.txt b/documentation/api/files/Model/Map/FeatureAvTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FeatureCategoryTableMap.php.txt b/documentation/api/files/Model/Map/FeatureCategoryTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FeatureI18nTableMap.php.txt b/documentation/api/files/Model/Map/FeatureI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FeatureProductTableMap.php.txt b/documentation/api/files/Model/Map/FeatureProductTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FeatureTableMap.php.txt b/documentation/api/files/Model/Map/FeatureTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FolderDocumentI18nTableMap.php.txt b/documentation/api/files/Model/Map/FolderDocumentI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FolderDocumentTableMap.php.txt b/documentation/api/files/Model/Map/FolderDocumentTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FolderI18nTableMap.php.txt b/documentation/api/files/Model/Map/FolderI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FolderImageI18nTableMap.php.txt b/documentation/api/files/Model/Map/FolderImageI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FolderImageTableMap.php.txt b/documentation/api/files/Model/Map/FolderImageTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FolderTableMap.php.txt b/documentation/api/files/Model/Map/FolderTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/FolderVersionTableMap.php.txt b/documentation/api/files/Model/Map/FolderVersionTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/GroupI18nTableMap.php.txt b/documentation/api/files/Model/Map/GroupI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/GroupModuleTableMap.php.txt b/documentation/api/files/Model/Map/GroupModuleTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/GroupResourceTableMap.php.txt b/documentation/api/files/Model/Map/GroupResourceTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/GroupTableMap.php.txt b/documentation/api/files/Model/Map/GroupTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ImageI18nTableMap.php.txt b/documentation/api/files/Model/Map/ImageI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ImageTableMap.php.txt b/documentation/api/files/Model/Map/ImageTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/LangTableMap.php.txt b/documentation/api/files/Model/Map/LangTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/MessageI18nTableMap.php.txt b/documentation/api/files/Model/Map/MessageI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/MessageTableMap.php.txt b/documentation/api/files/Model/Map/MessageTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/MessageVersionTableMap.php.txt b/documentation/api/files/Model/Map/MessageVersionTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ModuleI18nTableMap.php.txt b/documentation/api/files/Model/Map/ModuleI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ModuleTableMap.php.txt b/documentation/api/files/Model/Map/ModuleTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/OrderAddressTableMap.php.txt b/documentation/api/files/Model/Map/OrderAddressTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/OrderFeatureTableMap.php.txt b/documentation/api/files/Model/Map/OrderFeatureTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/OrderProductTableMap.php.txt b/documentation/api/files/Model/Map/OrderProductTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/OrderStatusI18nTableMap.php.txt b/documentation/api/files/Model/Map/OrderStatusI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/OrderStatusTableMap.php.txt b/documentation/api/files/Model/Map/OrderStatusTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/OrderTableMap.php.txt b/documentation/api/files/Model/Map/OrderTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ProductCategoryTableMap.php.txt b/documentation/api/files/Model/Map/ProductCategoryTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ProductDocumentI18nTableMap.php.txt b/documentation/api/files/Model/Map/ProductDocumentI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ProductDocumentTableMap.php.txt b/documentation/api/files/Model/Map/ProductDocumentTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ProductI18nTableMap.php.txt b/documentation/api/files/Model/Map/ProductI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ProductPriceTableMap.php.txt b/documentation/api/files/Model/Map/ProductPriceTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ProductSaleElementsTableMap.php.txt b/documentation/api/files/Model/Map/ProductSaleElementsTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ProductTableMap.php.txt b/documentation/api/files/Model/Map/ProductTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ProductVersionTableMap.php.txt b/documentation/api/files/Model/Map/ProductVersionTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ProdutImageI18nTableMap.php.txt b/documentation/api/files/Model/Map/ProdutImageI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ProdutImageTableMap.php.txt b/documentation/api/files/Model/Map/ProdutImageTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ResourceI18nTableMap.php.txt b/documentation/api/files/Model/Map/ResourceI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/ResourceTableMap.php.txt b/documentation/api/files/Model/Map/ResourceTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/RewritingTableMap.php.txt b/documentation/api/files/Model/Map/RewritingTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/TaxI18nTableMap.php.txt b/documentation/api/files/Model/Map/TaxI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/TaxRuleCountryTableMap.php.txt b/documentation/api/files/Model/Map/TaxRuleCountryTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/TaxRuleI18nTableMap.php.txt b/documentation/api/files/Model/Map/TaxRuleI18nTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/TaxRuleTableMap.php.txt b/documentation/api/files/Model/Map/TaxRuleTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Map/TaxTableMap.php.txt b/documentation/api/files/Model/Map/TaxTableMap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Message.php.txt b/documentation/api/files/Model/Message.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/MessageI18n.php.txt b/documentation/api/files/Model/MessageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/MessageI18nQuery.php.txt b/documentation/api/files/Model/MessageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/MessageQuery.php.txt b/documentation/api/files/Model/MessageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/MessageVersion.php.txt b/documentation/api/files/Model/MessageVersion.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/MessageVersionQuery.php.txt b/documentation/api/files/Model/MessageVersionQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Module.php.txt b/documentation/api/files/Model/Module.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ModuleI18n.php.txt b/documentation/api/files/Model/ModuleI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ModuleI18nQuery.php.txt b/documentation/api/files/Model/ModuleI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ModuleQuery.php.txt b/documentation/api/files/Model/ModuleQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Order.php.txt b/documentation/api/files/Model/Order.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderAddress.php.txt b/documentation/api/files/Model/OrderAddress.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderAddressQuery.php.txt b/documentation/api/files/Model/OrderAddressQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderFeature.php.txt b/documentation/api/files/Model/OrderFeature.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderFeatureQuery.php.txt b/documentation/api/files/Model/OrderFeatureQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderProduct.php.txt b/documentation/api/files/Model/OrderProduct.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderProductQuery.php.txt b/documentation/api/files/Model/OrderProductQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderQuery.php.txt b/documentation/api/files/Model/OrderQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderStatus.php.txt b/documentation/api/files/Model/OrderStatus.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderStatusI18n.php.txt b/documentation/api/files/Model/OrderStatusI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderStatusI18nQuery.php.txt b/documentation/api/files/Model/OrderStatusI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/OrderStatusQuery.php.txt b/documentation/api/files/Model/OrderStatusQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Product.php.txt b/documentation/api/files/Model/Product.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductCategory.php.txt b/documentation/api/files/Model/ProductCategory.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductCategoryQuery.php.txt b/documentation/api/files/Model/ProductCategoryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductDocument.php.txt b/documentation/api/files/Model/ProductDocument.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductDocumentI18n.php.txt b/documentation/api/files/Model/ProductDocumentI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductDocumentI18nQuery.php.txt b/documentation/api/files/Model/ProductDocumentI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductDocumentQuery.php.txt b/documentation/api/files/Model/ProductDocumentQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductI18n.php.txt b/documentation/api/files/Model/ProductI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductI18nQuery.php.txt b/documentation/api/files/Model/ProductI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductPrice.php.txt b/documentation/api/files/Model/ProductPrice.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductPriceQuery.php.txt b/documentation/api/files/Model/ProductPriceQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductQuery.php.txt b/documentation/api/files/Model/ProductQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductSaleElements.php.txt b/documentation/api/files/Model/ProductSaleElements.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductSaleElementsQuery.php.txt b/documentation/api/files/Model/ProductSaleElementsQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductVersion.php.txt b/documentation/api/files/Model/ProductVersion.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProductVersionQuery.php.txt b/documentation/api/files/Model/ProductVersionQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProdutImage.php.txt b/documentation/api/files/Model/ProdutImage.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProdutImageI18n.php.txt b/documentation/api/files/Model/ProdutImageI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProdutImageI18nQuery.php.txt b/documentation/api/files/Model/ProdutImageI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ProdutImageQuery.php.txt b/documentation/api/files/Model/ProdutImageQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Resource.php.txt b/documentation/api/files/Model/Resource.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ResourceI18n.php.txt b/documentation/api/files/Model/ResourceI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ResourceI18nQuery.php.txt b/documentation/api/files/Model/ResourceI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/ResourceQuery.php.txt b/documentation/api/files/Model/ResourceQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Rewriting.php.txt b/documentation/api/files/Model/Rewriting.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/RewritingQuery.php.txt b/documentation/api/files/Model/RewritingQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/Tax.php.txt b/documentation/api/files/Model/Tax.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/TaxI18n.php.txt b/documentation/api/files/Model/TaxI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/TaxI18nQuery.php.txt b/documentation/api/files/Model/TaxI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/TaxQuery.php.txt b/documentation/api/files/Model/TaxQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/TaxRule.php.txt b/documentation/api/files/Model/TaxRule.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/TaxRuleCountry.php.txt b/documentation/api/files/Model/TaxRuleCountry.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/TaxRuleCountryQuery.php.txt b/documentation/api/files/Model/TaxRuleCountryQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/TaxRuleI18n.php.txt b/documentation/api/files/Model/TaxRuleI18n.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/TaxRuleI18nQuery.php.txt b/documentation/api/files/Model/TaxRuleI18nQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Model/TaxRuleQuery.php.txt b/documentation/api/files/Model/TaxRuleQuery.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Module.BaseModule.php.html b/documentation/api/files/Module.BaseModule.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Module/BaseModule.php.txt b/documentation/api/files/Module/BaseModule.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Routing.Matcher.DefaultMatcher.php.html b/documentation/api/files/Routing.Matcher.DefaultMatcher.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Routing.NullUrlGenerator.php.html b/documentation/api/files/Routing.NullUrlGenerator.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Routing.TheliaMatcherCollection.php.html b/documentation/api/files/Routing.TheliaMatcherCollection.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Routing/Matcher/DefaultMatcher.php.txt b/documentation/api/files/Routing/Matcher/DefaultMatcher.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Routing/NullUrlGenerator.php.txt b/documentation/api/files/Routing/NullUrlGenerator.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Routing/TheliaMatcherCollection.php.txt b/documentation/api/files/Routing/TheliaMatcherCollection.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Action.CartTest.php.html b/documentation/api/files/Tests.Action.CartTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Command.BaseCommandTest.php.html b/documentation/api/files/Tests.Command.BaseCommandTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Command.CacheClearTest.php.html b/documentation/api/files/Tests.Command.CacheClearTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Command.ModuleGenerateCommandTest.php.html b/documentation/api/files/Tests.Command.ModuleGenerateCommandTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Controller.DefaultControllerTest.php.html b/documentation/api/files/Tests.Controller.DefaultControllerTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.HttpFoundation.RequestTest.php.html b/documentation/api/files/Tests.Core.HttpFoundation.RequestTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.HttpFoundation.Session.SessionTest.php.html b/documentation/api/files/Tests.Core.HttpFoundation.Session.SessionTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Element.BaseLoopTestor.php.html b/documentation/api/files/Tests.Core.Template.Element.BaseLoopTestor.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.AccessoryTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.AccessoryTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.AddressTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.AddressTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.Argument.ArgumentCollectionTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.Argument.ArgumentCollectionTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.CategoryTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.CategoryTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.ContentTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.ContentTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.CountryTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.CountryTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.CustomerTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.CustomerTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.FeatureAvailableTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.FeatureAvailableTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.FeatureTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.FeatureTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.FeatureValueTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.FeatureValueTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.FolderTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.FolderTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.ProductTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.ProductTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Core.Template.Loop.TitleTest.php.html b/documentation/api/files/Tests.Core.Template.Loop.TitleTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Fixtures.Dumper.Config.Empty.php.html b/documentation/api/files/Tests.Fixtures.Dumper.Config.Empty.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Form.CartAddTest.php.html b/documentation/api/files/Tests.Form.CartAddTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Log.TlogTest.php.html b/documentation/api/files/Tests.Log.TlogTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.AlphaNumStringListTypeTest.php.html b/documentation/api/files/Tests.Type.AlphaNumStringListTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.AlphaNumStringTypeTest.php.html b/documentation/api/files/Tests.Type.AlphaNumStringTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.AnyTypeTest.php.html b/documentation/api/files/Tests.Type.AnyTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.BooleanTypeTest.php.html b/documentation/api/files/Tests.Type.BooleanTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.EnumListTypeTest.php.html b/documentation/api/files/Tests.Type.EnumListTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.EnumTypeTest.php.html b/documentation/api/files/Tests.Type.EnumTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.FloatTypeTest.php.html b/documentation/api/files/Tests.Type.FloatTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.IntListTypeTest.php.html b/documentation/api/files/Tests.Type.IntListTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.IntToCombinedIntsListTypeTest.php.html b/documentation/api/files/Tests.Type.IntToCombinedIntsListTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.IntToCombinedStringsListTypeTest.php.html b/documentation/api/files/Tests.Type.IntToCombinedStringsListTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.IntTypeTest.php.html b/documentation/api/files/Tests.Type.IntTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.JsonTypeTest.php.html b/documentation/api/files/Tests.Type.JsonTypeTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.Type.TypeCollectionTest.php.html b/documentation/api/files/Tests.Type.TypeCollectionTest.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests.bootstrap.php.html b/documentation/api/files/Tests.bootstrap.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Action/CartTest.php.txt b/documentation/api/files/Tests/Action/CartTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Command/BaseCommandTest.php.txt b/documentation/api/files/Tests/Command/BaseCommandTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Command/CacheClearTest.php.txt b/documentation/api/files/Tests/Command/CacheClearTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Command/ModuleGenerateCommandTest.php.txt b/documentation/api/files/Tests/Command/ModuleGenerateCommandTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Controller/DefaultControllerTest.php.txt b/documentation/api/files/Tests/Controller/DefaultControllerTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/HttpFoundation/RequestTest.php.txt b/documentation/api/files/Tests/Core/HttpFoundation/RequestTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/HttpFoundation/Session/SessionTest.php.txt b/documentation/api/files/Tests/Core/HttpFoundation/Session/SessionTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Element/BaseLoopTestor.php.txt b/documentation/api/files/Tests/Core/Template/Element/BaseLoopTestor.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/AccessoryTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/AccessoryTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/AddressTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/AddressTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/Argument/ArgumentCollectionTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/Argument/ArgumentCollectionTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/CategoryTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/CategoryTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/ContentTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/ContentTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/CountryTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/CountryTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/CustomerTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/CustomerTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/FeatureAvailableTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/FeatureAvailableTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/FeatureTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/FeatureTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/FeatureValueTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/FeatureValueTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/FolderTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/FolderTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/ProductTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/ProductTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Core/Template/Loop/TitleTest.php.txt b/documentation/api/files/Tests/Core/Template/Loop/TitleTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Fixtures/Dumper/Config/Empty.php.txt b/documentation/api/files/Tests/Fixtures/Dumper/Config/Empty.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Form/CartAddTest.php.txt b/documentation/api/files/Tests/Form/CartAddTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Log/TlogTest.php.txt b/documentation/api/files/Tests/Log/TlogTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/AlphaNumStringListTypeTest.php.txt b/documentation/api/files/Tests/Type/AlphaNumStringListTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/AlphaNumStringTypeTest.php.txt b/documentation/api/files/Tests/Type/AlphaNumStringTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/AnyTypeTest.php.txt b/documentation/api/files/Tests/Type/AnyTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/BooleanTypeTest.php.txt b/documentation/api/files/Tests/Type/BooleanTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/EnumListTypeTest.php.txt b/documentation/api/files/Tests/Type/EnumListTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/EnumTypeTest.php.txt b/documentation/api/files/Tests/Type/EnumTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/FloatTypeTest.php.txt b/documentation/api/files/Tests/Type/FloatTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/IntListTypeTest.php.txt b/documentation/api/files/Tests/Type/IntListTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/IntToCombinedIntsListTypeTest.php.txt b/documentation/api/files/Tests/Type/IntToCombinedIntsListTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/IntToCombinedStringsListTypeTest.php.txt b/documentation/api/files/Tests/Type/IntToCombinedStringsListTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/IntTypeTest.php.txt b/documentation/api/files/Tests/Type/IntTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/JsonTypeTest.php.txt b/documentation/api/files/Tests/Type/JsonTypeTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/Type/TypeCollectionTest.php.txt b/documentation/api/files/Tests/Type/TypeCollectionTest.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tests/bootstrap.php.txt b/documentation/api/files/Tests/bootstrap.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tools.DIGenerator.php.html b/documentation/api/files/Tools.DIGenerator.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tools.Redirect.php.html b/documentation/api/files/Tools.Redirect.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tools.URL.php.html b/documentation/api/files/Tools.URL.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tools/DIGenerator.php.txt b/documentation/api/files/Tools/DIGenerator.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tools/Redirect.php.txt b/documentation/api/files/Tools/Redirect.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Tools/URL.php.txt b/documentation/api/files/Tools/URL.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.AlphaNumStringListType.php.html b/documentation/api/files/Type.AlphaNumStringListType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.AlphaNumStringType.php.html b/documentation/api/files/Type.AlphaNumStringType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.AnyType.php.html b/documentation/api/files/Type.AnyType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.BooleanOrBothType.php.html b/documentation/api/files/Type.BooleanOrBothType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.BooleanType.php.html b/documentation/api/files/Type.BooleanType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.EnumListType.php.html b/documentation/api/files/Type.EnumListType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.EnumType.php.html b/documentation/api/files/Type.EnumType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.FloatType.php.html b/documentation/api/files/Type.FloatType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.IntListType.php.html b/documentation/api/files/Type.IntListType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.IntToCombinedIntsListType.php.html b/documentation/api/files/Type.IntToCombinedIntsListType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.IntToCombinedStringsListType.php.html b/documentation/api/files/Type.IntToCombinedStringsListType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.IntType.php.html b/documentation/api/files/Type.IntType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.JsonType.php.html b/documentation/api/files/Type.JsonType.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.TypeCollection.php.html b/documentation/api/files/Type.TypeCollection.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type.TypeInterface.php.html b/documentation/api/files/Type.TypeInterface.php.html old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/AlphaNumStringListType.php.txt b/documentation/api/files/Type/AlphaNumStringListType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/AlphaNumStringType.php.txt b/documentation/api/files/Type/AlphaNumStringType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/AnyType.php.txt b/documentation/api/files/Type/AnyType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/BooleanOrBothType.php.txt b/documentation/api/files/Type/BooleanOrBothType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/BooleanType.php.txt b/documentation/api/files/Type/BooleanType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/EnumListType.php.txt b/documentation/api/files/Type/EnumListType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/EnumType.php.txt b/documentation/api/files/Type/EnumType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/FloatType.php.txt b/documentation/api/files/Type/FloatType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/IntListType.php.txt b/documentation/api/files/Type/IntListType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/IntToCombinedIntsListType.php.txt b/documentation/api/files/Type/IntToCombinedIntsListType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/IntToCombinedStringsListType.php.txt b/documentation/api/files/Type/IntToCombinedStringsListType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/IntType.php.txt b/documentation/api/files/Type/IntType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/JsonType.php.txt b/documentation/api/files/Type/JsonType.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/TypeCollection.php.txt b/documentation/api/files/Type/TypeCollection.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/files/Type/TypeInterface.php.txt b/documentation/api/files/Type/TypeInterface.php.txt old mode 100644 new mode 100755 diff --git a/documentation/api/graphs/class.html b/documentation/api/graphs/class.html old mode 100644 new mode 100755 diff --git a/documentation/api/graphs/classes.svg b/documentation/api/graphs/classes.svg old mode 100644 new mode 100755 diff --git a/documentation/api/images/custom-icons.svg b/documentation/api/images/custom-icons.svg old mode 100644 new mode 100755 diff --git a/documentation/api/images/hierarchy-item.png b/documentation/api/images/hierarchy-item.png old mode 100644 new mode 100755 diff --git a/documentation/api/images/icon-class-13x13.png b/documentation/api/images/icon-class-13x13.png old mode 100644 new mode 100755 diff --git a/documentation/api/images/icon-class.svg b/documentation/api/images/icon-class.svg old mode 100644 new mode 100755 diff --git a/documentation/api/images/icon-interface-13x13.png b/documentation/api/images/icon-interface-13x13.png old mode 100644 new mode 100755 diff --git a/documentation/api/images/icon-interface.svg b/documentation/api/images/icon-interface.svg old mode 100644 new mode 100755 diff --git a/documentation/api/images/icon-trait-13x13.png b/documentation/api/images/icon-trait-13x13.png old mode 100644 new mode 100755 diff --git a/documentation/api/images/icon-trait.svg b/documentation/api/images/icon-trait.svg old mode 100644 new mode 100755 diff --git a/documentation/api/images/iviewer/grab.cur b/documentation/api/images/iviewer/grab.cur old mode 100644 new mode 100755 diff --git a/documentation/api/images/iviewer/hand.cur b/documentation/api/images/iviewer/hand.cur old mode 100644 new mode 100755 diff --git a/documentation/api/images/iviewer/iviewer.rotate_left.png b/documentation/api/images/iviewer/iviewer.rotate_left.png old mode 100644 new mode 100755 diff --git a/documentation/api/images/iviewer/iviewer.rotate_right.png b/documentation/api/images/iviewer/iviewer.rotate_right.png old mode 100644 new mode 100755 diff --git a/documentation/api/images/iviewer/iviewer.zoom_fit.png b/documentation/api/images/iviewer/iviewer.zoom_fit.png old mode 100644 new mode 100755 diff --git a/documentation/api/images/iviewer/iviewer.zoom_in.png b/documentation/api/images/iviewer/iviewer.zoom_in.png old mode 100644 new mode 100755 diff --git a/documentation/api/images/iviewer/iviewer.zoom_out.png b/documentation/api/images/iviewer/iviewer.zoom_out.png old mode 100644 new mode 100755 diff --git a/documentation/api/images/iviewer/iviewer.zoom_zero.png b/documentation/api/images/iviewer/iviewer.zoom_zero.png old mode 100644 new mode 100755 diff --git a/documentation/api/index.html b/documentation/api/index.html old mode 100644 new mode 100755 diff --git a/documentation/api/js/jquery.dotdotdot-1.5.9.js b/documentation/api/js/jquery.dotdotdot-1.5.9.js old mode 100644 new mode 100755 diff --git a/documentation/api/js/jquery.dotdotdot-1.5.9.min.js b/documentation/api/js/jquery.dotdotdot-1.5.9.min.js old mode 100644 new mode 100755 diff --git a/documentation/api/js/jquery.iviewer.js b/documentation/api/js/jquery.iviewer.js old mode 100644 new mode 100755 diff --git a/documentation/api/js/jquery.iviewer.min.js b/documentation/api/js/jquery.iviewer.min.js old mode 100644 new mode 100755 diff --git a/documentation/api/js/jquery.smooth-scroll.js b/documentation/api/js/jquery.smooth-scroll.js old mode 100644 new mode 100755 diff --git a/documentation/api/js/prism.min.js b/documentation/api/js/prism.min.js old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Action.Exception.html b/documentation/api/namespaces/Thelia.Action.Exception.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Action.html b/documentation/api/namespaces/Thelia.Action.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Admin.Controller.html b/documentation/api/namespaces/Thelia.Admin.Controller.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Admin.html b/documentation/api/namespaces/Thelia.Admin.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Cart.html b/documentation/api/namespaces/Thelia.Cart.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Command.Output.html b/documentation/api/namespaces/Thelia.Command.Output.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Command.html b/documentation/api/namespaces/Thelia.Command.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Config.html b/documentation/api/namespaces/Thelia.Config.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Controller.Admin.html b/documentation/api/namespaces/Thelia.Controller.Admin.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Controller.Front.html b/documentation/api/namespaces/Thelia.Controller.Front.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Controller.html b/documentation/api/namespaces/Thelia.Controller.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Bundle.html b/documentation/api/namespaces/Thelia.Core.Bundle.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Controller.html b/documentation/api/namespaces/Thelia.Core.Controller.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.DependencyInjection.Compiler.html b/documentation/api/namespaces/Thelia.Core.DependencyInjection.Compiler.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.DependencyInjection.Loader.html b/documentation/api/namespaces/Thelia.Core.DependencyInjection.Loader.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.DependencyInjection.html b/documentation/api/namespaces/Thelia.Core.DependencyInjection.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Event.Internal.html b/documentation/api/namespaces/Thelia.Core.Event.Internal.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Event.html b/documentation/api/namespaces/Thelia.Core.Event.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.EventListener.html b/documentation/api/namespaces/Thelia.Core.EventListener.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Factory.html b/documentation/api/namespaces/Thelia.Core.Factory.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.HttpFoundation.Session.html b/documentation/api/namespaces/Thelia.Core.HttpFoundation.Session.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.HttpFoundation.html b/documentation/api/namespaces/Thelia.Core.HttpFoundation.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Security.Authentication.html b/documentation/api/namespaces/Thelia.Core.Security.Authentication.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Security.Exception.html b/documentation/api/namespaces/Thelia.Core.Security.Exception.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Security.Role.html b/documentation/api/namespaces/Thelia.Core.Security.Role.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Security.User.html b/documentation/api/namespaces/Thelia.Core.Security.User.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Security.UserProvider.html b/documentation/api/namespaces/Thelia.Core.Security.UserProvider.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Security.html b/documentation/api/namespaces/Thelia.Core.Security.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Template.Assets.html b/documentation/api/namespaces/Thelia.Core.Template.Assets.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Template.Element.Exception.html b/documentation/api/namespaces/Thelia.Core.Template.Element.Exception.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Template.Element.html b/documentation/api/namespaces/Thelia.Core.Template.Element.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Template.Exception.html b/documentation/api/namespaces/Thelia.Core.Template.Exception.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Template.Loop.Argument.html b/documentation/api/namespaces/Thelia.Core.Template.Loop.Argument.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Template.Loop.html b/documentation/api/namespaces/Thelia.Core.Template.Loop.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Template.Smarty.Assets.html b/documentation/api/namespaces/Thelia.Core.Template.Smarty.Assets.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Template.Smarty.Plugins.html b/documentation/api/namespaces/Thelia.Core.Template.Smarty.Plugins.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Template.Smarty.html b/documentation/api/namespaces/Thelia.Core.Template.Smarty.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Template.html b/documentation/api/namespaces/Thelia.Core.Template.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.Translation.html b/documentation/api/namespaces/Thelia.Core.Translation.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Core.html b/documentation/api/namespaces/Thelia.Core.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Exception.html b/documentation/api/namespaces/Thelia.Exception.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Form.Exception.html b/documentation/api/namespaces/Thelia.Form.Exception.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Form.html b/documentation/api/namespaces/Thelia.Form.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Log.Destination.html b/documentation/api/namespaces/Thelia.Log.Destination.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Log.html b/documentation/api/namespaces/Thelia.Log.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Model.Base.html b/documentation/api/namespaces/Thelia.Model.Base.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Model.Map.html b/documentation/api/namespaces/Thelia.Model.Map.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Model.html b/documentation/api/namespaces/Thelia.Model.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Module.html b/documentation/api/namespaces/Thelia.Module.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Routing.Matcher.html b/documentation/api/namespaces/Thelia.Routing.Matcher.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Routing.html b/documentation/api/namespaces/Thelia.Routing.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Action.html b/documentation/api/namespaces/Thelia.Tests.Action.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Command.html b/documentation/api/namespaces/Thelia.Tests.Command.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Controller.html b/documentation/api/namespaces/Thelia.Tests.Controller.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Core.HttpFoundation.Session.html b/documentation/api/namespaces/Thelia.Tests.Core.HttpFoundation.Session.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Core.HttpFoundation.html b/documentation/api/namespaces/Thelia.Tests.Core.HttpFoundation.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Core.Template.Element.html b/documentation/api/namespaces/Thelia.Tests.Core.Template.Element.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Core.Template.Loop.Argument.html b/documentation/api/namespaces/Thelia.Tests.Core.Template.Loop.Argument.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Core.Template.Loop.html b/documentation/api/namespaces/Thelia.Tests.Core.Template.Loop.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Core.Template.html b/documentation/api/namespaces/Thelia.Tests.Core.Template.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Core.html b/documentation/api/namespaces/Thelia.Tests.Core.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Form.html b/documentation/api/namespaces/Thelia.Tests.Form.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Log.html b/documentation/api/namespaces/Thelia.Tests.Log.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.Type.html b/documentation/api/namespaces/Thelia.Tests.Type.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tests.html b/documentation/api/namespaces/Thelia.Tests.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Tools.html b/documentation/api/namespaces/Thelia.Tools.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.Type.html b/documentation/api/namespaces/Thelia.Type.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/Thelia.html b/documentation/api/namespaces/Thelia.html old mode 100644 new mode 100755 diff --git a/documentation/api/namespaces/default.html b/documentation/api/namespaces/default.html old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-00/phpdoc-cache-file_007c3bb64d311faf7b3af44f513afd49.dat b/documentation/api/phpdoc-cache-00/phpdoc-cache-file_007c3bb64d311faf7b3af44f513afd49.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-02/phpdoc-cache-file_8589c108990567af521e7b3e51f77d8a.dat b/documentation/api/phpdoc-cache-02/phpdoc-cache-file_8589c108990567af521e7b3e51f77d8a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-02/phpdoc-cache-file_c2ccd8cde1815369a971dd2d774a0aa0.dat b/documentation/api/phpdoc-cache-02/phpdoc-cache-file_c2ccd8cde1815369a971dd2d774a0aa0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-02/phpdoc-cache-file_f7de1bcdc77f5b83713f7f3e93219e70.dat b/documentation/api/phpdoc-cache-02/phpdoc-cache-file_f7de1bcdc77f5b83713f7f3e93219e70.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-03/phpdoc-cache-file_edb862076d215e36dfca0891f00fc575.dat b/documentation/api/phpdoc-cache-03/phpdoc-cache-file_edb862076d215e36dfca0891f00fc575.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-04/phpdoc-cache-file_02a4cd7773a663b82b05fdb6ab9748de.dat b/documentation/api/phpdoc-cache-04/phpdoc-cache-file_02a4cd7773a663b82b05fdb6ab9748de.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-04/phpdoc-cache-file_cd2041a3024f3db333cc5dc6930bba3b.dat b/documentation/api/phpdoc-cache-04/phpdoc-cache-file_cd2041a3024f3db333cc5dc6930bba3b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-05/phpdoc-cache-file_48335b8369f8c636f866ba3a78c0f2e7.dat b/documentation/api/phpdoc-cache-05/phpdoc-cache-file_48335b8369f8c636f866ba3a78c0f2e7.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-05/phpdoc-cache-file_8733bf9c10c8c5d0ce0f2986f52af691.dat b/documentation/api/phpdoc-cache-05/phpdoc-cache-file_8733bf9c10c8c5d0ce0f2986f52af691.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-06/phpdoc-cache-file_66101ffbb95ea22acece75477b7c6995.dat b/documentation/api/phpdoc-cache-06/phpdoc-cache-file_66101ffbb95ea22acece75477b7c6995.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-07/phpdoc-cache-file_840be1506d7d8c9bc54aad3836e03123.dat b/documentation/api/phpdoc-cache-07/phpdoc-cache-file_840be1506d7d8c9bc54aad3836e03123.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-07/phpdoc-cache-file_8f65df88030079ab966184cbe3b51bb6.dat b/documentation/api/phpdoc-cache-07/phpdoc-cache-file_8f65df88030079ab966184cbe3b51bb6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-07/phpdoc-cache-file_b40aa4d6b97462338a43dfa8ef7e0ee4.dat b/documentation/api/phpdoc-cache-07/phpdoc-cache-file_b40aa4d6b97462338a43dfa8ef7e0ee4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-08/phpdoc-cache-file_1087120621c80fac3eb8b1f74ac8e198.dat b/documentation/api/phpdoc-cache-08/phpdoc-cache-file_1087120621c80fac3eb8b1f74ac8e198.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-08/phpdoc-cache-file_208bd17a2e490939724ebd6ac358068d.dat b/documentation/api/phpdoc-cache-08/phpdoc-cache-file_208bd17a2e490939724ebd6ac358068d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-08/phpdoc-cache-file_4ae0fdb79fcff88cd55b8b32b242ec1f.dat b/documentation/api/phpdoc-cache-08/phpdoc-cache-file_4ae0fdb79fcff88cd55b8b32b242ec1f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-08/phpdoc-cache-file_77bb00d82f83ed03f3a8dd8cfc57f9f8.dat b/documentation/api/phpdoc-cache-08/phpdoc-cache-file_77bb00d82f83ed03f3a8dd8cfc57f9f8.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-09/phpdoc-cache-file_f03f85432c229c41192cf77386c6c0fe.dat b/documentation/api/phpdoc-cache-09/phpdoc-cache-file_f03f85432c229c41192cf77386c6c0fe.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0a/phpdoc-cache-file_ec74aa3c754aab4aa58521fb2102d3b0.dat b/documentation/api/phpdoc-cache-0a/phpdoc-cache-file_ec74aa3c754aab4aa58521fb2102d3b0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0b/phpdoc-cache-file_32c9f993ba4d278f85efbdac57d30c1b.dat b/documentation/api/phpdoc-cache-0b/phpdoc-cache-file_32c9f993ba4d278f85efbdac57d30c1b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0b/phpdoc-cache-file_9c72276e4908e46c0dec9978b8b5cddb.dat b/documentation/api/phpdoc-cache-0b/phpdoc-cache-file_9c72276e4908e46c0dec9978b8b5cddb.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0c/phpdoc-cache-file_4b8812e4b5893c77f56c77b4244cc938.dat b/documentation/api/phpdoc-cache-0c/phpdoc-cache-file_4b8812e4b5893c77f56c77b4244cc938.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0c/phpdoc-cache-file_e360bebb106038147f90bf36e8194297.dat b/documentation/api/phpdoc-cache-0c/phpdoc-cache-file_e360bebb106038147f90bf36e8194297.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0d/phpdoc-cache-file_0ac3d73432ee6c86992d5ce1aa0a67fe.dat b/documentation/api/phpdoc-cache-0d/phpdoc-cache-file_0ac3d73432ee6c86992d5ce1aa0a67fe.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0e/phpdoc-cache-file_1fd70654fce80b0cf821bb92f22100cf.dat b/documentation/api/phpdoc-cache-0e/phpdoc-cache-file_1fd70654fce80b0cf821bb92f22100cf.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_164c99e0c1ede045082637b4c747b436.dat b/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_164c99e0c1ede045082637b4c747b436.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_1953985a3525df93e823df8b44d4968c.dat b/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_1953985a3525df93e823df8b44d4968c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_1b08c470dd5373a284c3d48f4db96b6f.dat b/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_1b08c470dd5373a284c3d48f4db96b6f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_59f22dc3c945aad705920f7ca4f24bb1.dat b/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_59f22dc3c945aad705920f7ca4f24bb1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_73436a3bfabf5f0bd98a790f42f54aeb.dat b/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_73436a3bfabf5f0bd98a790f42f54aeb.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_b726bad3b6173152da2c4adc230a6ed4.dat b/documentation/api/phpdoc-cache-0f/phpdoc-cache-file_b726bad3b6173152da2c4adc230a6ed4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-10/phpdoc-cache-file_06cf5c3cb19b3ad30571950d2d303ed9.dat b/documentation/api/phpdoc-cache-10/phpdoc-cache-file_06cf5c3cb19b3ad30571950d2d303ed9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-10/phpdoc-cache-file_1baa6542d148740a50a83f2e03494b29.dat b/documentation/api/phpdoc-cache-10/phpdoc-cache-file_1baa6542d148740a50a83f2e03494b29.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-10/phpdoc-cache-file_4c972dd78ef8615a8fe7064206c0f7da.dat b/documentation/api/phpdoc-cache-10/phpdoc-cache-file_4c972dd78ef8615a8fe7064206c0f7da.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-12/phpdoc-cache-file_423bcb863236e25b6968be0f947839b1.dat b/documentation/api/phpdoc-cache-12/phpdoc-cache-file_423bcb863236e25b6968be0f947839b1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-12/phpdoc-cache-file_67da6e2c41cb6983c153c5bbc0a4844f.dat b/documentation/api/phpdoc-cache-12/phpdoc-cache-file_67da6e2c41cb6983c153c5bbc0a4844f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-12/phpdoc-cache-file_73cb9bcdb5fb3f022e87b077ce42cae8.dat b/documentation/api/phpdoc-cache-12/phpdoc-cache-file_73cb9bcdb5fb3f022e87b077ce42cae8.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-12/phpdoc-cache-file_7ea795bdfba26bfd84728522e727320f.dat b/documentation/api/phpdoc-cache-12/phpdoc-cache-file_7ea795bdfba26bfd84728522e727320f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-12/phpdoc-cache-file_c22215188659362a17f2908e7bea8f11.dat b/documentation/api/phpdoc-cache-12/phpdoc-cache-file_c22215188659362a17f2908e7bea8f11.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-12/phpdoc-cache-file_dc149dc573e50faeb3da9859cf04a31f.dat b/documentation/api/phpdoc-cache-12/phpdoc-cache-file_dc149dc573e50faeb3da9859cf04a31f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-13/phpdoc-cache-file_7fe91ec10843f4507f7878a39358cffa.dat b/documentation/api/phpdoc-cache-13/phpdoc-cache-file_7fe91ec10843f4507f7878a39358cffa.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-13/phpdoc-cache-file_ab126bb3cedc6631c061cdc45a714a7f.dat b/documentation/api/phpdoc-cache-13/phpdoc-cache-file_ab126bb3cedc6631c061cdc45a714a7f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-13/phpdoc-cache-file_cae089a89773b716bb85d15995252fbc.dat b/documentation/api/phpdoc-cache-13/phpdoc-cache-file_cae089a89773b716bb85d15995252fbc.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-14/phpdoc-cache-file_4f877978a45801d997d90a5d3da160b6.dat b/documentation/api/phpdoc-cache-14/phpdoc-cache-file_4f877978a45801d997d90a5d3da160b6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-15/phpdoc-cache-file_2968679d28f091e8e25cc2d6629cba72.dat b/documentation/api/phpdoc-cache-15/phpdoc-cache-file_2968679d28f091e8e25cc2d6629cba72.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-15/phpdoc-cache-file_30b7c0c468e4270820a643e5e3172315.dat b/documentation/api/phpdoc-cache-15/phpdoc-cache-file_30b7c0c468e4270820a643e5e3172315.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-15/phpdoc-cache-file_fa141169cb764ede53895215c4e997c7.dat b/documentation/api/phpdoc-cache-15/phpdoc-cache-file_fa141169cb764ede53895215c4e997c7.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-16/phpdoc-cache-file_531f6a305c9b5209cb92f43e46aed9cf.dat b/documentation/api/phpdoc-cache-16/phpdoc-cache-file_531f6a305c9b5209cb92f43e46aed9cf.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-17/phpdoc-cache-file_7bd387ca0421c7f530846cadcf1bea6a.dat b/documentation/api/phpdoc-cache-17/phpdoc-cache-file_7bd387ca0421c7f530846cadcf1bea6a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-17/phpdoc-cache-file_b7e7e6ae2684542e2bda3ece4b5fa5ab.dat b/documentation/api/phpdoc-cache-17/phpdoc-cache-file_b7e7e6ae2684542e2bda3ece4b5fa5ab.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-17/phpdoc-cache-file_d6a6fd7136d2e923ce15ed7e477baa38.dat b/documentation/api/phpdoc-cache-17/phpdoc-cache-file_d6a6fd7136d2e923ce15ed7e477baa38.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-17/phpdoc-cache-file_ee683e3cb66277371bc07d2ba84c1096.dat b/documentation/api/phpdoc-cache-17/phpdoc-cache-file_ee683e3cb66277371bc07d2ba84c1096.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-18/phpdoc-cache-file_507af5c21bb4729f82f85d2926ceb2e6.dat b/documentation/api/phpdoc-cache-18/phpdoc-cache-file_507af5c21bb4729f82f85d2926ceb2e6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-19/phpdoc-cache-file_80bb084a9ac24fef0aad41d552d44060.dat b/documentation/api/phpdoc-cache-19/phpdoc-cache-file_80bb084a9ac24fef0aad41d552d44060.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-19/phpdoc-cache-file_99d45f67f71899aaa011dae5dfd1566d.dat b/documentation/api/phpdoc-cache-19/phpdoc-cache-file_99d45f67f71899aaa011dae5dfd1566d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-19/phpdoc-cache-file_a1906975ed27c393f6370235e8fe70b0.dat b/documentation/api/phpdoc-cache-19/phpdoc-cache-file_a1906975ed27c393f6370235e8fe70b0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-19/phpdoc-cache-file_a34477249b33d356d065d88ccf51f23c.dat b/documentation/api/phpdoc-cache-19/phpdoc-cache-file_a34477249b33d356d065d88ccf51f23c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1a/phpdoc-cache-file_36a45ae21b2286e24f024fc1c7ea0dfd.dat b/documentation/api/phpdoc-cache-1a/phpdoc-cache-file_36a45ae21b2286e24f024fc1c7ea0dfd.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1a/phpdoc-cache-file_3c60e4659d050b83d7173736fc3b5f77.dat b/documentation/api/phpdoc-cache-1a/phpdoc-cache-file_3c60e4659d050b83d7173736fc3b5f77.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1a/phpdoc-cache-file_59978404987ed54acf4cc76f2b48b7a6.dat b/documentation/api/phpdoc-cache-1a/phpdoc-cache-file_59978404987ed54acf4cc76f2b48b7a6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1a/phpdoc-cache-file_67f5bd0deefac5b00b28e543a627ea47.dat b/documentation/api/phpdoc-cache-1a/phpdoc-cache-file_67f5bd0deefac5b00b28e543a627ea47.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1b/phpdoc-cache-file_4d20bc7eb9ad54b1d733b74befe924e6.dat b/documentation/api/phpdoc-cache-1b/phpdoc-cache-file_4d20bc7eb9ad54b1d733b74befe924e6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1b/phpdoc-cache-file_e65b95377ea4c4ea92a57a2e5c717620.dat b/documentation/api/phpdoc-cache-1b/phpdoc-cache-file_e65b95377ea4c4ea92a57a2e5c717620.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_02461ab4bff7e55c78be52904bd814d8.dat b/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_02461ab4bff7e55c78be52904bd814d8.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_29b974f93e66f6b73f52244b873a3e85.dat b/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_29b974f93e66f6b73f52244b873a3e85.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_773f12d16ed908ede73f44ddce19db65.dat b/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_773f12d16ed908ede73f44ddce19db65.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_a96865c39bddc33e0ab9178fe41e8e17.dat b/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_a96865c39bddc33e0ab9178fe41e8e17.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_bd0039f0dfa541ab496a516455fddb42.dat b/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_bd0039f0dfa541ab496a516455fddb42.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_df271d40fe931f2ed7754699e5113a51.dat b/documentation/api/phpdoc-cache-1c/phpdoc-cache-file_df271d40fe931f2ed7754699e5113a51.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1d/phpdoc-cache-file_4e6834ff0d6bfd276fe52f839c4e78c5.dat b/documentation/api/phpdoc-cache-1d/phpdoc-cache-file_4e6834ff0d6bfd276fe52f839c4e78c5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1e/phpdoc-cache-file_98568985671f54f738e1237e393ac22f.dat b/documentation/api/phpdoc-cache-1e/phpdoc-cache-file_98568985671f54f738e1237e393ac22f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1e/phpdoc-cache-file_d0bf2d740951391509068ba511a81ad0.dat b/documentation/api/phpdoc-cache-1e/phpdoc-cache-file_d0bf2d740951391509068ba511a81ad0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1f/phpdoc-cache-file_37ca6ce2671c4b5f0c8f195df142e378.dat b/documentation/api/phpdoc-cache-1f/phpdoc-cache-file_37ca6ce2671c4b5f0c8f195df142e378.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-1f/phpdoc-cache-file_d4f2322e4dcbaeff436119bc10697f65.dat b/documentation/api/phpdoc-cache-1f/phpdoc-cache-file_d4f2322e4dcbaeff436119bc10697f65.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-20/phpdoc-cache-file_1407349aca3f4c5d53d5befec592caa9.dat b/documentation/api/phpdoc-cache-20/phpdoc-cache-file_1407349aca3f4c5d53d5befec592caa9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-21/phpdoc-cache-file_52ce923e6b4998502161cf828bd5a39d.dat b/documentation/api/phpdoc-cache-21/phpdoc-cache-file_52ce923e6b4998502161cf828bd5a39d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-21/phpdoc-cache-file_831cdab47dac8b6418e883e3477dd810.dat b/documentation/api/phpdoc-cache-21/phpdoc-cache-file_831cdab47dac8b6418e883e3477dd810.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-21/phpdoc-cache-file_a3643b212d0a35c0dafbee9c2bbe2c11.dat b/documentation/api/phpdoc-cache-21/phpdoc-cache-file_a3643b212d0a35c0dafbee9c2bbe2c11.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-21/phpdoc-cache-file_f4dd18e43673dba0e0d930dabbfaad08.dat b/documentation/api/phpdoc-cache-21/phpdoc-cache-file_f4dd18e43673dba0e0d930dabbfaad08.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-22/phpdoc-cache-file_50455407091e0a655f60dbfd28627d3b.dat b/documentation/api/phpdoc-cache-22/phpdoc-cache-file_50455407091e0a655f60dbfd28627d3b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-23/phpdoc-cache-file_bb601b902eab32eab68ccfe659714f60.dat b/documentation/api/phpdoc-cache-23/phpdoc-cache-file_bb601b902eab32eab68ccfe659714f60.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-23/phpdoc-cache-file_c2727613ef905fe3bf2394dd4064989c.dat b/documentation/api/phpdoc-cache-23/phpdoc-cache-file_c2727613ef905fe3bf2394dd4064989c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-23/phpdoc-cache-file_dd1515b731bf5f596dea2529995c8c37.dat b/documentation/api/phpdoc-cache-23/phpdoc-cache-file_dd1515b731bf5f596dea2529995c8c37.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-24/phpdoc-cache-file_21fd455767b56da0500558fc4bec6024.dat b/documentation/api/phpdoc-cache-24/phpdoc-cache-file_21fd455767b56da0500558fc4bec6024.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-24/phpdoc-cache-file_7b7c9713299ccd370c77d697e78975ee.dat b/documentation/api/phpdoc-cache-24/phpdoc-cache-file_7b7c9713299ccd370c77d697e78975ee.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-24/phpdoc-cache-file_8945e6f19cbb53975f8dce632694d79a.dat b/documentation/api/phpdoc-cache-24/phpdoc-cache-file_8945e6f19cbb53975f8dce632694d79a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-25/phpdoc-cache-file_7b74bbbe5860b5fec52777afba38dd78.dat b/documentation/api/phpdoc-cache-25/phpdoc-cache-file_7b74bbbe5860b5fec52777afba38dd78.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-25/phpdoc-cache-file_e44cc026fcfd792097262bda1a800098.dat b/documentation/api/phpdoc-cache-25/phpdoc-cache-file_e44cc026fcfd792097262bda1a800098.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-26/phpdoc-cache-file_95085cec3ddf840cd10bf047b4c9bb9d.dat b/documentation/api/phpdoc-cache-26/phpdoc-cache-file_95085cec3ddf840cd10bf047b4c9bb9d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-26/phpdoc-cache-file_f18be6cd94bba60c70b6aea8897b0239.dat b/documentation/api/phpdoc-cache-26/phpdoc-cache-file_f18be6cd94bba60c70b6aea8897b0239.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-27/phpdoc-cache-file_1fe662cdc4d18bd6c94ab663d92e94e0.dat b/documentation/api/phpdoc-cache-27/phpdoc-cache-file_1fe662cdc4d18bd6c94ab663d92e94e0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-27/phpdoc-cache-file_621f2f1f2160bd61bf05e92f18e198c7.dat b/documentation/api/phpdoc-cache-27/phpdoc-cache-file_621f2f1f2160bd61bf05e92f18e198c7.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-27/phpdoc-cache-file_c8d56734f26182bfc343d385509dbf36.dat b/documentation/api/phpdoc-cache-27/phpdoc-cache-file_c8d56734f26182bfc343d385509dbf36.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-27/phpdoc-cache-file_dd5311952ac8196e65a7154ec49202c2.dat b/documentation/api/phpdoc-cache-27/phpdoc-cache-file_dd5311952ac8196e65a7154ec49202c2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-28/phpdoc-cache-file_15fe61575f4b045fe41f59bb774a7aeb.dat b/documentation/api/phpdoc-cache-28/phpdoc-cache-file_15fe61575f4b045fe41f59bb774a7aeb.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-29/phpdoc-cache-file_02dd5dae8e728c66fe37fed835d9e348.dat b/documentation/api/phpdoc-cache-29/phpdoc-cache-file_02dd5dae8e728c66fe37fed835d9e348.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-29/phpdoc-cache-file_48bacfcec9625a8580f225df6721433b.dat b/documentation/api/phpdoc-cache-29/phpdoc-cache-file_48bacfcec9625a8580f225df6721433b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-29/phpdoc-cache-file_8695f5c1695266654f954b19f299387c.dat b/documentation/api/phpdoc-cache-29/phpdoc-cache-file_8695f5c1695266654f954b19f299387c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-29/phpdoc-cache-file_8d35e6f1a7c14516f5a19304b19992b3.dat b/documentation/api/phpdoc-cache-29/phpdoc-cache-file_8d35e6f1a7c14516f5a19304b19992b3.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2a/phpdoc-cache-file_bb8d810efef76d8db959dca267fbc9d9.dat b/documentation/api/phpdoc-cache-2a/phpdoc-cache-file_bb8d810efef76d8db959dca267fbc9d9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2a/phpdoc-cache-file_ca908c374d2f2ecc3236a94c8011c35d.dat b/documentation/api/phpdoc-cache-2a/phpdoc-cache-file_ca908c374d2f2ecc3236a94c8011c35d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2b/phpdoc-cache-file_2445887c23e1b3d59f9936abeb432127.dat b/documentation/api/phpdoc-cache-2b/phpdoc-cache-file_2445887c23e1b3d59f9936abeb432127.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2b/phpdoc-cache-file_60dd690c80263fe8d28dd847fd07da73.dat b/documentation/api/phpdoc-cache-2b/phpdoc-cache-file_60dd690c80263fe8d28dd847fd07da73.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2c/phpdoc-cache-file_2c67dd9f089fca588c4b8b4e895e8628.dat b/documentation/api/phpdoc-cache-2c/phpdoc-cache-file_2c67dd9f089fca588c4b8b4e895e8628.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2c/phpdoc-cache-file_361e1ee3c27fba2fde7dcd156ac28fb0.dat b/documentation/api/phpdoc-cache-2c/phpdoc-cache-file_361e1ee3c27fba2fde7dcd156ac28fb0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2c/phpdoc-cache-file_3f2741113a12e7bb574b83317809ba33.dat b/documentation/api/phpdoc-cache-2c/phpdoc-cache-file_3f2741113a12e7bb574b83317809ba33.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2c/phpdoc-cache-file_51086854c847b9ec2d50a77686234b81.dat b/documentation/api/phpdoc-cache-2c/phpdoc-cache-file_51086854c847b9ec2d50a77686234b81.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2d/phpdoc-cache-file_1f93744d93b78eb6c619bfbc761344be.dat b/documentation/api/phpdoc-cache-2d/phpdoc-cache-file_1f93744d93b78eb6c619bfbc761344be.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2d/phpdoc-cache-file_6aba8510bc7f4d875891ad4819aa376b.dat b/documentation/api/phpdoc-cache-2d/phpdoc-cache-file_6aba8510bc7f4d875891ad4819aa376b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2d/phpdoc-cache-file_f816a59a2f82130c8adb740763c4e548.dat b/documentation/api/phpdoc-cache-2d/phpdoc-cache-file_f816a59a2f82130c8adb740763c4e548.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2e/phpdoc-cache-file_7aa13b7eba8dd2bd8d9ecee0a643f082.dat b/documentation/api/phpdoc-cache-2e/phpdoc-cache-file_7aa13b7eba8dd2bd8d9ecee0a643f082.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2e/phpdoc-cache-settings.dat b/documentation/api/phpdoc-cache-2e/phpdoc-cache-settings.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2f/phpdoc-cache-file_4afd599eaa00115b935ed1b044755808.dat b/documentation/api/phpdoc-cache-2f/phpdoc-cache-file_4afd599eaa00115b935ed1b044755808.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-2f/phpdoc-cache-file_f509d00b04775677b329f6729ece572a.dat b/documentation/api/phpdoc-cache-2f/phpdoc-cache-file_f509d00b04775677b329f6729ece572a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-30/phpdoc-cache-file_8c1ff7fb35b63f7cf70e0f1025a9b2ba.dat b/documentation/api/phpdoc-cache-30/phpdoc-cache-file_8c1ff7fb35b63f7cf70e0f1025a9b2ba.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-31/phpdoc-cache-file_5c03bb019f0bbd41e0bb75309b385fe3.dat b/documentation/api/phpdoc-cache-31/phpdoc-cache-file_5c03bb019f0bbd41e0bb75309b385fe3.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-32/phpdoc-cache-file_08c2753b4aa20c2650c5e27642c08857.dat b/documentation/api/phpdoc-cache-32/phpdoc-cache-file_08c2753b4aa20c2650c5e27642c08857.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-32/phpdoc-cache-file_5a004db618d1bafd2af32491bd8415f3.dat b/documentation/api/phpdoc-cache-32/phpdoc-cache-file_5a004db618d1bafd2af32491bd8415f3.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-34/phpdoc-cache-file_0b5365709d5df6e9b8beb295b8b26cdb.dat b/documentation/api/phpdoc-cache-34/phpdoc-cache-file_0b5365709d5df6e9b8beb295b8b26cdb.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-35/phpdoc-cache-file_4b8584b86232dbe10b809043f80067d1.dat b/documentation/api/phpdoc-cache-35/phpdoc-cache-file_4b8584b86232dbe10b809043f80067d1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-35/phpdoc-cache-file_c53050672dec3c7cc6f0aa82db5e6f66.dat b/documentation/api/phpdoc-cache-35/phpdoc-cache-file_c53050672dec3c7cc6f0aa82db5e6f66.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-35/phpdoc-cache-file_e667b1d40a08f9c3aeb42a4086a7c148.dat b/documentation/api/phpdoc-cache-35/phpdoc-cache-file_e667b1d40a08f9c3aeb42a4086a7c148.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-36/phpdoc-cache-file_8e7f8af29de3c0b1f3aae137f8a4fcb8.dat b/documentation/api/phpdoc-cache-36/phpdoc-cache-file_8e7f8af29de3c0b1f3aae137f8a4fcb8.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-36/phpdoc-cache-file_929deec305f7daa2ec3e98b0f2973296.dat b/documentation/api/phpdoc-cache-36/phpdoc-cache-file_929deec305f7daa2ec3e98b0f2973296.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-36/phpdoc-cache-file_db1ad7790e7ddeeb30139193fe15a738.dat b/documentation/api/phpdoc-cache-36/phpdoc-cache-file_db1ad7790e7ddeeb30139193fe15a738.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-36/phpdoc-cache-file_eeef8b34bcc831f976fb4a679edeaf4c.dat b/documentation/api/phpdoc-cache-36/phpdoc-cache-file_eeef8b34bcc831f976fb4a679edeaf4c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-37/phpdoc-cache-file_01945eb63621da198ea133cb2c31db18.dat b/documentation/api/phpdoc-cache-37/phpdoc-cache-file_01945eb63621da198ea133cb2c31db18.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-37/phpdoc-cache-file_e968649f343e6eb73d73b6b2c5fa3e9d.dat b/documentation/api/phpdoc-cache-37/phpdoc-cache-file_e968649f343e6eb73d73b6b2c5fa3e9d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-38/phpdoc-cache-file_572937fb780d222a81ec291c3a718470.dat b/documentation/api/phpdoc-cache-38/phpdoc-cache-file_572937fb780d222a81ec291c3a718470.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-38/phpdoc-cache-file_7012e16c28cc8468c8f9c97cb92a2cbc.dat b/documentation/api/phpdoc-cache-38/phpdoc-cache-file_7012e16c28cc8468c8f9c97cb92a2cbc.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-38/phpdoc-cache-file_cae3d55a8b7b920d987831809f30606c.dat b/documentation/api/phpdoc-cache-38/phpdoc-cache-file_cae3d55a8b7b920d987831809f30606c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-39/phpdoc-cache-file_0e55c82c8f24d31f29833d13ca937c95.dat b/documentation/api/phpdoc-cache-39/phpdoc-cache-file_0e55c82c8f24d31f29833d13ca937c95.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-39/phpdoc-cache-file_0fffc67309db0616d8e64f3093654dd2.dat b/documentation/api/phpdoc-cache-39/phpdoc-cache-file_0fffc67309db0616d8e64f3093654dd2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-39/phpdoc-cache-file_1759208252c5a8cddd7bf97662060c8f.dat b/documentation/api/phpdoc-cache-39/phpdoc-cache-file_1759208252c5a8cddd7bf97662060c8f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3a/phpdoc-cache-file_4f324c3b3e8c722f4a97d067498eb523.dat b/documentation/api/phpdoc-cache-3a/phpdoc-cache-file_4f324c3b3e8c722f4a97d067498eb523.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3a/phpdoc-cache-file_875b6ad60bdec7e9e3a2cac66c86ea22.dat b/documentation/api/phpdoc-cache-3a/phpdoc-cache-file_875b6ad60bdec7e9e3a2cac66c86ea22.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3b/phpdoc-cache-file_7cba0d65d2f9727acd550f4551721f19.dat b/documentation/api/phpdoc-cache-3b/phpdoc-cache-file_7cba0d65d2f9727acd550f4551721f19.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3b/phpdoc-cache-file_85428d79270bc404df8964bb529e11fa.dat b/documentation/api/phpdoc-cache-3b/phpdoc-cache-file_85428d79270bc404df8964bb529e11fa.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3c/phpdoc-cache-file_0ac46febcf0125f97386e77a8a2a91c4.dat b/documentation/api/phpdoc-cache-3c/phpdoc-cache-file_0ac46febcf0125f97386e77a8a2a91c4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3c/phpdoc-cache-file_57113206de58a1540b20e4f120b67737.dat b/documentation/api/phpdoc-cache-3c/phpdoc-cache-file_57113206de58a1540b20e4f120b67737.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3c/phpdoc-cache-file_5f3211fc39ea0c9ecadbedf10b8392cd.dat b/documentation/api/phpdoc-cache-3c/phpdoc-cache-file_5f3211fc39ea0c9ecadbedf10b8392cd.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3d/phpdoc-cache-file_939af359fed33854bd55e59313ec017c.dat b/documentation/api/phpdoc-cache-3d/phpdoc-cache-file_939af359fed33854bd55e59313ec017c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3e/phpdoc-cache-file_b30147217e7b1416de259cc9437862a9.dat b/documentation/api/phpdoc-cache-3e/phpdoc-cache-file_b30147217e7b1416de259cc9437862a9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3f/phpdoc-cache-file_8dc0c675a50d37c914d613688bb41282.dat b/documentation/api/phpdoc-cache-3f/phpdoc-cache-file_8dc0c675a50d37c914d613688bb41282.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-3f/phpdoc-cache-file_bb563eb45c4f2e24300cb3e60e3d4fb4.dat b/documentation/api/phpdoc-cache-3f/phpdoc-cache-file_bb563eb45c4f2e24300cb3e60e3d4fb4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-40/phpdoc-cache-file_42ca860447ce9823266e46fe4f6124f1.dat b/documentation/api/phpdoc-cache-40/phpdoc-cache-file_42ca860447ce9823266e46fe4f6124f1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-40/phpdoc-cache-file_b7eeb3998815b9201a47695717a4a454.dat b/documentation/api/phpdoc-cache-40/phpdoc-cache-file_b7eeb3998815b9201a47695717a4a454.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-42/phpdoc-cache-file_123d8b223840af8148919d4c69a8b2a6.dat b/documentation/api/phpdoc-cache-42/phpdoc-cache-file_123d8b223840af8148919d4c69a8b2a6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-42/phpdoc-cache-file_95f0e5ccb39f3c662f429a034c82640e.dat b/documentation/api/phpdoc-cache-42/phpdoc-cache-file_95f0e5ccb39f3c662f429a034c82640e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-42/phpdoc-cache-file_a79a84c870cabe60a63adde7441011a3.dat b/documentation/api/phpdoc-cache-42/phpdoc-cache-file_a79a84c870cabe60a63adde7441011a3.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-44/phpdoc-cache-file_01cbbc7c4eb44503b3da74307b73bc8d.dat b/documentation/api/phpdoc-cache-44/phpdoc-cache-file_01cbbc7c4eb44503b3da74307b73bc8d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-44/phpdoc-cache-file_9e4148f5fc7be5d87063372f34be5e8e.dat b/documentation/api/phpdoc-cache-44/phpdoc-cache-file_9e4148f5fc7be5d87063372f34be5e8e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-45/phpdoc-cache-file_66bc4cc40350ed3e372991dfbbae096d.dat b/documentation/api/phpdoc-cache-45/phpdoc-cache-file_66bc4cc40350ed3e372991dfbbae096d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-45/phpdoc-cache-file_ed8bc8f20100dfd4c1ce0b781d0d8329.dat b/documentation/api/phpdoc-cache-45/phpdoc-cache-file_ed8bc8f20100dfd4c1ce0b781d0d8329.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-46/phpdoc-cache-file_1aaa9749adc01012afc191807d0ad561.dat b/documentation/api/phpdoc-cache-46/phpdoc-cache-file_1aaa9749adc01012afc191807d0ad561.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-46/phpdoc-cache-file_38d2ac7e37e0095f630f80655817b59a.dat b/documentation/api/phpdoc-cache-46/phpdoc-cache-file_38d2ac7e37e0095f630f80655817b59a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-46/phpdoc-cache-file_441c6bf1033ddfea0fb2aead09b63404.dat b/documentation/api/phpdoc-cache-46/phpdoc-cache-file_441c6bf1033ddfea0fb2aead09b63404.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-46/phpdoc-cache-file_75598a10e7016adc5d21021a339e4b6f.dat b/documentation/api/phpdoc-cache-46/phpdoc-cache-file_75598a10e7016adc5d21021a339e4b6f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-46/phpdoc-cache-file_a19693104f5855c15d4739566baff9f1.dat b/documentation/api/phpdoc-cache-46/phpdoc-cache-file_a19693104f5855c15d4739566baff9f1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-47/phpdoc-cache-file_2235039af65e432259b672ffc380fa80.dat b/documentation/api/phpdoc-cache-47/phpdoc-cache-file_2235039af65e432259b672ffc380fa80.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-47/phpdoc-cache-file_26d96be15b5a73f07de633544b86376d.dat b/documentation/api/phpdoc-cache-47/phpdoc-cache-file_26d96be15b5a73f07de633544b86376d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-47/phpdoc-cache-file_859c20039edf434936c9b76319b0460c.dat b/documentation/api/phpdoc-cache-47/phpdoc-cache-file_859c20039edf434936c9b76319b0460c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-48/phpdoc-cache-file_8f9c815a7332d4be118b9f4097a6ddb6.dat b/documentation/api/phpdoc-cache-48/phpdoc-cache-file_8f9c815a7332d4be118b9f4097a6ddb6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-48/phpdoc-cache-file_9429081dfbf82a946a54913429d323b5.dat b/documentation/api/phpdoc-cache-48/phpdoc-cache-file_9429081dfbf82a946a54913429d323b5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-48/phpdoc-cache-file_d09f1d5ffe955119bab29517969925c2.dat b/documentation/api/phpdoc-cache-48/phpdoc-cache-file_d09f1d5ffe955119bab29517969925c2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-48/phpdoc-cache-file_eebf2420e7cf34fd64a6507d7f196ff5.dat b/documentation/api/phpdoc-cache-48/phpdoc-cache-file_eebf2420e7cf34fd64a6507d7f196ff5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4a/phpdoc-cache-file_0cadb9d20d28153a565e22f7c36fa96b.dat b/documentation/api/phpdoc-cache-4a/phpdoc-cache-file_0cadb9d20d28153a565e22f7c36fa96b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4a/phpdoc-cache-file_0d5418e3f1eed6f768220bb7743a94c4.dat b/documentation/api/phpdoc-cache-4a/phpdoc-cache-file_0d5418e3f1eed6f768220bb7743a94c4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4a/phpdoc-cache-file_505df7811a76cb06c0cb657c6198489e.dat b/documentation/api/phpdoc-cache-4a/phpdoc-cache-file_505df7811a76cb06c0cb657c6198489e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4a/phpdoc-cache-file_edb58f71697e487d5546e042206c9ece.dat b/documentation/api/phpdoc-cache-4a/phpdoc-cache-file_edb58f71697e487d5546e042206c9ece.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4b/phpdoc-cache-file_d52c3c75e3afa4ef3d398ccf1ab5c3b0.dat b/documentation/api/phpdoc-cache-4b/phpdoc-cache-file_d52c3c75e3afa4ef3d398ccf1ab5c3b0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4b/phpdoc-cache-file_f23750a6c724b476d1bdec98204665e7.dat b/documentation/api/phpdoc-cache-4b/phpdoc-cache-file_f23750a6c724b476d1bdec98204665e7.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4c/phpdoc-cache-file_4c33517c4c8e46306fef4902293ecb25.dat b/documentation/api/phpdoc-cache-4c/phpdoc-cache-file_4c33517c4c8e46306fef4902293ecb25.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4c/phpdoc-cache-file_8486517b83c57b540c7714b1cb44d4f2.dat b/documentation/api/phpdoc-cache-4c/phpdoc-cache-file_8486517b83c57b540c7714b1cb44d4f2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4c/phpdoc-cache-file_e6834001eecd2e5b161783efb6d3491b.dat b/documentation/api/phpdoc-cache-4c/phpdoc-cache-file_e6834001eecd2e5b161783efb6d3491b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4d/phpdoc-cache-file_1fec36a976c3fa1ba384fb4b45930c1c.dat b/documentation/api/phpdoc-cache-4d/phpdoc-cache-file_1fec36a976c3fa1ba384fb4b45930c1c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4d/phpdoc-cache-file_85b63a47d3809a454e3e4c98c0a15437.dat b/documentation/api/phpdoc-cache-4d/phpdoc-cache-file_85b63a47d3809a454e3e4c98c0a15437.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4d/phpdoc-cache-file_9c16d7c73a5bbc17deb8b9b6e68cf648.dat b/documentation/api/phpdoc-cache-4d/phpdoc-cache-file_9c16d7c73a5bbc17deb8b9b6e68cf648.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4e/phpdoc-cache-file_94ccf1d6684f73c94414e65b98169089.dat b/documentation/api/phpdoc-cache-4e/phpdoc-cache-file_94ccf1d6684f73c94414e65b98169089.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4e/phpdoc-cache-file_97b6e404c941066d5cf5faac3983f193.dat b/documentation/api/phpdoc-cache-4e/phpdoc-cache-file_97b6e404c941066d5cf5faac3983f193.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4e/phpdoc-cache-file_a1694f428590444860d4064d525ef639.dat b/documentation/api/phpdoc-cache-4e/phpdoc-cache-file_a1694f428590444860d4064d525ef639.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4e/phpdoc-cache-file_cf2ab36c6499c4ae6b0058951fe0d25a.dat b/documentation/api/phpdoc-cache-4e/phpdoc-cache-file_cf2ab36c6499c4ae6b0058951fe0d25a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4e/phpdoc-cache-file_ea4e13b8f387d12c5be8c250d28ea526.dat b/documentation/api/phpdoc-cache-4e/phpdoc-cache-file_ea4e13b8f387d12c5be8c250d28ea526.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4f/phpdoc-cache-file_4aa0043a6f6e59ba22ef64682ed7f564.dat b/documentation/api/phpdoc-cache-4f/phpdoc-cache-file_4aa0043a6f6e59ba22ef64682ed7f564.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-4f/phpdoc-cache-file_9a7a82cf9ac9ef872792b9630522e251.dat b/documentation/api/phpdoc-cache-4f/phpdoc-cache-file_9a7a82cf9ac9ef872792b9630522e251.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-50/phpdoc-cache-file_2127e4b2d7f182d9522a39862d2e807c.dat b/documentation/api/phpdoc-cache-50/phpdoc-cache-file_2127e4b2d7f182d9522a39862d2e807c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-50/phpdoc-cache-file_6fbe88ca313a70d065623e06ae529e76.dat b/documentation/api/phpdoc-cache-50/phpdoc-cache-file_6fbe88ca313a70d065623e06ae529e76.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-50/phpdoc-cache-file_9d58d2afe946e413c0eed006640a6866.dat b/documentation/api/phpdoc-cache-50/phpdoc-cache-file_9d58d2afe946e413c0eed006640a6866.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-50/phpdoc-cache-file_f315560c2b62e911bf9e0ea82129b62a.dat b/documentation/api/phpdoc-cache-50/phpdoc-cache-file_f315560c2b62e911bf9e0ea82129b62a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-51/phpdoc-cache-file_78a6fd35d72c4ce07a97b1e5f94efa4b.dat b/documentation/api/phpdoc-cache-51/phpdoc-cache-file_78a6fd35d72c4ce07a97b1e5f94efa4b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-51/phpdoc-cache-file_bc8a98d8b2e3998c8bdf760d087c5953.dat b/documentation/api/phpdoc-cache-51/phpdoc-cache-file_bc8a98d8b2e3998c8bdf760d087c5953.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-51/phpdoc-cache-file_bdf6c73265835d449f7e4af5b5584aff.dat b/documentation/api/phpdoc-cache-51/phpdoc-cache-file_bdf6c73265835d449f7e4af5b5584aff.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-51/phpdoc-cache-file_d9deda0854d4adede9546d5aa70f0eaf.dat b/documentation/api/phpdoc-cache-51/phpdoc-cache-file_d9deda0854d4adede9546d5aa70f0eaf.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-52/phpdoc-cache-file_530335ec2fe520add9953af88fa884f2.dat b/documentation/api/phpdoc-cache-52/phpdoc-cache-file_530335ec2fe520add9953af88fa884f2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-53/phpdoc-cache-file_22865500b18bb0a124dc6c4de4c940e0.dat b/documentation/api/phpdoc-cache-53/phpdoc-cache-file_22865500b18bb0a124dc6c4de4c940e0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-53/phpdoc-cache-file_3119dd633d014a6204cc390dee6fa0ff.dat b/documentation/api/phpdoc-cache-53/phpdoc-cache-file_3119dd633d014a6204cc390dee6fa0ff.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-53/phpdoc-cache-file_398da34afa0bda625b553d75fcfeba7e.dat b/documentation/api/phpdoc-cache-53/phpdoc-cache-file_398da34afa0bda625b553d75fcfeba7e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-54/phpdoc-cache-file_00bcb7fd610784652ab72aa8ce064b61.dat b/documentation/api/phpdoc-cache-54/phpdoc-cache-file_00bcb7fd610784652ab72aa8ce064b61.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-55/phpdoc-cache-file_7c678c104792ef7f012831d4fb13de2c.dat b/documentation/api/phpdoc-cache-55/phpdoc-cache-file_7c678c104792ef7f012831d4fb13de2c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-55/phpdoc-cache-file_9225ebe9bb9ef999ccb899f5364f4212.dat b/documentation/api/phpdoc-cache-55/phpdoc-cache-file_9225ebe9bb9ef999ccb899f5364f4212.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-55/phpdoc-cache-file_b603d24463c38765c8522c6beefaaaac.dat b/documentation/api/phpdoc-cache-55/phpdoc-cache-file_b603d24463c38765c8522c6beefaaaac.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-56/phpdoc-cache-file_28365dbe1bcb390ca3a02ba984c7fc31.dat b/documentation/api/phpdoc-cache-56/phpdoc-cache-file_28365dbe1bcb390ca3a02ba984c7fc31.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-56/phpdoc-cache-file_6292586be9cf0e0bc04f26a91fe489c1.dat b/documentation/api/phpdoc-cache-56/phpdoc-cache-file_6292586be9cf0e0bc04f26a91fe489c1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-56/phpdoc-cache-file_eaed19941419976e58ee573158f507f4.dat b/documentation/api/phpdoc-cache-56/phpdoc-cache-file_eaed19941419976e58ee573158f507f4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-57/phpdoc-cache-file_1c33b6a68f33d75274d716e68fd174ce.dat b/documentation/api/phpdoc-cache-57/phpdoc-cache-file_1c33b6a68f33d75274d716e68fd174ce.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-58/phpdoc-cache-file_31019a58ad48296cf4f703bec4e99d82.dat b/documentation/api/phpdoc-cache-58/phpdoc-cache-file_31019a58ad48296cf4f703bec4e99d82.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-58/phpdoc-cache-file_e16ec0554937329680c5f06889868866.dat b/documentation/api/phpdoc-cache-58/phpdoc-cache-file_e16ec0554937329680c5f06889868866.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-58/phpdoc-cache-file_f6925b5850f62ffec5cbdd630fcf5898.dat b/documentation/api/phpdoc-cache-58/phpdoc-cache-file_f6925b5850f62ffec5cbdd630fcf5898.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-59/phpdoc-cache-file_a7aecce5140d618367b61aee094902e4.dat b/documentation/api/phpdoc-cache-59/phpdoc-cache-file_a7aecce5140d618367b61aee094902e4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-59/phpdoc-cache-file_cde944c6714ba3b5ae790780cf5237cf.dat b/documentation/api/phpdoc-cache-59/phpdoc-cache-file_cde944c6714ba3b5ae790780cf5237cf.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5a/phpdoc-cache-file_3346cebf7a1b1b3a3b069a25a1f926ae.dat b/documentation/api/phpdoc-cache-5a/phpdoc-cache-file_3346cebf7a1b1b3a3b069a25a1f926ae.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5a/phpdoc-cache-file_7e158744c9ccbcaf8dc9c14485fee811.dat b/documentation/api/phpdoc-cache-5a/phpdoc-cache-file_7e158744c9ccbcaf8dc9c14485fee811.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5b/phpdoc-cache-file_2f210e244ba149b71efc1a7c3152a890.dat b/documentation/api/phpdoc-cache-5b/phpdoc-cache-file_2f210e244ba149b71efc1a7c3152a890.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5b/phpdoc-cache-file_661c4b5746a49da8b034c59431a7dcd3.dat b/documentation/api/phpdoc-cache-5b/phpdoc-cache-file_661c4b5746a49da8b034c59431a7dcd3.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5b/phpdoc-cache-file_c5627f7b20af3024f4425626fd7c75d5.dat b/documentation/api/phpdoc-cache-5b/phpdoc-cache-file_c5627f7b20af3024f4425626fd7c75d5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5c/phpdoc-cache-file_087703a029a89f30517c6c8359e13c8f.dat b/documentation/api/phpdoc-cache-5c/phpdoc-cache-file_087703a029a89f30517c6c8359e13c8f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5c/phpdoc-cache-file_344662206cd074a669ac843db53e3305.dat b/documentation/api/phpdoc-cache-5c/phpdoc-cache-file_344662206cd074a669ac843db53e3305.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5c/phpdoc-cache-file_b03b092aa2499d60b6cc7f4fd5b34118.dat b/documentation/api/phpdoc-cache-5c/phpdoc-cache-file_b03b092aa2499d60b6cc7f4fd5b34118.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5d/phpdoc-cache-file_6d556bfc5a045eda9bf22868754d5d76.dat b/documentation/api/phpdoc-cache-5d/phpdoc-cache-file_6d556bfc5a045eda9bf22868754d5d76.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5e/phpdoc-cache-file_9381588142738446e7428e19e0035788.dat b/documentation/api/phpdoc-cache-5e/phpdoc-cache-file_9381588142738446e7428e19e0035788.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5e/phpdoc-cache-file_d3bd63268c3656de487f901d28ad0271.dat b/documentation/api/phpdoc-cache-5e/phpdoc-cache-file_d3bd63268c3656de487f901d28ad0271.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5f/phpdoc-cache-file_0888919cfbc55694096d25115dc378a1.dat b/documentation/api/phpdoc-cache-5f/phpdoc-cache-file_0888919cfbc55694096d25115dc378a1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-5f/phpdoc-cache-file_82cdb4ec4e3b86fbd679f51cf0cdda49.dat b/documentation/api/phpdoc-cache-5f/phpdoc-cache-file_82cdb4ec4e3b86fbd679f51cf0cdda49.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-60/phpdoc-cache-file_23a457d8c1cd54c87497834ec4a78f7c.dat b/documentation/api/phpdoc-cache-60/phpdoc-cache-file_23a457d8c1cd54c87497834ec4a78f7c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-60/phpdoc-cache-file_37429137210373dd7acec17435894afe.dat b/documentation/api/phpdoc-cache-60/phpdoc-cache-file_37429137210373dd7acec17435894afe.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-60/phpdoc-cache-file_9ecf7bd21e4e1dfd0d7a86fbdbe1f43c.dat b/documentation/api/phpdoc-cache-60/phpdoc-cache-file_9ecf7bd21e4e1dfd0d7a86fbdbe1f43c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-60/phpdoc-cache-file_ae58586253dd8be2734458d8acdeeae2.dat b/documentation/api/phpdoc-cache-60/phpdoc-cache-file_ae58586253dd8be2734458d8acdeeae2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-61/phpdoc-cache-file_044478db75199f0d2332b999c4151f05.dat b/documentation/api/phpdoc-cache-61/phpdoc-cache-file_044478db75199f0d2332b999c4151f05.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-61/phpdoc-cache-file_4fb89e040ddf781c74362641247a4ade.dat b/documentation/api/phpdoc-cache-61/phpdoc-cache-file_4fb89e040ddf781c74362641247a4ade.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-62/phpdoc-cache-file_646677072a50251de7913a057e178f15.dat b/documentation/api/phpdoc-cache-62/phpdoc-cache-file_646677072a50251de7913a057e178f15.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-62/phpdoc-cache-file_783c42ffc0edd491158a6e77c9d23f1a.dat b/documentation/api/phpdoc-cache-62/phpdoc-cache-file_783c42ffc0edd491158a6e77c9d23f1a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-62/phpdoc-cache-file_cebacf89638be29edd1733d96a588749.dat b/documentation/api/phpdoc-cache-62/phpdoc-cache-file_cebacf89638be29edd1733d96a588749.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-63/phpdoc-cache-file_5cae61c42aac8a8fa3c6442f92b90466.dat b/documentation/api/phpdoc-cache-63/phpdoc-cache-file_5cae61c42aac8a8fa3c6442f92b90466.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-63/phpdoc-cache-file_6a28f48216bb12b9a54edb3909ead3c2.dat b/documentation/api/phpdoc-cache-63/phpdoc-cache-file_6a28f48216bb12b9a54edb3909ead3c2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-63/phpdoc-cache-file_ae07255c8219c83bc1163e7d99eaf436.dat b/documentation/api/phpdoc-cache-63/phpdoc-cache-file_ae07255c8219c83bc1163e7d99eaf436.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-63/phpdoc-cache-file_b03c480021e01ca902d9629a362ed93c.dat b/documentation/api/phpdoc-cache-63/phpdoc-cache-file_b03c480021e01ca902d9629a362ed93c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-64/phpdoc-cache-file_4b9b1f444116d364f7cc4d7567dbf4f0.dat b/documentation/api/phpdoc-cache-64/phpdoc-cache-file_4b9b1f444116d364f7cc4d7567dbf4f0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-64/phpdoc-cache-file_e9aa7453b8b155b579a19d6f4dcd6b3e.dat b/documentation/api/phpdoc-cache-64/phpdoc-cache-file_e9aa7453b8b155b579a19d6f4dcd6b3e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-64/phpdoc-cache-file_fae02e3620f0cbe41bd3324034c3eb5a.dat b/documentation/api/phpdoc-cache-64/phpdoc-cache-file_fae02e3620f0cbe41bd3324034c3eb5a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-65/phpdoc-cache-file_f0d004e5f62bfe6b0e85d410ffa79782.dat b/documentation/api/phpdoc-cache-65/phpdoc-cache-file_f0d004e5f62bfe6b0e85d410ffa79782.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-66/phpdoc-cache-file_23b20e60b800655d879c738b083944e5.dat b/documentation/api/phpdoc-cache-66/phpdoc-cache-file_23b20e60b800655d879c738b083944e5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-66/phpdoc-cache-file_72f284a31b43d885136ef84ccb0c9c4c.dat b/documentation/api/phpdoc-cache-66/phpdoc-cache-file_72f284a31b43d885136ef84ccb0c9c4c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-66/phpdoc-cache-file_b76b9256e2ca4f244a6d146c31549c59.dat b/documentation/api/phpdoc-cache-66/phpdoc-cache-file_b76b9256e2ca4f244a6d146c31549c59.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-66/phpdoc-cache-file_e4a71e35e291d2132b9e3e3494791fd9.dat b/documentation/api/phpdoc-cache-66/phpdoc-cache-file_e4a71e35e291d2132b9e3e3494791fd9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-67/phpdoc-cache-file_9994497e5cf1abcc35eb72fd690f6ed2.dat b/documentation/api/phpdoc-cache-67/phpdoc-cache-file_9994497e5cf1abcc35eb72fd690f6ed2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-67/phpdoc-cache-file_99dd1d75967c3702fac42102eb53b893.dat b/documentation/api/phpdoc-cache-67/phpdoc-cache-file_99dd1d75967c3702fac42102eb53b893.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-68/phpdoc-cache-file_6fade2c14a490d5d22971946e73922fe.dat b/documentation/api/phpdoc-cache-68/phpdoc-cache-file_6fade2c14a490d5d22971946e73922fe.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-69/phpdoc-cache-file_bd069686b3e1dc852fe8fe97cffa7aa1.dat b/documentation/api/phpdoc-cache-69/phpdoc-cache-file_bd069686b3e1dc852fe8fe97cffa7aa1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6a/phpdoc-cache-file_3ebaabe9f8be9e7f7037046e5c69736e.dat b/documentation/api/phpdoc-cache-6a/phpdoc-cache-file_3ebaabe9f8be9e7f7037046e5c69736e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6a/phpdoc-cache-file_d1d24b943d014d1b9ae959476c1d2227.dat b/documentation/api/phpdoc-cache-6a/phpdoc-cache-file_d1d24b943d014d1b9ae959476c1d2227.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6a/phpdoc-cache-file_f788cf3250df7ea6e762ce80f395fec9.dat b/documentation/api/phpdoc-cache-6a/phpdoc-cache-file_f788cf3250df7ea6e762ce80f395fec9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6b/phpdoc-cache-file_1add7d876a7bb154185a23d9ae572ab1.dat b/documentation/api/phpdoc-cache-6b/phpdoc-cache-file_1add7d876a7bb154185a23d9ae572ab1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6b/phpdoc-cache-file_25b3e15b804b0a606039d9b1a0386014.dat b/documentation/api/phpdoc-cache-6b/phpdoc-cache-file_25b3e15b804b0a606039d9b1a0386014.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6b/phpdoc-cache-file_c2f3dc55c3496f01d50c9867d0f40dae.dat b/documentation/api/phpdoc-cache-6b/phpdoc-cache-file_c2f3dc55c3496f01d50c9867d0f40dae.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6b/phpdoc-cache-file_d769682eb1b116beca4bc4c5f63aac81.dat b/documentation/api/phpdoc-cache-6b/phpdoc-cache-file_d769682eb1b116beca4bc4c5f63aac81.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6c/phpdoc-cache-file_301cb46a68a7a10aa4fb6c7906dac332.dat b/documentation/api/phpdoc-cache-6c/phpdoc-cache-file_301cb46a68a7a10aa4fb6c7906dac332.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6c/phpdoc-cache-file_61bd8ab8f5299f0d0d55db05ac1f10a4.dat b/documentation/api/phpdoc-cache-6c/phpdoc-cache-file_61bd8ab8f5299f0d0d55db05ac1f10a4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6c/phpdoc-cache-file_cf5ad683cf6869e9f7d8b61a19b70408.dat b/documentation/api/phpdoc-cache-6c/phpdoc-cache-file_cf5ad683cf6869e9f7d8b61a19b70408.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6c/phpdoc-cache-file_eb590228c72b69bc77a64ff8e1d82c54.dat b/documentation/api/phpdoc-cache-6c/phpdoc-cache-file_eb590228c72b69bc77a64ff8e1d82c54.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6d/phpdoc-cache-file_aaa2e5fe9dc377a45fc124d0683872e9.dat b/documentation/api/phpdoc-cache-6d/phpdoc-cache-file_aaa2e5fe9dc377a45fc124d0683872e9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6e/phpdoc-cache-file_260462198241213910b0a28734d305f9.dat b/documentation/api/phpdoc-cache-6e/phpdoc-cache-file_260462198241213910b0a28734d305f9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6e/phpdoc-cache-file_7d3a656edef4aace1cb70f9ff2c8e208.dat b/documentation/api/phpdoc-cache-6e/phpdoc-cache-file_7d3a656edef4aace1cb70f9ff2c8e208.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6e/phpdoc-cache-file_8efb6f8ae1e2bcbe92f4b960c07fb4c7.dat b/documentation/api/phpdoc-cache-6e/phpdoc-cache-file_8efb6f8ae1e2bcbe92f4b960c07fb4c7.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6f/phpdoc-cache-file_53fb184cd1848a3f6dcc7661a3010a60.dat b/documentation/api/phpdoc-cache-6f/phpdoc-cache-file_53fb184cd1848a3f6dcc7661a3010a60.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-6f/phpdoc-cache-file_98c8ecc72c431ee96c3a17d64832621f.dat b/documentation/api/phpdoc-cache-6f/phpdoc-cache-file_98c8ecc72c431ee96c3a17d64832621f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-70/phpdoc-cache-file_4e363163bf12ff5b6b6d4caff8484be0.dat b/documentation/api/phpdoc-cache-70/phpdoc-cache-file_4e363163bf12ff5b6b6d4caff8484be0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-70/phpdoc-cache-file_c9d30b03429f742e8b46acd238c2c497.dat b/documentation/api/phpdoc-cache-70/phpdoc-cache-file_c9d30b03429f742e8b46acd238c2c497.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-71/phpdoc-cache-file_004f4fa87c8d81e762867c976e6fdfdd.dat b/documentation/api/phpdoc-cache-71/phpdoc-cache-file_004f4fa87c8d81e762867c976e6fdfdd.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-71/phpdoc-cache-file_1118c4e1130a70976b079a02f476e79d.dat b/documentation/api/phpdoc-cache-71/phpdoc-cache-file_1118c4e1130a70976b079a02f476e79d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-71/phpdoc-cache-file_a3b0ef1a0d4db44bd8c731404cdfb707.dat b/documentation/api/phpdoc-cache-71/phpdoc-cache-file_a3b0ef1a0d4db44bd8c731404cdfb707.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-71/phpdoc-cache-file_c4c6f83dce92ea81f660855ae883fc07.dat b/documentation/api/phpdoc-cache-71/phpdoc-cache-file_c4c6f83dce92ea81f660855ae883fc07.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-71/phpdoc-cache-file_fc8ab4e15deac93a9b136c054e5fe409.dat b/documentation/api/phpdoc-cache-71/phpdoc-cache-file_fc8ab4e15deac93a9b136c054e5fe409.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-72/phpdoc-cache-file_2aa2e8c285118b9ea0d30ca95a81578e.dat b/documentation/api/phpdoc-cache-72/phpdoc-cache-file_2aa2e8c285118b9ea0d30ca95a81578e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-73/phpdoc-cache-file_14bd9fbf5a6b280744de18d9604b5622.dat b/documentation/api/phpdoc-cache-73/phpdoc-cache-file_14bd9fbf5a6b280744de18d9604b5622.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-73/phpdoc-cache-file_36357f2e33182e0f363167a65b0adea0.dat b/documentation/api/phpdoc-cache-73/phpdoc-cache-file_36357f2e33182e0f363167a65b0adea0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-74/phpdoc-cache-file_99fdc8f69b07fa2b0f7883f9ace9ef66.dat b/documentation/api/phpdoc-cache-74/phpdoc-cache-file_99fdc8f69b07fa2b0f7883f9ace9ef66.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-74/phpdoc-cache-file_bcf202d8d69003802e96d29b3fb564e6.dat b/documentation/api/phpdoc-cache-74/phpdoc-cache-file_bcf202d8d69003802e96d29b3fb564e6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-75/phpdoc-cache-file_08bb8adf6352eb443e89dde64895e717.dat b/documentation/api/phpdoc-cache-75/phpdoc-cache-file_08bb8adf6352eb443e89dde64895e717.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-75/phpdoc-cache-file_e91d2a71312a05c5e812ed442269d149.dat b/documentation/api/phpdoc-cache-75/phpdoc-cache-file_e91d2a71312a05c5e812ed442269d149.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-75/phpdoc-cache-file_ebe1a62b12e3f770a703579aa9415d56.dat b/documentation/api/phpdoc-cache-75/phpdoc-cache-file_ebe1a62b12e3f770a703579aa9415d56.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-76/phpdoc-cache-file_d4326f35901f3874de2b52c3e80eb7bb.dat b/documentation/api/phpdoc-cache-76/phpdoc-cache-file_d4326f35901f3874de2b52c3e80eb7bb.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-77/phpdoc-cache-file_a7d701149da8f224661e826e4c706423.dat b/documentation/api/phpdoc-cache-77/phpdoc-cache-file_a7d701149da8f224661e826e4c706423.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-77/phpdoc-cache-file_f5f8ad4050ebaf8413ef0fabf12f4215.dat b/documentation/api/phpdoc-cache-77/phpdoc-cache-file_f5f8ad4050ebaf8413ef0fabf12f4215.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-78/phpdoc-cache-file_97f299a2de3f8de55b69a8204b7fb756.dat b/documentation/api/phpdoc-cache-78/phpdoc-cache-file_97f299a2de3f8de55b69a8204b7fb756.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-78/phpdoc-cache-file_9c4853c806e3058b5aad7d384ac29dd7.dat b/documentation/api/phpdoc-cache-78/phpdoc-cache-file_9c4853c806e3058b5aad7d384ac29dd7.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-78/phpdoc-cache-file_bd860e2530ba9df97e3d49eb3e113969.dat b/documentation/api/phpdoc-cache-78/phpdoc-cache-file_bd860e2530ba9df97e3d49eb3e113969.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-78/phpdoc-cache-file_cb3124c1f19c1b99b179b693f5f3dcd2.dat b/documentation/api/phpdoc-cache-78/phpdoc-cache-file_cb3124c1f19c1b99b179b693f5f3dcd2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-78/phpdoc-cache-file_eb8ff64c84538167041e698bd8d71185.dat b/documentation/api/phpdoc-cache-78/phpdoc-cache-file_eb8ff64c84538167041e698bd8d71185.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-79/phpdoc-cache-file_2d9cd54a5b15bc02e0ebca041c42057b.dat b/documentation/api/phpdoc-cache-79/phpdoc-cache-file_2d9cd54a5b15bc02e0ebca041c42057b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-79/phpdoc-cache-file_494a049f0a43abf5c7465e0a105b8288.dat b/documentation/api/phpdoc-cache-79/phpdoc-cache-file_494a049f0a43abf5c7465e0a105b8288.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7a/phpdoc-cache-file_561adfbc7f8d3175641257527b53993a.dat b/documentation/api/phpdoc-cache-7a/phpdoc-cache-file_561adfbc7f8d3175641257527b53993a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7b/phpdoc-cache-file_2c33317ca3618a1dd8a8265364d23eca.dat b/documentation/api/phpdoc-cache-7b/phpdoc-cache-file_2c33317ca3618a1dd8a8265364d23eca.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7b/phpdoc-cache-file_3602c51d51eb359d8e2c2e73c01b6011.dat b/documentation/api/phpdoc-cache-7b/phpdoc-cache-file_3602c51d51eb359d8e2c2e73c01b6011.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7b/phpdoc-cache-file_45fd3555aacc6ea2fefb54c61223e346.dat b/documentation/api/phpdoc-cache-7b/phpdoc-cache-file_45fd3555aacc6ea2fefb54c61223e346.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7b/phpdoc-cache-file_8c07b0b33d3a27c1f0ecdf1885442122.dat b/documentation/api/phpdoc-cache-7b/phpdoc-cache-file_8c07b0b33d3a27c1f0ecdf1885442122.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7c/phpdoc-cache-file_0b32f1478065256cbc0b4d2517b6af1f.dat b/documentation/api/phpdoc-cache-7c/phpdoc-cache-file_0b32f1478065256cbc0b4d2517b6af1f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7c/phpdoc-cache-file_691214fea2ed5a115190cc190b833066.dat b/documentation/api/phpdoc-cache-7c/phpdoc-cache-file_691214fea2ed5a115190cc190b833066.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7c/phpdoc-cache-file_b4ed467f04665b58b167fe629789ea14.dat b/documentation/api/phpdoc-cache-7c/phpdoc-cache-file_b4ed467f04665b58b167fe629789ea14.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7c/phpdoc-cache-file_c3e268101c0a6dd2ebb5d15104d97e1e.dat b/documentation/api/phpdoc-cache-7c/phpdoc-cache-file_c3e268101c0a6dd2ebb5d15104d97e1e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7d/phpdoc-cache-file_1016da6075d9754157994455a8ef102f.dat b/documentation/api/phpdoc-cache-7d/phpdoc-cache-file_1016da6075d9754157994455a8ef102f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7d/phpdoc-cache-file_38b8a2c3192b86246c7d68aaeac18cab.dat b/documentation/api/phpdoc-cache-7d/phpdoc-cache-file_38b8a2c3192b86246c7d68aaeac18cab.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7e/phpdoc-cache-file_67d9d118e24b201342b545f20384e0ab.dat b/documentation/api/phpdoc-cache-7e/phpdoc-cache-file_67d9d118e24b201342b545f20384e0ab.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7e/phpdoc-cache-file_73af8ff0d42d640f85a8c9e71fde84e5.dat b/documentation/api/phpdoc-cache-7e/phpdoc-cache-file_73af8ff0d42d640f85a8c9e71fde84e5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-7e/phpdoc-cache-file_ed020e517755fb973592d5ecf22b8ec6.dat b/documentation/api/phpdoc-cache-7e/phpdoc-cache-file_ed020e517755fb973592d5ecf22b8ec6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-80/phpdoc-cache-file_644f2a41fda7fd06100f0786402443b9.dat b/documentation/api/phpdoc-cache-80/phpdoc-cache-file_644f2a41fda7fd06100f0786402443b9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-80/phpdoc-cache-file_b3f39c9ccb11eedbb95716dad7c2e61f.dat b/documentation/api/phpdoc-cache-80/phpdoc-cache-file_b3f39c9ccb11eedbb95716dad7c2e61f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-81/phpdoc-cache-file_351c715541b3768b735616537edf3218.dat b/documentation/api/phpdoc-cache-81/phpdoc-cache-file_351c715541b3768b735616537edf3218.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-81/phpdoc-cache-file_a17b4d574787f1b578300b7667fc8524.dat b/documentation/api/phpdoc-cache-81/phpdoc-cache-file_a17b4d574787f1b578300b7667fc8524.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-81/phpdoc-cache-file_c4cda16260d7e3982ac111b5dcf32a3f.dat b/documentation/api/phpdoc-cache-81/phpdoc-cache-file_c4cda16260d7e3982ac111b5dcf32a3f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-82/phpdoc-cache-file_b463becbd7206e4f6ca7d5efc43a2a11.dat b/documentation/api/phpdoc-cache-82/phpdoc-cache-file_b463becbd7206e4f6ca7d5efc43a2a11.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-82/phpdoc-cache-file_b88f3d73101831f9d33205506f3a0a3b.dat b/documentation/api/phpdoc-cache-82/phpdoc-cache-file_b88f3d73101831f9d33205506f3a0a3b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-82/phpdoc-cache-file_e66020f7c2728bce96a786b7f43edff3.dat b/documentation/api/phpdoc-cache-82/phpdoc-cache-file_e66020f7c2728bce96a786b7f43edff3.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-84/phpdoc-cache-file_547c8bb992ee4b27195900020bfdedd4.dat b/documentation/api/phpdoc-cache-84/phpdoc-cache-file_547c8bb992ee4b27195900020bfdedd4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-84/phpdoc-cache-file_ab90f294515a45f918687f68ab2907d4.dat b/documentation/api/phpdoc-cache-84/phpdoc-cache-file_ab90f294515a45f918687f68ab2907d4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-85/phpdoc-cache-file_3df0325d5d4498a501c1f8e74e7909bb.dat b/documentation/api/phpdoc-cache-85/phpdoc-cache-file_3df0325d5d4498a501c1f8e74e7909bb.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-86/phpdoc-cache-file_4cc77a252ab61ede384be796a48c2cce.dat b/documentation/api/phpdoc-cache-86/phpdoc-cache-file_4cc77a252ab61ede384be796a48c2cce.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-86/phpdoc-cache-file_872b4c31e5de68247ca0689d04ffaf05.dat b/documentation/api/phpdoc-cache-86/phpdoc-cache-file_872b4c31e5de68247ca0689d04ffaf05.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-86/phpdoc-cache-file_c1ba15c322108f97e17c243af859ed08.dat b/documentation/api/phpdoc-cache-86/phpdoc-cache-file_c1ba15c322108f97e17c243af859ed08.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-87/phpdoc-cache-file_f61dacd1f4d1f89ee2fd262a17029b63.dat b/documentation/api/phpdoc-cache-87/phpdoc-cache-file_f61dacd1f4d1f89ee2fd262a17029b63.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-88/phpdoc-cache-file_122f27b817da714dc090e17e4f442932.dat b/documentation/api/phpdoc-cache-88/phpdoc-cache-file_122f27b817da714dc090e17e4f442932.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-88/phpdoc-cache-file_7e12a834d07230be85b2a31ef012a2d6.dat b/documentation/api/phpdoc-cache-88/phpdoc-cache-file_7e12a834d07230be85b2a31ef012a2d6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-89/phpdoc-cache-file_47d46dbd2df33a0c02ec6fff72f1d039.dat b/documentation/api/phpdoc-cache-89/phpdoc-cache-file_47d46dbd2df33a0c02ec6fff72f1d039.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-89/phpdoc-cache-file_4d831b567f897d0ad5c9a32d78f968e1.dat b/documentation/api/phpdoc-cache-89/phpdoc-cache-file_4d831b567f897d0ad5c9a32d78f968e1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-89/phpdoc-cache-file_9a7d2d99c354d3e16c0dab490693f402.dat b/documentation/api/phpdoc-cache-89/phpdoc-cache-file_9a7d2d99c354d3e16c0dab490693f402.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-89/phpdoc-cache-file_e80707747a9ea5f4e427edf62dc4f6db.dat b/documentation/api/phpdoc-cache-89/phpdoc-cache-file_e80707747a9ea5f4e427edf62dc4f6db.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-89/phpdoc-cache-file_efbce0d62301af0fc67b759974a1193d.dat b/documentation/api/phpdoc-cache-89/phpdoc-cache-file_efbce0d62301af0fc67b759974a1193d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8a/phpdoc-cache-file_6446c143d7122b1700e91b7554d2133c.dat b/documentation/api/phpdoc-cache-8a/phpdoc-cache-file_6446c143d7122b1700e91b7554d2133c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8a/phpdoc-cache-file_939ec9607a0458b5558b43a0eae631e0.dat b/documentation/api/phpdoc-cache-8a/phpdoc-cache-file_939ec9607a0458b5558b43a0eae631e0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8b/phpdoc-cache-file_4a3236ec830ef7b75e13e2d3629cd5f0.dat b/documentation/api/phpdoc-cache-8b/phpdoc-cache-file_4a3236ec830ef7b75e13e2d3629cd5f0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8b/phpdoc-cache-file_db5752a552fd2f9e8540614521796777.dat b/documentation/api/phpdoc-cache-8b/phpdoc-cache-file_db5752a552fd2f9e8540614521796777.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8b/phpdoc-cache-file_e53ea012d3060144d49042cff35b0d46.dat b/documentation/api/phpdoc-cache-8b/phpdoc-cache-file_e53ea012d3060144d49042cff35b0d46.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8c/phpdoc-cache-file_5f7d2fb5167bf2c4f53aa1d91e977338.dat b/documentation/api/phpdoc-cache-8c/phpdoc-cache-file_5f7d2fb5167bf2c4f53aa1d91e977338.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8c/phpdoc-cache-file_c014a968e73374dc83c23cc621215eb8.dat b/documentation/api/phpdoc-cache-8c/phpdoc-cache-file_c014a968e73374dc83c23cc621215eb8.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8d/phpdoc-cache-file_12d31b8fcb019d56c40c34a0edc1cdd9.dat b/documentation/api/phpdoc-cache-8d/phpdoc-cache-file_12d31b8fcb019d56c40c34a0edc1cdd9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8d/phpdoc-cache-file_cc11acbd9507b895891f8794bcc60272.dat b/documentation/api/phpdoc-cache-8d/phpdoc-cache-file_cc11acbd9507b895891f8794bcc60272.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8e/phpdoc-cache-file_5f4b638db5b8661079f6ec73e1a20b0b.dat b/documentation/api/phpdoc-cache-8e/phpdoc-cache-file_5f4b638db5b8661079f6ec73e1a20b0b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8f/phpdoc-cache-file_79b741d7456aff1af98c1c812de8fb19.dat b/documentation/api/phpdoc-cache-8f/phpdoc-cache-file_79b741d7456aff1af98c1c812de8fb19.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-8f/phpdoc-cache-file_e60fa6c9aa0c146c8fff550c695bcb38.dat b/documentation/api/phpdoc-cache-8f/phpdoc-cache-file_e60fa6c9aa0c146c8fff550c695bcb38.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-90/phpdoc-cache-file_6750da92c24dd584c59d6cc57430661a.dat b/documentation/api/phpdoc-cache-90/phpdoc-cache-file_6750da92c24dd584c59d6cc57430661a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-90/phpdoc-cache-file_d3cc896236c7e3366d9adccc49180c1b.dat b/documentation/api/phpdoc-cache-90/phpdoc-cache-file_d3cc896236c7e3366d9adccc49180c1b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-91/phpdoc-cache-file_5cfa84803e40206f9a22d3826a6590bf.dat b/documentation/api/phpdoc-cache-91/phpdoc-cache-file_5cfa84803e40206f9a22d3826a6590bf.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-91/phpdoc-cache-file_874c69166888dcb75790509fc9bc7638.dat b/documentation/api/phpdoc-cache-91/phpdoc-cache-file_874c69166888dcb75790509fc9bc7638.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-92/phpdoc-cache-file_34aa294d03b2eac32b22a178224e7fd4.dat b/documentation/api/phpdoc-cache-92/phpdoc-cache-file_34aa294d03b2eac32b22a178224e7fd4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-92/phpdoc-cache-file_362c9c2ef451cc6966e4787fc57b4fb0.dat b/documentation/api/phpdoc-cache-92/phpdoc-cache-file_362c9c2ef451cc6966e4787fc57b4fb0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-93/phpdoc-cache-file_25242dae30811270802138c15458789c.dat b/documentation/api/phpdoc-cache-93/phpdoc-cache-file_25242dae30811270802138c15458789c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-93/phpdoc-cache-file_7f1ae55c4a23e04cc930637b4ef0e976.dat b/documentation/api/phpdoc-cache-93/phpdoc-cache-file_7f1ae55c4a23e04cc930637b4ef0e976.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-93/phpdoc-cache-file_b3be804a4031d5e4c671fbae5354ccaf.dat b/documentation/api/phpdoc-cache-93/phpdoc-cache-file_b3be804a4031d5e4c671fbae5354ccaf.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-93/phpdoc-cache-file_e77c4fa451e32a41bd4749e7cf066c29.dat b/documentation/api/phpdoc-cache-93/phpdoc-cache-file_e77c4fa451e32a41bd4749e7cf066c29.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-93/phpdoc-cache-file_fc6803db681a3ff66fc28a06778da1f0.dat b/documentation/api/phpdoc-cache-93/phpdoc-cache-file_fc6803db681a3ff66fc28a06778da1f0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-94/phpdoc-cache-file_f4f0873eb74837aee50942f160d118c1.dat b/documentation/api/phpdoc-cache-94/phpdoc-cache-file_f4f0873eb74837aee50942f160d118c1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-95/phpdoc-cache-file_c71ed59f358f6db859c5a1252150c744.dat b/documentation/api/phpdoc-cache-95/phpdoc-cache-file_c71ed59f358f6db859c5a1252150c744.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-95/phpdoc-cache-file_f312c17e13b5538730814011faa2fe1f.dat b/documentation/api/phpdoc-cache-95/phpdoc-cache-file_f312c17e13b5538730814011faa2fe1f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-95/phpdoc-cache-file_f68a2a9664b988c325f351caa090dcde.dat b/documentation/api/phpdoc-cache-95/phpdoc-cache-file_f68a2a9664b988c325f351caa090dcde.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-97/phpdoc-cache-file_f6eb325ce960ddfd53e35a4c5ac32dbd.dat b/documentation/api/phpdoc-cache-97/phpdoc-cache-file_f6eb325ce960ddfd53e35a4c5ac32dbd.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-98/phpdoc-cache-file_026f8c1fd0bfff804f1292955c8b25bb.dat b/documentation/api/phpdoc-cache-98/phpdoc-cache-file_026f8c1fd0bfff804f1292955c8b25bb.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-98/phpdoc-cache-file_6a06debfa551e5cd1a7b635d0f782f88.dat b/documentation/api/phpdoc-cache-98/phpdoc-cache-file_6a06debfa551e5cd1a7b635d0f782f88.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-98/phpdoc-cache-file_d2c66070e2086545ad3dedc98163cb5c.dat b/documentation/api/phpdoc-cache-98/phpdoc-cache-file_d2c66070e2086545ad3dedc98163cb5c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-99/phpdoc-cache-file_0504e886a473f926a0ed77cd421ec188.dat b/documentation/api/phpdoc-cache-99/phpdoc-cache-file_0504e886a473f926a0ed77cd421ec188.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-99/phpdoc-cache-file_3e0324d13c24892aabdb33bf3d382ff0.dat b/documentation/api/phpdoc-cache-99/phpdoc-cache-file_3e0324d13c24892aabdb33bf3d382ff0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-99/phpdoc-cache-file_69c09a33b1e4f8ce8af6b1ae11c6f3aa.dat b/documentation/api/phpdoc-cache-99/phpdoc-cache-file_69c09a33b1e4f8ce8af6b1ae11c6f3aa.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-99/phpdoc-cache-file_8804c512e595d19d5bd3d87ecaff0183.dat b/documentation/api/phpdoc-cache-99/phpdoc-cache-file_8804c512e595d19d5bd3d87ecaff0183.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9a/phpdoc-cache-file_1db110392b2b3b84733102d8383ca60d.dat b/documentation/api/phpdoc-cache-9a/phpdoc-cache-file_1db110392b2b3b84733102d8383ca60d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9a/phpdoc-cache-file_34a9e84700b139d712cbed5391dcec00.dat b/documentation/api/phpdoc-cache-9a/phpdoc-cache-file_34a9e84700b139d712cbed5391dcec00.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9a/phpdoc-cache-file_dfe63b10500d23ed5b8609f61f1e0998.dat b/documentation/api/phpdoc-cache-9a/phpdoc-cache-file_dfe63b10500d23ed5b8609f61f1e0998.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9b/phpdoc-cache-file_019d854bd2196e014f7372f5c390801b.dat b/documentation/api/phpdoc-cache-9b/phpdoc-cache-file_019d854bd2196e014f7372f5c390801b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9b/phpdoc-cache-file_33ef8f2ce476307e815bb23e882b8bff.dat b/documentation/api/phpdoc-cache-9b/phpdoc-cache-file_33ef8f2ce476307e815bb23e882b8bff.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9b/phpdoc-cache-file_7acd95a6ef16902cc4c1f3f90a227f5d.dat b/documentation/api/phpdoc-cache-9b/phpdoc-cache-file_7acd95a6ef16902cc4c1f3f90a227f5d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9b/phpdoc-cache-file_addd9425844f027d9380f2ba6904179e.dat b/documentation/api/phpdoc-cache-9b/phpdoc-cache-file_addd9425844f027d9380f2ba6904179e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9c/phpdoc-cache-file_07520ff11b58e47194f8120b897b1908.dat b/documentation/api/phpdoc-cache-9c/phpdoc-cache-file_07520ff11b58e47194f8120b897b1908.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9c/phpdoc-cache-file_90a88cccaabe6d795994b920d0314408.dat b/documentation/api/phpdoc-cache-9c/phpdoc-cache-file_90a88cccaabe6d795994b920d0314408.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9c/phpdoc-cache-file_c8db83bfd4ecb1d7ac384a88031b207b.dat b/documentation/api/phpdoc-cache-9c/phpdoc-cache-file_c8db83bfd4ecb1d7ac384a88031b207b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9c/phpdoc-cache-file_f4d3d7cd56a0c0c96ffe9ebd02ca5be4.dat b/documentation/api/phpdoc-cache-9c/phpdoc-cache-file_f4d3d7cd56a0c0c96ffe9ebd02ca5be4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9d/phpdoc-cache-file_38f2b0a6909bf1d2befd5f3668be0d17.dat b/documentation/api/phpdoc-cache-9d/phpdoc-cache-file_38f2b0a6909bf1d2befd5f3668be0d17.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-9e/phpdoc-cache-file_b2c0d1e9ca93477e262ef6f1e1e8e0b1.dat b/documentation/api/phpdoc-cache-9e/phpdoc-cache-file_b2c0d1e9ca93477e262ef6f1e1e8e0b1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a0/phpdoc-cache-file_53264ec62bf09d2d105804fb0859d3b3.dat b/documentation/api/phpdoc-cache-a0/phpdoc-cache-file_53264ec62bf09d2d105804fb0859d3b3.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a0/phpdoc-cache-file_a5b048d8c267fdc12844122b70debaea.dat b/documentation/api/phpdoc-cache-a0/phpdoc-cache-file_a5b048d8c267fdc12844122b70debaea.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a0/phpdoc-cache-file_d32c6885d705c5451bdf1ac62a969573.dat b/documentation/api/phpdoc-cache-a0/phpdoc-cache-file_d32c6885d705c5451bdf1ac62a969573.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a1/phpdoc-cache-file_2468ccb167c267f02158b2a902f6ccb4.dat b/documentation/api/phpdoc-cache-a1/phpdoc-cache-file_2468ccb167c267f02158b2a902f6ccb4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a1/phpdoc-cache-file_5162277b4aa3af1e45f3c14928103878.dat b/documentation/api/phpdoc-cache-a1/phpdoc-cache-file_5162277b4aa3af1e45f3c14928103878.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a1/phpdoc-cache-file_65a7787c8c8f3cd643eb923e3acfa989.dat b/documentation/api/phpdoc-cache-a1/phpdoc-cache-file_65a7787c8c8f3cd643eb923e3acfa989.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a2/phpdoc-cache-file_cc993ca367e5ccc857f30a98ef164509.dat b/documentation/api/phpdoc-cache-a2/phpdoc-cache-file_cc993ca367e5ccc857f30a98ef164509.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a2/phpdoc-cache-file_edde9c6874dfc757a9ff1f1ff79e5764.dat b/documentation/api/phpdoc-cache-a2/phpdoc-cache-file_edde9c6874dfc757a9ff1f1ff79e5764.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a3/phpdoc-cache-file_61c9795639a8bffa47e99e23a9879924.dat b/documentation/api/phpdoc-cache-a3/phpdoc-cache-file_61c9795639a8bffa47e99e23a9879924.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a3/phpdoc-cache-file_9eef90b6f7d53c21a3f427c45e21f2ea.dat b/documentation/api/phpdoc-cache-a3/phpdoc-cache-file_9eef90b6f7d53c21a3f427c45e21f2ea.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a3/phpdoc-cache-file_ac7b83f5077433f55b5ded93d0609e07.dat b/documentation/api/phpdoc-cache-a3/phpdoc-cache-file_ac7b83f5077433f55b5ded93d0609e07.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a3/phpdoc-cache-file_cb76ca16ebce0428cd214816e2bda696.dat b/documentation/api/phpdoc-cache-a3/phpdoc-cache-file_cb76ca16ebce0428cd214816e2bda696.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a4/phpdoc-cache-file_1b7efb8f78600b1ca2e7b7db192b8c98.dat b/documentation/api/phpdoc-cache-a4/phpdoc-cache-file_1b7efb8f78600b1ca2e7b7db192b8c98.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a4/phpdoc-cache-file_73dd97367adcf1ef6cc335911c512271.dat b/documentation/api/phpdoc-cache-a4/phpdoc-cache-file_73dd97367adcf1ef6cc335911c512271.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a4/phpdoc-cache-file_aadb9b4049b696ecba8a4f48049d95f0.dat b/documentation/api/phpdoc-cache-a4/phpdoc-cache-file_aadb9b4049b696ecba8a4f48049d95f0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a5/phpdoc-cache-file_4ba673d0dcf66cc0d11ecf5a717b2630.dat b/documentation/api/phpdoc-cache-a5/phpdoc-cache-file_4ba673d0dcf66cc0d11ecf5a717b2630.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a5/phpdoc-cache-file_5114c4d5fc839ac32198288738496f46.dat b/documentation/api/phpdoc-cache-a5/phpdoc-cache-file_5114c4d5fc839ac32198288738496f46.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a5/phpdoc-cache-file_6dfb1bdb5d083189fdce028029eb1ced.dat b/documentation/api/phpdoc-cache-a5/phpdoc-cache-file_6dfb1bdb5d083189fdce028029eb1ced.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a6/phpdoc-cache-file_29a316313531220faf37601cf8581d43.dat b/documentation/api/phpdoc-cache-a6/phpdoc-cache-file_29a316313531220faf37601cf8581d43.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a6/phpdoc-cache-file_6275b41d8b57afadd7878781d9c3956c.dat b/documentation/api/phpdoc-cache-a6/phpdoc-cache-file_6275b41d8b57afadd7878781d9c3956c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a6/phpdoc-cache-file_a41a4ffd061a1e5008b111313fea56c4.dat b/documentation/api/phpdoc-cache-a6/phpdoc-cache-file_a41a4ffd061a1e5008b111313fea56c4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a7/phpdoc-cache-file_28ba4448d87939aa687f6a9f4102384d.dat b/documentation/api/phpdoc-cache-a7/phpdoc-cache-file_28ba4448d87939aa687f6a9f4102384d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a8/phpdoc-cache-file_438820914076c4c0d905b34ead653b6a.dat b/documentation/api/phpdoc-cache-a8/phpdoc-cache-file_438820914076c4c0d905b34ead653b6a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a8/phpdoc-cache-file_7d4f238133800bcb16236b5f4265e94d.dat b/documentation/api/phpdoc-cache-a8/phpdoc-cache-file_7d4f238133800bcb16236b5f4265e94d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a8/phpdoc-cache-file_915f6b44ab6b84ebd0b19001ea65ad6b.dat b/documentation/api/phpdoc-cache-a8/phpdoc-cache-file_915f6b44ab6b84ebd0b19001ea65ad6b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_1636162f0c8c1b6cbd6152231e77767d.dat b/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_1636162f0c8c1b6cbd6152231e77767d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_65e7983bea8ebadab3bcfe07e4d9dbd5.dat b/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_65e7983bea8ebadab3bcfe07e4d9dbd5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_717835a9fb51922f2cba1ebf3c74b97c.dat b/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_717835a9fb51922f2cba1ebf3c74b97c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_98f902fbcb7b8d0d19d32543e7eaa664.dat b/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_98f902fbcb7b8d0d19d32543e7eaa664.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_aac1b219d6d9ff19e1f120654a395ecc.dat b/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_aac1b219d6d9ff19e1f120654a395ecc.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_fe1d81c1b711bd31752e7fc628352be2.dat b/documentation/api/phpdoc-cache-a9/phpdoc-cache-file_fe1d81c1b711bd31752e7fc628352be2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-aa/phpdoc-cache-file_4855b1a3e650fcf51311d4c88f9653ce.dat b/documentation/api/phpdoc-cache-aa/phpdoc-cache-file_4855b1a3e650fcf51311d4c88f9653ce.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-aa/phpdoc-cache-file_69eda8fcaa667cbf6a4e0926af9fe06a.dat b/documentation/api/phpdoc-cache-aa/phpdoc-cache-file_69eda8fcaa667cbf6a4e0926af9fe06a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-aa/phpdoc-cache-file_b8150f9fa81e9a38f1b92460f951d355.dat b/documentation/api/phpdoc-cache-aa/phpdoc-cache-file_b8150f9fa81e9a38f1b92460f951d355.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-aa/phpdoc-cache-file_d77b7ff1d9d4027b90fc287e23580f88.dat b/documentation/api/phpdoc-cache-aa/phpdoc-cache-file_d77b7ff1d9d4027b90fc287e23580f88.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-aa/phpdoc-cache-file_e740d8e7402367007274a7526d9ca1e9.dat b/documentation/api/phpdoc-cache-aa/phpdoc-cache-file_e740d8e7402367007274a7526d9ca1e9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ab/phpdoc-cache-file_d2d13fcbcfab740daf756752950bbd92.dat b/documentation/api/phpdoc-cache-ab/phpdoc-cache-file_d2d13fcbcfab740daf756752950bbd92.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ab/phpdoc-cache-file_fa63ab75dc4e55dbd4f5edc3da7bcc4d.dat b/documentation/api/phpdoc-cache-ab/phpdoc-cache-file_fa63ab75dc4e55dbd4f5edc3da7bcc4d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_2340e2a56c6a2325bb53d7abdfff2664.dat b/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_2340e2a56c6a2325bb53d7abdfff2664.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_60c5841dffa0ae6d572fb43c2548fd9f.dat b/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_60c5841dffa0ae6d572fb43c2548fd9f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_9de3cc95d300c3416ed966643e7eb6a2.dat b/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_9de3cc95d300c3416ed966643e7eb6a2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_ab1f945e3ed041c09aeba6f0fb945d5b.dat b/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_ab1f945e3ed041c09aeba6f0fb945d5b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_f45572a9aa449952289194053d35c8af.dat b/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_f45572a9aa449952289194053d35c8af.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_f5e6d0b9f91ec68955cc7cac3eade7d8.dat b/documentation/api/phpdoc-cache-ac/phpdoc-cache-file_f5e6d0b9f91ec68955cc7cac3eade7d8.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ad/phpdoc-cache-file_55ea59654f67d7271d74a2ba3f25625f.dat b/documentation/api/phpdoc-cache-ad/phpdoc-cache-file_55ea59654f67d7271d74a2ba3f25625f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ad/phpdoc-cache-file_a90b46cafa45d36ccdb60463675ba54f.dat b/documentation/api/phpdoc-cache-ad/phpdoc-cache-file_a90b46cafa45d36ccdb60463675ba54f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ae/phpdoc-cache-file_424d3f36fac7089dcdd02db708b0c75d.dat b/documentation/api/phpdoc-cache-ae/phpdoc-cache-file_424d3f36fac7089dcdd02db708b0c75d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ae/phpdoc-cache-file_4ff31cfa4a4d82c31b671556a9028bf3.dat b/documentation/api/phpdoc-cache-ae/phpdoc-cache-file_4ff31cfa4a4d82c31b671556a9028bf3.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ae/phpdoc-cache-file_6c465119c1fb52a1fa5c495dbe1007ba.dat b/documentation/api/phpdoc-cache-ae/phpdoc-cache-file_6c465119c1fb52a1fa5c495dbe1007ba.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ae/phpdoc-cache-file_a6b450a3850e9850826c22a3f12f2c4c.dat b/documentation/api/phpdoc-cache-ae/phpdoc-cache-file_a6b450a3850e9850826c22a3f12f2c4c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-af/phpdoc-cache-file_117d64e629d38de452286601d0c0cc7a.dat b/documentation/api/phpdoc-cache-af/phpdoc-cache-file_117d64e629d38de452286601d0c0cc7a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-af/phpdoc-cache-file_15a3726fcb9105f041d92c23f734c7d4.dat b/documentation/api/phpdoc-cache-af/phpdoc-cache-file_15a3726fcb9105f041d92c23f734c7d4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-af/phpdoc-cache-file_2591c535df199fb67ee6c104c4c15283.dat b/documentation/api/phpdoc-cache-af/phpdoc-cache-file_2591c535df199fb67ee6c104c4c15283.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-af/phpdoc-cache-file_3ffc789e9ca7146a863fb25172f6fe29.dat b/documentation/api/phpdoc-cache-af/phpdoc-cache-file_3ffc789e9ca7146a863fb25172f6fe29.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-af/phpdoc-cache-file_cd61ec151f8c02cd63d7c188e7493e65.dat b/documentation/api/phpdoc-cache-af/phpdoc-cache-file_cd61ec151f8c02cd63d7c188e7493e65.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-af/phpdoc-cache-file_dbd16e2dca7234960efbc01d24705be7.dat b/documentation/api/phpdoc-cache-af/phpdoc-cache-file_dbd16e2dca7234960efbc01d24705be7.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b1/phpdoc-cache-file_64f32808c43bf97014f83a15f1e42432.dat b/documentation/api/phpdoc-cache-b1/phpdoc-cache-file_64f32808c43bf97014f83a15f1e42432.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b1/phpdoc-cache-file_a61946e099c66ae6e2be16b5dafa8243.dat b/documentation/api/phpdoc-cache-b1/phpdoc-cache-file_a61946e099c66ae6e2be16b5dafa8243.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b1/phpdoc-cache-file_b28f9c606ca08ac32d2b8527af720bd5.dat b/documentation/api/phpdoc-cache-b1/phpdoc-cache-file_b28f9c606ca08ac32d2b8527af720bd5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b1/phpdoc-cache-file_b93c51c82fc5f3190329c889ef7a0463.dat b/documentation/api/phpdoc-cache-b1/phpdoc-cache-file_b93c51c82fc5f3190329c889ef7a0463.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b1/phpdoc-cache-file_e6849179539d706bda2e5efdb0b8d6e6.dat b/documentation/api/phpdoc-cache-b1/phpdoc-cache-file_e6849179539d706bda2e5efdb0b8d6e6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b2/phpdoc-cache-file_ff73088382277b477a7c4989db397f2e.dat b/documentation/api/phpdoc-cache-b2/phpdoc-cache-file_ff73088382277b477a7c4989db397f2e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b3/phpdoc-cache-file_e00e0b3b9aa3184c8e9c5f21c774c757.dat b/documentation/api/phpdoc-cache-b3/phpdoc-cache-file_e00e0b3b9aa3184c8e9c5f21c774c757.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b3/phpdoc-cache-file_f714330fbcc5cda433fb3b85810a2a14.dat b/documentation/api/phpdoc-cache-b3/phpdoc-cache-file_f714330fbcc5cda433fb3b85810a2a14.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_04b3e0fe1f91b2417a8a0ff4f036e16d.dat b/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_04b3e0fe1f91b2417a8a0ff4f036e16d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_0be1ae1bb7e1d48f0f0dc6871eec8821.dat b/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_0be1ae1bb7e1d48f0f0dc6871eec8821.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_7f41025898f81078d4fcd4a66f6ce972.dat b/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_7f41025898f81078d4fcd4a66f6ce972.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_9decadcd070e3285fc727e74554d2773.dat b/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_9decadcd070e3285fc727e74554d2773.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_b1244b661ca1b6e95c680a1c2dd4fb59.dat b/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_b1244b661ca1b6e95c680a1c2dd4fb59.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_c6121287de320bb66016b1b65e250000.dat b/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_c6121287de320bb66016b1b65e250000.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_e8dec610ea95f845559b54f9c537c440.dat b/documentation/api/phpdoc-cache-b6/phpdoc-cache-file_e8dec610ea95f845559b54f9c537c440.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b7/phpdoc-cache-file_e82ffe8eca7376a847b6fe7f45b67b9e.dat b/documentation/api/phpdoc-cache-b7/phpdoc-cache-file_e82ffe8eca7376a847b6fe7f45b67b9e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-b9/phpdoc-cache-file_f7777069b123854551f9a1a3524e437b.dat b/documentation/api/phpdoc-cache-b9/phpdoc-cache-file_f7777069b123854551f9a1a3524e437b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ba/phpdoc-cache-file_5cdeff0af784bc7c6840aad33891d6d5.dat b/documentation/api/phpdoc-cache-ba/phpdoc-cache-file_5cdeff0af784bc7c6840aad33891d6d5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ba/phpdoc-cache-file_b1a988e353d23d62d115030146305186.dat b/documentation/api/phpdoc-cache-ba/phpdoc-cache-file_b1a988e353d23d62d115030146305186.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-bb/phpdoc-cache-file_7329a8bbc9c96b66485b6b62c386ed35.dat b/documentation/api/phpdoc-cache-bb/phpdoc-cache-file_7329a8bbc9c96b66485b6b62c386ed35.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-bb/phpdoc-cache-file_ef70a7d24ca89c6e0f00cc4d549a574c.dat b/documentation/api/phpdoc-cache-bb/phpdoc-cache-file_ef70a7d24ca89c6e0f00cc4d549a574c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-bc/phpdoc-cache-file_042bbb36382f5192a0512a46f92cfd1f.dat b/documentation/api/phpdoc-cache-bc/phpdoc-cache-file_042bbb36382f5192a0512a46f92cfd1f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-bd/phpdoc-cache-file_1a1ecf4a37ea221195403d8b6f2fca5c.dat b/documentation/api/phpdoc-cache-bd/phpdoc-cache-file_1a1ecf4a37ea221195403d8b6f2fca5c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-bd/phpdoc-cache-file_97a53ad0d06f3ed59a23b8abae528445.dat b/documentation/api/phpdoc-cache-bd/phpdoc-cache-file_97a53ad0d06f3ed59a23b8abae528445.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-bd/phpdoc-cache-file_9f8d89a6efb80d966ee9ddf71517d964.dat b/documentation/api/phpdoc-cache-bd/phpdoc-cache-file_9f8d89a6efb80d966ee9ddf71517d964.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-be/phpdoc-cache-file_1e2f0e235a872e708cb757f6056c7bd6.dat b/documentation/api/phpdoc-cache-be/phpdoc-cache-file_1e2f0e235a872e708cb757f6056c7bd6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-be/phpdoc-cache-file_3c05b35567eb32a5f6dfc671b96b7f3b.dat b/documentation/api/phpdoc-cache-be/phpdoc-cache-file_3c05b35567eb32a5f6dfc671b96b7f3b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-be/phpdoc-cache-file_5f9ac0ecb13c6a71bd47c70f1172b414.dat b/documentation/api/phpdoc-cache-be/phpdoc-cache-file_5f9ac0ecb13c6a71bd47c70f1172b414.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c0/phpdoc-cache-file_a0af05ff2db5b71002d0539cae2de8ff.dat b/documentation/api/phpdoc-cache-c0/phpdoc-cache-file_a0af05ff2db5b71002d0539cae2de8ff.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c0/phpdoc-cache-file_fce4558203293146b049d450189a66f8.dat b/documentation/api/phpdoc-cache-c0/phpdoc-cache-file_fce4558203293146b049d450189a66f8.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c2/phpdoc-cache-file_5cc825b33cd734ae9baa1fe881a3597f.dat b/documentation/api/phpdoc-cache-c2/phpdoc-cache-file_5cc825b33cd734ae9baa1fe881a3597f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c2/phpdoc-cache-file_efac58dda3ed2a91f80002a7984d2298.dat b/documentation/api/phpdoc-cache-c2/phpdoc-cache-file_efac58dda3ed2a91f80002a7984d2298.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c3/phpdoc-cache-file_1d937744dc6da8b27dbec9f2e5e76ea2.dat b/documentation/api/phpdoc-cache-c3/phpdoc-cache-file_1d937744dc6da8b27dbec9f2e5e76ea2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c3/phpdoc-cache-file_48bf8e04da4a66373b52aba6b495c816.dat b/documentation/api/phpdoc-cache-c3/phpdoc-cache-file_48bf8e04da4a66373b52aba6b495c816.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c4/phpdoc-cache-file_edf2fdada4f4dfb909d305db0630729b.dat b/documentation/api/phpdoc-cache-c4/phpdoc-cache-file_edf2fdada4f4dfb909d305db0630729b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c5/phpdoc-cache-file_3bbb2a3bcec23af628d6e872254a7764.dat b/documentation/api/phpdoc-cache-c5/phpdoc-cache-file_3bbb2a3bcec23af628d6e872254a7764.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c5/phpdoc-cache-file_832aa9f1729d39b5cffb3843acfa3d58.dat b/documentation/api/phpdoc-cache-c5/phpdoc-cache-file_832aa9f1729d39b5cffb3843acfa3d58.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c5/phpdoc-cache-file_a5dcf62b5a0193aa42d27f9259dfc68c.dat b/documentation/api/phpdoc-cache-c5/phpdoc-cache-file_a5dcf62b5a0193aa42d27f9259dfc68c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c6/phpdoc-cache-file_aadb42696af8b1df13a4ffc5989b697e.dat b/documentation/api/phpdoc-cache-c6/phpdoc-cache-file_aadb42696af8b1df13a4ffc5989b697e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c7/phpdoc-cache-file_1a4142ccd20153e84d6c28bee8965d26.dat b/documentation/api/phpdoc-cache-c7/phpdoc-cache-file_1a4142ccd20153e84d6c28bee8965d26.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c8/phpdoc-cache-file_ff804e4fd2e1d6bf77537523174d5779.dat b/documentation/api/phpdoc-cache-c8/phpdoc-cache-file_ff804e4fd2e1d6bf77537523174d5779.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c9/phpdoc-cache-file_8cd5a6bfe9a8427cd48b46f2ad2f99af.dat b/documentation/api/phpdoc-cache-c9/phpdoc-cache-file_8cd5a6bfe9a8427cd48b46f2ad2f99af.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-c9/phpdoc-cache-file_c1891628e009e5bd16ec5d2565e1855c.dat b/documentation/api/phpdoc-cache-c9/phpdoc-cache-file_c1891628e009e5bd16ec5d2565e1855c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ca/phpdoc-cache-file_b2b1d28b44ca31bf1dab69d0606fc25a.dat b/documentation/api/phpdoc-cache-ca/phpdoc-cache-file_b2b1d28b44ca31bf1dab69d0606fc25a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-cb/phpdoc-cache-file_9b3e5e53f4d2aa3bacbfd60c31d75865.dat b/documentation/api/phpdoc-cache-cb/phpdoc-cache-file_9b3e5e53f4d2aa3bacbfd60c31d75865.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-cb/phpdoc-cache-file_9f4dd52820112031304d6609bd08a08c.dat b/documentation/api/phpdoc-cache-cb/phpdoc-cache-file_9f4dd52820112031304d6609bd08a08c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-cc/phpdoc-cache-file_9566a32e2da16aabfddf6c786c355cce.dat b/documentation/api/phpdoc-cache-cc/phpdoc-cache-file_9566a32e2da16aabfddf6c786c355cce.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ce/phpdoc-cache-file_72af63282a3ac919401c5100147984de.dat b/documentation/api/phpdoc-cache-ce/phpdoc-cache-file_72af63282a3ac919401c5100147984de.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ce/phpdoc-cache-file_dd67b59ef7e59384403b1e4195803ff1.dat b/documentation/api/phpdoc-cache-ce/phpdoc-cache-file_dd67b59ef7e59384403b1e4195803ff1.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ce/phpdoc-cache-file_e16b1540860ea3e0eabbd5974b4b56d2.dat b/documentation/api/phpdoc-cache-ce/phpdoc-cache-file_e16b1540860ea3e0eabbd5974b4b56d2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-cf/phpdoc-cache-file_265086d53d0e7fa820c9fcb9028453dc.dat b/documentation/api/phpdoc-cache-cf/phpdoc-cache-file_265086d53d0e7fa820c9fcb9028453dc.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-cf/phpdoc-cache-file_4c1e02c69f2d5a67c8e529686bb53926.dat b/documentation/api/phpdoc-cache-cf/phpdoc-cache-file_4c1e02c69f2d5a67c8e529686bb53926.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d0/phpdoc-cache-file_b2ff8730f9ae5eae260b13055b00f3e5.dat b/documentation/api/phpdoc-cache-d0/phpdoc-cache-file_b2ff8730f9ae5eae260b13055b00f3e5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d1/phpdoc-cache-file_73e7f87157e76d45d91f49a210198749.dat b/documentation/api/phpdoc-cache-d1/phpdoc-cache-file_73e7f87157e76d45d91f49a210198749.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d1/phpdoc-cache-file_b18678ec7462c071534a54084ea87403.dat b/documentation/api/phpdoc-cache-d1/phpdoc-cache-file_b18678ec7462c071534a54084ea87403.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d2/phpdoc-cache-file_2efe5d7bddb38f718ec91745adda09aa.dat b/documentation/api/phpdoc-cache-d2/phpdoc-cache-file_2efe5d7bddb38f718ec91745adda09aa.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d2/phpdoc-cache-file_9f59feed7311ace98f9120dc081ff475.dat b/documentation/api/phpdoc-cache-d2/phpdoc-cache-file_9f59feed7311ace98f9120dc081ff475.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d2/phpdoc-cache-file_ae53ab598a9b7cec56cc1e627ad49544.dat b/documentation/api/phpdoc-cache-d2/phpdoc-cache-file_ae53ab598a9b7cec56cc1e627ad49544.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d2/phpdoc-cache-file_ddb603b6d696fac50baffcc963779d57.dat b/documentation/api/phpdoc-cache-d2/phpdoc-cache-file_ddb603b6d696fac50baffcc963779d57.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d2/phpdoc-cache-file_fafb32986b07c0d072d99651a2e852ac.dat b/documentation/api/phpdoc-cache-d2/phpdoc-cache-file_fafb32986b07c0d072d99651a2e852ac.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d3/phpdoc-cache-file_1370afce610bdfa8945f45a7f09196b0.dat b/documentation/api/phpdoc-cache-d3/phpdoc-cache-file_1370afce610bdfa8945f45a7f09196b0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d3/phpdoc-cache-file_f58c805c57f12408c1aa364d063af491.dat b/documentation/api/phpdoc-cache-d3/phpdoc-cache-file_f58c805c57f12408c1aa364d063af491.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d4/phpdoc-cache-file_62755501b8377a9f78c716715e5c8e94.dat b/documentation/api/phpdoc-cache-d4/phpdoc-cache-file_62755501b8377a9f78c716715e5c8e94.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d4/phpdoc-cache-file_832e9125e28d129a08dffc6674429050.dat b/documentation/api/phpdoc-cache-d4/phpdoc-cache-file_832e9125e28d129a08dffc6674429050.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d5/phpdoc-cache-file_16d007a671e764b5676156ca3f52eb8f.dat b/documentation/api/phpdoc-cache-d5/phpdoc-cache-file_16d007a671e764b5676156ca3f52eb8f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d5/phpdoc-cache-file_e4e6dd5844111392017114e871708213.dat b/documentation/api/phpdoc-cache-d5/phpdoc-cache-file_e4e6dd5844111392017114e871708213.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d6/phpdoc-cache-file_22f98c558369aa070cc93c3bf68b3165.dat b/documentation/api/phpdoc-cache-d6/phpdoc-cache-file_22f98c558369aa070cc93c3bf68b3165.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d6/phpdoc-cache-file_27c4023de05a5018f9a320305f2566b7.dat b/documentation/api/phpdoc-cache-d6/phpdoc-cache-file_27c4023de05a5018f9a320305f2566b7.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d6/phpdoc-cache-file_b63b0c0e7ea7539cb4f3b181cbeb10cb.dat b/documentation/api/phpdoc-cache-d6/phpdoc-cache-file_b63b0c0e7ea7539cb4f3b181cbeb10cb.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d6/phpdoc-cache-file_bfbb075787c8a54b9af875b6e1dc16a5.dat b/documentation/api/phpdoc-cache-d6/phpdoc-cache-file_bfbb075787c8a54b9af875b6e1dc16a5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d7/phpdoc-cache-file_f0026af4141eff8bc7ad5bfc4e654d07.dat b/documentation/api/phpdoc-cache-d7/phpdoc-cache-file_f0026af4141eff8bc7ad5bfc4e654d07.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d8/phpdoc-cache-file_93889157046806cf3af63db71b0379df.dat b/documentation/api/phpdoc-cache-d8/phpdoc-cache-file_93889157046806cf3af63db71b0379df.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d9/phpdoc-cache-file_62018ac8099ee0ccf6d434bbf5a2978b.dat b/documentation/api/phpdoc-cache-d9/phpdoc-cache-file_62018ac8099ee0ccf6d434bbf5a2978b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d9/phpdoc-cache-file_a7835ce1694a9fbce766f15f1d304060.dat b/documentation/api/phpdoc-cache-d9/phpdoc-cache-file_a7835ce1694a9fbce766f15f1d304060.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-d9/phpdoc-cache-file_b23b33409cce84abcf325f2bd921cc45.dat b/documentation/api/phpdoc-cache-d9/phpdoc-cache-file_b23b33409cce84abcf325f2bd921cc45.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-da/phpdoc-cache-file_284af1514ce0dda6fd9d1cbf52e57b11.dat b/documentation/api/phpdoc-cache-da/phpdoc-cache-file_284af1514ce0dda6fd9d1cbf52e57b11.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-da/phpdoc-cache-file_687fcd81d4c0a2257fd10080121f2ace.dat b/documentation/api/phpdoc-cache-da/phpdoc-cache-file_687fcd81d4c0a2257fd10080121f2ace.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-db/phpdoc-cache-file_6334c9123c36a31a9deab26b9c9b581a.dat b/documentation/api/phpdoc-cache-db/phpdoc-cache-file_6334c9123c36a31a9deab26b9c9b581a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-db/phpdoc-cache-file_96951cc2711577dcc7cd62cb0f837397.dat b/documentation/api/phpdoc-cache-db/phpdoc-cache-file_96951cc2711577dcc7cd62cb0f837397.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-dc/phpdoc-cache-file_86cf5096f73e622a6fd6a2bc719f1583.dat b/documentation/api/phpdoc-cache-dc/phpdoc-cache-file_86cf5096f73e622a6fd6a2bc719f1583.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-dc/phpdoc-cache-file_daa3aa4965d826af8d95ca5cce51d143.dat b/documentation/api/phpdoc-cache-dc/phpdoc-cache-file_daa3aa4965d826af8d95ca5cce51d143.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-dd/phpdoc-cache-file_603fb1315b0c8a8fc3b07a159a6e70a4.dat b/documentation/api/phpdoc-cache-dd/phpdoc-cache-file_603fb1315b0c8a8fc3b07a159a6e70a4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-dd/phpdoc-cache-file_b071d275e1d745730a8c09b2e009be6b.dat b/documentation/api/phpdoc-cache-dd/phpdoc-cache-file_b071d275e1d745730a8c09b2e009be6b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-dd/phpdoc-cache-file_d1f090306aece7c6773aff6f022c79a5.dat b/documentation/api/phpdoc-cache-dd/phpdoc-cache-file_d1f090306aece7c6773aff6f022c79a5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-df/phpdoc-cache-file_ad20415c3a40b3c195e52328218e7561.dat b/documentation/api/phpdoc-cache-df/phpdoc-cache-file_ad20415c3a40b3c195e52328218e7561.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e0/phpdoc-cache-file_77481b88b334c7682596ea0589936064.dat b/documentation/api/phpdoc-cache-e0/phpdoc-cache-file_77481b88b334c7682596ea0589936064.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e1/phpdoc-cache-file_284fddcb5febee29bef11650ce70e92a.dat b/documentation/api/phpdoc-cache-e1/phpdoc-cache-file_284fddcb5febee29bef11650ce70e92a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e1/phpdoc-cache-file_ddd89ae9c408a1b6813d7470d9638ced.dat b/documentation/api/phpdoc-cache-e1/phpdoc-cache-file_ddd89ae9c408a1b6813d7470d9638ced.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e2/phpdoc-cache-file_5840655521ac933e27e32b921a8c91cc.dat b/documentation/api/phpdoc-cache-e2/phpdoc-cache-file_5840655521ac933e27e32b921a8c91cc.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e2/phpdoc-cache-file_6717638b7e4e8a5313999799dec37b01.dat b/documentation/api/phpdoc-cache-e2/phpdoc-cache-file_6717638b7e4e8a5313999799dec37b01.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e2/phpdoc-cache-file_924da037ccea3fa086e465c5534571ca.dat b/documentation/api/phpdoc-cache-e2/phpdoc-cache-file_924da037ccea3fa086e465c5534571ca.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e2/phpdoc-cache-file_a82b588f4b68d89f4cd6976abbb63436.dat b/documentation/api/phpdoc-cache-e2/phpdoc-cache-file_a82b588f4b68d89f4cd6976abbb63436.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e2/phpdoc-cache-file_e5372ed80138e5ee60b7ba5086cf42e4.dat b/documentation/api/phpdoc-cache-e2/phpdoc-cache-file_e5372ed80138e5ee60b7ba5086cf42e4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e3/phpdoc-cache-file_d13afc753a2b434853e67f216ffb6fc4.dat b/documentation/api/phpdoc-cache-e3/phpdoc-cache-file_d13afc753a2b434853e67f216ffb6fc4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e3/phpdoc-cache-file_e4147dea1ec68dca2a40965fa6390f8b.dat b/documentation/api/phpdoc-cache-e3/phpdoc-cache-file_e4147dea1ec68dca2a40965fa6390f8b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e4/phpdoc-cache-file_3c6eaad8989ea9d20019fd201cedc794.dat b/documentation/api/phpdoc-cache-e4/phpdoc-cache-file_3c6eaad8989ea9d20019fd201cedc794.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e4/phpdoc-cache-file_8c2a33d398b05ceba55efcc98026d16c.dat b/documentation/api/phpdoc-cache-e4/phpdoc-cache-file_8c2a33d398b05ceba55efcc98026d16c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e4/phpdoc-cache-file_c5324374bf49265a1d8217baa708b86e.dat b/documentation/api/phpdoc-cache-e4/phpdoc-cache-file_c5324374bf49265a1d8217baa708b86e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e5/phpdoc-cache-file_28185e1d31551706b6952858de8243ae.dat b/documentation/api/phpdoc-cache-e5/phpdoc-cache-file_28185e1d31551706b6952858de8243ae.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e5/phpdoc-cache-file_5e21bf382c3074bfc6ed877381c88c40.dat b/documentation/api/phpdoc-cache-e5/phpdoc-cache-file_5e21bf382c3074bfc6ed877381c88c40.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e5/phpdoc-cache-file_c09ec856b070697ed0e8d1734b3c6211.dat b/documentation/api/phpdoc-cache-e5/phpdoc-cache-file_c09ec856b070697ed0e8d1734b3c6211.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e5/phpdoc-cache-file_c4b2413c0ae028886f062cb5a52b64d2.dat b/documentation/api/phpdoc-cache-e5/phpdoc-cache-file_c4b2413c0ae028886f062cb5a52b64d2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e6/phpdoc-cache-file_1edd5c11037b1b59a1f8b1d80b90c01d.dat b/documentation/api/phpdoc-cache-e6/phpdoc-cache-file_1edd5c11037b1b59a1f8b1d80b90c01d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e7/phpdoc-cache-file_2126d3aab3be1e777170ac30dce93720.dat b/documentation/api/phpdoc-cache-e7/phpdoc-cache-file_2126d3aab3be1e777170ac30dce93720.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e7/phpdoc-cache-file_255242a860d1848261d46fff19c7071d.dat b/documentation/api/phpdoc-cache-e7/phpdoc-cache-file_255242a860d1848261d46fff19c7071d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e7/phpdoc-cache-file_4c2910cb7372e1f32a617e0901a62d7a.dat b/documentation/api/phpdoc-cache-e7/phpdoc-cache-file_4c2910cb7372e1f32a617e0901a62d7a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e7/phpdoc-cache-file_5fe478a2a25c1f9d5ce6f3b64a312b9e.dat b/documentation/api/phpdoc-cache-e7/phpdoc-cache-file_5fe478a2a25c1f9d5ce6f3b64a312b9e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e7/phpdoc-cache-file_fbf2f6d0676ddf39aefb68003f03e976.dat b/documentation/api/phpdoc-cache-e7/phpdoc-cache-file_fbf2f6d0676ddf39aefb68003f03e976.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_0278bb2045659d3c069061a7a4f6ec68.dat b/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_0278bb2045659d3c069061a7a4f6ec68.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_0457aded8463f23a74c2f7c4cc6b5cb5.dat b/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_0457aded8463f23a74c2f7c4cc6b5cb5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_16eeb8183266d903e96a730c3735bc6b.dat b/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_16eeb8183266d903e96a730c3735bc6b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_18c0c847e36ee6622ce24875fab46481.dat b/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_18c0c847e36ee6622ce24875fab46481.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_234ab3d3a8739f930f87567b9690a7ac.dat b/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_234ab3d3a8739f930f87567b9690a7ac.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_27c674bf12652057b95b65c3cc1860ff.dat b/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_27c674bf12652057b95b65c3cc1860ff.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_fc0e801390d365e04e40fe87274eb857.dat b/documentation/api/phpdoc-cache-e8/phpdoc-cache-file_fc0e801390d365e04e40fe87274eb857.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e9/phpdoc-cache-file_31ab2d4d69364fd0104a269607649740.dat b/documentation/api/phpdoc-cache-e9/phpdoc-cache-file_31ab2d4d69364fd0104a269607649740.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e9/phpdoc-cache-file_926576bef6099e8b1558d858a9ed20d5.dat b/documentation/api/phpdoc-cache-e9/phpdoc-cache-file_926576bef6099e8b1558d858a9ed20d5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-e9/phpdoc-cache-file_bcb2e7b13d0d4e073466926d18824135.dat b/documentation/api/phpdoc-cache-e9/phpdoc-cache-file_bcb2e7b13d0d4e073466926d18824135.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ea/phpdoc-cache-file_5150879a921d1edab729a63e987b46d8.dat b/documentation/api/phpdoc-cache-ea/phpdoc-cache-file_5150879a921d1edab729a63e987b46d8.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ea/phpdoc-cache-file_9bea330c4032c51dc4089032a253ba76.dat b/documentation/api/phpdoc-cache-ea/phpdoc-cache-file_9bea330c4032c51dc4089032a253ba76.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-eb/phpdoc-cache-file_e8e0768e08fdf29bec7ef62622745c1b.dat b/documentation/api/phpdoc-cache-eb/phpdoc-cache-file_e8e0768e08fdf29bec7ef62622745c1b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-eb/phpdoc-cache-file_ebb395969fc3ec1ba56c9391fe274c4b.dat b/documentation/api/phpdoc-cache-eb/phpdoc-cache-file_ebb395969fc3ec1ba56c9391fe274c4b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ec/phpdoc-cache-file_130fdbd1c55c2d2d5bbbaf499a7494b2.dat b/documentation/api/phpdoc-cache-ec/phpdoc-cache-file_130fdbd1c55c2d2d5bbbaf499a7494b2.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ec/phpdoc-cache-file_525f113107a0a12b363562577cc2dcff.dat b/documentation/api/phpdoc-cache-ec/phpdoc-cache-file_525f113107a0a12b363562577cc2dcff.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ec/phpdoc-cache-file_598cf23046f43703e6eba1983e0ce1bb.dat b/documentation/api/phpdoc-cache-ec/phpdoc-cache-file_598cf23046f43703e6eba1983e0ce1bb.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ec/phpdoc-cache-file_6ff463f146aedfcfd360ce5a8fedcb5d.dat b/documentation/api/phpdoc-cache-ec/phpdoc-cache-file_6ff463f146aedfcfd360ce5a8fedcb5d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ed/phpdoc-cache-file_9e83bfcb4ad5c41852006c55a46a2f72.dat b/documentation/api/phpdoc-cache-ed/phpdoc-cache-file_9e83bfcb4ad5c41852006c55a46a2f72.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ed/phpdoc-cache-file_babd614306d3c45378af2b7e6357033d.dat b/documentation/api/phpdoc-cache-ed/phpdoc-cache-file_babd614306d3c45378af2b7e6357033d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ee/phpdoc-cache-file_96c6151468b03666a812082bf7bfacf9.dat b/documentation/api/phpdoc-cache-ee/phpdoc-cache-file_96c6151468b03666a812082bf7bfacf9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ef/phpdoc-cache-file_aafe3e3c258e4e00d8acd003d34a25d6.dat b/documentation/api/phpdoc-cache-ef/phpdoc-cache-file_aafe3e3c258e4e00d8acd003d34a25d6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ef/phpdoc-cache-file_eea623a41582565fe28ebffaa0913bd7.dat b/documentation/api/phpdoc-cache-ef/phpdoc-cache-file_eea623a41582565fe28ebffaa0913bd7.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f0/phpdoc-cache-file_2d0e75c846e5078f0a61e426a5969ee9.dat b/documentation/api/phpdoc-cache-f0/phpdoc-cache-file_2d0e75c846e5078f0a61e426a5969ee9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f0/phpdoc-cache-file_931657f7683f5d3368f814b6a2a92689.dat b/documentation/api/phpdoc-cache-f0/phpdoc-cache-file_931657f7683f5d3368f814b6a2a92689.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f0/phpdoc-cache-file_9c86484e2acd47f9bf4e560c9b0105ff.dat b/documentation/api/phpdoc-cache-f0/phpdoc-cache-file_9c86484e2acd47f9bf4e560c9b0105ff.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f0/phpdoc-cache-file_b617c8caed29d2fd4ae26ed2c0c4fdf4.dat b/documentation/api/phpdoc-cache-f0/phpdoc-cache-file_b617c8caed29d2fd4ae26ed2c0c4fdf4.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f1/phpdoc-cache-file_bc4e29c76fe113554e183af52f897b65.dat b/documentation/api/phpdoc-cache-f1/phpdoc-cache-file_bc4e29c76fe113554e183af52f897b65.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f1/phpdoc-cache-file_c5531200ca3389bbe0bcaa3f201af0e5.dat b/documentation/api/phpdoc-cache-f1/phpdoc-cache-file_c5531200ca3389bbe0bcaa3f201af0e5.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f2/phpdoc-cache-file_071ce88b22c1d9ff6f11c18561d8d6cb.dat b/documentation/api/phpdoc-cache-f2/phpdoc-cache-file_071ce88b22c1d9ff6f11c18561d8d6cb.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f2/phpdoc-cache-file_5b2409c0b60e4b5895e19edb6ab2ca6f.dat b/documentation/api/phpdoc-cache-f2/phpdoc-cache-file_5b2409c0b60e4b5895e19edb6ab2ca6f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f2/phpdoc-cache-file_90c06817bb87dd194601544afa659901.dat b/documentation/api/phpdoc-cache-f2/phpdoc-cache-file_90c06817bb87dd194601544afa659901.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f3/phpdoc-cache-file_5086dab53c078f395027f57e00fc6dac.dat b/documentation/api/phpdoc-cache-f3/phpdoc-cache-file_5086dab53c078f395027f57e00fc6dac.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f3/phpdoc-cache-file_5a9f5328801bed42d1edeb96a4ac871a.dat b/documentation/api/phpdoc-cache-f3/phpdoc-cache-file_5a9f5328801bed42d1edeb96a4ac871a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f3/phpdoc-cache-file_6308945f40a44eac79459bb6a6da5c04.dat b/documentation/api/phpdoc-cache-f3/phpdoc-cache-file_6308945f40a44eac79459bb6a6da5c04.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f4/phpdoc-cache-file_1fcc0656fdc2d84a1d6edd199a0eabbd.dat b/documentation/api/phpdoc-cache-f4/phpdoc-cache-file_1fcc0656fdc2d84a1d6edd199a0eabbd.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f4/phpdoc-cache-file_6533a78c2260615a9e5171454cbb4f23.dat b/documentation/api/phpdoc-cache-f4/phpdoc-cache-file_6533a78c2260615a9e5171454cbb4f23.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f4/phpdoc-cache-file_925e1734286928436e7193a6dda4d87b.dat b/documentation/api/phpdoc-cache-f4/phpdoc-cache-file_925e1734286928436e7193a6dda4d87b.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f4/phpdoc-cache-file_b58aa07464ed69a02634f89541f7dec3.dat b/documentation/api/phpdoc-cache-f4/phpdoc-cache-file_b58aa07464ed69a02634f89541f7dec3.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f5/phpdoc-cache-file_69bebcf2ec6f5d364b97b8dc42a76cab.dat b/documentation/api/phpdoc-cache-f5/phpdoc-cache-file_69bebcf2ec6f5d364b97b8dc42a76cab.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f5/phpdoc-cache-file_6a9414d75ddf96e8f9aeb7afe3450e3a.dat b/documentation/api/phpdoc-cache-f5/phpdoc-cache-file_6a9414d75ddf96e8f9aeb7afe3450e3a.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f6/phpdoc-cache-file_1ca75ecdbe0f836d250e435431c6cd63.dat b/documentation/api/phpdoc-cache-f6/phpdoc-cache-file_1ca75ecdbe0f836d250e435431c6cd63.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f6/phpdoc-cache-file_415fd344c1229472372a06e7cccb218c.dat b/documentation/api/phpdoc-cache-f6/phpdoc-cache-file_415fd344c1229472372a06e7cccb218c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f6/phpdoc-cache-file_c16934e15f04cfc351ce0b5a2fd128b6.dat b/documentation/api/phpdoc-cache-f6/phpdoc-cache-file_c16934e15f04cfc351ce0b5a2fd128b6.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f6/phpdoc-cache-file_e6b8bc3613f2e2546be2db11c1edb92f.dat b/documentation/api/phpdoc-cache-f6/phpdoc-cache-file_e6b8bc3613f2e2546be2db11c1edb92f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f7/phpdoc-cache-file_09f63bb12393ddf82ca4585feee32044.dat b/documentation/api/phpdoc-cache-f7/phpdoc-cache-file_09f63bb12393ddf82ca4585feee32044.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f7/phpdoc-cache-file_ff6079e65f8aea9a8369183a7fd6e19f.dat b/documentation/api/phpdoc-cache-f7/phpdoc-cache-file_ff6079e65f8aea9a8369183a7fd6e19f.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f8/phpdoc-cache-file_90cfdb1a8c9d266fc9e4d94cbe72aab0.dat b/documentation/api/phpdoc-cache-f8/phpdoc-cache-file_90cfdb1a8c9d266fc9e4d94cbe72aab0.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f9/phpdoc-cache-file_011efc08f8485e7752bf0da413539561.dat b/documentation/api/phpdoc-cache-f9/phpdoc-cache-file_011efc08f8485e7752bf0da413539561.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f9/phpdoc-cache-file_1ace23574ac2d6d82733bf71cb74025e.dat b/documentation/api/phpdoc-cache-f9/phpdoc-cache-file_1ace23574ac2d6d82733bf71cb74025e.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-f9/phpdoc-cache-file_1add6a6f23743e2234c378e05beac29d.dat b/documentation/api/phpdoc-cache-f9/phpdoc-cache-file_1add6a6f23743e2234c378e05beac29d.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fa/phpdoc-cache-file_cf970b63319f369f70cd2a2bf7147bb9.dat b/documentation/api/phpdoc-cache-fa/phpdoc-cache-file_cf970b63319f369f70cd2a2bf7147bb9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fb/phpdoc-cache-file_752d3473588679cbf5167548d5d846cc.dat b/documentation/api/phpdoc-cache-fb/phpdoc-cache-file_752d3473588679cbf5167548d5d846cc.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fc/phpdoc-cache-file_39ba6cbce6e0262121ddac3766d53fbf.dat b/documentation/api/phpdoc-cache-fc/phpdoc-cache-file_39ba6cbce6e0262121ddac3766d53fbf.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fc/phpdoc-cache-file_52a2a799d70812ad49b51c59877d9234.dat b/documentation/api/phpdoc-cache-fc/phpdoc-cache-file_52a2a799d70812ad49b51c59877d9234.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fc/phpdoc-cache-file_813f6784ad945213c270d8f5111ba100.dat b/documentation/api/phpdoc-cache-fc/phpdoc-cache-file_813f6784ad945213c270d8f5111ba100.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fc/phpdoc-cache-file_849a3fed1ffaee9b272bbdaac90d847c.dat b/documentation/api/phpdoc-cache-fc/phpdoc-cache-file_849a3fed1ffaee9b272bbdaac90d847c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fc/phpdoc-cache-file_c43d3ccc11c02c1e51878514279e583c.dat b/documentation/api/phpdoc-cache-fc/phpdoc-cache-file_c43d3ccc11c02c1e51878514279e583c.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fd/phpdoc-cache-file_5a0ec461faba6c24629bc724dd7e79d9.dat b/documentation/api/phpdoc-cache-fd/phpdoc-cache-file_5a0ec461faba6c24629bc724dd7e79d9.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fd/phpdoc-cache-file_8ccdbbac8df4dad1c84995e897d58f80.dat b/documentation/api/phpdoc-cache-fd/phpdoc-cache-file_8ccdbbac8df4dad1c84995e897d58f80.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fe/phpdoc-cache-file_3a202f8aed229d2e6b7013a1f8887467.dat b/documentation/api/phpdoc-cache-fe/phpdoc-cache-file_3a202f8aed229d2e6b7013a1f8887467.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fe/phpdoc-cache-file_ba3f73c72527fdc8215470469c924b07.dat b/documentation/api/phpdoc-cache-fe/phpdoc-cache-file_ba3f73c72527fdc8215470469c924b07.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-fe/phpdoc-cache-file_e79721e3d1f008bb0a4184f772e38609.dat b/documentation/api/phpdoc-cache-fe/phpdoc-cache-file_e79721e3d1f008bb0a4184f772e38609.dat old mode 100644 new mode 100755 diff --git a/documentation/api/phpdoc-cache-ff/phpdoc-cache-file_4299eabd52ccf9d3218008aefb3ec617.dat b/documentation/api/phpdoc-cache-ff/phpdoc-cache-file_4299eabd52ccf9d3218008aefb3ec617.dat old mode 100644 new mode 100755 diff --git a/documentation/api/reports/deprecated.html b/documentation/api/reports/deprecated.html old mode 100644 new mode 100755 diff --git a/documentation/api/reports/errors.html b/documentation/api/reports/errors.html old mode 100644 new mode 100755 diff --git a/documentation/api/reports/markers.html b/documentation/api/reports/markers.html old mode 100644 new mode 100755 diff --git a/install/INSTALL-TODO.txt b/install/INSTALL-TODO.txt old mode 100644 new mode 100755 diff --git a/install/faker-assets/FreeSans.ttf b/install/faker-assets/FreeSans.ttf old mode 100644 new mode 100755 diff --git a/install/faker.php b/install/faker.php index b262a8460..1394196d7 100755 --- a/install/faker.php +++ b/install/faker.php @@ -1,22 +1,434 @@ boot(); $faker = Faker\Factory::create(); -$con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME); +$con = \Propel\Runtime\Propel::getConnection( + Thelia\Model\Map\ProductTableMap::DATABASE_NAME +); $con->beginTransaction(); $currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne(); +try { + $stmt = $con->prepare("SET foreign_key_checks = 0"); + $stmt->execute(); + + $productAssociatedContent = Thelia\Model\ProductAssociatedContentQuery::create() + ->find(); + $productAssociatedContent->delete(); + + $categoryAssociatedContent = Thelia\Model\CategoryAssociatedContentQuery::create() + ->find(); + $categoryAssociatedContent->delete(); + + $attributeCategory = Thelia\Model\AttributeCategoryQuery::create() + ->find(); + $attributeCategory->delete(); + + $featureCategory = Thelia\Model\FeatureCategoryQuery::create() + ->find(); + $featureCategory->delete(); + + $featureProduct = Thelia\Model\FeatureProductQuery::create() + ->find(); + $featureProduct->delete(); + + $attributeCombination = Thelia\Model\AttributeCombinationQuery::create() + ->find(); + $attributeCombination->delete(); + + $feature = Thelia\Model\FeatureQuery::create() + ->find(); + $feature->delete(); + + $feature = Thelia\Model\FeatureI18nQuery::create() + ->find(); + $feature->delete(); + + $featureAv = Thelia\Model\FeatureAvQuery::create() + ->find(); + $featureAv->delete(); + + $featureAv = Thelia\Model\FeatureAvI18nQuery::create() + ->find(); + $featureAv->delete(); + + $attribute = Thelia\Model\AttributeQuery::create() + ->find(); + $attribute->delete(); + + $attribute = Thelia\Model\AttributeI18nQuery::create() + ->find(); + $attribute->delete(); + + $attributeAv = Thelia\Model\AttributeAvQuery::create() + ->find(); + $attributeAv->delete(); + + $attributeAv = Thelia\Model\AttributeAvI18nQuery::create() + ->find(); + $attributeAv->delete(); + + $category = Thelia\Model\CategoryQuery::create() + ->find(); + $category->delete(); + + $category = Thelia\Model\CategoryI18nQuery::create() + ->find(); + $category->delete(); + + $product = Thelia\Model\ProductQuery::create() + ->find(); + $product->delete(); + + $product = Thelia\Model\ProductI18nQuery::create() + ->find(); + $product->delete(); + + $customer = Thelia\Model\CustomerQuery::create() + ->find(); + $customer->delete(); + + $folder = Thelia\Model\FolderQuery::create() + ->find(); + $folder->delete(); + + $folder = Thelia\Model\FolderI18nQuery::create() + ->find(); + $folder->delete(); + + $content = Thelia\Model\ContentQuery::create() + ->find(); + $content->delete(); + + $content = Thelia\Model\ContentI18nQuery::create() + ->find(); + $content->delete(); + + $accessory = Thelia\Model\AccessoryQuery::create() + ->find(); + $accessory->delete(); + + $stock = \Thelia\Model\ProductSaleElementsQuery::create() + ->find(); + $stock->delete(); + + $productPrice = \Thelia\Model\ProductPriceQuery::create() + ->find(); + $productPrice->delete(); + + $stmt = $con->prepare("SET foreign_key_checks = 1"); + $stmt->execute(); + + //customer + $customer = new Thelia\Model\Customer(); + $customer->createOrUpdate( + 1, + "thelia", + "thelia", + "5 rue rochon", + "", + "", + "0102030405", + "0601020304", + "63000", + "clermont-ferrand", + 64, + "test@thelia.net", + "azerty" + ); + + //features and features_av + $featureList = array(); + for($i=0; $i<4; $i++) { + $feature = new Thelia\Model\Feature(); + $feature->setVisible(rand(1, 10)>7 ? 0 : 1); + $feature->setPosition($i); + setI18n($faker, $feature); + + $feature->save(); + $featureId = $feature->getId(); + $featureList[$featureId] = array(); + + for($j=0; $jsetFeature($feature); + $featureAv->setPosition($j); + setI18n($faker, $featureAv); + + $featureAv->save(); + $featureList[$featureId][] = $featureAv->getId(); + } + } + + //attributes and attributes_av + $attributeList = array(); + for($i=0; $i<4; $i++) { + $attribute = new Thelia\Model\Attribute(); + $attribute->setPosition($i); + setI18n($faker, $attribute); + + $attribute->save(); + $attributeId = $attribute->getId(); + $attributeList[$attributeId] = array(); + + for($j=0; $jsetAttribute($attribute); + $attributeAv->setPosition($j); + setI18n($faker, $attributeAv); + + $attributeAv->save(); + $attributeList[$attributeId][] = $attributeAv->getId(); + } + } + + //folders and contents + $contentIdList = array(); + for($i=0; $i<4; $i++) { + $folder = new Thelia\Model\Folder(); + $folder->setParent(0); + $folder->setVisible(rand(1, 10)>7 ? 0 : 1); + $folder->setPosition($i); + setI18n($faker, $folder); + + $folder->save(); + + $image = new FolderImage(); + $image->setFolderId($folder->getId()); + generate_image($image, 1, 'folder', $folder->getId()); + + for($j=1; $jsetParent($folder->getId()); + $subfolder->setVisible(rand(1, 10)>7 ? 0 : 1); + $subfolder->setPosition($j); + setI18n($faker, $subfolder); + + $subfolder->save(); + + $image = new FolderImage(); + $image->setFolderId($subfolder->getId()); + generate_image($image, 1, 'folder', $subfolder->getId()); + + for($k=0; $kaddFolder($subfolder); + $content->setVisible(rand(1, 10)>7 ? 0 : 1); + $content->setPosition($k); + setI18n($faker, $content); + + $content->save(); + $contentId = $content->getId(); + $contentIdList[] = $contentId; + + $image = new ContentImage(); + $image->setContentId($content->getId()); + generate_image($image, 1, 'content', $contentId); + } + } + } + + //categories and products + $productIdList = array(); + $categoryIdList = array(); + for($i=1; $i<5; $i++) { + $category = createCategory($faker, 0, $i, $categoryIdList, $contentIdList); + + for($j=1; $jgetId(), $j, $categoryIdList, $contentIdList); + + for($k=0; $k $attributeAvId) { + $attributeCategory = new Thelia\Model\AttributeCategory(); + $attributeCategory->setCategoryId($categoryId) + ->setAttributeId($attributeId) + ->save(); + } + foreach($featureList as $featureId => $featureAvId) { + $featureCategory = new Thelia\Model\FeatureCategory(); + $featureCategory->setCategoryId($categoryId) + ->setFeatureId($featureId) + ->save(); + } + } + + foreach($productIdList as $productId) { + //add random accessories - or not + $alreadyPicked = array(); + for($i=1; $isetAccessory($productIdList[$pick]) + ->setProductId($productId) + ->setPosition($i) + ->save(); + } + + //add random associated content + $alreadyPicked = array(); + for($i=1; $isetContentId($contentIdList[$pick]) + ->setProductId($productId) + ->setPosition($i) + ->save(); + } + + //associate PSE and stocks to products + for($i=0; $isetProductId($productId); + $stock->setQuantity($faker->randomNumber(1,50)); + $stock->setPromo($faker->randomNumber(0,1)); + $stock->setNewness($faker->randomNumber(0,1)); + $stock->setWeight($faker->randomFloat(2, 100,10000)); + $stock->save(); + + $productPrice = new \Thelia\Model\ProductPrice(); + $productPrice->setProductSaleElements($stock); + $productPrice->setCurrency($currency); + $productPrice->setPrice($faker->randomFloat(2, 20, 250)); + $productPrice->setPromoPrice($faker->randomFloat(2, 20, 250)); + $productPrice->save(); + + //associate attributes - or not - to PSE + + $alreadyPicked = array(); + for($i=0; $isetAttributeId($pick) + ->setAttributeAvId($attributeList[$pick][array_rand($attributeList[$pick], 1)]) + ->setProductSaleElements($stock) + ->save(); + } + } + + //associate features to products + foreach($featureList as $featureId => $featureAvId) { + $featureProduct = new Thelia\Model\FeatureProduct(); + $featureProduct->setProductId($productId) + ->setFeatureId($featureId); + + if(count($featureAvId) > 0) { //got some av + $featureProduct->setFeatureAvId( + $featureAvId[array_rand($featureAvId, 1)] + ); + } else { //no av + $featureProduct->setByDefault($faker->text(10)); + } + + $featureProduct->save(); + } + } + + generateCouponFixtures($thelia); + + $con->commit(); +} catch (Exception $e) { + echo "error : ".$e->getMessage()."\n"; + $con->rollBack(); +} + +function createProduct($faker, $category, $position, &$productIdList) +{ + $product = new Thelia\Model\Product(); + $product->setRef($category->getId() . '_' . $position . '_' . $faker->randomNumber(8)); + $product->addCategory($category); + $product->setVisible(rand(1, 10)>7 ? 0 : 1); + $product->setPosition($position); + $product->setTaxRuleId(1); + setI18n($faker, $product); + + $product->save(); + $productId = $product->getId(); + $productIdList[] = $productId; + + $image = new ProductImage(); + $image->setProductId($productId); + generate_image($image, 1, 'product', $productId); + + return $product; +} + +function createCategory($faker, $parent, $position, &$categoryIdList, $contentIdList) +{ + $category = new Thelia\Model\Category(); + $category->setParent($parent); + $category->setVisible(rand(1, 10)>7 ? 0 : 1); + $category->setPosition($position); + setI18n($faker, $category); + + $category->save(); + $categoryId = $category->getId(); + $categoryIdList[] = $categoryId; + + //add random associated content + $alreadyPicked = array(); + for ($i=1; $isetContentId($contentIdList[$pick]) + ->setCategoryId($categoryId) + ->setPosition($i) + ->save(); + } + + $image = new CategoryImage(); + $image->setCategoryId($categoryId); + generate_image($image, 1, 'category', $categoryId); + + return $category; +} + function generate_image($image, $position, $typeobj, $id) { global $faker; @@ -66,232 +478,77 @@ function generate_image($image, $position, $typeobj, $id) { $image->save($image_file); } -try { +function setI18n($faker, &$object) +{ + $localeList = array('fr_FR', 'en_EN'); - $stmt = $con->prepare("SET foreign_key_checks = 0"); - $stmt->execute(); + $title = $faker->text(20); + $description = $faker->text(50); - $category = Thelia\Model\CategoryQuery::create() - ->find(); - $category->delete(); + foreach($localeList as $locale) { + $object->setLocale($locale); - $product = Thelia\Model\ProductQuery::create() - ->find(); - $product->delete(); + $object->setTitle($locale . ' : ' . $title); + $object->setDescription($locale . ' : ' . $description); + } +} +/** + * Generate Coupon fixtures + */ +function generateCouponFixtures($thelia) +{ + $container = $thelia->getContainer(); + $adapter = $container->get('thelia.adapter'); + $translator = $container->get('thelia.translator'); - $customer = Thelia\Model\CustomerQuery::create() - ->find(); - $customer->delete(); + // Coupons + $coupon1 = new Thelia\Model\Coupon(); + $coupon1->setCode('XMAS'); + $coupon1->setType('Thelia\Coupon\Type\RemoveXAmount'); + $coupon1->setTitle('Christmas coupon'); + $coupon1->setShortDescription('Coupon for Christmas removing 10€ if your total checkout is more than 40€'); + $coupon1->setDescription('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras at luctus tellus. Integer turpis mauris, aliquet vitae risus tristique, pellentesque vestibulum urna. Vestibulum sodales laoreet lectus dictum suscipit. Praesent vulputate, sem id varius condimentum, quam magna tempor elit, quis venenatis ligula nulla eget libero. Cras egestas euismod tellus, id pharetra leo suscipit quis. Donec lacinia ac lacus et ultricies. Nunc in porttitor neque. Proin at quam congue, consectetur orci sed, congue nulla. Nulla eleifend nunc ligula, nec pharetra elit tempus quis. Vivamus vel mauris sed est dictum blandit. Maecenas blandit dapibus velit ut sollicitudin. In in euismod mauris, consequat viverra magna. Cras velit velit, sollicitudin commodo tortor gravida, tempus varius nulla. - $customer = new Thelia\Model\Customer(); - $customer->createOrUpdate( - 1, - "thelia", - "thelia", - "5 rue rochon", - "", - "", - "0102030405", - "0601020304", - "63000", - "clermont-ferrand", - 64, - "test@thelia.net", - "azerty" +Donec rhoncus leo mauris, id porttitor ante luctus tempus. Curabitur quis augue feugiat, ullamcorper mauris ac, interdum mi. Quisque aliquam lorem vitae felis lobortis, id interdum turpis mattis. Vestibulum diam massa, ornare congue blandit quis, facilisis at nisl. In tortor metus, venenatis non arcu nec, sollicitudin ornare nisl. Nunc erat risus, varius nec urna at, iaculis lacinia elit. Aenean ut felis tempus, tincidunt odio non, sagittis nisl. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec vitae hendrerit elit. Nunc sit amet gravida risus, euismod lobortis massa. Nam a erat mauris. Nam a malesuada lorem. Nulla id accumsan dolor, sed rhoncus tellus. Quisque dictum felis sed leo auctor, at volutpat lectus viverra. Morbi rutrum, est ac aliquam imperdiet, nibh sem sagittis justo, ac mattis magna lacus eu nulla. + +Duis interdum lectus nulla, nec pellentesque sapien condimentum at. Suspendisse potenti. Sed eu purus tellus. Nunc quis rhoncus metus. Fusce vitae tellus enim. Interdum et malesuada fames ac ante ipsum primis in faucibus. Etiam tempor porttitor erat vitae iaculis. Sed est elit, consequat non ornare vitae, vehicula eget lectus. Etiam consequat sapien mauris, eget consectetur magna imperdiet eget. Nunc sollicitudin luctus velit, in commodo nulla adipiscing fermentum. Fusce nisi sapien, posuere vitae metus sit amet, facilisis sollicitudin dui. Fusce ultricies auctor enim sit amet iaculis. Morbi at vestibulum enim, eget adipiscing eros. + +Praesent ligula lorem, faucibus ut metus quis, fermentum iaculis erat. Pellentesque elit erat, lacinia sed semper ac, sagittis vel elit. Nam eu convallis est. Curabitur rhoncus odio vitae consectetur pellentesque. Nam vitae arcu nec ante scelerisque dignissim vel nec neque. Suspendisse augue nulla, mollis eget dui et, tempor facilisis erat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac diam ipsum. Donec convallis dui ultricies velit auctor, non lobortis nulla ultrices. Morbi vitae dignissim ante, sit amet lobortis tortor. Nunc dapibus condimentum augue, in molestie neque congue non. + +Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesuada tortor vel erat volutpat tincidunt. In vehicula diam est, a convallis eros scelerisque ut. Donec aliquet venenatis iaculis. Ut a arcu gravida, placerat dui eu, iaculis nisl. Quisque adipiscing orci sit amet dui dignissim lacinia. Sed vulputate lorem non dolor adipiscing ornare. Morbi ornare id nisl id aliquam. Ut fringilla elit ante, nec lacinia enim fermentum sit amet. Aenean rutrum lorem eu convallis pharetra. Cras malesuada varius metus, vitae gravida velit. Nam a varius ipsum, ac commodo dolor. Phasellus nec elementum elit. Etiam vel adipiscing leo.'); + $coupon1->setAmount(10.00); + $coupon1->setIsUsed(1); + $coupon1->setIsEnabled(1); + $date = new \DateTime(); + $coupon1->setExpirationDate($date->setTimestamp(strtotime("today + 2 months"))); + + $rule1 = new AvailableForTotalAmount($adapter); + $operators = array(AvailableForTotalAmount::PARAM1_PRICE => Operators::SUPERIOR); + $values = array( + AvailableForTotalAmount::PARAM1_PRICE => 40.00, + AvailableForTotalAmount::PARAM1_CURRENCY => 'EUR' ); + $rule1->populateFromForm($operators, $values); + $rule2 = new AvailableForTotalAmount($adapter); + $operators = array(AvailableForTotalAmount::PARAM1_PRICE => Operators::INFERIOR); + $values = array( + AvailableForTotalAmount::PARAM1_PRICE => 400.00, + AvailableForTotalAmount::PARAM1_CURRENCY => 'EUR' + ); + $rule2->populateFromForm($operators, $values); - $folder = Thelia\Model\FolderQuery::create() - ->find(); - $folder->delete(); + $rules = new CouponRuleCollection(); + $rules->add($rule1); + $rules->add($rule2); - $content = Thelia\Model\ContentQuery::create() - ->find(); - $content->delete(); + /** @var ConstraintManager $constraintManager */ + $constraintManager = new ConstraintManager($container); - $stmt = $con->prepare("SET foreign_key_checks = 1"); - $stmt->execute(); + $serializedRules = $constraintManager->serializeCouponRuleCollection($rules); + $coupon1->setSerializedRules($serializedRules); - //first category - $sweet = new Thelia\Model\Category(); - $sweet->setParent(0); - $sweet->setVisible(1); - $sweet->setPosition(1); - $sweet->setDescription($faker->text(255)); - $sweet->setTitle($faker->text(20)); - - $sweet->save(); - - $image = new CategoryImage(); - $image->setCategoryId($sweet->getId()); - generate_image($image, 1, 'category', $sweet->getId()); - - //second category - $jeans = new Thelia\Model\Category(); - $jeans->setParent(0); - $jeans->setVisible(1); - $jeans->setPosition(2); - $jeans->setDescription($faker->text(255)); - $jeans->setTitle($faker->text(20)); - - $jeans->save(); - - $image = new CategoryImage(); - $image->setCategoryId($jeans->getId()); - generate_image($image, 2, 'category', $jeans->getId()); - - //third category - $other = new Thelia\Model\Category(); - $other->setParent($jeans->getId()); - $other->setVisible(1); - $other->setPosition(3); - $other->setDescription($faker->text(255)); - $other->setTitle($faker->text(20)); - - $other->save(); - - $image = new CategoryImage(); - $image->setCategoryId($other->getId()); - generate_image($image, 3, 'category', $other->getId()); - - for ($i=1; $i <= 5; $i++) { - $product = new \Thelia\Model\Product(); - $product->addCategory($sweet); - $product->setTitle($faker->text(20)); - $product->setDescription($faker->text(250)); -/* $product->setQuantity($faker->randomNumber(1,50)); - $product->setPrice($faker->randomFloat(2, 20, 2500));*/ - $product->setVisible(1); - $product->setPosition($i); - $product->setRef($faker->text(255)); - $product->save(); - - $stock = new \Thelia\Model\ProductSaleElements(); - $stock->setProduct($product); - $stock->setQuantity($faker->randomNumber(1,50)); - $stock->setPromo($faker->randomNumber(0,1)); - $stock->save(); - - $productPrice = new \Thelia\Model\ProductPrice(); - $productPrice->setProductSaleElements($stock); - $productPrice->setCurrency($currency); - $productPrice->setPrice($faker->randomFloat(2, 20, 2500)); - - $productPrice->save(); - - $image = new ProductImage(); - $image->setProductId($product->getId()); - generate_image($image, $i, 'product', $product->getId()); - } - - for ($i=1; $i <= 5; $i++) { - $product = new \Thelia\Model\Product(); - $product->addCategory($jeans); - $product->setTitle($faker->text(20)); - $product->setDescription($faker->text(250)); -/* $product->setQuantity($faker->randomNumber(1,50)); - $product->setPrice($faker->randomFloat(2, 20, 2500));*/ - $product->setVisible(1); - $product->setPosition($i); - $product->setRef($faker->text(255)); - $product->save(); - - $stock = new \Thelia\Model\ProductSaleElements(); - $stock->setProduct($product); - $stock->setQuantity($faker->randomNumber(1,50)); - $stock->setPromo($faker->randomNumber(0,1)); - $stock->save(); - - $productPrice = new \Thelia\Model\ProductPrice(); - $productPrice->setProductSaleElements($stock); - $productPrice->setCurrency($currency); - $productPrice->setPrice($faker->randomFloat(2, 20, 2500)); - $productPrice->save(); - - $image = new ProductImage(); - $image->setProductId($product->getId()); - generate_image($image, $i, 'product', $product->getId()); - - } - - //folders and contents - for($i=0; $i<4; $i++) { - $folder = new Thelia\Model\Folder(); - $folder->setParent(0); - $folder->setVisible(rand(1, 10)>7 ? 0 : 1); - $folder->setPosition($i); - $folder->setTitle($faker->text(20)); - $folder->setDescription($faker->text(255)); - - $folder->save(); - - $image = new FolderImage(); - $image->setFolderId($folder->getId()); - generate_image($image, $i, 'folder', $folder->getId()); - - for($j=0; $jsetParent($folder->getId()); - $subfolder->setVisible(rand(1, 10)>7 ? 0 : 1); - $subfolder->setPosition($j); - $subfolder->setTitle($faker->text(20)); - $subfolder->setDescription($faker->text(255)); - - $subfolder->save(); - - $image = new FolderImage(); - $image->setFolderId($subfolder->getId()); - generate_image($image, $j, 'folder', $subfolder->getId()); - - for($k=0; $kaddFolder($subfolder); - $content->setVisible(rand(1, 10)>7 ? 0 : 1); - $content->setPosition($k); - $content->setTitle($faker->text(20)); - $content->setDescription($faker->text(255)); - - $content->save(); - - $image = new ContentImage(); - $image->setContentId($content->getId()); - generate_image($image, $k, 'content', $content->getId()); - - } - } - } - - //features and features_av - for($i=0; $i<4; $i++) { - $feature = new Thelia\Model\Feature(); - $feature->setVisible(rand(1, 10)>7 ? 0 : 1); - $feature->setPosition($i); - $feature->setTitle($faker->text(20)); - $feature->setDescription($faker->text(50)); - - $feature->save(); - - for($j=0; $jsetFeature($feature); - $featureAv->setPosition($j); - $featureAv->setTitle($faker->text(20)); - $featureAv->setDescription($faker->text(255)); - - $featureAv->save(); - } - } - - $con->commit(); + $coupon1->setIsCumulative(1); + $coupon1->setIsRemovingPostage(0); + $coupon1->save(); } -catch (PropelException $pe) { - echo "Propel error: ".$pe->getMessage()."\n".$pe->getTraceAsString(); - $con->rollBack(); -} -catch (Exception $e) { - echo "error occured : ".$e->getMessage()."\n".$e->getTraceAsString(); - $con->rollBack(); -} - - - diff --git a/install/faker_100categories_1000products_4locales.php b/install/faker_100categories_1000products_4locales.php new file mode 100755 index 000000000..ce18aa5c7 --- /dev/null +++ b/install/faker_100categories_1000products_4locales.php @@ -0,0 +1,173 @@ +beginTransaction(); + +$currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne(); + +try { + $stmt = $con->prepare("SET foreign_key_checks = 0"); + $stmt->execute(); + + $productAssociatedContent = Thelia\Model\ProductAssociatedContentQuery::create() + ->find(); + $productAssociatedContent->delete(); + + $categoryAssociatedContent = Thelia\Model\CategoryAssociatedContentQuery::create() + ->find(); + $categoryAssociatedContent->delete(); + + $attributeCategory = Thelia\Model\AttributeCategoryQuery::create() + ->find(); + $attributeCategory->delete(); + + $featureCategory = Thelia\Model\FeatureCategoryQuery::create() + ->find(); + $featureCategory->delete(); + + $featureProduct = Thelia\Model\FeatureProductQuery::create() + ->find(); + $featureProduct->delete(); + + $attributeCombination = Thelia\Model\AttributeCombinationQuery::create() + ->find(); + $attributeCombination->delete(); + + $feature = Thelia\Model\FeatureQuery::create() + ->find(); + $feature->delete(); + + $feature = Thelia\Model\FeatureI18nQuery::create() + ->find(); + $feature->delete(); + + $featureAv = Thelia\Model\FeatureAvQuery::create() + ->find(); + $featureAv->delete(); + + $featureAv = Thelia\Model\FeatureAvI18nQuery::create() + ->find(); + $featureAv->delete(); + + $attribute = Thelia\Model\AttributeQuery::create() + ->find(); + $attribute->delete(); + + $attribute = Thelia\Model\AttributeI18nQuery::create() + ->find(); + $attribute->delete(); + + $attributeAv = Thelia\Model\AttributeAvQuery::create() + ->find(); + $attributeAv->delete(); + + $attributeAv = Thelia\Model\AttributeAvI18nQuery::create() + ->find(); + $attributeAv->delete(); + + $category = Thelia\Model\CategoryQuery::create() + ->find(); + $category->delete(); + + $category = Thelia\Model\CategoryI18nQuery::create() + ->find(); + $category->delete(); + + $product = Thelia\Model\ProductQuery::create() + ->find(); + $product->delete(); + + $product = Thelia\Model\ProductI18nQuery::create() + ->find(); + $product->delete(); + + $customer = Thelia\Model\CustomerQuery::create() + ->find(); + $customer->delete(); + + $folder = Thelia\Model\FolderQuery::create() + ->find(); + $folder->delete(); + + $folder = Thelia\Model\FolderI18nQuery::create() + ->find(); + $folder->delete(); + + $content = Thelia\Model\ContentQuery::create() + ->find(); + $content->delete(); + + $content = Thelia\Model\ContentI18nQuery::create() + ->find(); + $content->delete(); + + $accessory = Thelia\Model\AccessoryQuery::create() + ->find(); + $accessory->delete(); + + $stock = \Thelia\Model\ProductSaleElementsQuery::create() + ->find(); + $stock->delete(); + + $productPrice = \Thelia\Model\ProductPriceQuery::create() + ->find(); + $productPrice->delete(); + + $stmt = $con->prepare("SET foreign_key_checks = 1"); + $stmt->execute(); + + //categories and products + for($i=0; $i<100; $i++) { + $category = new Thelia\Model\Category(); + $category->setParent(0); + $category->setVisible(1); + $category->setPosition($i); + setI18n($faker, $category); + + $category->save(); + + for($j=0; $j<10; $j++) { + $product = new Thelia\Model\Product(); + $product->setRef($category->getId() . '_' . $j . '_' . $faker->randomNumber(8)); + $product->addCategory($category); + $product->setVisible(1); + $product->setPosition($j); + setI18n($faker, $product); + + $product->save(); + } + } + + $con->commit(); +} catch (Exception $e) { + echo "error : ".$e->getMessage()."\n"; + $con->rollBack(); +} + +function setI18n($faker, &$object) +{ + $localeList = array('fr_FR', 'en_EN', 'es_ES', 'it_IT'); + + $title = $faker->text(20); + $description = $faker->text(50); + + foreach($localeList as $locale) { + $object->setLocale($locale); + + $object->setTitle($locale . ' : ' . $title); + $object->setDescription($locale . ' : ' . $description); + } +} + diff --git a/install/insert.sql b/install/insert.sql index b4b0570dd..917966893 100755 --- a/install/insert.sql +++ b/install/insert.sql @@ -1,21 +1,25 @@ -INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`by_default`,`position`,`created_at`,`updated_at`)VALUES -(1, 'Français', 'fr', 'fr_FR', '','1', '1', NOW(), NOW()), -(2, 'English', 'en', 'en_EN', '', '0', '2', NOW(), NOW()), -(3, 'Espanol', 'es', 'es_ES', '', '0', '3', NOW(), NOW()), -(4, 'Italiano', 'it', 'it_IT', '','0', '4', NOW(), NOW()); +INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`date_format`,`time_format`,`datetime_format`,`decimal_separator`,`thousands_separator`,`decimals`,`by_default`,`created_at`,`updated_at`)VALUES +(1, 'Français', 'fr', 'fr_FR', '', 'd/m/Y', 'H:i:s', 'd/m/y H:i:s', ',', ' ', '2', '1', NOW(), NOW()), +(2, 'English', 'en', 'en_EN', '', 'm-d-Y', 'h:i:s', 'm-d-Y h:i:s', '.', ' ', '2', '0', NOW(), NOW()), +(3, 'castellano', 'es', 'es_ES', '', 'm-d-Y', 'h:i:s', 'm-d-Y h:i:s', ',', '.', '2', '0', NOW(), NOW()), +(4, 'Italiano', 'it', 'it_IT', '', 'd/m/Y', 'H:i:s', 'd/m/y H:i:s', ',', ' ', '2', '0', NOW(), NOW()); INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES ('session_config.default', '1', 1, 1, NOW(), NOW()), -('verifyStock', '1', 1, 0, NOW(), NOW()), -('imagine_graphic_driver', 'gd', 1, 0, NOW(), NOW()), -('default_images_quality_percent', '75', 1, 0, NOW(), NOW()), -('original_image_delivery_mode', 'symlink', 1, 0, NOW(), NOW()), -('images_library_path', 'local/media/images', 1, 0, NOW(), NOW()), -('image_cache_dir_from_web_root', 'cache/images', 1, 0, NOW(), NOW()); +('verifyStock', '1', 0, 0, NOW(), NOW()), +('default_lang_without_translation', '1', 0, 0, NOW(), NOW()), +('rewriting_enable', '0', 0, 0, NOW(), NOW()), +('imagine_graphic_driver', 'gd', 0, 0, NOW(), NOW()), +('default_images_quality_percent', '75', 0, 0, NOW(), NOW()), +('original_image_delivery_mode', 'symlink', 0, 0, NOW(), NOW()), +('images_library_path', 'local/media/images', 0, 0, NOW(), NOW()), +('image_cache_dir_from_web_root', 'cache/images', 0, 0, NOW(), NOW()), +('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()), +('page_not_found_view', '404.html', 0, 0, NOW(), NOW()); - -INSERT INTO `module` (`code`, `type`, `activate`, `position`, `created_at`, `updated_at`) VALUES ('test', '1', '1', '1', NOW(), NOW()); +INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES +(1, 'DebugBar', 1, 1, 1, 'DebugBar\\DebugBar', NOW(), NOW()); INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES (1, 1, 1, NOW(), NOW()), @@ -23,24 +27,27 @@ INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `upda (3, 0, 3, NOW(), NOW()); INSERT INTO `customer_title_i18n` (`id`, `locale`, `short`, `long`) VALUES -(1, 'en_US', 'Mr', 'Mister'), -(1, 'fr_FR', 'M', 'Monsieur'), -(2, 'en_US', 'Mrs', 'Misses'), -(2, 'fr_FR', 'Mme', 'Madame'), -(3, 'en_US', 'Miss', 'Miss'), -(3, 'fr_FR', 'Mlle', 'Madamemoiselle'); +(1, 'fr_FR', 'Mr', 'Monsieur'), +(1, 'en_UK', 'M', 'Mister'), +(2, 'fr_FR', 'Mrs', 'Madame'), +(2, 'en_UK', 'Mme', 'Misses'), +(3, 'fr_FR', 'Miss', 'Madamemoiselle'), +(3, 'en_UK', 'Mlle', 'Miss'); -INSERT INTO `currency` (`id` ,`code` ,`symbol` ,`rate` ,`by_default`, `position` ,`created_at` ,`updated_at`) +INSERT INTO `currency` (`id` ,`code` ,`symbol` ,`rate`, `position` ,`by_default` ,`created_at` ,`updated_at`) VALUES -(1, 'EUR', '€', '1', '1', '1', NOW() , NOW()), -(2, 'USD', '$', '1.26', '0', '2', NOW(), NOW()), -(3, 'GBP', '£', '0.89', '0', '3',NOW(), NOW()); +(1, 'EUR', '€', '1', 1, '1', NOW() , NOW()), +(2, 'USD', '$', '1.26', 2, '0', NOW(), NOW()), +(3, 'GBP', '£', '0.89', 3, '0', NOW(), NOW()); INSERT INTO `currency_i18n` (`id` ,`locale` ,`name`) VALUES -(1, 'en_US', 'euro'), -(2, 'en_US', 'dollar'), -(3, 'en_US', 'pound'); +(1, 'fr_FR', 'Euro'), +(1, 'en_UK', 'Euro'), +(2, 'fr_FR', 'Dollar Américain'), +(2, 'en_UK', 'United States Dollar'), +(3, 'fr_FR', 'Livre anglaise'), +(3, 'en_UK', 'UK Pound'); INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `created_at`, `updated_at`) VALUES @@ -310,795 +317,817 @@ INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `cr (268, NULL, '840', 'US', 'USA', NOW(), NOW()); INSERT INTO `country_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES -(1, 'en_US', 'Afghanistan', '', '', ''), +(1, 'en_UK', 'Afghanistan', '', '', ''), (1, 'es_ES', 'Afganistán', '', '', ''), (1, 'fr_FR', 'Afghanistan', '', '', ''), -(2, 'en_US', 'South Africa', '', '', ''), +(2, 'en_UK', 'South Africa', '', '', ''), (2, 'es_ES', 'Sudáfrica', '', '', ''), (2, 'fr_FR', 'Afrique du Sud', '', '', ''), -(3, 'en_US', 'Albania', '', '', ''), +(3, 'en_UK', 'Albania', '', '', ''), (3, 'es_ES', 'Albania', '', '', ''), (3, 'fr_FR', 'Albanie', '', '', ''), -(4, 'en_US', 'Algeria', '', '', ''), +(4, 'en_UK', 'Algeria', '', '', ''), (4, 'es_ES', 'Argelia', '', '', ''), (4, 'fr_FR', 'Algérie', '', '', ''), -(5, 'en_US', 'Germany', '', '', ''), +(5, 'en_UK', 'Germany', '', '', ''), (5, 'es_ES', 'Alemania', '', '', ''), (5, 'fr_FR', 'Allemagne', '', '', ''), -(6, 'en_US', 'Andorra', '', '', ''), +(6, 'en_UK', 'Andorra', '', '', ''), (6, 'es_ES', 'Andorra', '', '', ''), (6, 'fr_FR', 'Andorre', '', '', ''), -(7, 'en_US', 'Angola', '', '', ''), +(7, 'en_UK', 'Angola', '', '', ''), (7, 'es_ES', 'Angola', '', '', ''), (7, 'fr_FR', 'Angola', '', '', ''), -(8, 'en_US', 'Antigua and Barbuda', '', '', ''), +(8, 'en_UK', 'Antigua and Barbuda', '', '', ''), (8, 'es_ES', 'Antigua y Barbuda', '', '', ''), (8, 'fr_FR', 'Antigua-et-Barbuda', '', '', ''), -(9, 'en_US', 'Saudi Arabia', '', '', ''), +(9, 'en_UK', 'Saudi Arabia', '', '', ''), (9, 'es_ES', 'Arabia Saudita', '', '', ''), (9, 'fr_FR', 'Arabie saoudite', '', '', ''), -(10, 'en_US', 'Argentina', '', '', ''), +(10, 'en_UK', 'Argentina', '', '', ''), (10, 'es_ES', 'Argentina', '', '', ''), (10, 'fr_FR', 'Argentine', '', '', ''), -(11, 'en_US', 'Armenia', '', '', ''), +(11, 'en_UK', 'Armenia', '', '', ''), (11, 'es_ES', 'Armenia', '', '', ''), (11, 'fr_FR', 'Arménie', '', '', ''), -(12, 'en_US', 'Australia', '', '', ''), +(12, 'en_UK', 'Australia', '', '', ''), (12, 'es_ES', 'Australia', '', '', ''), (12, 'fr_FR', 'Australie', '', '', ''), -(13, 'en_US', 'Austria', '', '', ''), +(13, 'en_UK', 'Austria', '', '', ''), (13, 'es_ES', 'Austria', '', '', ''), (13, 'fr_FR', 'Autriche', '', '', ''), -(14, 'en_US', 'Azerbaijan', '', '', ''), +(14, 'en_UK', 'Azerbaijan', '', '', ''), (14, 'es_ES', 'Azerbaiyán', '', '', ''), (14, 'fr_FR', 'Azerbaïdjan', '', '', ''), -(15, 'en_US', 'Bahamas', '', '', ''), +(15, 'en_UK', 'Bahamas', '', '', ''), (15, 'es_ES', 'Bahamas', '', '', ''), (15, 'fr_FR', 'Bahamas', '', '', ''), -(16, 'en_US', 'Bahrain', '', '', ''), +(16, 'en_UK', 'Bahrain', '', '', ''), (16, 'es_ES', 'Bahrein', '', '', ''), (16, 'fr_FR', 'Bahreïn', '', '', ''), -(17, 'en_US', 'Bangladesh', '', '', ''), +(17, 'en_UK', 'Bangladesh', '', '', ''), (17, 'es_ES', 'Bangladesh', '', '', ''), (17, 'fr_FR', 'Bangladesh', '', '', ''), -(18, 'en_US', 'Barbados', '', '', ''), +(18, 'en_UK', 'Barbados', '', '', ''), (18, 'es_ES', 'Barbados', '', '', ''), (18, 'fr_FR', 'Barbade', '', '', ''), -(19, 'en_US', 'Belarus', '', '', ''), +(19, 'en_UK', 'Belarus', '', '', ''), (19, 'es_ES', 'Belarús', '', '', ''), (19, 'fr_FR', 'Belau', '', '', ''), -(20, 'en_US', 'Belgium', '', '', ''), +(20, 'en_UK', 'Belgium', '', '', ''), (20, 'es_ES', 'Bélgica', '', '', ''), (20, 'fr_FR', 'Belgique', '', '', ''), -(21, 'en_US', 'Belize', '', '', ''), +(21, 'en_UK', 'Belize', '', '', ''), (21, 'es_ES', 'Belice', '', '', ''), (21, 'fr_FR', 'Belize', '', '', ''), -(22, 'en_US', 'Benin', '', '', ''), +(22, 'en_UK', 'Benin', '', '', ''), (22, 'es_ES', 'Benin', '', '', ''), (22, 'fr_FR', 'Bénin', '', '', ''), -(23, 'en_US', 'Bhutan', '', '', ''), +(23, 'en_UK', 'Bhutan', '', '', ''), (23, 'es_ES', 'Bhután', '', '', ''), (23, 'fr_FR', 'Bhoutan', '', '', ''), -(24, 'en_US', 'Bielorussia', '', '', ''), +(24, 'en_UK', 'Bielorussia', '', '', ''), (24, 'es_ES', 'Bielorusia', '', '', ''), (24, 'fr_FR', 'Biélorussie', '', '', ''), -(25, 'en_US', 'Burma', '', '', ''), +(25, 'en_UK', 'Burma', '', '', ''), (25, 'es_ES', 'Birmania', '', '', ''), (25, 'fr_FR', 'Birmanie', '', '', ''), -(26, 'en_US', 'Bolivia', '', '', ''), +(26, 'en_UK', 'Bolivia', '', '', ''), (26, 'es_ES', 'Bolivia', '', '', ''), (26, 'fr_FR', 'Bolivie', '', '', ''), -(27, 'en_US', 'Bosnia and Herzegovina', '', '', ''), +(27, 'en_UK', 'Bosnia and Herzegovina', '', '', ''), (27, 'es_ES', 'Bosnia y Herzegovina', '', '', ''), (27, 'fr_FR', 'Bosnie-Herzégovine', '', '', ''), -(28, 'en_US', 'Botswana', '', '', ''), +(28, 'en_UK', 'Botswana', '', '', ''), (28, 'es_ES', 'Botswana', '', '', ''), (28, 'fr_FR', 'Botswana', '', '', ''), -(29, 'en_US', 'Brazil', '', '', ''), +(29, 'en_UK', 'Brazil', '', '', ''), (29, 'es_ES', 'Brasil', '', '', ''), (29, 'fr_FR', 'Brésil', '', '', ''), -(30, 'en_US', 'Brunei', '', '', ''), +(30, 'en_UK', 'Brunei', '', '', ''), (30, 'es_ES', 'Brunei', '', '', ''), (30, 'fr_FR', 'Brunei', '', '', ''), -(31, 'en_US', 'Bulgaria', '', '', ''), +(31, 'en_UK', 'Bulgaria', '', '', ''), (31, 'es_ES', 'Bulgaria', '', '', ''), (31, 'fr_FR', 'Bulgarie', '', '', ''), -(32, 'en_US', 'Burkina', '', '', ''), +(32, 'en_UK', 'Burkina', '', '', ''), (32, 'es_ES', 'Burkina', '', '', ''), (32, 'fr_FR', 'Burkina', '', '', ''), -(33, 'en_US', 'Burundi', '', '', ''), +(33, 'en_UK', 'Burundi', '', '', ''), (33, 'es_ES', 'Burundi', '', '', ''), (33, 'fr_FR', 'Burundi', '', '', ''), -(34, 'en_US', 'Cambodia', '', '', ''), +(34, 'en_UK', 'Cambodia', '', '', ''), (34, 'es_ES', 'Camboya', '', '', ''), (34, 'fr_FR', 'Cambodge', '', '', ''), -(35, 'en_US', 'Cameroon', '', '', ''), +(35, 'en_UK', 'Cameroon', '', '', ''), (35, 'es_ES', 'Camerún', '', '', ''), (35, 'fr_FR', 'Cameroun', '', '', ''), -(37, 'en_US', 'Cape Verde', '', '', ''), +(37, 'en_UK', 'Cape Verde', '', '', ''), (37, 'es_ES', 'Cabo Verde', '', '', ''), (37, 'fr_FR', 'Cap-Vert', '', '', ''), -(38, 'en_US', 'Chile', '', '', ''), +(38, 'en_UK', 'Chile', '', '', ''), (38, 'es_ES', 'Chile', '', '', ''), (38, 'fr_FR', 'Chili', '', '', ''), -(39, 'en_US', 'China', '', '', ''), +(39, 'en_UK', 'China', '', '', ''), (39, 'es_ES', 'China', '', '', ''), (39, 'fr_FR', 'Chine', '', '', ''), -(40, 'en_US', 'Cyprus', '', '', ''), +(40, 'en_UK', 'Cyprus', '', '', ''), (40, 'es_ES', 'Chipre', '', '', ''), (40, 'fr_FR', 'Chypre', '', '', ''), -(41, 'en_US', 'Colombia', '', '', ''), +(41, 'en_UK', 'Colombia', '', '', ''), (41, 'es_ES', 'Colombia', '', '', ''), (41, 'fr_FR', 'Colombie', '', '', ''), -(42, 'en_US', 'Comoros', '', '', ''), +(42, 'en_UK', 'Comoros', '', '', ''), (42, 'es_ES', 'Comoras', '', '', ''), (42, 'fr_FR', 'Comores', '', '', ''), -(43, 'en_US', 'Congo', '', '', ''), +(43, 'en_UK', 'Congo', '', '', ''), (43, 'es_ES', 'Congo', '', '', ''), (43, 'fr_FR', 'Congo', '', '', ''), -(44, 'en_US', 'Cook Islands', '', '', ''), +(44, 'en_UK', 'Cook Islands', '', '', ''), (44, 'es_ES', 'Cook', '', '', ''), (44, 'fr_FR', 'Cook', '', '', ''), -(45, 'en_US', 'North Korea', '', '', ''), +(45, 'en_UK', 'North Korea', '', '', ''), (45, 'es_ES', 'Corea del Norte', '', '', ''), (45, 'fr_FR', 'Corée du Nord', '', '', ''), -(46, 'en_US', 'South Korea', '', '', ''), +(46, 'en_UK', 'South Korea', '', '', ''), (46, 'es_ES', 'Corea del Sur', '', '', ''), (46, 'fr_FR', 'Corée du Sud', '', '', ''), -(47, 'en_US', 'Costa Rica', '', '', ''), +(47, 'en_UK', 'Costa Rica', '', '', ''), (47, 'es_ES', 'Costa Rica', '', '', ''), (47, 'fr_FR', 'Costa Rica', '', '', ''), -(48, 'en_US', 'Ivory Coast', '', '', ''), +(48, 'en_UK', 'Ivory Coast', '', '', ''), (48, 'es_ES', 'Costa de Marfil', '', '', ''), (48, 'fr_FR', 'Côte dIvoire', '', '', ''), -(49, 'en_US', 'Croatia', '', '', ''), +(49, 'en_UK', 'Croatia', '', '', ''), (49, 'es_ES', 'Croacia', '', '', ''), (49, 'fr_FR', 'Croatie', '', '', ''), -(50, 'en_US', 'Cuba', '', '', ''), +(50, 'en_UK', 'Cuba', '', '', ''), (50, 'es_ES', 'Cuba', '', '', ''), (50, 'fr_FR', 'Cuba', '', '', ''), -(51, 'en_US', 'Denmark', '', '', ''), +(51, 'en_UK', 'Denmark', '', '', ''), (51, 'es_ES', 'Dinamarca', '', '', ''), (51, 'fr_FR', 'Danemark', '', '', ''), -(52, 'en_US', 'Djibouti', '', '', ''), +(52, 'en_UK', 'Djibouti', '', '', ''), (52, 'es_ES', 'Djibouti', '', '', ''), (52, 'fr_FR', 'Djibouti', '', '', ''), -(53, 'en_US', 'Dominica', '', '', ''), +(53, 'en_UK', 'Dominica', '', '', ''), (53, 'es_ES', 'Dominica', '', '', ''), (53, 'fr_FR', 'Dominique', '', '', ''), -(54, 'en_US', 'Egypt', '', '', ''), +(54, 'en_UK', 'Egypt', '', '', ''), (54, 'es_ES', 'Egipto', '', '', ''), (54, 'fr_FR', 'Égypte', '', '', ''), -(55, 'en_US', 'United Arab Emirates', '', '', ''), +(55, 'en_UK', 'United Arab Emirates', '', '', ''), (55, 'es_ES', 'Emiratos Árabes Unidos', '', '', ''), (55, 'fr_FR', 'Émirats arabes unis', '', '', ''), -(56, 'en_US', 'Ecuador', '', '', ''), +(56, 'en_UK', 'Ecuador', '', '', ''), (56, 'es_ES', 'Ecuador', '', '', ''), (56, 'fr_FR', 'Équateur', '', '', ''), -(57, 'en_US', 'Eritrea', '', '', ''), +(57, 'en_UK', 'Eritrea', '', '', ''), (57, 'es_ES', 'Eritrea', '', '', ''), (57, 'fr_FR', 'Érythrée', '', '', ''), -(58, 'en_US', 'Spain', '', '', ''), +(58, 'en_UK', 'Spain', '', '', ''), (58, 'es_ES', 'España', '', '', ''), (58, 'fr_FR', 'Espagne', '', '', ''), -(59, 'en_US', 'Estonia', '', '', ''), +(59, 'en_UK', 'Estonia', '', '', ''), (59, 'es_ES', 'Estonia', '', '', ''), (59, 'fr_FR', 'Estonie', '', '', ''), -(61, 'en_US', 'Ethiopia', '', '', ''), +(61, 'en_UK', 'Ethiopia', '', '', ''), (61, 'es_ES', 'Etiopía', '', '', ''), (61, 'fr_FR', 'Éthiopie', '', '', ''), -(62, 'en_US', 'Fiji', '', '', ''), +(62, 'en_UK', 'Fiji', '', '', ''), (62, 'es_ES', 'Fiji', '', '', ''), (62, 'fr_FR', 'Fidji', '', '', ''), -(63, 'en_US', 'Finland', '', '', ''), +(63, 'en_UK', 'Finland', '', '', ''), (63, 'es_ES', 'Finlandia', '', '', ''), (63, 'fr_FR', 'Finlande', '', '', ''), -(64, 'en_US', 'France metropolitan', '', '', ''), +(64, 'en_UK', 'France metropolitan', '', '', ''), (64, 'es_ES', 'Francia', '', '', ''), (64, 'fr_FR', 'France métropolitaine', '', '', ''), -(65, 'en_US', 'Gabon', '', '', ''), +(65, 'en_UK', 'Gabon', '', '', ''), (65, 'es_ES', 'Gabón', '', '', ''), (65, 'fr_FR', 'Gabon', '', '', ''), -(66, 'en_US', 'Gambia', '', '', ''), +(66, 'en_UK', 'Gambia', '', '', ''), (66, 'es_ES', 'Gambia', '', '', ''), (66, 'fr_FR', 'Gambie', '', '', ''), -(67, 'en_US', 'Georgia', '', '', ''), +(67, 'en_UK', 'Georgia', '', '', ''), (67, 'es_ES', 'Georgia', '', '', ''), (67, 'fr_FR', 'Géorgie', '', '', ''), -(68, 'en_US', 'Ghana', '', '', ''), +(68, 'en_UK', 'Ghana', '', '', ''), (68, 'es_ES', 'Ghana', '', '', ''), (68, 'fr_FR', 'Ghana', '', '', ''), -(69, 'en_US', 'Greece', '', '', ''), +(69, 'en_UK', 'Greece', '', '', ''), (69, 'es_ES', 'Grecia', '', '', ''), (69, 'fr_FR', 'Grèce', '', '', ''), -(70, 'en_US', 'Grenada', '', '', ''), +(70, 'en_UK', 'Grenada', '', '', ''), (70, 'es_ES', 'Granada', '', '', ''), (70, 'fr_FR', 'Grenade', '', '', ''), -(71, 'en_US', 'Guatemala', '', '', ''), +(71, 'en_UK', 'Guatemala', '', '', ''), (71, 'es_ES', 'Guatemala', '', '', ''), (71, 'fr_FR', 'Guatemala', '', '', ''), -(72, 'en_US', 'Guinea', '', '', ''), +(72, 'en_UK', 'Guinea', '', '', ''), (72, 'es_ES', 'Guinea', '', '', ''), (72, 'fr_FR', 'Guinée', '', '', ''), -(73, 'en_US', 'Guinea-Bissau', '', '', ''), +(73, 'en_UK', 'Guinea-Bissau', '', '', ''), (73, 'es_ES', 'Guinea-Bissau', '', '', ''), (73, 'fr_FR', 'Guinée-Bissao', '', '', ''), -(74, 'en_US', 'Equatorial Guinea', '', '', ''), +(74, 'en_UK', 'Equatorial Guinea', '', '', ''), (74, 'es_ES', 'Guinea Ecuatorial', '', '', ''), (74, 'fr_FR', 'Guinée équatoriale', '', '', ''), -(75, 'en_US', 'Guyana', '', '', ''), +(75, 'en_UK', 'Guyana', '', '', ''), (75, 'es_ES', 'Guyana', '', '', ''), (75, 'fr_FR', 'Guyana', '', '', ''), -(76, 'en_US', 'Haiti', '', '', ''), +(76, 'en_UK', 'Haiti', '', '', ''), (76, 'es_ES', 'Haití', '', '', ''), (76, 'fr_FR', 'Haïti', '', '', ''), -(77, 'en_US', 'Honduras', '', '', ''), +(77, 'en_UK', 'Honduras', '', '', ''), (77, 'es_ES', 'Honduras', '', '', ''), (77, 'fr_FR', 'Honduras', '', '', ''), -(78, 'en_US', 'Hungary', '', '', ''), +(78, 'en_UK', 'Hungary', '', '', ''), (78, 'es_ES', 'Hungría', '', '', ''), (78, 'fr_FR', 'Hongrie', '', '', ''), -(79, 'en_US', 'India', '', '', ''), +(79, 'en_UK', 'India', '', '', ''), (79, 'es_ES', 'India', '', '', ''), (79, 'fr_FR', 'Inde', '', '', ''), -(80, 'en_US', 'Indonesia', '', '', ''), +(80, 'en_UK', 'Indonesia', '', '', ''), (80, 'es_ES', 'Indonesia', '', '', ''), (80, 'fr_FR', 'Indonésie', '', '', ''), -(81, 'en_US', 'Iran', '', '', ''), +(81, 'en_UK', 'Iran', '', '', ''), (81, 'es_ES', 'Irán', '', '', ''), (81, 'fr_FR', 'Iran', '', '', ''), -(82, 'en_US', 'Iraq', '', '', ''), +(82, 'en_UK', 'Iraq', '', '', ''), (82, 'es_ES', 'Iraq', '', '', ''), (82, 'fr_FR', 'Iraq', '', '', ''), -(83, 'en_US', 'Ireland', '', '', ''), +(83, 'en_UK', 'Ireland', '', '', ''), (83, 'es_ES', 'Irlanda', '', '', ''), (83, 'fr_FR', 'Irlande', '', '', ''), -(84, 'en_US', 'Iceland', '', '', ''), +(84, 'en_UK', 'Iceland', '', '', ''), (84, 'es_ES', 'Islandia', '', '', ''), (84, 'fr_FR', 'Islande', '', '', ''), -(85, 'en_US', 'Israel', '', '', ''), +(85, 'en_UK', 'Israel', '', '', ''), (85, 'es_ES', 'Israel', '', '', ''), (85, 'fr_FR', 'Israël', '', '', ''), -(86, 'en_US', 'Italy', '', '', ''), +(86, 'en_UK', 'Italy', '', '', ''), (86, 'es_ES', 'Italia', '', '', ''), (86, 'fr_FR', 'Italie', '', '', ''), -(87, 'en_US', 'Jamaica', '', '', ''), +(87, 'en_UK', 'Jamaica', '', '', ''), (87, 'es_ES', 'Jamaica', '', '', ''), (87, 'fr_FR', 'Jamaïque', '', '', ''), -(88, 'en_US', 'Japan', '', '', ''), +(88, 'en_UK', 'Japan', '', '', ''), (88, 'es_ES', 'Japón', '', '', ''), (88, 'fr_FR', 'Japon', '', '', ''), -(89, 'en_US', 'Jordan', '', '', ''), +(89, 'en_UK', 'Jordan', '', '', ''), (89, 'es_ES', 'Jordania', '', '', ''), (89, 'fr_FR', 'Jordanie', '', '', ''), -(90, 'en_US', 'Kazakhstan', '', '', ''), +(90, 'en_UK', 'Kazakhstan', '', '', ''), (90, 'es_ES', 'Kazajstán', '', '', ''), (90, 'fr_FR', 'Kazakhstan', '', '', ''), -(91, 'en_US', 'Kenya', '', '', ''), +(91, 'en_UK', 'Kenya', '', '', ''), (91, 'es_ES', 'Kenia', '', '', ''), (91, 'fr_FR', 'Kenya', '', '', ''), -(92, 'en_US', 'Kyrgyzstan', '', '', ''), +(92, 'en_UK', 'Kyrgyzstan', '', '', ''), (92, 'es_ES', 'Kirguistán', '', '', ''), (92, 'fr_FR', 'Kirghizistan', '', '', ''), -(93, 'en_US', 'Kiribati', '', '', ''), +(93, 'en_UK', 'Kiribati', '', '', ''), (93, 'es_ES', 'Kiribati', '', '', ''), (93, 'fr_FR', 'Kiribati', '', '', ''), -(94, 'en_US', 'Kuwait', '', '', ''), +(94, 'en_UK', 'Kuwait', '', '', ''), (94, 'es_ES', 'Kuwait', '', '', ''), (94, 'fr_FR', 'Koweït', '', '', ''), -(95, 'en_US', 'Laos', '', '', ''), +(95, 'en_UK', 'Laos', '', '', ''), (95, 'es_ES', 'Laos', '', '', ''), (95, 'fr_FR', 'Laos', '', '', ''), -(96, 'en_US', 'Lesotho', '', '', ''), +(96, 'en_UK', 'Lesotho', '', '', ''), (96, 'es_ES', 'Lesotho', '', '', ''), (96, 'fr_FR', 'Lesotho', '', '', ''), -(97, 'en_US', 'Latvia', '', '', ''), +(97, 'en_UK', 'Latvia', '', '', ''), (97, 'es_ES', 'Letonia', '', '', ''), (97, 'fr_FR', 'Lettonie', '', '', ''), -(98, 'en_US', 'Lebanon', '', '', ''), +(98, 'en_UK', 'Lebanon', '', '', ''), (98, 'es_ES', 'Líbano', '', '', ''), (98, 'fr_FR', 'Liban', '', '', ''), -(99, 'en_US', 'Liberia', '', '', ''), +(99, 'en_UK', 'Liberia', '', '', ''), (99, 'es_ES', 'Liberia', '', '', ''), (99, 'fr_FR', 'Liberia', '', '', ''), -(100, 'en_US', 'Libya', '', '', ''), +(100, 'en_UK', 'Libya', '', '', ''), (100, 'es_ES', 'Libia', '', '', ''), (100, 'fr_FR', 'Libye', '', '', ''), -(101, 'en_US', 'Liechtenstein', '', '', ''), +(101, 'en_UK', 'Liechtenstein', '', '', ''), (101, 'es_ES', 'Liechtenstein', '', '', ''), (101, 'fr_FR', 'Liechtenstein', '', '', ''), -(102, 'en_US', 'Lithuania', '', '', ''), +(102, 'en_UK', 'Lithuania', '', '', ''), (102, 'es_ES', 'Lituania', '', '', ''), (102, 'fr_FR', 'Lituanie', '', '', ''), -(103, 'en_US', 'Luxembourg', '', '', ''), +(103, 'en_UK', 'Luxembourg', '', '', ''), (103, 'es_ES', 'Luxemburgo', '', '', ''), (103, 'fr_FR', 'Luxembourg', '', '', ''), -(104, 'en_US', 'Macedonia', '', '', ''), +(104, 'en_UK', 'Macedonia', '', '', ''), (104, 'es_ES', 'Macedonia', '', '', ''), (104, 'fr_FR', 'Macédoine', '', '', ''), -(105, 'en_US', 'Madagascar', '', '', ''), +(105, 'en_UK', 'Madagascar', '', '', ''), (105, 'es_ES', 'Madagascar', '', '', ''), (105, 'fr_FR', 'Madagascar', '', '', ''), -(106, 'en_US', 'Malaysia', '', '', ''), +(106, 'en_UK', 'Malaysia', '', '', ''), (106, 'es_ES', 'Malasia', '', '', ''), (106, 'fr_FR', 'Malaisie', '', '', ''), -(107, 'en_US', 'Malawi', '', '', ''), +(107, 'en_UK', 'Malawi', '', '', ''), (107, 'es_ES', 'Malawi', '', '', ''), (107, 'fr_FR', 'Malawi', '', '', ''), -(108, 'en_US', 'Maldives', '', '', ''), +(108, 'en_UK', 'Maldives', '', '', ''), (108, 'es_ES', 'Maldivas', '', '', ''), (108, 'fr_FR', 'Maldives', '', '', ''), -(109, 'en_US', 'Mali', '', '', ''), +(109, 'en_UK', 'Mali', '', '', ''), (109, 'es_ES', 'Malí', '', '', ''), (109, 'fr_FR', 'Mali', '', '', ''), -(110, 'en_US', 'Malta', '', '', ''), +(110, 'en_UK', 'Malta', '', '', ''), (110, 'es_ES', 'Malta', '', '', ''), (110, 'fr_FR', 'Malte', '', '', ''), -(111, 'en_US', 'Morocco', '', '', ''), +(111, 'en_UK', 'Morocco', '', '', ''), (111, 'es_ES', 'Marruecos', '', '', ''), (111, 'fr_FR', 'Maroc', '', '', ''), -(112, 'en_US', 'Marshall Islands', '', '', ''), +(112, 'en_UK', 'Marshall Islands', '', '', ''), (112, 'es_ES', 'Marshall', '', '', ''), (112, 'fr_FR', 'Marshall', '', '', ''), -(113, 'en_US', 'Mauritius', '', '', ''), +(113, 'en_UK', 'Mauritius', '', '', ''), (113, 'es_ES', 'Mauricio', '', '', ''), (113, 'fr_FR', 'Maurice', '', '', ''), -(114, 'en_US', 'Mauritania', '', '', ''), +(114, 'en_UK', 'Mauritania', '', '', ''), (114, 'es_ES', 'Mauritania', '', '', ''), (114, 'fr_FR', 'Mauritanie', '', '', ''), -(115, 'en_US', 'Mexico', '', '', ''), +(115, 'en_UK', 'Mexico', '', '', ''), (115, 'es_ES', 'Méjico', '', '', ''), (115, 'fr_FR', 'Mexique', '', '', ''), -(116, 'en_US', 'Micronesia', '', '', ''), +(116, 'en_UK', 'Micronesia', '', '', ''), (116, 'es_ES', 'Micronesia', '', '', ''), (116, 'fr_FR', 'Micronésie', '', '', ''), -(117, 'en_US', 'Moldova', '', '', ''), +(117, 'en_UK', 'Moldova', '', '', ''), (117, 'es_ES', 'Moldova', '', '', ''), (117, 'fr_FR', 'Moldavie', '', '', ''), -(118, 'en_US', 'Monaco', '', '', ''), +(118, 'en_UK', 'Monaco', '', '', ''), (118, 'es_ES', 'Mónaco', '', '', ''), (118, 'fr_FR', 'Monaco', '', '', ''), -(119, 'en_US', 'Mongolia', '', '', ''), +(119, 'en_UK', 'Mongolia', '', '', ''), (119, 'es_ES', 'Mongolia', '', '', ''), (119, 'fr_FR', 'Mongolie', '', '', ''), -(120, 'en_US', 'Mozambique', '', '', ''), +(120, 'en_UK', 'Mozambique', '', '', ''), (120, 'es_ES', 'Mozambique', '', '', ''), (120, 'fr_FR', 'Mozambique', '', '', ''), -(121, 'en_US', 'Namibia', '', '', ''), +(121, 'en_UK', 'Namibia', '', '', ''), (121, 'es_ES', 'Namibia', '', '', ''), (121, 'fr_FR', 'Namibie', '', '', ''), -(122, 'en_US', 'Nauru', '', '', ''), +(122, 'en_UK', 'Nauru', '', '', ''), (122, 'es_ES', 'Nauru', '', '', ''), (122, 'fr_FR', 'Nauru', '', '', ''), -(123, 'en_US', 'Nepal', '', '', ''), +(123, 'en_UK', 'Nepal', '', '', ''), (123, 'es_ES', 'Nepal', '', '', ''), (123, 'fr_FR', 'Népal', '', '', ''), -(124, 'en_US', 'Nicaragua', '', '', ''), +(124, 'en_UK', 'Nicaragua', '', '', ''), (124, 'es_ES', 'Nicaragua', '', '', ''), (124, 'fr_FR', 'Nicaragua', '', '', ''), -(125, 'en_US', 'Niger', '', '', ''), +(125, 'en_UK', 'Niger', '', '', ''), (125, 'es_ES', 'Níger', '', '', ''), (125, 'fr_FR', 'Niger', '', '', ''), -(126, 'en_US', 'Nigeria', '', '', ''), +(126, 'en_UK', 'Nigeria', '', '', ''), (126, 'es_ES', 'Nigeria', '', '', ''), (126, 'fr_FR', 'Nigeria', '', '', ''), -(127, 'en_US', 'Niue', '', '', ''), +(127, 'en_UK', 'Niue', '', '', ''), (127, 'es_ES', 'Niue', '', '', ''), (127, 'fr_FR', 'Niue', '', '', ''), -(128, 'en_US', 'Norway', '', '', ''), +(128, 'en_UK', 'Norway', '', '', ''), (128, 'es_ES', 'Noruega', '', '', ''), (128, 'fr_FR', 'Norvège', '', '', ''), -(129, 'en_US', 'New Zealand', '', '', ''), +(129, 'en_UK', 'New Zealand', '', '', ''), (129, 'es_ES', 'Nueva Zelandia', '', '', ''), (129, 'fr_FR', 'Nouvelle-Zélande', '', '', ''), -(130, 'en_US', 'Oman', '', '', ''), +(130, 'en_UK', 'Oman', '', '', ''), (130, 'es_ES', 'Omán', '', '', ''), (130, 'fr_FR', 'Oman', '', '', ''), -(131, 'en_US', 'Uganda', '', '', ''), +(131, 'en_UK', 'Uganda', '', '', ''), (131, 'es_ES', 'Uganda', '', '', ''), (131, 'fr_FR', 'Ouganda', '', '', ''), -(132, 'en_US', 'Uzbekistan', '', '', ''), +(132, 'en_UK', 'Uzbekistan', '', '', ''), (132, 'es_ES', 'Uzbekistán', '', '', ''), (132, 'fr_FR', 'Ouzbékistan', '', '', ''), -(133, 'en_US', 'Pakistan', '', '', ''), +(133, 'en_UK', 'Pakistan', '', '', ''), (133, 'es_ES', 'Pakistán', '', '', ''), (133, 'fr_FR', 'Pakistan', '', '', ''), -(134, 'en_US', 'Panama', '', '', ''), +(134, 'en_UK', 'Panama', '', '', ''), (134, 'es_ES', 'Panamá', '', '', ''), (134, 'fr_FR', 'Panama', '', '', ''), -(135, 'en_US', 'Papua Nueva Guinea', '', '', ''), +(135, 'en_UK', 'Papua Nueva Guinea', '', '', ''), (135, 'es_ES', 'Papua Nueva Guinea', '', '', ''), (135, 'fr_FR', 'Papouasie', '', '', ''), -(136, 'en_US', 'Paraguay', '', '', ''), +(136, 'en_UK', 'Paraguay', '', '', ''), (136, 'es_ES', 'Paraguay', '', '', ''), (136, 'fr_FR', 'Paraguay', '', '', ''), -(137, 'en_US', 'Netherlands', '', '', ''), +(137, 'en_UK', 'Netherlands', '', '', ''), (137, 'es_ES', 'Países Bajos', '', '', ''), (137, 'fr_FR', 'Pays-Bas', '', '', ''), -(138, 'en_US', 'Peru', '', '', ''), +(138, 'en_UK', 'Peru', '', '', ''), (138, 'es_ES', 'Perú', '', '', ''), (138, 'fr_FR', 'Pérou', '', '', ''), -(139, 'en_US', 'Philippines', '', '', ''), +(139, 'en_UK', 'Philippines', '', '', ''), (139, 'es_ES', 'Filipinas', '', '', ''), (139, 'fr_FR', 'Philippines', '', '', ''), -(140, 'en_US', 'Poland', '', '', ''), +(140, 'en_UK', 'Poland', '', '', ''), (140, 'es_ES', 'Polonia', '', '', ''), (140, 'fr_FR', 'Pologne', '', '', ''), -(141, 'en_US', 'Portugal', '', '', ''), +(141, 'en_UK', 'Portugal', '', '', ''), (141, 'es_ES', 'Portugal', '', '', ''), (141, 'fr_FR', 'Portugal', '', '', ''), -(142, 'en_US', 'Qatar', '', '', ''), +(142, 'en_UK', 'Qatar', '', '', ''), (142, 'es_ES', 'Qatar', '', '', ''), (142, 'fr_FR', 'Qatar', '', '', ''), -(143, 'en_US', 'Central African Republic', '', '', ''), +(143, 'en_UK', 'Central African Republic', '', '', ''), (143, 'es_ES', 'República Centroafricana', '', '', ''), (143, 'fr_FR', 'République centrafricaine', '', '', ''), -(144, 'en_US', 'Dominican Republic', '', '', ''), +(144, 'en_UK', 'Dominican Republic', '', '', ''), (144, 'es_ES', 'República Dominicana', '', '', ''), (144, 'fr_FR', 'République dominicaine', '', '', ''), -(145, 'en_US', 'Czech Republic', '', '', ''), +(145, 'en_UK', 'Czech Republic', '', '', ''), (145, 'es_ES', 'República Checa', '', '', ''), (145, 'fr_FR', 'République tchèque', '', '', ''), -(146, 'en_US', 'Romania', '', '', ''), +(146, 'en_UK', 'Romania', '', '', ''), (146, 'es_ES', 'Rumania', '', '', ''), (146, 'fr_FR', 'Roumanie', '', '', ''), -(147, 'en_US', 'United Kingdom', '', '', ''), +(147, 'en_UK', 'United Kingdom', '', '', ''), (147, 'es_ES', 'Reino Unido', '', '', ''), (147, 'fr_FR', 'Royaume-Uni', '', '', ''), -(148, 'en_US', 'Russia', '', '', ''), +(148, 'en_UK', 'Russia', '', '', ''), (148, 'es_ES', 'Rusia', '', '', ''), (148, 'fr_FR', 'Russie', '', '', ''), -(149, 'en_US', 'Rwanda', '', '', ''), +(149, 'en_UK', 'Rwanda', '', '', ''), (149, 'es_ES', 'Ruanda', '', '', ''), (149, 'fr_FR', 'Rwanda', '', '', ''), -(150, 'en_US', 'Saint Kitts and Nevis', '', '', ''), +(150, 'en_UK', 'Saint Kitts and Nevis', '', '', ''), (150, 'es_ES', 'San Cristóbal', '', '', ''), (150, 'fr_FR', 'Saint-Christophe-et-Niévès', '', '', ''), -(151, 'en_US', 'Saint Lucia', '', '', ''), +(151, 'en_UK', 'Saint Lucia', '', '', ''), (151, 'es_ES', 'Santa Lucía', '', '', ''), (151, 'fr_FR', 'Sainte-Lucie', '', '', ''), -(152, 'en_US', 'San Marino', '', '', ''), +(152, 'en_UK', 'San Marino', '', '', ''), (152, 'es_ES', 'San Marino', '', '', ''), (152, 'fr_FR', 'Saint-Marin', '', '', ''), -(153, 'en_US', 'Saint Vincent and the Grenadines', '', '', ''), +(153, 'en_UK', 'Saint Vincent and the Grenadines', '', '', ''), (153, 'es_ES', 'San Vicente y las Granadinas', '', '', ''), (153, 'fr_FR', 'Saint-Vincent-et-les Grenadines', '', '', ''), -(154, 'en_US', 'Solomon Islands', '', '', ''), +(154, 'en_UK', 'Solomon Islands', '', '', ''), (154, 'es_ES', 'Salomón', '', '', ''), (154, 'fr_FR', 'Salomon', '', '', ''), -(155, 'en_US', 'El Salvador', '', '', ''), +(155, 'en_UK', 'El Salvador', '', '', ''), (155, 'es_ES', 'El Salvador', '', '', ''), (155, 'fr_FR', 'Salvador', '', '', ''), -(156, 'en_US', 'Western Samoa', '', '', ''), +(156, 'en_UK', 'Western Samoa', '', '', ''), (156, 'es_ES', 'Samoa', '', '', ''), (156, 'fr_FR', 'Samoa occidentales', '', '', ''), -(157, 'en_US', 'Sao Tome and Principe', '', '', ''), +(157, 'en_UK', 'Sao Tome and Principe', '', '', ''), (157, 'es_ES', 'Santo Tomé y Príncipe', '', '', ''), (157, 'fr_FR', 'Sao Tomé-et-Principe', '', '', ''), -(158, 'en_US', 'Senegal', '', '', ''), +(158, 'en_UK', 'Senegal', '', '', ''), (158, 'es_ES', 'Senegal', '', '', ''), (158, 'fr_FR', 'Sénégal', '', '', ''), -(159, 'en_US', 'Seychelles', '', '', ''), +(159, 'en_UK', 'Seychelles', '', '', ''), (159, 'es_ES', 'Seychelles', '', '', ''), (159, 'fr_FR', 'Seychelles', '', '', ''), -(160, 'en_US', 'Sierra Leone', '', '', ''), +(160, 'en_UK', 'Sierra Leone', '', '', ''), (160, 'es_ES', 'Sierra Leona', '', '', ''), (160, 'fr_FR', 'Sierra Leone', '', '', ''), -(161, 'en_US', 'Singapore', '', '', ''), +(161, 'en_UK', 'Singapore', '', '', ''), (161, 'es_ES', 'Singapur', '', '', ''), (161, 'fr_FR', 'Singapour', '', '', ''), -(162, 'en_US', 'Slovakia', '', '', ''), +(162, 'en_UK', 'Slovakia', '', '', ''), (162, 'es_ES', 'Eslovaquia', '', '', ''), (162, 'fr_FR', 'Slovaquie', '', '', ''), -(163, 'en_US', 'Slovenia', '', '', ''), +(163, 'en_UK', 'Slovenia', '', '', ''), (163, 'es_ES', 'Eslovenia', '', '', ''), (163, 'fr_FR', 'Slovénie', '', '', ''), -(164, 'en_US', 'Somalia', '', '', ''), +(164, 'en_UK', 'Somalia', '', '', ''), (164, 'es_ES', 'Somalia', '', '', ''), (164, 'fr_FR', 'Somalie', '', '', ''), -(165, 'en_US', 'Sudan', '', '', ''), +(165, 'en_UK', 'Sudan', '', '', ''), (165, 'es_ES', 'Sudán', '', '', ''), (165, 'fr_FR', 'Soudan', '', '', ''), -(166, 'en_US', 'Sri Lanka', '', '', ''), +(166, 'en_UK', 'Sri Lanka', '', '', ''), (166, 'es_ES', 'Sri Lanka', '', '', ''), (166, 'fr_FR', 'Sri Lanka', '', '', ''), -(167, 'en_US', 'Sweden', '', '', ''), +(167, 'en_UK', 'Sweden', '', '', ''), (167, 'es_ES', 'Suecia', '', '', ''), (167, 'fr_FR', 'Suède', '', '', ''), -(168, 'en_US', 'Switzerland', '', '', ''), +(168, 'en_UK', 'Switzerland', '', '', ''), (168, 'es_ES', 'Suiza', '', '', ''), (168, 'fr_FR', 'Suisse', '', '', ''), -(169, 'en_US', 'Suriname', '', '', ''), +(169, 'en_UK', 'Suriname', '', '', ''), (169, 'es_ES', 'Suriname', '', '', ''), (169, 'fr_FR', 'Suriname', '', '', ''), -(170, 'en_US', 'Swaziland', '', '', ''), +(170, 'en_UK', 'Swaziland', '', '', ''), (170, 'es_ES', 'Swazilandia', '', '', ''), (170, 'fr_FR', 'Swaziland', '', '', ''), -(171, 'en_US', 'Syria', '', '', ''), +(171, 'en_UK', 'Syria', '', '', ''), (171, 'es_ES', 'Siria', '', '', ''), (171, 'fr_FR', 'Syrie', '', '', ''), -(172, 'en_US', 'Tajikistan', '', '', ''), +(172, 'en_UK', 'Tajikistan', '', '', ''), (172, 'es_ES', 'Tayikistán', '', '', ''), (172, 'fr_FR', 'Tadjikistan', '', '', ''), -(173, 'en_US', 'Tanzania', '', '', ''), +(173, 'en_UK', 'Tanzania', '', '', ''), (173, 'es_ES', 'Tanzanía', '', '', ''), (173, 'fr_FR', 'Tanzanie', '', '', ''), -(174, 'en_US', 'Chad', '', '', ''), +(174, 'en_UK', 'Chad', '', '', ''), (174, 'es_ES', 'Chad', '', '', ''), (174, 'fr_FR', 'Tchad', '', '', ''), -(175, 'en_US', 'Thailand', '', '', ''), +(175, 'en_UK', 'Thailand', '', '', ''), (175, 'es_ES', 'Tailandia', '', '', ''), (175, 'fr_FR', 'Thaïlande', '', '', ''), -(176, 'en_US', 'Togo', '', '', ''), +(176, 'en_UK', 'Togo', '', '', ''), (176, 'es_ES', 'Togo', '', '', ''), (176, 'fr_FR', 'Togo', '', '', ''), -(177, 'en_US', 'Tonga', '', '', ''), +(177, 'en_UK', 'Tonga', '', '', ''), (177, 'es_ES', 'Tonga', '', '', ''), (177, 'fr_FR', 'Tonga', '', '', ''), -(178, 'en_US', 'Trinidad and Tobago', '', '', ''), +(178, 'en_UK', 'Trinidad and Tobago', '', '', ''), (178, 'es_ES', 'Trinidad y Tabago', '', '', ''), (178, 'fr_FR', 'Trinité-et-Tobago', '', '', ''), -(179, 'en_US', 'Tunisia', '', '', ''), +(179, 'en_UK', 'Tunisia', '', '', ''), (179, 'es_ES', 'Túnez', '', '', ''), (179, 'fr_FR', 'Tunisie', '', '', ''), -(180, 'en_US', 'Turkmenistan', '', '', ''), +(180, 'en_UK', 'Turkmenistan', '', '', ''), (180, 'es_ES', 'Turkmenistán', '', '', ''), (180, 'fr_FR', 'Turkménistan', '', '', ''), -(181, 'en_US', 'Turkey', '', '', ''), +(181, 'en_UK', 'Turkey', '', '', ''), (181, 'es_ES', 'Turquía', '', '', ''), (181, 'fr_FR', 'Turquie', '', '', ''), -(182, 'en_US', 'Tuvalu', '', '', ''), +(182, 'en_UK', 'Tuvalu', '', '', ''), (182, 'es_ES', 'Tuvalu', '', '', ''), (182, 'fr_FR', 'Tuvalu', '', '', ''), -(183, 'en_US', 'Ukraine', '', '', ''), +(183, 'en_UK', 'Ukraine', '', '', ''), (183, 'es_ES', 'Ucrania', '', '', ''), (183, 'fr_FR', 'Ukraine', '', '', ''), -(184, 'en_US', 'Uruguay', '', '', ''), +(184, 'en_UK', 'Uruguay', '', '', ''), (184, 'es_ES', 'Uruguay', '', '', ''), (184, 'fr_FR', 'Uruguay', '', '', ''), -(185, 'en_US', 'The Vatican', '', '', ''), +(185, 'en_UK', 'The Vatican', '', '', ''), (185, 'es_ES', 'El Vatican', '', '', ''), (185, 'fr_FR', 'Vatican', '', '', ''), -(186, 'en_US', 'Vanuatu', '', '', ''), +(186, 'en_UK', 'Vanuatu', '', '', ''), (186, 'es_ES', 'Vanuatu', '', '', ''), (186, 'fr_FR', 'Vanuatu', '', '', ''), -(187, 'en_US', 'Venezuela', '', '', ''), +(187, 'en_UK', 'Venezuela', '', '', ''), (187, 'es_ES', 'Venezuela', '', '', ''), (187, 'fr_FR', 'Venezuela', '', '', ''), -(188, 'en_US', 'Vietnam', '', '', ''), +(188, 'en_UK', 'Vietnam', '', '', ''), (188, 'es_ES', 'Viet Nam', '', '', ''), (188, 'fr_FR', 'Viêt Nam', '', '', ''), -(189, 'en_US', 'Yemen', '', '', ''), +(189, 'en_UK', 'Yemen', '', '', ''), (189, 'es_ES', 'Yemen', '', '', ''), (189, 'fr_FR', 'Yémen', '', '', ''), -(190, 'en_US', 'Yougoslavia', '', '', ''), +(190, 'en_UK', 'Yougoslavia', '', '', ''), (190, 'es_ES', 'Yugoslavia', '', '', ''), (190, 'fr_FR', 'Yougoslavie', '', '', ''), -(191, 'en_US', 'Zaire', '', '', ''), +(191, 'en_UK', 'Zaire', '', '', ''), (191, 'es_ES', 'Zaire', '', '', ''), (191, 'fr_FR', 'Zaïre', '', '', ''), -(192, 'en_US', 'Zambia', '', '', ''), +(192, 'en_UK', 'Zambia', '', '', ''), (192, 'es_ES', 'Zambia', '', '', ''), (192, 'fr_FR', 'Zambie', '', '', ''), -(193, 'en_US', 'Zimbabwe', '', '', ''), +(193, 'en_UK', 'Zimbabwe', '', '', ''), (193, 'es_ES', 'Zimbabwe', '', '', ''), (193, 'fr_FR', 'Zimbabwe', '', '', ''), -(196, 'en_US', 'USA - Alaska', '', '', ''), +(196, 'en_UK', 'USA - Alaska', '', '', ''), (196, 'es_ES', 'USA - Alaska', '', '', ''), (196, 'fr_FR', 'USA - Alaska', '', '', ''), -(197, 'en_US', 'USA - Arizona', '', '', ''), +(197, 'en_UK', 'USA - Arizona', '', '', ''), (197, 'es_ES', 'USA - Arizona', '', '', ''), (197, 'fr_FR', 'USA - Arizona', '', '', ''), -(198, 'en_US', 'USA - Arkansas', '', '', ''), +(198, 'en_UK', 'USA - Arkansas', '', '', ''), (198, 'es_ES', 'USA - Arkansas', '', '', ''), (198, 'fr_FR', 'USA - Arkansas', '', '', ''), -(199, 'en_US', 'USA - California', '', '', ''), +(199, 'en_UK', 'USA - California', '', '', ''), (199, 'es_ES', 'USA - California', '', '', ''), (199, 'fr_FR', 'USA - California', '', '', ''), -(200, 'en_US', 'USA - Colorado', '', '', ''), +(200, 'en_UK', 'USA - Colorado', '', '', ''), (200, 'es_ES', 'USA - Colorado', '', '', ''), (200, 'fr_FR', 'USA - Colorado', '', '', ''), -(201, 'en_US', 'USA - Connecticut', '', '', ''), +(201, 'en_UK', 'USA - Connecticut', '', '', ''), (201, 'es_ES', 'USA - Connecticut', '', '', ''), (201, 'fr_FR', 'USA - Connecticut', '', '', ''), -(202, 'en_US', 'USA - Delaware', '', '', ''), +(202, 'en_UK', 'USA - Delaware', '', '', ''), (202, 'es_ES', 'USA - Delaware', '', '', ''), (202, 'fr_FR', 'USA - Delaware', '', '', ''), -(203, 'en_US', 'USA - District Of Columbia', '', '', ''), +(203, 'en_UK', 'USA - District Of Columbia', '', '', ''), (203, 'es_ES', 'USA - District Of Columbia', '', '', ''), (203, 'fr_FR', 'USA - District Of Columbia', '', '', ''), -(204, 'en_US', 'USA - Florida', '', '', ''), +(204, 'en_UK', 'USA - Florida', '', '', ''), (204, 'es_ES', 'USA - Florida', '', '', ''), (204, 'fr_FR', 'USA - Florida', '', '', ''), -(205, 'en_US', 'USA - Georgia', '', '', ''), +(205, 'en_UK', 'USA - Georgia', '', '', ''), (205, 'es_ES', 'USA - Georgia', '', '', ''), (205, 'fr_FR', 'USA - Georgia', '', '', ''), -(206, 'en_US', 'USA - Hawaii', '', '', ''), +(206, 'en_UK', 'USA - Hawaii', '', '', ''), (206, 'es_ES', 'USA - Hawaii', '', '', ''), (206, 'fr_FR', 'USA - Hawaii', '', '', ''), -(207, 'en_US', 'USA - Idaho', '', '', ''), +(207, 'en_UK', 'USA - Idaho', '', '', ''), (207, 'es_ES', 'USA - Idaho', '', '', ''), (207, 'fr_FR', 'USA - Idaho', '', '', ''), -(208, 'en_US', 'USA - Illinois', '', '', ''), +(208, 'en_UK', 'USA - Illinois', '', '', ''), (208, 'es_ES', 'USA - Illinois', '', '', ''), (208, 'fr_FR', 'USA - Illinois', '', '', ''), -(209, 'en_US', 'USA - Indiana', '', '', ''), +(209, 'en_UK', 'USA - Indiana', '', '', ''), (209, 'es_ES', 'USA - Indiana', '', '', ''), (209, 'fr_FR', 'USA - Indiana', '', '', ''), -(210, 'en_US', 'USA - Iowa', '', '', ''), +(210, 'en_UK', 'USA - Iowa', '', '', ''), (210, 'es_ES', 'USA - Iowa', '', '', ''), (210, 'fr_FR', 'USA - Iowa', '', '', ''), -(211, 'en_US', 'USA - Kansas', '', '', ''), +(211, 'en_UK', 'USA - Kansas', '', '', ''), (211, 'es_ES', 'USA - Kansas', '', '', ''), (211, 'fr_FR', 'USA - Kansas', '', '', ''), -(212, 'en_US', 'USA - Kentucky', '', '', ''), +(212, 'en_UK', 'USA - Kentucky', '', '', ''), (212, 'es_ES', 'USA - Kentucky', '', '', ''), (212, 'fr_FR', 'USA - Kentucky', '', '', ''), -(213, 'en_US', 'USA - Louisiana', '', '', ''), +(213, 'en_UK', 'USA - Louisiana', '', '', ''), (213, 'es_ES', 'USA - Louisiana', '', '', ''), (213, 'fr_FR', 'USA - Louisiana', '', '', ''), -(214, 'en_US', 'USA - Maine', '', '', ''), +(214, 'en_UK', 'USA - Maine', '', '', ''), (214, 'es_ES', 'USA - Maine', '', '', ''), (214, 'fr_FR', 'USA - Maine', '', '', ''), -(215, 'en_US', 'USA - Maryland', '', '', ''), +(215, 'en_UK', 'USA - Maryland', '', '', ''), (215, 'es_ES', 'USA - Maryland', '', '', ''), (215, 'fr_FR', 'USA - Maryland', '', '', ''), -(216, 'en_US', 'USA - Massachusetts', '', '', ''), +(216, 'en_UK', 'USA - Massachusetts', '', '', ''), (216, 'es_ES', 'USA - Massachusetts', '', '', ''), (216, 'fr_FR', 'USA - Massachusetts', '', '', ''), -(217, 'en_US', 'USA - Michigan', '', '', ''), +(217, 'en_UK', 'USA - Michigan', '', '', ''), (217, 'es_ES', 'USA - Michigan', '', '', ''), (217, 'fr_FR', 'USA - Michigan', '', '', ''), -(218, 'en_US', 'USA - Minnesota', '', '', ''), +(218, 'en_UK', 'USA - Minnesota', '', '', ''), (218, 'es_ES', 'USA - Minnesota', '', '', ''), (218, 'fr_FR', 'USA - Minnesota', '', '', ''), -(219, 'en_US', 'USA - Mississippi', '', '', ''), +(219, 'en_UK', 'USA - Mississippi', '', '', ''), (219, 'es_ES', 'USA - Mississippi', '', '', ''), (219, 'fr_FR', 'USA - Mississippi', '', '', ''), -(220, 'en_US', 'USA - Missouri', '', '', ''), +(220, 'en_UK', 'USA - Missouri', '', '', ''), (220, 'es_ES', 'USA - Missouri', '', '', ''), (220, 'fr_FR', 'USA - Missouri', '', '', ''), -(221, 'en_US', 'USA - Montana', '', '', ''), +(221, 'en_UK', 'USA - Montana', '', '', ''), (221, 'es_ES', 'USA - Montana', '', '', ''), (221, 'fr_FR', 'USA - Montana', '', '', ''), -(222, 'en_US', 'USA - Nebraska', '', '', ''), +(222, 'en_UK', 'USA - Nebraska', '', '', ''), (222, 'es_ES', 'USA - Nebraska', '', '', ''), (222, 'fr_FR', 'USA - Nebraska', '', '', ''), -(223, 'en_US', 'USA - Nevada', '', '', ''), +(223, 'en_UK', 'USA - Nevada', '', '', ''), (223, 'es_ES', 'USA - Nevada', '', '', ''), (223, 'fr_FR', 'USA - Nevada', '', '', ''), -(224, 'en_US', 'USA - New Hampshire', '', '', ''), +(224, 'en_UK', 'USA - New Hampshire', '', '', ''), (224, 'es_ES', 'USA - New Hampshire', '', '', ''), (224, 'fr_FR', 'USA - New Hampshire', '', '', ''), -(225, 'en_US', 'USA - New Jersey', '', '', ''), +(225, 'en_UK', 'USA - New Jersey', '', '', ''), (225, 'es_ES', 'USA - New Jersey', '', '', ''), (225, 'fr_FR', 'USA - New Jersey', '', '', ''), -(226, 'en_US', 'USA - New Mexico', '', '', ''), +(226, 'en_UK', 'USA - New Mexico', '', '', ''), (226, 'es_ES', 'USA - New Mexico', '', '', ''), (226, 'fr_FR', 'USA - New Mexico', '', '', ''), -(227, 'en_US', 'USA - New York', '', '', ''), +(227, 'en_UK', 'USA - New York', '', '', ''), (227, 'es_ES', 'USA - New York', '', '', ''), (227, 'fr_FR', 'USA - New York', '', '', ''), -(228, 'en_US', 'USA - North Carolina', '', '', ''), +(228, 'en_UK', 'USA - North Carolina', '', '', ''), (228, 'es_ES', 'USA - North Carolina', '', '', ''), (228, 'fr_FR', 'USA - North Carolina', '', '', ''), -(229, 'en_US', 'USA - North Dakota', '', '', ''), +(229, 'en_UK', 'USA - North Dakota', '', '', ''), (229, 'es_ES', 'USA - North Dakota', '', '', ''), (229, 'fr_FR', 'USA - North Dakota', '', '', ''), -(230, 'en_US', 'USA - Ohio', '', '', ''), +(230, 'en_UK', 'USA - Ohio', '', '', ''), (230, 'es_ES', 'USA - Ohio', '', '', ''), (230, 'fr_FR', 'USA - Ohio', '', '', ''), -(231, 'en_US', 'USA - Oklahoma', '', '', ''), +(231, 'en_UK', 'USA - Oklahoma', '', '', ''), (231, 'es_ES', 'USA - Oklahoma', '', '', ''), (231, 'fr_FR', 'USA - Oklahoma', '', '', ''), -(232, 'en_US', 'USA - Oregon', '', '', ''), +(232, 'en_UK', 'USA - Oregon', '', '', ''), (232, 'es_ES', 'USA - Oregon', '', '', ''), (232, 'fr_FR', 'USA - Oregon', '', '', ''), -(233, 'en_US', 'USA - Pennsylvania', '', '', ''), +(233, 'en_UK', 'USA - Pennsylvania', '', '', ''), (233, 'es_ES', 'USA - Pennsylvania', '', '', ''), (233, 'fr_FR', 'USA - Pennsylvania', '', '', ''), -(234, 'en_US', 'USA - Rhode Island', '', '', ''), +(234, 'en_UK', 'USA - Rhode Island', '', '', ''), (234, 'es_ES', 'USA - Rhode Island', '', '', ''), (234, 'fr_FR', 'USA - Rhode Island', '', '', ''), -(235, 'en_US', 'USA - South Carolina', '', '', ''), +(235, 'en_UK', 'USA - South Carolina', '', '', ''), (235, 'es_ES', 'USA - South Carolina', '', '', ''), (235, 'fr_FR', 'USA - South Carolina', '', '', ''), -(236, 'en_US', 'USA - South Dakota', '', '', ''), +(236, 'en_UK', 'USA - South Dakota', '', '', ''), (236, 'es_ES', 'USA - South Dakota', '', '', ''), (236, 'fr_FR', 'USA - South Dakota', '', '', ''), -(237, 'en_US', 'USA - Tennessee', '', '', ''), +(237, 'en_UK', 'USA - Tennessee', '', '', ''), (237, 'es_ES', 'USA - Tennessee', '', '', ''), (237, 'fr_FR', 'USA - Tennessee', '', '', ''), -(238, 'en_US', 'USA - Texas', '', '', ''), +(238, 'en_UK', 'USA - Texas', '', '', ''), (238, 'es_ES', 'USA - Texas', '', '', ''), (238, 'fr_FR', 'USA - Texas', '', '', ''), -(239, 'en_US', 'USA - Utah', '', '', ''), +(239, 'en_UK', 'USA - Utah', '', '', ''), (239, 'es_ES', 'USA - Utah', '', '', ''), (239, 'fr_FR', 'USA - Utah', '', '', ''), -(240, 'en_US', 'USA - Vermont', '', '', ''), +(240, 'en_UK', 'USA - Vermont', '', '', ''), (240, 'es_ES', 'USA - Vermont', '', '', ''), (240, 'fr_FR', 'USA - Vermont', '', '', ''), -(241, 'en_US', 'USA - Virginia', '', '', ''), +(241, 'en_UK', 'USA - Virginia', '', '', ''), (241, 'es_ES', 'USA - Virginia', '', '', ''), (241, 'fr_FR', 'USA - Virginia', '', '', ''), -(242, 'en_US', 'USA - Washington', '', '', ''), +(242, 'en_UK', 'USA - Washington', '', '', ''), (242, 'es_ES', 'USA - Washington', '', '', ''), (242, 'fr_FR', 'USA - Washington', '', '', ''), -(243, 'en_US', 'USA - West Virginia', '', '', ''), +(243, 'en_UK', 'USA - West Virginia', '', '', ''), (243, 'es_ES', 'USA - West Virginia', '', '', ''), (243, 'fr_FR', 'USA - West Virginia', '', '', ''), -(244, 'en_US', 'USA - Wisconsin', '', '', ''), +(244, 'en_UK', 'USA - Wisconsin', '', '', ''), (244, 'es_ES', 'USA - Wisconsin', '', '', ''), (244, 'fr_FR', 'USA - Wisconsin', '', '', ''), -(245, 'en_US', 'USA - Wyoming', '', '', ''), +(245, 'en_UK', 'USA - Wyoming', '', '', ''), (245, 'es_ES', 'USA - Wyoming', '', '', ''), (245, 'fr_FR', 'USA - Wyoming', '', '', ''), -(246, 'en_US', 'Canada - Colombie-Britannique', '', '', ''), +(246, 'en_UK', 'Canada - Colombie-Britannique', '', '', ''), (246, 'es_ES', 'Canada - Colombie-Britannique', '', '', ''), (246, 'fr_FR', 'Canada - Colombie-Britannique', '', '', ''), -(247, 'en_US', 'Canada - Alberta', '', '', ''), +(247, 'en_UK', 'Canada - Alberta', '', '', ''), (247, 'es_ES', 'Canada - Alberta', '', '', ''), (247, 'fr_FR', 'Canada - Alberta', '', '', ''), -(248, 'en_US', 'Canada - Saskatchewan', '', '', ''), +(248, 'en_UK', 'Canada - Saskatchewan', '', '', ''), (248, 'es_ES', 'Canada - Saskatchewan', '', '', ''), (248, 'fr_FR', 'Canada - Saskatchewan', '', '', ''), -(249, 'en_US', 'Canada - Manitoba', '', '', ''), +(249, 'en_UK', 'Canada - Manitoba', '', '', ''), (249, 'es_ES', 'Canada - Manitoba', '', '', ''), (249, 'fr_FR', 'Canada - Manitoba', '', '', ''), -(250, 'en_US', 'Canada - Ontario', '', '', ''), +(250, 'en_UK', 'Canada - Ontario', '', '', ''), (250, 'es_ES', 'Canada - Ontario', '', '', ''), (250, 'fr_FR', 'Canada - Ontario', '', '', ''), -(251, 'en_US', 'Canada - Québec', '', '', ''), +(251, 'en_UK', 'Canada - Québec', '', '', ''), (251, 'es_ES', 'Canada - Québec', '', '', ''), (251, 'fr_FR', 'Canada - Québec', '', '', ''), -(252, 'en_US', 'Canada - Nouveau-Brunswick', '', '', ''), +(252, 'en_UK', 'Canada - Nouveau-Brunswick', '', '', ''), (252, 'es_ES', 'Canada - Nouveau-Brunswick', '', '', ''), (252, 'fr_FR', 'Canada - Nouveau-Brunswick', '', '', ''), -(253, 'en_US', 'Canada - Nouvelle-Écosse', '', '', ''), +(253, 'en_UK', 'Canada - Nouvelle-Écosse', '', '', ''), (253, 'es_ES', 'Canada - Nouvelle-Écosse', '', '', ''), (253, 'fr_FR', 'Canada - Nouvelle-Écosse', '', '', ''), -(254, 'en_US', 'Canada - Île-du-Prince-Édouard ', '', '', ''), +(254, 'en_UK', 'Canada - Île-du-Prince-Édouard ', '', '', ''), (254, 'es_ES', 'Canada - Île-du-Prince-Édouard ', '', '', ''), (254, 'fr_FR', 'Canada - Île-du-Prince-Édouard ', '', '', ''), -(255, 'en_US', 'Canada - Terre-Neuve-et-Labrador ', '', '', ''), +(255, 'en_UK', 'Canada - Terre-Neuve-et-Labrador ', '', '', ''), (255, 'es_ES', 'Canada - Terre-Neuve-et-Labrador ', '', '', ''), (255, 'fr_FR', 'Canada - Terre-Neuve-et-Labrador ', '', '', ''), -(256, 'en_US', 'Canada - Yukon', '', '', ''), +(256, 'en_UK', 'Canada - Yukon', '', '', ''), (256, 'es_ES', 'Canada - Yukon', '', '', ''), (256, 'fr_FR', 'Canada - Yukon', '', '', ''), -(257, 'en_US', 'Canada - Territoires-du-Nord-Ouest', '', '', ''), +(257, 'en_UK', 'Canada - Territoires-du-Nord-Ouest', '', '', ''), (257, 'es_ES', 'Canada - Territoires-du-Nord-Ouest', '', '', ''), (257, 'fr_FR', 'Canada - Territoires-du-Nord-Ouest', '', '', ''), -(258, 'en_US', 'Canada - Nunavut', '', '', ''), +(258, 'en_UK', 'Canada - Nunavut', '', '', ''), (258, 'es_ES', 'Canada - Nunavut', '', '', ''), (258, 'fr_FR', 'Canada - Nunavut', '', '', ''), -(259, 'en_US', 'Guadeloupe', '', '', ''), +(259, 'en_UK', 'Guadeloupe', '', '', ''), (259, 'es_ES', 'Guadeloupe', '', '', ''), (259, 'fr_FR', 'Guadeloupe', '', '', ''), -(260, 'en_US', 'Guyane Française', '', '', ''), +(260, 'en_UK', 'Guyane Française', '', '', ''), (260, 'es_ES', 'Guyane Française', '', '', ''), (260, 'fr_FR', 'Guyane Française', '', '', ''), -(261, 'en_US', 'Martinique', '', '', ''), +(261, 'en_UK', 'Martinique', '', '', ''), (261, 'es_ES', 'Martinique', '', '', ''), (261, 'fr_FR', 'Martinique', '', '', ''), -(262, 'en_US', 'Mayotte', '', '', ''), +(262, 'en_UK', 'Mayotte', '', '', ''), (262, 'es_ES', 'Mayotte', '', '', ''), (262, 'fr_FR', 'Mayotte', '', '', ''), -(263, 'en_US', 'Réunion(La)', '', '', ''), +(263, 'en_UK', 'Réunion(La)', '', '', ''), (263, 'es_ES', 'Réunion(La)', '', '', ''), (263, 'fr_FR', 'Réunion(La)', '', '', ''), -(264, 'en_US', 'St Pierre et Miquelon', '', '', ''), +(264, 'en_UK', 'St Pierre et Miquelon', '', '', ''), (264, 'es_ES', 'St Pierre et Miquelon', '', '', ''), (264, 'fr_FR', 'St Pierre et Miquelon', '', '', ''), -(265, 'en_US', 'Nouvelle-Calédonie', '', '', ''), +(265, 'en_UK', 'Nouvelle-Calédonie', '', '', ''), (265, 'es_ES', 'Nouvelle-Calédonie', '', '', ''), (265, 'fr_FR', 'Nouvelle-Calédonie', '', '', ''), -(266, 'en_US', 'Polynésie française', '', '', ''), +(266, 'en_UK', 'Polynésie française', '', '', ''), (266, 'es_ES', 'Polynésie française', '', '', ''), (266, 'fr_FR', 'Polynésie française', '', '', ''), -(267, 'en_US', 'Wallis-et-Futuna', '', '', ''), +(267, 'en_UK', 'Wallis-et-Futuna', '', '', ''), (267, 'es_ES', 'Wallis-et-Futuna', '', '', ''), (267, 'fr_FR', 'Wallis-et-Futuna', '', '', ''), -(268, 'en_US', 'USA - Alabama', '', '', ''), +(268, 'en_UK', 'USA - Alabama', '', '', ''), (268, 'es_ES', 'USA - Alabama', '', '', ''), (268, 'fr_FR', 'USA - Alabama', '', '', ''); + +INSERT INTO `tax` (`id`, `rate`, `created_at`, `updated_at`) + VALUES + (1, '19.6', NOW(), NOW()); + +INSERT INTO `tax_i18n` (`id`, `locale`, `title`) + VALUES + (1, 'fr_FR', 'TVA française à 19.6%'), + (1, 'en_UK', 'french 19.6% tax'); + +INSERT INTO `tax_rule` (`id`, `created_at`, `updated_at`) + VALUES + (1, NOW(), NOW()); + +INSERT INTO `tax_rule_i18n` (`id`, `locale`, `title`) + VALUES + (1, 'fr_FR', 'TVA française à 19.6%'), + (1, 'en_UK', 'french 19.6% tax'); + +INSERT INTO `tax_rule_country` (`tax_rule_id`, `country_id`, `tax_id`, `position`, `created_at`, `updated_at`) + VALUES + (1, 64, 1, 1, NOW(), NOW()); \ No newline at end of file diff --git a/install/thelia.sql b/install/thelia.sql index 9188f164d..d38d45379 100755 --- a/install/thelia.sql +++ b/install/thelia.sql @@ -126,9 +126,6 @@ DROP TABLE IF EXISTS `tax_rule`; CREATE TABLE `tax_rule` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `code` VARCHAR(45), - `title` VARCHAR(255), - `description` TEXT, `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`) @@ -142,14 +139,13 @@ DROP TABLE IF EXISTS `tax_rule_country`; CREATE TABLE `tax_rule_country` ( - `id` INTEGER NOT NULL, - `tax_rule_id` INTEGER, - `country_id` INTEGER, - `tax_id` INTEGER, - `none` TINYINT, + `tax_rule_id` INTEGER NOT NULL, + `country_id` INTEGER NOT NULL, + `tax_id` INTEGER NOT NULL, + `position` INTEGER NOT NULL, `created_at` DATETIME, `updated_at` DATETIME, - PRIMARY KEY (`id`), + PRIMARY KEY (`tax_rule_id`,`country_id`,`tax_id`), INDEX `idx_tax_rule_country_tax_id` (`tax_id`), INDEX `idx_tax_rule_country_tax_rule_id` (`tax_rule_id`), INDEX `idx_tax_rule_country_country_id` (`country_id`), @@ -157,7 +153,7 @@ CREATE TABLE `tax_rule_country` FOREIGN KEY (`tax_id`) REFERENCES `tax` (`id`) ON UPDATE RESTRICT - ON DELETE SET NULL, + ON DELETE CASCADE, CONSTRAINT `fk_tax_rule_country_tax_rule_id` FOREIGN KEY (`tax_rule_id`) REFERENCES `tax_rule` (`id`) @@ -410,7 +406,8 @@ CREATE TABLE `config` `hidden` TINYINT DEFAULT 1 NOT NULL, `created_at` DATETIME, `updated_at` DATETIME, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + UNIQUE INDEX `name_UNIQUE` (`name`) ) ENGINE=InnoDB; -- --------------------------------------------------------------------- @@ -454,7 +451,7 @@ DROP TABLE IF EXISTS `address`; CREATE TABLE `address` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `name` VARCHAR(255), + `label` VARCHAR(255), `customer_id` INTEGER NOT NULL, `title_id` INTEGER NOT NULL, `company` VARCHAR(255), @@ -521,8 +518,14 @@ CREATE TABLE `lang` `code` VARCHAR(10), `locale` VARCHAR(45), `url` VARCHAR(255), - `position` INTEGER, + `date_format` VARCHAR(45), + `time_format` VARCHAR(45), + `datetime_format` VARCHAR(45), + `decimal_separator` VARCHAR(45), + `thousands_separator` VARCHAR(45), + `decimals` VARCHAR(45), `by_default` TINYINT, + `position` INTEGER, `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`) @@ -567,42 +570,6 @@ CREATE TABLE `content` PRIMARY KEY (`id`) ) ENGINE=InnoDB; --- --------------------------------------------------------------------- --- content_assoc --- --------------------------------------------------------------------- - -DROP TABLE IF EXISTS `content_assoc`; - -CREATE TABLE `content_assoc` -( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `category_id` INTEGER, - `product_id` INTEGER, - `content_id` INTEGER, - `position` INTEGER, - `created_at` DATETIME, - `updated_at` DATETIME, - PRIMARY KEY (`id`), - INDEX `idx_content_assoc_category_id` (`category_id`), - INDEX `idx_content_assoc_product_id` (`product_id`), - INDEX `idx_content_assoc_content_id` (`content_id`), - CONSTRAINT `fk_content_assoc_category_id` - FOREIGN KEY (`category_id`) - REFERENCES `category` (`id`) - ON UPDATE RESTRICT - ON DELETE CASCADE, - CONSTRAINT `fk_content_assoc_product_id` - FOREIGN KEY (`product_id`) - REFERENCES `product` (`id`) - ON UPDATE RESTRICT - ON DELETE CASCADE, - CONSTRAINT `fk_content_assoc_content_id` - FOREIGN KEY (`content_id`) - REFERENCES `content` (`id`) - ON UPDATE RESTRICT - ON DELETE CASCADE -) ENGINE=InnoDB; - -- --------------------------------------------------------------------- -- product_image -- --------------------------------------------------------------------- @@ -832,6 +799,7 @@ CREATE TABLE `module` `type` TINYINT NOT NULL, `activate` TINYINT, `position` INTEGER, + `full_namespace` VARCHAR(255), `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`), @@ -846,7 +814,7 @@ DROP TABLE IF EXISTS `accessory`; CREATE TABLE `accessory` ( - `id` INTEGER NOT NULL, + `id` INTEGER NOT NULL AUTO_INCREMENT, `product_id` INTEGER NOT NULL, `accessory` INTEGER NOT NULL, `position` INTEGER NOT NULL, @@ -1053,58 +1021,15 @@ DROP TABLE IF EXISTS `message`; CREATE TABLE `message` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `code` VARCHAR(45) NOT NULL, + `name` VARCHAR(255) NOT NULL, `secured` TINYINT, - `ref` VARCHAR(255), `created_at` DATETIME, `updated_at` DATETIME, `version` INTEGER DEFAULT 0, `version_created_at` DATETIME, `version_created_by` VARCHAR(100), - PRIMARY KEY (`id`) -) ENGINE=InnoDB; - --- --------------------------------------------------------------------- --- rewriting --- --------------------------------------------------------------------- - -DROP TABLE IF EXISTS `rewriting`; - -CREATE TABLE `rewriting` -( - `id` INTEGER NOT NULL, - `url` VARCHAR(255) NOT NULL, - `product_id` INTEGER, - `category_id` INTEGER, - `folder_id` INTEGER, - `content_id` INTEGER, - `created_at` DATETIME, - `updated_at` DATETIME, PRIMARY KEY (`id`), - INDEX `idx_rewriting_product_id` (`product_id`), - INDEX `idx_rewriting_category_id` (`category_id`), - INDEX `idx_rewriting_folder_id` (`folder_id`), - INDEX `idx_rewriting_content_id` (`content_id`), - CONSTRAINT `fk_rewriting_product_id` - FOREIGN KEY (`product_id`) - REFERENCES `product` (`id`) - ON UPDATE RESTRICT - ON DELETE CASCADE, - CONSTRAINT `fk_rewriting_category_id` - FOREIGN KEY (`category_id`) - REFERENCES `category` (`id`) - ON UPDATE RESTRICT - ON DELETE CASCADE, - CONSTRAINT `fk_rewriting_folder_id` - FOREIGN KEY (`folder_id`) - REFERENCES `folder` (`id`) - ON UPDATE RESTRICT - ON DELETE CASCADE, - CONSTRAINT `fk_rewriting_content_id` - FOREIGN KEY (`content_id`) - REFERENCES `content` (`id`) - ON UPDATE RESTRICT - ON DELETE CASCADE + UNIQUE INDEX `name_UNIQUE` (`name`) ) ENGINE=InnoDB; -- --------------------------------------------------------------------- @@ -1117,40 +1042,30 @@ CREATE TABLE `coupon` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `code` VARCHAR(45) NOT NULL, - `action` VARCHAR(255) NOT NULL, - `value` FLOAT NOT NULL, - `used` TINYINT, - `available_since` DATETIME, - `date_limit` DATETIME, - `activate` TINYINT, + `type` VARCHAR(255) NOT NULL, + `amount` FLOAT NOT NULL, + `is_used` TINYINT NOT NULL, + `is_enabled` TINYINT NOT NULL, + `expiration_date` DATETIME NOT NULL, + `serialized_rules` TEXT NOT NULL, + `is_cumulative` TINYINT NOT NULL, + `is_removing_postage` TINYINT NOT NULL, + `max_usage` INTEGER NOT NULL, + `is_available_on_special_offers` TINYINT(1) NOT NULL, `created_at` DATETIME, `updated_at` DATETIME, + `version` INTEGER DEFAULT 0, PRIMARY KEY (`id`), - UNIQUE INDEX `code_UNIQUE` (`code`) -) ENGINE=InnoDB; - --- --------------------------------------------------------------------- --- coupon_rule --- --------------------------------------------------------------------- - -DROP TABLE IF EXISTS `coupon_rule`; - -CREATE TABLE `coupon_rule` -( - `id` INTEGER NOT NULL AUTO_INCREMENT, - `coupon_id` INTEGER NOT NULL, - `controller` VARCHAR(255), - `operation` VARCHAR(255), - `value` FLOAT, - `created_at` DATETIME, - `updated_at` DATETIME, - PRIMARY KEY (`id`), - INDEX `idx_coupon_rule_coupon_id` (`coupon_id`), - CONSTRAINT `fk_coupon_rule_coupon_id` - FOREIGN KEY (`coupon_id`) - REFERENCES `coupon` (`id`) - ON UPDATE RESTRICT - ON DELETE CASCADE + UNIQUE INDEX `code_UNIQUE` (`code`), + INDEX `idx_is_enabled` (`is_enabled`), + INDEX `idx_is_used` (`is_used`), + INDEX `idx_type` (`type`), + INDEX `idx_amount` (`amount`), + INDEX `idx_expiration_date` (`expiration_date`), + INDEX `idx_is_cumulative` (`is_cumulative`), + INDEX `idx_is_removing_postage` (`is_removing_postage`), + INDEX `idx_max_usage` (`max_usage`), + INDEX `idx_is_available_on_special_offers` (`is_available_on_special_offers`) ) ENGINE=InnoDB; -- --------------------------------------------------------------------- @@ -1163,7 +1078,6 @@ CREATE TABLE `coupon_order` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `order_id` INTEGER NOT NULL, - `code` VARCHAR(45) NOT NULL, `value` FLOAT NOT NULL, `created_at` DATETIME, `updated_at` DATETIME, @@ -1457,6 +1371,113 @@ CREATE TABLE `folder_document` ON DELETE CASCADE ) ENGINE=InnoDB; +-- --------------------------------------------------------------------- +-- product_associated_content +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `product_associated_content`; + +CREATE TABLE `product_associated_content` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `product_id` INTEGER NOT NULL, + `content_id` INTEGER NOT NULL, + `position` INTEGER NOT NULL, + `created_at` DATETIME, + `updated_at` DATETIME, + PRIMARY KEY (`id`), + INDEX `idx_product_associated_content_product_id` (`product_id`), + INDEX `idx_product_associated_content_content_id` (`content_id`), + CONSTRAINT `fk_product_associated_content_product_id` + FOREIGN KEY (`product_id`) + REFERENCES `product` (`id`) + ON UPDATE RESTRICT + ON DELETE CASCADE, + CONSTRAINT `fk_product_associated_content_content_id` + FOREIGN KEY (`content_id`) + REFERENCES `content` (`id`) + ON UPDATE RESTRICT + ON DELETE CASCADE +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- category_associated_content +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `category_associated_content`; + +CREATE TABLE `category_associated_content` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `category_id` INTEGER NOT NULL, + `content_id` INTEGER NOT NULL, + `position` INTEGER NOT NULL, + `created_at` DATETIME, + `updated_at` DATETIME, + PRIMARY KEY (`id`), + INDEX `idx_category_associated_content_category_id` (`category_id`), + INDEX `idx_category_associated_content_content_id` (`content_id`), + CONSTRAINT `fk_category_associated_content_category_id` + FOREIGN KEY (`category_id`) + REFERENCES `category` (`id`) + ON UPDATE RESTRICT + ON DELETE CASCADE, + CONSTRAINT `fk_category_associated_content_content_id` + FOREIGN KEY (`content_id`) + REFERENCES `content` (`id`) + ON UPDATE RESTRICT + ON DELETE CASCADE +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- rewriting_url +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `rewriting_url`; + +CREATE TABLE `rewriting_url` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `url` VARCHAR(255) NOT NULL, + `view` VARCHAR(255), + `view_id` VARCHAR(255), + `view_locale` VARCHAR(255), + `redirected` INTEGER, + `created_at` DATETIME, + `updated_at` DATETIME, + PRIMARY KEY (`id`), + UNIQUE INDEX `url_UNIQUE` (`url`), + INDEX `idx_view_id` (`view_id`), + INDEX `idx_rewriting_url_redirected` (`redirected`), + CONSTRAINT `fk_rewriting_url_redirected` + FOREIGN KEY (`redirected`) + REFERENCES `rewriting_url` (`id`) + ON UPDATE RESTRICT + ON DELETE RESTRICT +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- rewriting_argument +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `rewriting_argument`; + +CREATE TABLE `rewriting_argument` +( + `rewriting_url_id` INTEGER NOT NULL, + `parameter` VARCHAR(255) NOT NULL, + `value` VARCHAR(255) NOT NULL, + `created_at` DATETIME, + `updated_at` DATETIME, + PRIMARY KEY (`rewriting_url_id`,`parameter`,`value`), + INDEX `idx_rewriting_argument_rewirting_url_id` (`rewriting_url_id`), + CONSTRAINT `fk_rewriting_argument_rewirting_url_id` + FOREIGN KEY (`rewriting_url_id`) + REFERENCES `rewriting_url` (`id`) + ON UPDATE RESTRICT + ON DELETE CASCADE +) ENGINE=InnoDB; + -- --------------------------------------------------------------------- -- category_i18n -- --------------------------------------------------------------------- @@ -1549,6 +1570,8 @@ CREATE TABLE `tax_rule_i18n` ( `id` INTEGER NOT NULL, `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, + `title` VARCHAR(255), + `description` TEXT, PRIMARY KEY (`id`,`locale`), CONSTRAINT `tax_rule_i18n_FK_1` FOREIGN KEY (`id`) @@ -1877,8 +1900,9 @@ CREATE TABLE `message_i18n` `id` INTEGER NOT NULL, `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` TEXT, - `description` LONGTEXT, - `description_html` LONGTEXT, + `subject` TEXT, + `text_message` LONGTEXT, + `html_message` LONGTEXT, PRIMARY KEY (`id`,`locale`), CONSTRAINT `message_i18n_FK_1` FOREIGN KEY (`id`) @@ -1886,6 +1910,26 @@ CREATE TABLE `message_i18n` ON DELETE CASCADE ) ENGINE=InnoDB; +-- --------------------------------------------------------------------- +-- coupon_i18n +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `coupon_i18n`; + +CREATE TABLE `coupon_i18n` +( + `id` INTEGER NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, + `title` VARCHAR(255) NOT NULL, + `short_description` TEXT NOT NULL, + `description` LONGTEXT NOT NULL, + PRIMARY KEY (`id`,`locale`), + CONSTRAINT `coupon_i18n_FK_1` + FOREIGN KEY (`id`) + REFERENCES `coupon` (`id`) + ON DELETE CASCADE +) ENGINE=InnoDB; + -- --------------------------------------------------------------------- -- category_image_i18n -- --------------------------------------------------------------------- @@ -2117,9 +2161,8 @@ DROP TABLE IF EXISTS `message_version`; CREATE TABLE `message_version` ( `id` INTEGER NOT NULL, - `code` VARCHAR(45) NOT NULL, + `name` VARCHAR(255) NOT NULL, `secured` TINYINT, - `ref` VARCHAR(255), `created_at` DATETIME, `updated_at` DATETIME, `version` INTEGER DEFAULT 0 NOT NULL, @@ -2132,5 +2175,35 @@ CREATE TABLE `message_version` ON DELETE CASCADE ) ENGINE=InnoDB; +-- --------------------------------------------------------------------- +-- coupon_version +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `coupon_version`; + +CREATE TABLE `coupon_version` +( + `id` INTEGER NOT NULL, + `code` VARCHAR(45) NOT NULL, + `type` VARCHAR(255) NOT NULL, + `amount` FLOAT NOT NULL, + `is_used` TINYINT NOT NULL, + `is_enabled` TINYINT NOT NULL, + `expiration_date` DATETIME NOT NULL, + `serialized_rules` TEXT NOT NULL, + `is_cumulative` TINYINT NOT NULL, + `is_removing_postage` TINYINT NOT NULL, + `max_usage` INTEGER NOT NULL, + `is_available_on_special_offers` TINYINT(1) NOT NULL, + `created_at` DATETIME, + `updated_at` DATETIME, + `version` INTEGER DEFAULT 0 NOT NULL, + PRIMARY KEY (`id`,`version`), + CONSTRAINT `coupon_version_FK_1` + FOREIGN KEY (`id`) + REFERENCES `coupon` (`id`) + ON DELETE CASCADE +) ENGINE=InnoDB; + # This restores the fkey checks, after having unset them earlier SET FOREIGN_KEY_CHECKS = 1; diff --git a/local/config/database.yml.sample b/local/config/database.yml.sample old mode 100644 new mode 100755 diff --git a/local/config/schema.xml b/local/config/schema.xml index 59ef62cb9..39f649650 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -1,4 +1,4 @@ - + @@ -96,19 +96,19 @@
- - + + +
- - - - - - + + + + + @@ -303,6 +303,9 @@ + + + @@ -334,7 +337,7 @@
- + @@ -386,8 +389,14 @@ - + + + + + + +
@@ -425,32 +434,6 @@
- - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -622,6 +605,7 @@ + @@ -631,7 +615,7 @@
- + @@ -766,86 +750,79 @@
- + - - - + + + + + + - +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - + + + + + + + + + + + + + - -
- - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- @@ -1086,4 +1063,75 @@
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
diff --git a/local/media/.gitkeep b/local/media/.gitkeep old mode 100644 new mode 100755 diff --git a/local/modules/Colissimo/Colissimo.php b/local/modules/Colissimo/Colissimo.php new file mode 100644 index 000000000..4d24cc059 --- /dev/null +++ b/local/modules/Colissimo/Colissimo.php @@ -0,0 +1,83 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Colissimo; + +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpFoundation\Request; +use Thelia\Module\BaseModule; +use Thelia\Module\DeliveryModuleInterface; + +class Colissimo extends BaseModule implements DeliveryModuleInterface +{ + protected $request; + protected $dispatcher; + + public function setRequest(Request $request) + { + $this->request = $request; + } + + public function getRequest() + { + return $this->request; + } + + public function setDispatcher(EventDispatcherInterface $dispatcher) + { + $this->dispatcher = $dispatcher; + } + + public function getDispatcher() + { + return $this->dispatcher; + } + + /** + * + * calculate and return delivery price + * + * @param null $country + * @return mixed + */ + public function calculate($country = null) + { + // TODO: Implement calculate() method. + return 2; + } + + /** + * YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class + * Like install and destroy + */ + public function install() + { + // TODO: Implement install() method. + } + + public function destroy() + { + // TODO: Implement destroy() method. + } + +} diff --git a/local/modules/Colissimo/Config/config.xml b/local/modules/Colissimo/Config/config.xml new file mode 100644 index 000000000..2430f5027 --- /dev/null +++ b/local/modules/Colissimo/Config/config.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/default/bug.html b/local/modules/Colissimo/Config/plugin.xml similarity index 100% rename from templates/default/bug.html rename to local/modules/Colissimo/Config/plugin.xml diff --git a/local/modules/Colissimo/Config/schema.xml b/local/modules/Colissimo/Config/schema.xml new file mode 100644 index 000000000..a4e2315b0 --- /dev/null +++ b/local/modules/Colissimo/Config/schema.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/local/modules/DebugBar/Config/config.xml b/local/modules/DebugBar/Config/config.xml new file mode 100644 index 000000000..6713c8ce6 --- /dev/null +++ b/local/modules/DebugBar/Config/config.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + %kernel.debug% + + + + + + + + + + + diff --git a/local/modules/DebugBar/Config/plugin.xml b/local/modules/DebugBar/Config/plugin.xml new file mode 100644 index 000000000..e69de29bb diff --git a/local/modules/DebugBar/Config/schema.xml b/local/modules/DebugBar/Config/schema.xml new file mode 100644 index 000000000..86ccca913 --- /dev/null +++ b/local/modules/DebugBar/Config/schema.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/local/modules/DebugBar/DataCollector/PropelCollector.php b/local/modules/DebugBar/DataCollector/PropelCollector.php new file mode 100644 index 000000000..881b1b64a --- /dev/null +++ b/local/modules/DebugBar/DataCollector/PropelCollector.php @@ -0,0 +1,236 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace DebugBar\DataCollector; +use Propel\Runtime\Propel; +use Psr\Log\LoggerInterface; + + +/** + * Class PropelCollector + * @package DebugBar\DataCollector + * @author Manuel Raynaud + */ +class PropelCollector extends DataCollector implements Renderable, LoggerInterface +{ + + protected $statements = array(); + + protected $accumulatedTime = 0; + + protected $peakMemory = 0; + + public function __construct() + { + $serviceContainer = Propel::getServiceContainer(); + $serviceContainer->setLogger('defaultLogger', $this); + + $con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME); + $con->setLogMethods(array( + 'exec', + 'query', + 'execute', // these first three are the default + 'beginTransaction', + 'commit', + 'rollBack', + )); + } + + /** + * Called by the DebugBar when data needs to be collected + * + * @return array Collected data + */ + function collect() + { + return array( + 'nb_statements' => count($this->statements), + 'nb_failed_statements' => 0, + 'accumulated_duration' => '10', + 'accumulated_duration_str' => $this->formatDuration(1), + 'peak_memory_usage' => $this->peakMemory, + 'peak_memory_usage_str' => $this->formatBytes($this->peakMemory), + 'statements' => $this->statements + ); + } + + /** + * Returns the unique name of the collector + * + * @return string + */ + public function getName() + { + return 'propel'; + } + + /** + * Returns a hash where keys are control names and their values + * an array of options as defined in {@see DebugBar\JavascriptRenderer::addControl()} + * + * @return array + */ + public function getWidgets() + { + return array( + "propel" => array( + "widget" => "PhpDebugBar.Widgets.SQLQueriesWidget", + "map" => "propel", + "default" => "[]" + ), + "propel:badge" => array( + "map" => "propel.nb_statements", + "default" => 0 + ) + ); + } + + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * @return null + */ + public function log($level, $message, array $context = array()) + { + $this->statements[] = array( + 'sql' => $message, + 'is_success' => true, + 'duration' => 0, + 'duration_str' => $this->formatDuration(1), + 'memory' => 1, + 'memory_str' => $this->formatBytes(1) + ); + } + + /** + * System is unusable. + * + * @param string $message + * @param array $context + * @return null + */ + public function emergency($message, array $context = array()) + { + $this->log(null, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string $message + * @param array $context + * @return null + */ + public function alert($message, array $context = array()) + { + $this->log(null, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string $message + * @param array $context + * @return null + */ + public function critical($message, array $context = array()) + { + $this->log(null, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string $message + * @param array $context + * @return null + */ + public function error($message, array $context = array()) + { + $this->log(null, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string $message + * @param array $context + * @return null + */ + public function warning($message, array $context = array()) + { + $this->log(null, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string $message + * @param array $context + * @return null + */ + public function notice($message, array $context = array()) + { + $this->log(null, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string $message + * @param array $context + * @return null + */ + public function info($message, array $context = array()) + { + $this->log(null, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string $message + * @param array $context + * @return null + */ + public function debug($message, array $context = array()) + { + $this->log(null, $message, $context); + } + + +} \ No newline at end of file diff --git a/local/modules/DebugBar/DebugBar.php b/local/modules/DebugBar/DebugBar.php new file mode 100644 index 000000000..7dde5fa8d --- /dev/null +++ b/local/modules/DebugBar/DebugBar.php @@ -0,0 +1,44 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace DebugBar; + +use Thelia\Module\BaseModule; + +class DebugBar extends BaseModule +{ + /** + * YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class + * Like install and destroy + */ + + public function install() + { + // TODO: Implement install() method. + } + + public function destroy() + { + // TODO: Implement destroy() method. + } +} diff --git a/local/modules/DebugBar/Listeners/DebugBarListeners.php b/local/modules/DebugBar/Listeners/DebugBarListeners.php new file mode 100644 index 000000000..7d0981d5d --- /dev/null +++ b/local/modules/DebugBar/Listeners/DebugBarListeners.php @@ -0,0 +1,72 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace DebugBar\Listeners; +use DebugBar\DataCollector\PropelCollector; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpKernel\KernelEvents; +use Thelia\Action\BaseAction; +use Thelia\Core\Event\TheliaEvents; + + +/** + * Class DebugBarListeners + * @package DebugBar\Listeners + * @author Manuel Raynaud + */ +class DebugBarListeners extends BaseAction implements EventSubscriberInterface { + + public function initDebugBar() + { + $debugBar = $this->container->get("debugBar"); + + $debugBar->addCollector(new PropelCollector()); + } + + /** + * 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::BOOT => array("initDebugBar", 128) + ); + } +} \ No newline at end of file diff --git a/local/modules/DebugBar/Smarty/Plugin/DebugBar.php b/local/modules/DebugBar/Smarty/Plugin/DebugBar.php new file mode 100644 index 000000000..9a333b1d6 --- /dev/null +++ b/local/modules/DebugBar/Smarty/Plugin/DebugBar.php @@ -0,0 +1,82 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace DebugBar\Smarty\Plugin; +use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; +use Thelia\Core\Template\Smarty\an; +use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; +use DebugBar\DebugBar as BaseDebugBar; + +/** + * Class DebugBar + * @author Manuel Raynaud + */ +class DebugBar extends AbstractSmartyPlugin +{ + protected $debugBar; + protected $debugMode; + + public function __construct(BaseDebugBar $debugbar, $debugMode) + { + $this->debugBar = $debugbar; + $this->debugMode = $debugMode; + } + + public function render($params, \Smarty_Internal_Template $template) + { + $render = ""; + if ($this->debugMode) { + $render = $this->debugBar->getJavascriptRenderer()->render(); + } + + return $render; + } + + public function renderHead($params, \Smarty_Internal_Template $template) + { + $render = ""; + if ($this->debugMode) { + $javascriptRenderer = $this->debugBar->getJavascriptRenderer(); + $assets = $javascriptRenderer->getAsseticCollection(); + + $cssCollection = $assets[0]; + $jsCollection = $assets[1]; + + $render .= sprintf('', $cssCollection->dump()); + $render .= sprintf('', $jsCollection->dump()); + } + + return $render; + } + + /** + * @return an array of SmartyPluginDescriptor + */ + public function getPluginDescriptors() + { + return array( + new SmartyPluginDescriptor("function", "debugbar_renderHead", $this, "renderHead"), + new SmartyPluginDescriptor("function", "debugbar_render", $this, "render") + ); + } +} \ No newline at end of file diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml old mode 100644 new mode 100755 diff --git a/reset_install.bat b/reset_install.bat new file mode 100644 index 000000000..d117e525b --- /dev/null +++ b/reset_install.bat @@ -0,0 +1,35 @@ +echo off +REM @author Guillaume MOREL +REM v0.1 + +echo [WARN] This script will reset this Thelia2 install + +if exist local\config\database.yml ( + echo [INFO] Downloading vendors + composer install --prefer-dist + + cd local\config\ + + echo [INFO] Building Models file + ..\..\bin\propel build -v --output-dir=../../core/lib/ + + echo [INFO] Building SQL CREATE file + ..\..\bin\propel sql:build -v --output-dir=../../install/ + + + echo [INFO] Reloaded Thelia2 database + cd ..\.. + del install\sqldb.map + php Thelia thelia:dev:reloadDB + + echo [INFO] Installing fixtures + php install\faker.php + + echo [INFO] Adding admin + php Thelia thelia:create-admin + + echo [SUCCESS] Reset done +) +) else ( + echo [FAILED] Please add your database informations in local\config\database.yml and start this script again. +) \ No newline at end of file diff --git a/reset_install.sh b/reset_install.sh new file mode 100755 index 000000000..399156b67 --- /dev/null +++ b/reset_install.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# @author Guillaume MOREL +# v0.2 + +echo -e "\033[47m\033[1;31m\n[WARN] This script will reset this Thelia2 install\n\033[0m" + +echo -e "\n\e[01;34m[INFO] Clearing caches\e[00m\n" +php Thelia cache:clear + +echo -e "\n\e[01;34m[INFO] Downloading vendors\e[00m\n" +composer install --prefer-dist + +cd local/config/ + +echo -e "\n\e[01;34m[INFO] Building Models file\e[00m\n" +../../bin/propel build -v --output-dir=../../core/lib/ + +echo -e "\n\e[01;34m[INFO] Building SQL CREATE file\e[00m\n" +../../bin/propel sql:build -v --output-dir=../../install/ + +echo -e "\n\e[01;34m[INFO] Reloaded Thelia2 database\e[00m\n" +cd ../.. +rm install/sqldb.map +php Thelia thelia:dev:reloadDB + +echo -e "\n\e[01;34m[INFO] Installing fixtures\e[00m\n" +php install/faker.php + +echo -e "\n\e[01;34m[INFO] Adding admin\e[00m\n" +php Thelia thelia:create-admin --login_name thelia2 --password thelia2 --last_name thelia2 --first_name thelia2 + +echo -e "\n\e[01;34m[INFO] Clearing caches\e[00m\n" +php Thelia cache:clear + +echo -e "\n\e[00;32m[SUCCESS] Reset done\e[00m\n" \ No newline at end of file diff --git a/templates/admin/default/404.html b/templates/admin/default/404.html index 48caf7a12..c72b43b01 100755 --- a/templates/admin/default/404.html +++ b/templates/admin/default/404.html @@ -1,11 +1,9 @@ -{$page_title={intl l='Page not found'}} +{extends file="general_error.html"} -{include file='includes/header.inc.html'} +{block name="page-title"}{intl l='Page not found'}{/block} +{block name="content-title"}{intl l='Page not found'}{/block} -
-

{intl l="Oops! An Error Occurred"}

-

{intl l='The server returned a "404 Not Found"'}

-

{intl l='The page you\'ve requested was not found. Please check the page address, and try again.'}

-
- -{include file='includes/footer.inc.html'} \ No newline at end of file +{block name="error-message"} +

{intl l='The server returned a "404 Not Found"'}

+

{intl l='The page you\'ve requested was not found. Please check the page address, and try again.'}

+{/block} \ No newline at end of file diff --git a/templates/admin/default/admin-layout.tpl b/templates/admin/default/admin-layout.tpl new file mode 100644 index 000000000..6a6a529ab --- /dev/null +++ b/templates/admin/default/admin-layout.tpl @@ -0,0 +1,237 @@ +{* -- By default, check admin login ----------------------------------------- *} + +{block name="check-auth"} + {check_auth roles="ADMIN" permissions="{block name="check-permissions"}{/block}" login_tpl="/admin/login"} +{/block} + + + + + {block name="page-title"}Default Page Title{/block} - {intl l='Thelia Back Office'} + + {images file='assets/img/favicon.ico'}{/images} + + + + {block name="meta"}{/block} + + {* -- Bootstrap CSS section --------------------------------------------- *} + + {block name="before-bootstrap-css"}{/block} + + {stylesheets file='assets/less/*' filters='less,cssembed'} + + {/stylesheets} + + {debugbar_renderHead} + + {block name="after-bootstrap-css"}{/block} + + {* -- Admin CSS section ------------------------------------------------- *} + + {block name="before-admin-css"}{/block} + + {block name="after-admin-css"}{/block} + + {* Modules css are included here *} + + {module_include location='head_css'} + + + + {* display top bar only if admin is connected *} + + {loop name="top-bar-auth" type="auth" roles="ADMIN"} + + {* -- Brand bar section ------------------------------------------------- *} + + {module_include location='before_topbar'} + +
+
+ +
+
+
{intl l='Version %ver' ver="{$THELIA_VERSION}"}
+
+ + {module_include location='inside_topbar'} + +
+ +
+ {intl l="View shop"} + + + +
+ +
+
+ +
+
+ + {module_include location='after_topbar'} + + {* -- Top menu section -------------------------------------------------- *} + + {module_include location='before_top_menu'} + + + + {module_include location='after_top_menu'} + + {/loop} + + {* A basic brandbar is displayed if user is not connected *} + + {elseloop rel="top-bar-auth"} + + {/elseloop} + + {* -- Main page content section ----------------------------------------- *} + + {block name="main-content"}Put here the content of the template{/block} + + {* -- Footer section ---------------------------------------------------- *} + + {module_include location='before_footer'} + +
+ + + {module_include location='after_footer'} + + + {* -- Javascript section ------------------------------------------------ *} + + {block name="before-javascript-include"}{/block} + + + + {block name="after-javascript-include"}{/block} + + {block name="javascript-initialization"}{/block} + {debugbar_render} + {* Modules scripts are included now *} + {module_include location='footer_js'} + + {javascripts file='assets/js/bootstrap/bootstrap.js'} + + {/javascripts} + + \ No newline at end of file diff --git a/templates/admin/default/assets/bootstrap-datepicker/js/bootstrap-datepicker.js b/templates/admin/default/assets/bootstrap-datepicker/js/bootstrap-datepicker.js new file mode 100755 index 000000000..bf3a56df0 --- /dev/null +++ b/templates/admin/default/assets/bootstrap-datepicker/js/bootstrap-datepicker.js @@ -0,0 +1,474 @@ +/* ========================================================= + * bootstrap-datepicker.js + * http://www.eyecon.ro/bootstrap-datepicker + * ========================================================= + * Copyright 2012 Stefan Petre + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + +!function( $ ) { + + // Picker object + + var Datepicker = function(element, options){ + this.element = $(element); + this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy'); + this.picker = $(DPGlobal.template) + .appendTo('body') + .on({ + click: $.proxy(this.click, this)//, + //mousedown: $.proxy(this.mousedown, this) + }); + this.isInput = this.element.is('input'); + this.component = this.element.is('.date') ? this.element.find('.add-on') : false; + + if (this.isInput) { + this.element.on({ + focus: $.proxy(this.show, this), + //blur: $.proxy(this.hide, this), + keyup: $.proxy(this.update, this) + }); + } else { + if (this.component){ + this.component.on('click', $.proxy(this.show, this)); + } else { + this.element.on('click', $.proxy(this.show, this)); + } + } + + this.minViewMode = options.minViewMode||this.element.data('date-minviewmode')||0; + if (typeof this.minViewMode === 'string') { + switch (this.minViewMode) { + case 'months': + this.minViewMode = 1; + break; + case 'years': + this.minViewMode = 2; + break; + default: + this.minViewMode = 0; + break; + } + } + this.viewMode = options.viewMode||this.element.data('date-viewmode')||0; + if (typeof this.viewMode === 'string') { + switch (this.viewMode) { + case 'months': + this.viewMode = 1; + break; + case 'years': + this.viewMode = 2; + break; + default: + this.viewMode = 0; + break; + } + } + this.startViewMode = this.viewMode; + this.weekStart = options.weekStart||this.element.data('date-weekstart')||0; + this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1; + this.onRender = options.onRender; + this.fillDow(); + this.fillMonths(); + this.update(); + this.showMode(); + }; + + Datepicker.prototype = { + constructor: Datepicker, + + show: function(e) { + this.picker.show(); + this.height = this.component ? this.component.outerHeight() : this.element.outerHeight(); + this.place(); + $(window).on('resize', $.proxy(this.place, this)); + if (e ) { + e.stopPropagation(); + e.preventDefault(); + } + if (!this.isInput) { + } + var that = this; + $(document).on('mousedown', function(ev){ + if ($(ev.target).closest('.datepicker').length == 0) { + that.hide(); + } + }); + this.element.trigger({ + type: 'show', + date: this.date + }); + }, + + hide: function(){ + this.picker.hide(); + $(window).off('resize', this.place); + this.viewMode = this.startViewMode; + this.showMode(); + if (!this.isInput) { + $(document).off('mousedown', this.hide); + } + //this.set(); + this.element.trigger({ + type: 'hide', + date: this.date + }); + }, + + set: function() { + var formated = DPGlobal.formatDate(this.date, this.format); + if (!this.isInput) { + if (this.component){ + this.element.find('input').prop('value', formated); + } + this.element.data('date', formated); + } else { + this.element.prop('value', formated); + } + }, + + setValue: function(newDate) { + if (typeof newDate === 'string') { + this.date = DPGlobal.parseDate(newDate, this.format); + } else { + this.date = new Date(newDate); + } + this.set(); + this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0); + this.fill(); + }, + + place: function(){ + var offset = this.component ? this.component.offset() : this.element.offset(); + this.picker.css({ + top: offset.top + this.height, + left: offset.left + }); + }, + + update: function(newDate){ + this.date = DPGlobal.parseDate( + typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')), + this.format + ); + this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0); + this.fill(); + }, + + fillDow: function(){ + var dowCnt = this.weekStart; + var html = ''; + while (dowCnt < this.weekStart + 7) { + html += ''+DPGlobal.dates.daysMin[(dowCnt++)%7]+''; + } + html += ''; + this.picker.find('.datepicker-days thead').append(html); + }, + + fillMonths: function(){ + var html = ''; + var i = 0 + while (i < 12) { + html += ''+DPGlobal.dates.monthsShort[i++]+''; + } + this.picker.find('.datepicker-months td').append(html); + }, + + fill: function() { + var d = new Date(this.viewDate), + year = d.getFullYear(), + month = d.getMonth(), + currentDate = this.date.valueOf(); + this.picker.find('.datepicker-days th:eq(1)') + .text(DPGlobal.dates.months[month]+' '+year); + var prevMonth = new Date(year, month-1, 28,0,0,0,0), + day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth()); + prevMonth.setDate(day); + prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7); + var nextMonth = new Date(prevMonth); + nextMonth.setDate(nextMonth.getDate() + 42); + nextMonth = nextMonth.valueOf(); + var html = []; + var clsName, + prevY, + prevM; + while(prevMonth.valueOf() < nextMonth) { + if (prevMonth.getDay() === this.weekStart) { + html.push(''); + } + clsName = this.onRender(prevMonth); + prevY = prevMonth.getFullYear(); + prevM = prevMonth.getMonth(); + if ((prevM < month && prevY === year) || prevY < year) { + clsName += ' old'; + } else if ((prevM > month && prevY === year) || prevY > year) { + clsName += ' new'; + } + if (prevMonth.valueOf() === currentDate) { + clsName += ' active'; + } + html.push(''+prevMonth.getDate() + ''); + if (prevMonth.getDay() === this.weekEnd) { + html.push(''); + } + prevMonth.setDate(prevMonth.getDate()+1); + } + this.picker.find('.datepicker-days tbody').empty().append(html.join('')); + var currentYear = this.date.getFullYear(); + + var months = this.picker.find('.datepicker-months') + .find('th:eq(1)') + .text(year) + .end() + .find('span').removeClass('active'); + if (currentYear === year) { + months.eq(this.date.getMonth()).addClass('active'); + } + + html = ''; + year = parseInt(year/10, 10) * 10; + var yearCont = this.picker.find('.datepicker-years') + .find('th:eq(1)') + .text(year + '-' + (year + 9)) + .end() + .find('td'); + year -= 1; + for (var i = -1; i < 11; i++) { + html += ''+year+''; + year += 1; + } + yearCont.html(html); + }, + + click: function(e) { + e.stopPropagation(); + e.preventDefault(); + var target = $(e.target).closest('span, td, th'); + if (target.length === 1) { + switch(target[0].nodeName.toLowerCase()) { + case 'th': + switch(target[0].className) { + case 'switch': + this.showMode(1); + break; + case 'prev': + case 'next': + this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call( + this.viewDate, + this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) + + DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1) + ); + this.fill(); + this.set(); + break; + } + break; + case 'span': + if (target.is('.month')) { + var month = target.parent().find('span').index(target); + this.viewDate.setMonth(month); + } else { + var year = parseInt(target.text(), 10)||0; + this.viewDate.setFullYear(year); + } + if (this.viewMode !== 0) { + this.date = new Date(this.viewDate); + this.element.trigger({ + type: 'changeDate', + date: this.date, + viewMode: DPGlobal.modes[this.viewMode].clsName + }); + } + this.showMode(-1); + this.fill(); + this.set(); + break; + case 'td': + if (target.is('.day') && !target.is('.disabled')){ + var day = parseInt(target.text(), 10)||1; + var month = this.viewDate.getMonth(); + if (target.is('.old')) { + month -= 1; + } else if (target.is('.new')) { + month += 1; + } + var year = this.viewDate.getFullYear(); + this.date = new Date(year, month, day,0,0,0,0); + this.viewDate = new Date(year, month, Math.min(28, day),0,0,0,0); + this.fill(); + this.set(); + this.element.trigger({ + type: 'changeDate', + date: this.date, + viewMode: DPGlobal.modes[this.viewMode].clsName + }); + } + break; + } + } + }, + + mousedown: function(e){ + e.stopPropagation(); + e.preventDefault(); + }, + + showMode: function(dir) { + if (dir) { + this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir)); + } + this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show(); + } + }; + + $.fn.datepicker = function ( option, val ) { + return this.each(function () { + var $this = $(this), + data = $this.data('datepicker'), + options = typeof option === 'object' && option; + if (!data) { + $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options)))); + } + if (typeof option === 'string') data[option](val); + }); + }; + + $.fn.datepicker.defaults = { + onRender: function(date) { + return ''; + } + }; + $.fn.datepicker.Constructor = Datepicker; + + var DPGlobal = { + modes: [ + { + clsName: 'days', + navFnc: 'Month', + navStep: 1 + }, + { + clsName: 'months', + navFnc: 'FullYear', + navStep: 1 + }, + { + clsName: 'years', + navFnc: 'FullYear', + navStep: 10 + }], + dates:{ + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], + daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + }, + isLeapYear: function (year) { + return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) + }, + getDaysInMonth: function (year, month) { + return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] + }, + parseFormat: function(format){ + var separator = format.match(/[.\/\-\s].*?/), + parts = format.split(/\W+/); + if (!separator || !parts || parts.length === 0){ + throw new Error("Invalid date format."); + } + return {separator: separator, parts: parts}; + }, + parseDate: function(date, format) { + var parts = date.split(format.separator), + date = new Date(), + val; + date.setHours(0); + date.setMinutes(0); + date.setSeconds(0); + date.setMilliseconds(0); + if (parts.length === format.parts.length) { + var year = date.getFullYear(), day = date.getDate(), month = date.getMonth(); + for (var i=0, cnt = format.parts.length; i < cnt; i++) { + val = parseInt(parts[i], 10)||1; + switch(format.parts[i]) { + case 'dd': + case 'd': + day = val; + date.setDate(val); + break; + case 'mm': + case 'm': + month = val - 1; + date.setMonth(val - 1); + break; + case 'yy': + year = 2000 + val; + date.setFullYear(2000 + val); + break; + case 'yyyy': + year = val; + date.setFullYear(val); + break; + } + } + date = new Date(year, month, day, 0 ,0 ,0); + } + return date; + }, + formatDate: function(date, format){ + var val = { + d: date.getDate(), + m: date.getMonth() + 1, + yy: date.getFullYear().toString().substring(2), + yyyy: date.getFullYear() + }; + val.dd = (val.d < 10 ? '0' : '') + val.d; + val.mm = (val.m < 10 ? '0' : '') + val.m; + var date = []; + for (var i=0, cnt = format.parts.length; i < cnt; i++) { + date.push(val[format.parts[i]]); + } + return date.join(format.separator); + }, + headTemplate: ''+ + ''+ + '‹'+ + ''+ + '›'+ + ''+ + '', + contTemplate: '' + }; + DPGlobal.template = ''; + +}( window.jQuery ); \ No newline at end of file diff --git a/templates/admin/default/assets/bootstrap-editable/js/bootstrap-editable.min.js b/templates/admin/default/assets/bootstrap-editable/js/bootstrap-editable.min.js deleted file mode 100644 index 13df29e24..000000000 --- a/templates/admin/default/assets/bootstrap-editable/js/bootstrap-editable.min.js +++ /dev/null @@ -1,5 +0,0 @@ -/*! X-editable - v1.4.6 -* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery -* http://github.com/vitalets/x-editable -* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */ -(function(e){"use strict";var t=function(t,n){this.options=e.extend({},e.fn.editableform.defaults,n),this.$div=e(t),this.options.scope||(this.options.scope=this)};t.prototype={constructor:t,initInput:function(){this.input=this.options.input,this.value=this.input.str2value(this.options.value)},initTemplate:function(){this.$form=e(e.fn.editableform.template)},initButtons:function(){var t=this.$form.find(".editable-buttons");t.append(e.fn.editableform.buttons),this.options.showbuttons==="bottom"&&t.addClass("editable-buttons-bottom")},render:function(){this.$loading=e(e.fn.editableform.loading),this.$div.empty().append(this.$loading),this.initTemplate(),this.options.showbuttons?this.initButtons():this.$form.find(".editable-buttons").remove(),this.showLoading(),this.isSaving=!1,this.$div.triggerHandler("rendering"),this.initInput(),this.input.prerender(),this.$form.find("div.editable-input").append(this.input.$tpl),this.$div.append(this.$form),e.when(this.input.render()).then(e.proxy(function(){this.options.showbuttons||this.input.autosubmit(),this.$form.find(".editable-cancel").click(e.proxy(this.cancel,this));if(this.input.error)this.error(this.input.error),this.$form.find(".editable-submit").attr("disabled",!0),this.input.$input.attr("disabled",!0),this.$form.submit(function(e){e.preventDefault()});else{this.error(!1),this.input.$input.removeAttr("disabled"),this.$form.find(".editable-submit").removeAttr("disabled");var t=this.value===null||this.value===undefined||this.value===""?this.options.defaultValue:this.value;this.input.value2input(t),this.$form.submit(e.proxy(this.submit,this))}this.$div.triggerHandler("rendered"),this.showForm(),this.input.postrender&&this.input.postrender()},this))},cancel:function(){this.$div.triggerHandler("cancel")},showLoading:function(){var e,t;this.$form?(e=this.$form.outerWidth(),t=this.$form.outerHeight(),e&&this.$loading.width(e),t&&this.$loading.height(t),this.$form.hide()):(e=this.$loading.parent().width(),e&&this.$loading.width(e)),this.$loading.show()},showForm:function(e){this.$loading.hide(),this.$form.show(),e!==!1&&this.input.activate(),this.$div.triggerHandler("show")},error:function(t){var n=this.$form.find(".control-group"),r=this.$form.find(".editable-error-block"),i;if(t===!1)n.removeClass(e.fn.editableform.errorGroupClass),r.removeClass(e.fn.editableform.errorBlockClass).empty().hide();else{if(t){i=t.split("\n");for(var s=0;s").text(i[s]).html();t=i.join("
")}n.addClass(e.fn.editableform.errorGroupClass),r.addClass(e.fn.editableform.errorBlockClass).html(t).show()}},submit:function(t){t.stopPropagation(),t.preventDefault();var n,r=this.input.input2value();if(n=this.validate(r)){this.error(n),this.showForm();return}if(!this.options.savenochange&&this.input.value2str(r)==this.input.value2str(this.value)){this.$div.triggerHandler("nochange");return}var i=this.input.value2submit(r);this.isSaving=!0,e.when(this.save(i)).done(e.proxy(function(e){this.isSaving=!1;var t=typeof this.options.success=="function"?this.options.success.call(this.options.scope,e,r):null;if(t===!1){this.error(!1),this.showForm(!1);return}if(typeof t=="string"){this.error(t),this.showForm();return}t&&typeof t=="object"&&t.hasOwnProperty("newValue")&&(r=t.newValue),this.error(!1),this.value=r,this.$div.triggerHandler("save",{newValue:r,submitValue:i,response:e})},this)).fail(e.proxy(function(e){this.isSaving=!1;var t;typeof this.options.error=="function"?t=this.options.error.call(this.options.scope,e,r):t=typeof e=="string"?e:e.responseText||e.statusText||"Unknown error!",this.error(t),this.showForm()},this))},save:function(t){this.options.pk=e.fn.editableutils.tryParseJson(this.options.pk,!0);var n=typeof this.options.pk=="function"?this.options.pk.call(this.options.scope):this.options.pk,r=!!(typeof this.options.url=="function"||this.options.url&&(this.options.send==="always"||this.options.send==="auto"&&n!==null&&n!==undefined)),i;if(r)return this.showLoading(),i={name:this.options.name||"",value:t,pk:n},typeof this.options.params=="function"?i=this.options.params.call(this.options.scope,i):(this.options.params=e.fn.editableutils.tryParseJson(this.options.params,!0),e.extend(i,this.options.params)),typeof this.options.url=="function"?this.options.url.call(this.options.scope,i):e.ajax(e.extend({url:this.options.url,data:i,type:"POST"},this.options.ajaxOptions))},validate:function(e){e===undefined&&(e=this.value);if(typeof this.options.validate=="function")return this.options.validate.call(this.options.scope,e)},option:function(e,t){e in this.options&&(this.options[e]=t),e==="value"&&this.setValue(t)},setValue:function(e,t){t?this.value=this.input.str2value(e):this.value=e,this.$form&&this.$form.is(":visible")&&this.input.value2input(this.value)}},e.fn.editableform=function(n){var r=arguments;return this.each(function(){var i=e(this),s=i.data("editableform"),o=typeof n=="object"&&n;s||i.data("editableform",s=new t(this,o)),typeof n=="string"&&s[n].apply(s,Array.prototype.slice.call(r,1))})},e.fn.editableform.Constructor=t,e.fn.editableform.defaults={type:"text",url:null,params:null,name:null,pk:null,value:null,defaultValue:null,send:"auto",validate:null,success:null,error:null,ajaxOptions:null,showbuttons:!0,scope:null,savenochange:!1},e.fn.editableform.template='
',e.fn.editableform.loading='
',e.fn.editableform.buttons='',e.fn.editableform.errorGroupClass=null,e.fn.editableform.errorBlockClass="editable-error"})(window.jQuery),function(e){"use strict";e.fn.editableutils={inherit:function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.superclass=t.prototype},setCursorPosition:function(e,t){if(e.setSelectionRange)e.setSelectionRange(t,t);else if(e.createTextRange){var n=e.createTextRange();n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",t),n.select()}},tryParseJson:function(e,t){if(typeof e=="string"&&e.length&&e.match(/^[\{\[].*[\}\]]$/))if(t)try{e=(new Function("return "+e))()}catch(n){}finally{return e}else e=(new Function("return "+e))();return e},sliceObj:function(t,n,r){var i,s,o={};if(!e.isArray(n)||!n.length)return o;for(var u=0;u").text(t).html()},itemsByValue:function(t,n,r){if(!n||t===null)return[];if(typeof r!="function"){var i=r||"value";r=function(e){return e[i]}}var s=e.isArray(t),o=[],u=this;return e.each(n,function(n,i){if(i.children)o=o.concat(u.itemsByValue(t,i.children,r));else if(s)e.grep(t,function(e){return e==(i&&typeof i==="object"?r(i):i)}).length&&o.push(i);else{var a=i&&typeof i=="object"?r(i):i;t==a&&o.push(i)}}),o},createInput:function(t){var n,r,i,s=t.type;return s==="date"&&(t.mode==="inline"?e.fn.editabletypes.datefield?s="datefield":e.fn.editabletypes.dateuifield&&(s="dateuifield"):e.fn.editabletypes.date?s="date":e.fn.editabletypes.dateui&&(s="dateui"),s==="date"&&!e.fn.editabletypes.date&&(s="combodate")),s==="datetime"&&t.mode==="inline"&&(s="datetimefield"),s==="wysihtml5"&&!e.fn.editabletypes[s]&&(s="textarea"),typeof e.fn.editabletypes[s]=="function"?(n=e.fn.editabletypes[s],r=this.sliceObj(t,this.objectKeys(n.defaults)),i=new n(r),i):(e.error("Unknown type: "+s),!1)},supportsTransitions:function(){var e=document.body||document.documentElement,t=e.style,n="transition",r=["Moz","Webkit","Khtml","O","ms"];if(typeof t[n]=="string")return!0;n=n.charAt(0).toUpperCase()+n.substr(1);for(var i=0;i"),this.tip().is(this.innerCss)?this.tip().append(this.$form):this.tip().find(this.innerCss).append(this.$form),this.renderForm()},hide:function(e){if(!this.tip()||!this.tip().is(":visible")||!this.$element.hasClass("editable-open"))return;if(this.$form.data("editableform").isSaving){this.delayedHide={reason:e};return}this.delayedHide=!1,this.$element.removeClass("editable-open"),this.innerHide(),this.$element.triggerHandler("hidden",e||"manual")},innerShow:function(){},innerHide:function(){},toggle:function(e){this.container()&&this.tip()&&this.tip().is(":visible")?this.hide():this.show(e)},setPosition:function(){},save:function(e,t){this.$element.triggerHandler("save",t),this.hide("save")},option:function(e,t){this.options[e]=t,e in this.containerOptions?(this.containerOptions[e]=t,this.setContainerOption(e,t)):(this.formOptions[e]=t,this.$form&&this.$form.editableform("option",e,t))},setContainerOption:function(e,t){this.call("option",e,t)},destroy:function(){this.hide(),this.innerDestroy(),this.$element.off("destroyed"),this.$element.removeData("editableContainer")},innerDestroy:function(){},closeOthers:function(t){e(".editable-open").each(function(n,r){if(r===t||e(r).find(t).length)return;var i=e(r),s=i.data("editableContainer");if(!s)return;s.options.onblur==="cancel"?i.data("editableContainer").hide("onblur"):s.options.onblur==="submit"&&i.data("editableContainer").tip().find("form").submit()})},activate:function(){this.tip&&this.tip().is(":visible")&&this.$form&&this.$form.data("editableform").input.activate()}},e.fn.editableContainer=function(r){var i=arguments;return this.each(function(){var s=e(this),o="editableContainer",u=s.data(o),a=typeof r=="object"&&r,f=a.mode==="inline"?n:t;u||s.data(o,u=new f(this,a)),typeof r=="string"&&u[r].apply(u,Array.prototype.slice.call(i,1))})},e.fn.editableContainer.Popup=t,e.fn.editableContainer.Inline=n,e.fn.editableContainer.defaults={value:null,placement:"top",autohide:!0,onblur:"cancel",anim:!1,mode:"popup"},jQuery.event.special.destroyed={remove:function(e){e.handler&&e.handler()}}}(window.jQuery),function(e){"use strict";e.extend(e.fn.editableContainer.Inline.prototype,e.fn.editableContainer.Popup.prototype,{containerName:"editableform",innerCss:".editable-inline",containerClass:"editable-container editable-inline",initContainer:function(){this.$tip=e(""),this.options.anim||(this.options.anim=0)},splitOptions:function(){this.containerOptions={},this.formOptions=this.options},tip:function(){return this.$tip},innerShow:function(){this.$element.hide(),this.tip().insertAfter(this.$element).show()},innerHide:function(){this.$tip.hide(this.options.anim,e.proxy(function(){this.$element.show(),this.innerDestroy()},this))},innerDestroy:function(){this.tip()&&this.tip().empty().remove()}})}(window.jQuery),function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.editable.defaults,n,e.fn.editableutils.getConfigData(this.$element)),this.options.selector?this.initLive():this.init(),this.options.highlight&&!e.fn.editableutils.supportsTransitions()&&(this.options.highlight=!1)};t.prototype={constructor:t,init:function(){var t=!1,n,r;this.options.name=this.options.name||this.$element.attr("id"),this.options.scope=this.$element[0],this.input=e.fn.editableutils.createInput(this.options);if(!this.input)return;this.options.value===undefined||this.options.value===null?(this.value=this.input.html2value(e.trim(this.$element.html())),t=!0):(this.options.value=e.fn.editableutils.tryParseJson(this.options.value,!0),typeof this.options.value=="string"?this.value=this.input.str2value(this.options.value):this.value=this.options.value),this.$element.addClass("editable"),this.input.type==="textarea"&&this.$element.addClass("editable-pre-wrapped"),this.options.toggle!=="manual"?(this.$element.addClass("editable-click"),this.$element.on(this.options.toggle+".editable",e.proxy(function(e){this.options.disabled||e.preventDefault();if(this.options.toggle==="mouseenter")this.show();else{var t=this.options.toggle!=="click";this.toggle(t)}},this))):this.$element.attr("tabindex",-1),typeof this.options.display=="function"&&(this.options.autotext="always");switch(this.options.autotext){case"always":n=!0;break;case"auto":n=!e.trim(this.$element.text()).length&&this.value!==null&&this.value!==undefined&&!t;break;default:n=!1}e.when(n?this.render():!0).then(e.proxy(function(){this.options.disabled?this.disable():this.enable(),this.$element.triggerHandler("init",this)},this))},initLive:function(){var t=this.options.selector;this.options.selector=!1,this.options.autotext="never",this.$element.on(this.options.toggle+".editable",t,e.proxy(function(t){var n=e(t.target);n.data("editable")||(n.hasClass(this.options.emptyclass)&&n.empty(),n.editable(this.options).trigger(t))},this))},render:function(e){if(this.options.display===!1)return;return this.input.value2htmlFinal?this.input.value2html(this.value,this.$element[0],this.options.display,e):typeof this.options.display=="function"?this.options.display.call(this.$element[0],this.value,e):this.input.value2html(this.value,this.$element[0])},enable:function(){this.options.disabled=!1,this.$element.removeClass("editable-disabled"),this.handleEmpty(this.isEmpty),this.options.toggle!=="manual"&&this.$element.attr("tabindex")==="-1"&&this.$element.removeAttr("tabindex")},disable:function(){this.options.disabled=!0,this.hide(),this.$element.addClass("editable-disabled"),this.handleEmpty(this.isEmpty),this.$element.attr("tabindex",-1)},toggleDisabled:function(){this.options.disabled?this.enable():this.disable()},option:function(t,n){if(t&&typeof t=="object"){e.each(t,e.proxy(function(t,n){this.option(e.trim(t),n)},this));return}this.options[t]=n;if(t==="disabled")return n?this.disable():this.enable();t==="value"&&this.setValue(n),this.container&&this.container.option(t,n),this.input.option&&this.input.option(t,n)},handleEmpty:function(t){if(this.options.display===!1)return;t!==undefined?this.isEmpty=t:e.trim(this.$element.html())===""?this.isEmpty=!0:e.trim(this.$element.text())!==""?this.isEmpty=!1:this.isEmpty=!this.$element.height()||!this.$element.width(),this.options.disabled?this.isEmpty&&(this.$element.empty(),this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass)):this.isEmpty?(this.$element.html(this.options.emptytext),this.options.emptyclass&&this.$element.addClass(this.options.emptyclass)):this.options.emptyclass&&this.$element.removeClass(this.options.emptyclass)},show:function(t){if(this.options.disabled)return;if(!this.container){var n=e.extend({},this.options,{value:this.value,input:this.input});this.$element.editableContainer(n),this.$element.on("save.internal",e.proxy(this.save,this)),this.container=this.$element.data("editableContainer")}else if(this.container.tip().is(":visible"))return;this.container.show(t)},hide:function(){this.container&&this.container.hide()},toggle:function(e){this.container&&this.container.tip().is(":visible")?this.hide():this.show(e)},save:function(e,t){if(this.options.unsavedclass){var n=!1;n=n||typeof this.options.url=="function",n=n||this.options.display===!1,n=n||t.response!==undefined,n=n||this.options.savenochange&&this.input.value2str(this.value)!==this.input.value2str(t.newValue),n?this.$element.removeClass(this.options.unsavedclass):this.$element.addClass(this.options.unsavedclass)}if(this.options.highlight){var r=this.$element,i=r.css("background-color");r.css("background-color",this.options.highlight),setTimeout(function(){i==="transparent"&&(i=""),r.css("background-color",i),r.addClass("editable-bg-transition"),setTimeout(function(){r.removeClass("editable-bg-transition")},1700)},10)}this.setValue(t.newValue,!1,t.response)},validate:function(){if(typeof this.options.validate=="function")return this.options.validate.call(this,this.value)},setValue:function(t,n,r){n?this.value=this.input.str2value(t):this.value=t,this.container&&this.container.option("value",this.value),e.when(this.render(r)).then(e.proxy(function(){this.handleEmpty()},this))},activate:function(){this.container&&this.container.activate()},destroy:function(){this.disable(),this.container&&this.container.destroy(),this.input.destroy(),this.options.toggle!=="manual"&&(this.$element.removeClass("editable-click"),this.$element.off(this.options.toggle+".editable")),this.$element.off("save.internal"),this.$element.removeClass("editable editable-open editable-disabled"),this.$element.removeData("editable")}},e.fn.editable=function(n){var r={},i=arguments,s="editable";switch(n){case"validate":return this.each(function(){var t=e(this),n=t.data(s),i;n&&(i=n.validate())&&(r[n.options.name]=i)}),r;case"getValue":return arguments.length===2&&arguments[1]===!0?r=this.eq(0).data(s).value:this.each(function(){var t=e(this),n=t.data(s);n&&n.value!==undefined&&n.value!==null&&(r[n.options.name]=n.input.value2submit(n.value))}),r;case"submit":var o=arguments[1]||{},u=this,a=this.editable("validate"),f;return e.isEmptyObject(a)?(f=this.editable("getValue"),o.data&&e.extend(f,o.data),e.ajax(e.extend({url:o.url,data:f,type:"POST"},o.ajaxOptions)).success(function(e){typeof o.success=="function"&&o.success.call(u,e,o)}).error(function(){typeof o.error=="function"&&o.error.apply(u,arguments)})):typeof o.error=="function"&&o.error.call(u,a),this}return this.each(function(){var r=e(this),o=r.data(s),u=typeof n=="object"&&n;if(u&&u.selector){o=new t(this,u);return}o||r.data(s,o=new t(this,u)),typeof n=="string"&&o[n].apply(o,Array.prototype.slice.call(i,1))})},e.fn.editable.defaults={type:"text",disabled:!1,toggle:"click",emptytext:"Empty",autotext:"auto",value:null,display:null,emptyclass:"editable-empty",unsavedclass:"editable-unsaved",selector:null,highlight:"#FFFF80"}}(window.jQuery),function(e){"use strict";e.fn.editabletypes={};var t=function(){};t.prototype={init:function(t,n,r){this.type=t,this.options=e.extend({},r,n)},prerender:function(){this.$tpl=e(this.options.tpl),this.$input=this.$tpl,this.$clear=null,this.error=null},render:function(){},value2html:function(t,n){e(n).text(e.trim(t))},html2value:function(t){return e("
").html(t).text()},value2str:function(e){return e},str2value:function(e){return e},value2submit:function(e){return e},value2input:function(e){this.$input.val(e)},input2value:function(){return this.$input.val()},activate:function(){this.$input.is(":visible")&&this.$input.focus()},clear:function(){this.$input.val(null)},escape:function(t){return e("
").text(t).html()},autosubmit:function(){},destroy:function(){},setClass:function(){this.options.inputclass&&this.$input.addClass(this.options.inputclass)},setAttr:function(e){this.options[e]!==undefined&&this.options[e]!==null&&this.$input.attr(e,this.options[e])},option:function(e,t){this.options[e]=t}},t.defaults={tpl:"",inputclass:"input-medium",scope:null,showbuttons:!0},e.extend(e.fn.editabletypes,{abstractinput:t})}(window.jQuery),function(e){"use strict";var t=function(e){};e.fn.editableutils.inherit(t,e.fn.editabletypes.abstractinput),e.extend(t.prototype,{render:function(){var t=e.Deferred();return this.error=null,this.onSourceReady(function(){this.renderList(),t.resolve()},function(){this.error=this.options.sourceError,t.resolve()}),t.promise()},html2value:function(e){return null},value2html:function(t,n,r,i){var s=e.Deferred(),o=function(){typeof r=="function"?r.call(n,t,this.sourceData,i):this.value2htmlFinal(t,n),s.resolve()};return t===null?o.call(this):this.onSourceReady(o,function(){s.resolve()}),s.promise()},onSourceReady:function(t,n){var r;e.isFunction(this.options.source)?(r=this.options.source.call(this.options.scope),this.sourceData=null):r=this.options.source;if(this.options.sourceCache&&e.isArray(this.sourceData)){t.call(this);return}try{r=e.fn.editableutils.tryParseJson(r,!1)}catch(i){n.call(this);return}if(typeof r=="string"){if(this.options.sourceCache){var s=r,o;e(document).data(s)||e(document).data(s,{}),o=e(document).data(s);if(o.loading===!1&&o.sourceData){this.sourceData=o.sourceData,this.doPrepend(),t.call(this);return}if(o.loading===!0){o.callbacks.push(e.proxy(function(){this.sourceData=o.sourceData,this.doPrepend(),t.call(this)},this)),o.err_callbacks.push(e.proxy(n,this));return}o.loading=!0,o.callbacks=[],o.err_callbacks=[]}e.ajax({url:r,type:"get",cache:!1,dataType:"json",success:e.proxy(function(r){o&&(o.loading=!1),this.sourceData=this.makeArray(r),e.isArray(this.sourceData)?(o&&(o.sourceData=this.sourceData,e.each(o.callbacks,function(){this.call()})),this.doPrepend(),t.call(this)):(n.call(this),o&&e.each(o.err_callbacks,function(){this.call()}))},this),error:e.proxy(function(){n.call(this),o&&(o.loading=!1,e.each(o.err_callbacks,function(){this.call()}))},this)})}else this.sourceData=this.makeArray(r),e.isArray(this.sourceData)?(this.doPrepend(),t.call(this)):n.call(this)},doPrepend:function(){if(this.options.prepend===null||this.options.prepend===undefined)return;e.isArray(this.prependData)||(e.isFunction(this.options.prepend)&&(this.options.prepend=this.options.prepend.call(this.options.scope)),this.options.prepend=e.fn.editableutils.tryParseJson(this.options.prepend,!0),typeof this.options.prepend=="string"&&(this.options.prepend={"":this.options.prepend}),this.prependData=this.makeArray(this.options.prepend)),e.isArray(this.prependData)&&e.isArray(this.sourceData)&&(this.sourceData=this.prependData.concat(this.sourceData))},renderList:function(){},value2htmlFinal:function(e,t){},makeArray:function(t){var n,r,i=[],s,o;if(!t||typeof t=="string")return null;if(e.isArray(t)){o=function(e,t){r={value:e,text:t};if(n++>=2)return!1};for(var u=0;u1&&(s.children&&(s.children=this.makeArray(s.children)),i.push(s))):i.push({value:s,text:s})}else e.each(t,function(e,t){i.push({value:e,text:t})});return i},option:function(e,t){this.options[e]=t,e==="source"&&(this.sourceData=null),e==="prepend"&&(this.prependData=null)}}),t.defaults=e.extend({},e.fn.editabletypes.abstractinput.defaults,{source:null,prepend:!1,sourceError:"Error when loading list",sourceCache:!0}),e.fn.editabletypes.list=t}(window.jQuery),function(e){"use strict";var t=function(e){this.init("text",e,t.defaults)};e.fn.editableutils.inherit(t,e.fn.editabletypes.abstractinput),e.extend(t.prototype,{render:function(){this.renderClear(),this.setClass(),this.setAttr("placeholder")},activate:function(){this.$input.is(":visible")&&(this.$input.focus(),e.fn.editableutils.setCursorPosition(this.$input.get(0),this.$input.val().length),this.toggleClear&&this.toggleClear())},renderClear:function(){this.options.clear&&(this.$clear=e(''),this.$input.after(this.$clear).css("padding-right",24).keyup(e.proxy(function(t){if(~e.inArray(t.keyCode,[40,38,9,13,27]))return;clearTimeout(this.t);var n=this;this.t=setTimeout(function(){n.toggleClear(t)},100)},this)).parent().css("position","relative"),this.$clear.click(e.proxy(this.clear,this)))},postrender:function(){},toggleClear:function(e){if(!this.$clear)return;var t=this.$input.val().length,n=this.$clear.is(":visible");t&&!n&&this.$clear.show(),!t&&n&&this.$clear.hide()},clear:function(){this.$clear.hide(),this.$input.val("").focus()}}),t.defaults=e.extend({},e.fn.editabletypes.abstractinput.defaults,{tpl:'',placeholder:null,clear:!0}),e.fn.editabletypes.text=t}(window.jQuery),function(e){"use strict";var t=function(e){this.init("textarea",e,t.defaults)};e.fn.editableutils.inherit(t,e.fn.editabletypes.abstractinput),e.extend(t.prototype,{render:function(){this.setClass(),this.setAttr("placeholder"),this.setAttr("rows"),this.$input.keydown(function(t){t.ctrlKey&&t.which===13&&e(this).closest("form").submit()})},activate:function(){e.fn.editabletypes.text.prototype.activate.call(this)}}),t.defaults=e.extend({},e.fn.editabletypes.abstractinput.defaults,{tpl:"",inputclass:"input-large",placeholder:null,rows:7}),e.fn.editabletypes.textarea=t}(window.jQuery),function(e){"use strict";var t=function(e){this.init("select",e,t.defaults)};e.fn.editableutils.inherit(t,e.fn.editabletypes.list),e.extend(t.prototype,{renderList:function(){this.$input.empty();var t=function(n,r){var i;if(e.isArray(r))for(var s=0;s",i),r[s].children))):(i.value=r[s].value,r[s].disabled&&(i.disabled=!0),n.append(e("