diff --git a/.gitignore b/.gitignore index cd8f8ffa3..cad92f7a8 100755 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,10 @@ coverage .project .settings/ local/cache/* +local/media/documents/* +local/media/images/* web/assets/* +web/cache/* web/.htaccess phpdoc*.log php-cs diff --git a/composer.json b/composer.json index 5e86dad43..cf7822189 100755 --- a/composer.json +++ b/composer.json @@ -27,14 +27,16 @@ "symfony-cmf/routing": "1.0.0", "symfony/form": "2.2.*", - "symfony/validator": "2.3.*", + "symfony/validator": "2.2.*", "smarty/smarty": "v3.1.14", "kriswallsmith/assetic": "1.2.*@dev", "leafo/lessphp": "0.3.*@dev", "ptachoire/cssembed": "dev-master", - "simplepie/simplepie": "dev-master" + "simplepie/simplepie": "dev-master", + + "imagine/imagine": "dev-master" }, "require-dev" : { "phpunit/phpunit": "3.7.*", diff --git a/composer.lock b/composer.lock index 45044d90c..054d1f71f 100755 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "b20fbb4995fbf676a7028034f21cfbe0", + "hash": "21a698b038efa96e592a3673a760c065", "packages": [ { "name": "ezyang/htmlpurifier", @@ -49,6 +49,58 @@ ], "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" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/avalanche123/Imagine/zipball/v0.5.0", + "reference": "v0.5.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "sami/sami": "dev-master" + }, + "suggest": { + "ext-gd": "to use the GD implementation", + "ext-gmagick": "to use the Gmagick implementation", + "ext-imagick": "to use the Imagick implementation" + }, + "type": "library", + "autoload": { + "psr-0": { + "Imagine": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bulat Shakirzyanov", + "email": "mallluhuct@gmail.com", + "homepage": "http://avalanche123.com" + } + ], + "description": "Image processing for PHP 5.3", + "homepage": "http://imagine.readthedocs.org/", + "keywords": [ + "drawing", + "graphics", + "image manipulation", + "image processing" + ], + "time": "2013-07-10 17:25:36" + }, { "name": "ircmaxell/password-compat", "version": "dev-master", @@ -165,12 +217,12 @@ "source": { "type": "git", "url": "https://github.com/leafo/lessphp.git", - "reference": "366fb52798d4f120503af0703da11cba4ad06f8d" + "reference": "v0.4.0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/leafo/lessphp/zipball/366fb52798d4f120503af0703da11cba4ad06f8d", - "reference": "366fb52798d4f120503af0703da11cba4ad06f8d", + "url": "https://api.github.com/repos/leafo/lessphp/zipball/v0.4.0", + "reference": "v0.4.0", "shasum": "" }, "type": "library", @@ -198,7 +250,7 @@ ], "description": "lessphp is a compiler for LESS written in PHP.", "homepage": "http://leafo.net/lessphp/", - "time": "2013-07-09 16:25:09" + "time": "2013-08-09 17:09:19" }, { "name": "propel/propel", @@ -206,12 +258,12 @@ "source": { "type": "git", "url": "https://github.com/propelorm/Propel2.git", - "reference": "4cf5fca150ed93b33dc54206e3d9d943d0712621" + "reference": "c33b5ade89d0d6c1be7dd9252102ddee6b620890" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/propelorm/Propel2/zipball/4cf5fca150ed93b33dc54206e3d9d943d0712621", - "reference": "4cf5fca150ed93b33dc54206e3d9d943d0712621", + "url": "https://api.github.com/repos/propelorm/Propel2/zipball/c33b5ade89d0d6c1be7dd9252102ddee6b620890", + "reference": "c33b5ade89d0d6c1be7dd9252102ddee6b620890", "shasum": "" }, "require": { @@ -220,7 +272,7 @@ "symfony/console": "~2.2", "symfony/filesystem": "~2.2", "symfony/finder": "~2.2", - "symfony/validator": "~2.2", + "symfony/validator": "2.2.*@dev", "symfony/yaml": "~2.2" }, "require-dev": { @@ -258,7 +310,7 @@ "orm", "persistence" ], - "time": "2013-07-10 11:32:06" + "time": "2013-08-14 23:15:50" }, { "name": "psr/log", @@ -488,17 +540,17 @@ }, { "name": "symfony/class-loader", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/ClassLoader", "source": { "type": "git", "url": "https://github.com/symfony/ClassLoader.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -538,17 +590,17 @@ }, { "name": "symfony/config", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/Config", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/Config/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -581,21 +633,21 @@ ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2013-07-10 14:03:01" + "time": "2013-08-06 02:31:28" }, { "name": "symfony/console", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/Console/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -632,17 +684,17 @@ }, { "name": "symfony/dependency-injection", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/DependencyInjection", "source": { "type": "git", "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -683,21 +735,21 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "http://symfony.com", - "time": "2013-05-06 08:37:50" + "time": "2013-07-21 09:38:59" }, { "name": "symfony/event-dispatcher", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -741,17 +793,17 @@ }, { "name": "symfony/filesystem", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -788,17 +840,17 @@ }, { "name": "symfony/finder", - "version": "v2.3.2", + "version": "v2.3.3", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "v2.3.2" + "reference": "v2.3.3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.3.2", - "reference": "v2.3.2", + "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.3.3", + "reference": "v2.3.3", "shasum": "" }, "require": { @@ -831,21 +883,21 @@ ], "description": "Symfony Finder Component", "homepage": "http://symfony.com", - "time": "2013-07-01 12:17:23" + "time": "2013-07-21 12:12:18" }, { "name": "symfony/form", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/Form", "source": { "type": "git", "url": "https://github.com/symfony/Form.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Form/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/Form/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -890,21 +942,21 @@ ], "description": "Symfony Form Component", "homepage": "http://symfony.com", - "time": "2013-06-23 07:35:41" + "time": "2013-08-02 13:12:51" }, { "name": "symfony/http-foundation", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/HttpFoundation", "source": { "type": "git", "url": "https://github.com/symfony/HttpFoundation.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -940,21 +992,21 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "http://symfony.com", - "time": "2013-07-15 12:12:07" + "time": "2013-08-07 14:00:53" }, { "name": "symfony/http-kernel", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/HttpKernel", "source": { "type": "git", "url": "https://github.com/symfony/HttpKernel.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -972,7 +1024,8 @@ "symfony/finder": "~2.0", "symfony/process": "~2.0", "symfony/routing": ">=2.2,<2.3-dev", - "symfony/stopwatch": ">=2.2,<2.3-dev" + "symfony/stopwatch": ">=2.2,<2.3-dev", + "symfony/templating": "~2.2" }, "suggest": { "symfony/browser-kit": "2.2.*", @@ -1009,25 +1062,24 @@ ], "description": "Symfony HttpKernel Component", "homepage": "http://symfony.com", - "time": "2013-07-15 12:28:01" + "time": "2013-08-07 15:57:43" }, { "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": "v1.0.0" }, "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/v1.0.0", + "reference": "v1.0.0", "shasum": "" }, "require": { - "lib-icu": ">=4.4", "php": ">=5.3.3", "symfony/intl": ">=2.3,<3.0" }, @@ -1057,21 +1109,21 @@ "icu", "intl" ], - "time": "2013-06-03 18:32:58" + "time": "2013-06-03 18:32:07" }, { "name": "symfony/intl", - "version": "v2.3.2", + "version": "v2.3.3", "target-dir": "Symfony/Component/Intl", "source": { "type": "git", "url": "https://github.com/symfony/Intl.git", - "reference": "v2.3.2" + "reference": "v2.3.3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Intl/zipball/v2.3.2", - "reference": "v2.3.2", + "url": "https://api.github.com/repos/symfony/Intl/zipball/v2.3.3", + "reference": "v2.3.3", "shasum": "" }, "require": { @@ -1134,21 +1186,21 @@ "l10n", "localization" ], - "time": "2013-07-08 13:00:35" + "time": "2013-08-01 12:40:45" }, { "name": "symfony/locale", - "version": "v2.3.2", + "version": "v2.3.3", "target-dir": "Symfony/Component/Locale", "source": { "type": "git", "url": "https://github.com/symfony/Locale.git", - "reference": "v2.3.2" + "reference": "v2.3.3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Locale/zipball/v2.3.2", - "reference": "v2.3.2", + "url": "https://api.github.com/repos/symfony/Locale/zipball/v2.3.3", + "reference": "v2.3.3", "shasum": "" }, "require": { @@ -1186,17 +1238,17 @@ }, { "name": "symfony/options-resolver", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/OptionsResolver", "source": { "type": "git", "url": "https://github.com/symfony/OptionsResolver.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/OptionsResolver/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/OptionsResolver/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -1238,17 +1290,17 @@ }, { "name": "symfony/process", - "version": "v2.3.2", + "version": "v2.3.3", "target-dir": "Symfony/Component/Process", "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "v2.3.2" + "reference": "v2.3.3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/v2.3.2", - "reference": "v2.3.2", + "url": "https://api.github.com/repos/symfony/Process/zipball/v2.3.3", + "reference": "v2.3.3", "shasum": "" }, "require": { @@ -1281,21 +1333,21 @@ ], "description": "Symfony Process Component", "homepage": "http://symfony.com", - "time": "2013-07-01 12:24:43" + "time": "2013-08-02 21:51:01" }, { "name": "symfony/property-access", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/PropertyAccess", "source": { "type": "git", "url": "https://github.com/symfony/PropertyAccess.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/PropertyAccess/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/PropertyAccess/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -1339,21 +1391,21 @@ "property path", "reflection" ], - "time": "2013-04-07 22:02:49" + "time": "2013-07-28 18:26:16" }, { "name": "symfony/routing", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/Routing", "source": { "type": "git", "url": "https://github.com/symfony/Routing.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Routing/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/Routing/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -1397,21 +1449,21 @@ ], "description": "Symfony Routing Component", "homepage": "http://symfony.com", - "time": "2013-06-23 06:56:04" + "time": "2013-07-30 11:22:46" }, { "name": "symfony/translation", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/Translation", "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/Translation/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -1452,21 +1504,21 @@ ], "description": "Symfony Translation Component", "homepage": "http://symfony.com", - "time": "2013-05-10 16:49:00" + "time": "2013-07-28 18:26:16" }, { "name": "symfony/validator", - "version": "v2.3.2", + "version": "v2.2.5", "target-dir": "Symfony/Component/Validator", "source": { "type": "git", "url": "https://github.com/symfony/Validator.git", - "reference": "v2.3.2" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/v2.3.2", - "reference": "v2.3.2", + "url": "https://api.github.com/repos/symfony/Validator/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -1474,22 +1526,22 @@ "symfony/translation": "~2.0" }, "require-dev": { - "symfony/config": "~2.2", + "symfony/config": ">=2.2,<2.3-dev", "symfony/http-foundation": "~2.1", - "symfony/intl": "~2.3", + "symfony/locale": "~2.0", "symfony/yaml": "~2.0" }, "suggest": { - "doctrine/common": "", - "symfony/config": "", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/yaml": "" + "doctrine/common": "~2.2", + "symfony/config": "2.2.*", + "symfony/http-foundation": "2.2.*", + "symfony/locale": "2.2.*", + "symfony/yaml": "2.2.*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.2-dev" } }, "autoload": { @@ -1513,21 +1565,21 @@ ], "description": "Symfony Validator Component", "homepage": "http://symfony.com", - "time": "2013-07-08 13:36:15" + "time": "2013-08-06 05:59:38" }, { "name": "symfony/yaml", - "version": "v2.2.4", + "version": "v2.2.5", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "v2.2.4" + "reference": "v2.2.5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.2.4", - "reference": "v2.2.4", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.2.5", + "reference": "v2.2.5", "shasum": "" }, "require": { @@ -1570,12 +1622,12 @@ "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "3613b1466d5e9518b83f87d828f93f962ff0f997" + "reference": "feb6492762a77db946bc13cc44a20a01546be0e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/3613b1466d5e9518b83f87d828f93f962ff0f997", - "reference": "3613b1466d5e9518b83f87d828f93f962ff0f997", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/feb6492762a77db946bc13cc44a20a01546be0e6", + "reference": "feb6492762a77db946bc13cc44a20a01546be0e6", "shasum": "" }, "require": { @@ -1608,7 +1660,7 @@ "faker", "fixtures" ], - "time": "2013-07-15 16:26:12" + "time": "2013-08-12 10:05:47" }, { "name": "phpunit/php-code-coverage", @@ -1762,16 +1814,16 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", - "url": "git://github.com/sebastianbergmann/php-timer.git", - "reference": "1.0.4" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "1.0.5" }, "dist": { "type": "zip", - "url": "https://github.com/sebastianbergmann/php-timer/zipball/1.0.4", - "reference": "1.0.4", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1.0.5", + "reference": "1.0.5", "shasum": "" }, "require": { @@ -1798,24 +1850,24 @@ } ], "description": "Utility class for timing", - "homepage": "http://www.phpunit.de/", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ "timer" ], - "time": "2012-10-11 04:45:58" + "time": "2013-08-02 07:42:54" }, { "name": "phpunit/php-token-stream", - "version": "1.1.7", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "1.1.7" + "reference": "1.2.0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1.1.7", - "reference": "1.1.7", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1.2.0", + "reference": "1.2.0", "shasum": "" }, "require": { @@ -1823,6 +1875,11 @@ "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, "autoload": { "classmap": [ "PHP/" @@ -1847,20 +1904,20 @@ "keywords": [ "tokenizer" ], - "time": "2013-07-29 14:27:06" + "time": "2013-08-04 05:57:48" }, { "name": "phpunit/phpunit", - "version": "3.7.22", + "version": "3.7.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3.7.22" + "reference": "3.7.24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.22", - "reference": "3.7.22", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.24", + "reference": "3.7.24", "shasum": "" }, "require": { @@ -1872,7 +1929,7 @@ "phpunit/php-code-coverage": "~1.2.1", "phpunit/php-file-iterator": ">=1.3.1", "phpunit/php-text-template": ">=1.1.1", - "phpunit/php-timer": "~1.0.2", + "phpunit/php-timer": ">=1.0.4", "phpunit/phpunit-mock-objects": "~1.2.0", "symfony/yaml": "~2.0" }, @@ -1921,7 +1978,7 @@ "testing", "xunit" ], - "time": "2013-07-06 06:29:15" + "time": "2013-08-09 06:58:24" }, { "name": "phpunit/phpunit-mock-objects", @@ -1985,6 +2042,7 @@ "leafo/lessphp": 20, "ptachoire/cssembed": 20, "simplepie/simplepie": 20, + "imagine/imagine": 20, "fzaninotto/faker": 20 }, "platform": { diff --git a/core/lib/Thelia/Action/BaseAction.php b/core/lib/Thelia/Action/BaseAction.php index fde3607c8..bef57b30d 100644 --- a/core/lib/Thelia/Action/BaseAction.php +++ b/core/lib/Thelia/Action/BaseAction.php @@ -30,7 +30,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; class BaseAction { - /** * @var The container */ diff --git a/core/lib/Thelia/Action/Image.php b/core/lib/Thelia/Action/Image.php new file mode 100644 index 000000000..eabf03b0a --- /dev/null +++ b/core/lib/Thelia/Action/Image.php @@ -0,0 +1,497 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +use Thelia\Core\Event\ActionEvent; +use Thelia\Core\Event\ImageEvent; +use Thelia\Model\ConfigQuery; +use Thelia\Tools\URL; + +use Imagine\Image\ImagineInterface; +use Imagine\Image\ImageInterface; +use Imagine\Image\Box; +use Imagine\Image\Color; +use Imagine\Image\Point; +use Thelia\Exception\ImageException; +use Thelia\Core\Event\TheliaEvents; + +/** + * + * Image management actions. This class handles image processing an caching. + * + * Basically, images are stored outside the web space (by default in local/media/images), + * and cached in the web space (by default in web/local/images). + * + * In the images caches directory, a subdirectory for images categories (eg. product, category, folder, etc.) is + * automatically created, and the cached image is created here. Plugin may use their own subdirectory as required. + * + * The cached image name contains a hash of the processing options, and the original (normalized) name of the image. + * + * A copy (or symbolic link, by default) of the original image is always created in the cache, so that the full + * resolution image is always available. + * + * Various image processing options are available : + * + * - resizing, with border, crop, or by keeping image aspect ratio + * - rotation, in degrees, positive or negative + * - background color, applyed to empty background when creating borders or rotating + * - effects. The effects are applied in the specified order. The following effects are available: + * - gamma:value : change the image Gamma to the specified value. Example: gamma:0.7 + * - grayscale or greyscale: switch image to grayscale + * - colorize:color : apply a color mask to the image. Exemple: colorize:#ff2244 + * - negative : transform the image in its negative equivalent + * - vflip or vertical_flip : vertical flip + * - hflip or horizontal_flip : horizontal flip + * + * If a problem occurs, an ImageException may be thrown. + * + * @package Thelia\Action + * @author Franck Allimant + * + */ +class Image extends BaseAction implements EventSubscriberInterface +{ + // Resize mode constants + const EXACT_RATIO_WITH_BORDERS = 1; + const EXACT_RATIO_WITH_CROP = 2; + const KEEP_IMAGE_RATIO = 3; + + /** + * Clear the image cache. Is a subdirectory is specified, only this directory is cleared. + * If no directory is specified, the whole cache is cleared. + * Only files are deleted, directories will remain. + * + * @param ImageEvent $event + */ + public function clearCache(ImageEvent $event) { + + $path = $this->getCachePath($event->getCacheSubdirectory(), false); + + $this->clearDirectory($path); + } + + /** + * Recursively clears the specified directory. + * + * @param string $path the directory path + */ + protected function clearDirectory($path) { + + $iterator = new \DirectoryIterator($path); + + foreach ($iterator as $fileinfo) { + + if ($fileinfo->isDot()) continue; + + if ($fileinfo->isFile() || $fileinfo->isLink()) { + @unlink($fileinfo->getPathname()); + } + else if ($fileinfo->isDir()) { + $this->clearDirectory($fileinfo->getPathname()); + } + } + } + + /** + * Process image and write the result in the image cache. + * + * If the image already exists in cache, the cache file is immediately returned, without any processing + * If the original (full resolution) image is required, create either a symbolic link with the + * original image in the cache dir, or copy it in the cache dir. + * + * This method updates the cache_file_path and file_url attributes of the event + * + * @param ImageEvent $event + * @throws \InvalidArgumentException, ImageException + */ + public function processImage(ImageEvent $event) + { + + $subdir = $event->getCacheSubdirectory(); + $source_file = $event->getSourceFilepath(); + + if (null == $subdir || null == $source_file) { + throw new \InvalidArgumentException("Cache sub-directory and source file path cannot be null"); + } + + // echo basename($source_file).": "; + + // Find cached file path + $cacheFilePath = $this->getCacheFilePath($subdir, $source_file, $event); + + $originalImagePathInCache = $this->getCacheFilePath($subdir, $source_file, $event, true); + + if (! file_exists($cacheFilePath)) { + + if (! file_exists($source_file)) { + throw new ImageException(sprintf("Source image file %s does not exists.", $source_file)); + } + + // Create a chached version of the original image in the web space, if not exists + + if (! file_exists($originalImagePathInCache)) { + + $mode = ConfigQuery::read('original_image_delivery_mode', 'symlink'); + + if ($mode == 'symlink') { + if (false == symlink($source_file, $originalImagePathInCache)) { + throw new ImageException(sprintf("Failed to create symbolic link for %s in %s image cache directory", basename($source_file), $subdir)); + } + } + else {// mode = 'copy' + if (false == @copy($source_file, $originalImagePathInCache)) { + throw new ImageException(sprintf("Failed to copy %s in %s image cache directory", basename($source_file), $subdir)); + } + } + } + + // Process image only if we have some transformations to do. + if (! $event->isOriginalImage()) { + + // We have to process the image. + $imagine = $this->createImagineInstance(); + + $image = $imagine->open($source_file); + + if ($image) { + + $background_color = $event->getBackgroundColor(); + + if ($background_color != null) { + $bg_color = new Color($background_color); + } + else + $bg_color = null; + + // Apply resize + $image = $this->applyResize($imagine, $image, $event->getWidth(), $event->getHeight(), $event->getResizeMode(), $bg_color); + + // Rotate if required + $rotation = intval($event->getRotation()); + + if ($rotation != 0) + $image->rotate($rotation, $bg_color); + + // Flip + // Process each effects + foreach ($event->getEffects() as $effect) { + + $effect = trim(strtolower($effect)); + + $params = explode(':', $effect); + + switch ($params[0]) { + + case 'greyscale': + case 'grayscale': + $image->effects()->grayscale(); + break; + + case 'negative': + $image->effects()->negative(); + break; + + case 'horizontal_flip': + case 'hflip': + $image->flipHorizontally(); + break; + + case 'vertical_flip': + case 'vflip': + $image-> flipVertically(); + break; + + case 'gamma': + // Syntax: gamma:value. Exemple: gamma:0.7 + if (isset($params[1])) { + $gamma = floatval($params[1]); + + $image->effects()->gamma($gamma); + } + break; + + case 'colorize': + // Syntax: colorize:couleur. Exemple: colorize:#ff00cc + if (isset($params[1])) { + $the_color = new Color($params[1]); + + $image->effects()->colorize($the_color); + } + break; + } + } + + $quality = $event->getQuality(); + + if (is_null($quality)) $quality = ConfigQuery::read('default_image_quality_percent', 75); + + $image->save( + $cacheFilePath, + array('quality' => $quality) + ); + } + else { + throw new ImageException(sprintf("Source file %s cannot be opened.", basename($source_file))); + } + } + } + + // Compute the image URL + $processed_image_url = $this->getCacheFileURL($subdir, basename($cacheFilePath)); + + // compute the full resulution image path in cache + $original_image_url = $this->getCacheFileURL($subdir, basename($originalImagePathInCache)); + + // Update the event with file path and file URL + $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)); + } + + /** + * Process image resizing, with borders or cropping. If $dest_width and $dest_height + * are both null, no resize is performed. + * + * @param ImagineInterface $imagine the Imagine instance + * @param ImageInterface $image the image to process + * @param int $dest_width the required width + * @param int $dest_height the required height + * @param int $resize_mode the resize mode (crop / bands / keep image ratio)p + * @param string $bg_color the bg_color used for bands + * @return ImageInterface the resized image. + */ + protected function applyResize(ImagineInterface $imagine, ImageInterface $image, $dest_width, $dest_height, $resize_mode, $bg_color) + { + if (! (is_null($dest_width) && is_null($dest_height))) { + + $width_orig = $image->getSize()->getWidth(); + $height_orig = $image->getSize()->getHeight(); + + if (is_null($dest_width)) + $dest_width = $width_orig; + + if (is_null($dest_height)) + $dest_height = $height_orig; + + if (is_null($resize_mode)) + $resize_mode = self::KEEP_IMAGE_RATIO; + + $width_diff = $dest_width / $width_orig; + $height_diff = $dest_height / $height_orig; + + $delta_x = $delta_y = $border_width = $border_height = 0; + + if ($width_diff > 1 AND $height_diff > 1) { + + $next_width = $width_orig; + $next_height = $height_orig; + + $dest_width = ($resize_mode == self::EXACT_RATIO_WITH_BORDERS ? $dest_width : $next_width); + $dest_height = ($resize_mode == self::EXACT_RATIO_WITH_BORDERS ? $dest_height : $next_height); + } + else if ($width_diff > $height_diff) { + // Image height > image width + + $next_height = $dest_height; + $next_width = intval(($width_orig * $next_height) / $height_orig); + + if ($resize_mode == self::EXACT_RATIO_WITH_CROP) { + $next_width = $dest_width; + $next_height = intval($height_orig * $dest_width / $width_orig); + $delta_y = ($next_height - $dest_height) / 2; + } + else if ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) { + $dest_width = $next_width; + } + } + else { + // Image width > image height + $next_width = $dest_width; + $next_height = intval($height_orig * $dest_width / $width_orig); + + if ($resize_mode == self::EXACT_RATIO_WITH_CROP) { + $next_height = $dest_height; + $next_width = intval(($width_orig * $next_height) / $height_orig); + $delta_x = ($next_width - $dest_width) / 2; + } + else if ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) { + $dest_height = $next_height; + } + } + + $image->resize(new Box($next_width, $next_height)); + + // echo "w=$dest_width, h=$dest_height, nw=$next_width, nh=$next_height, dx=$delta_x, dy=$delta_y, bw=$border_width, bh=$border_height\n"; + + if ($resize_mode == self::EXACT_RATIO_WITH_BORDERS) { + + $border_width = intval(($dest_width - $next_width) / 2); + $border_height = intval(($dest_height - $next_height) / 2); + + $canvas = new Box($dest_width, $dest_height); + + return $imagine->create($canvas, $bg_color) + ->paste($image, new Point($border_width, $border_height)); + } + + else if ($resize_mode == self::EXACT_RATIO_WITH_CROP) { + $image->crop( + new Point($delta_x, $delta_y), + new Box($dest_width, $dest_height) + ); + } + } + + return $image; + } + + + /** + * Return the absolute URL to the cached image + * + * @param string $subdir the subdirectory related to cache base + * @param string $filename the safe filename, as returned by getCacheFilePath() + * @return string the absolute URL to the cached image + */ + protected function getCacheFileURL($subdir, $safe_filename) + { + $path = $this->getCachePathFromWebRoot($subdir); + + return URL::absoluteUrl(sprintf("%s/%s", $path, $safe_filename), null, URL::PATH_TO_FILE); + } + + /** + * Return the full path of the cached file + * + * @param string $subdir the subdirectory related to cache base + * @param string $filename the filename + * @param boolean $forceOriginalImage if true, the origiunal image path in the cache dir is returned. + * @return string the cache directory path relative to Web Root + */ + protected function getCacheFilePath($subdir, $filename, ImageEvent $event, $forceOriginalImage = false) + { + $path = $this->getCachePath($subdir); + + $safe_filename = preg_replace("[^:alnum:\-\._]", "-", strtolower(basename($filename))); + + // Keep original safe name if no tranformations are applied + if ($forceOriginalImage || $event->isOriginalImage()) + return sprintf("%s/%s", $path, $safe_filename); + else + return sprintf("%s/%s-%s", $path, $event->getOptionsHash(), $safe_filename); + } + + /** + * Return the cache directory path relative to Web Root + * + * @param string $subdir the subdirectory related to cache base, or null to get the cache directory only. + * @return string the cache directory path relative to Web Root + */ + protected function getCachePathFromWebRoot($subdir = null) + { + $cache_dir_from_web_root = ConfigQuery::read('image_cache_dir_from_web_root', 'cache'); + + if ($subdir != null) { + $safe_subdir = basename($subdir); + + $path = sprintf("%s/%s", $cache_dir_from_web_root, $safe_subdir); + } + else + $path = $cache_dir_from_web_root; + + // Check if path is valid, e.g. in the cache dir + + return $path; + } + + /** + * Return the absolute cache directory path + * + * @param string $subdir the subdirectory related to cache base, or null to get the cache base directory. + * @throws \RuntimeException if cache directory cannot be created + * @return string the absolute cache directory path + */ + protected function getCachePath($subdir = null, $create_if_not_exists = true) + { + $cache_base = $this->getCachePathFromWebRoot($subdir); + + $web_root = rtrim(THELIA_WEB_DIR, '/'); + + $path = sprintf("%s/%s", $web_root, $cache_base); + + // Create directory (recursively) if it does not exists. + if ($create_if_not_exists && !is_dir($path)) { + if (!@mkdir($path, 0777, true)) { + throw new ImageException(sprintf("Failed to create %s/%s image cache directory", $cache_base)); + } + } + + // Check if path is valid, e.g. in the cache dir + $cache_base = realpath(sprintf("%s/%s", $web_root, $this->getCachePathFromWebRoot())); + + if (strpos(realpath($path), $cache_base) !== 0) { + throw new \InvalidArgumentException(sprintf("Invalid cache path %s, with subdirectory %s", $path, $subdir)); + } + + return $path; + } + + /** + * Create a new Imagine object using current driver configuration + * + * @return \Imagine\ImagineInterface + */ + protected function createImagineInstance() + { + $driver = ConfigQuery::read("imagine_graphic_driver", "gd"); + + switch ($driver) { + case 'imagik': + $image = new \Imagine\Imagick\Imagine(); + break; + + case 'gmagick': + $image = new \Imagine\Gmagick\Imagine(); + break; + + case 'gd': + default: + $image = new \Imagine\Gd\Imagine(); + } + + return $image; + } + + public static function getSubscribedEvents() + { + return array( + TheliaEvents::IMAGE_PROCESS => array("processImage", 128), + TheliaEvents::IMAGE_CLEAR_CACHE => array("clearCache", 128), + ); + } +} diff --git a/core/lib/Thelia/Command/ClearImageCache.php b/core/lib/Thelia/Command/ClearImageCache.php new file mode 100644 index 000000000..801e2e8d0 --- /dev/null +++ b/core/lib/Thelia/Command/ClearImageCache.php @@ -0,0 +1,70 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Command; + + +use Thelia\Command\ContainerAwareCommand; +use Thelia\Core\Event\TheliaEvents; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Thelia\Core\Event\ImageEvent; +use Thelia\Core\HttpFoundation\Request; +use Symfony\Component\Console\Input\InputArgument; + + +class ClearImageCache extends ContainerAwareCommand +{ + protected function configure() + { + $this + ->setName("image-cache:clear") + ->setDescription("Empty part or whole web space image cache") + ->addArgument("subdir", InputArgument::OPTIONAL, "Clear only the specified subdirectory") + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $dispatcher = $this->getContainer()->get('event_dispatcher'); + + $request = new Request(); + + try { + $event = new ImageEvent($request); + + $subdir = $input->getArgument('subdir'); + + if (! is_null($subdir)) $event->setCacheSubdirectory($subdir); + + $dispatcher->dispatch(TheliaEvents::IMAGE_CLEAR_CACHE, $event); + + $output->writeln(sprintf('%s image cache successfully cleared.', is_null($subdir) ? 'Entire' : ucfirst($subdir))); + } + catch(\Exception $ex) { + $output->writeln(sprintf("Failed to clear image cache: %s", $ex->getMessage())); + } + } +} diff --git a/core/lib/Thelia/Command/Install.php b/core/lib/Thelia/Command/Install.php index c151c44b7..edf459086 100755 --- a/core/lib/Thelia/Command/Install.php +++ b/core/lib/Thelia/Command/Install.php @@ -189,7 +189,8 @@ class Install extends ContainerAwareCommand file_put_contents($configFile, $configContent); - $fs->remove($sampleConfigFile); + // FA - no, as no further install will be possible + // $fs->remove($sampleConfigFile); $fs->remove($this->getContainer()->getParameter("kernel.cache_dir")); diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml index 988c86ce9..f773b4cd7 100755 --- a/core/lib/Thelia/Config/Resources/action.xml +++ b/core/lib/Thelia/Config/Resources/action.xml @@ -27,6 +27,11 @@ + + + + + diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 98017f979..a404fa6f2 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -25,6 +25,7 @@ + @@ -42,6 +43,7 @@ + diff --git a/core/lib/Thelia/Core/Event/ImageEvent.php b/core/lib/Thelia/Core/Event/ImageEvent.php new file mode 100644 index 000000000..a105d9f6f --- /dev/null +++ b/core/lib/Thelia/Core/Event/ImageEvent.php @@ -0,0 +1,257 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Core\HttpFoundation\Request; +use Thelia\Model\Cart; + +class ImageEvent extends ActionEvent +{ + /** + * @var string The complete file name (with path) of the source image + */ + protected $source_filepath = null; + /** + * @var string The target subdirectory in the image cache + */ + protected $cache_subdirectory = null; + + /** + * @var string The absolute URL of the cached image (in the web space) + */ + protected $file_url = null; + + /** + * @var string The absolute path of the cached image file + */ + protected $cache_filepath = null; + + /** + * @var string The absolute URL of the cached version of the original image (in the web space) + */ + protected $original_file_url = null; + + /** + * @var string The absolute path of the cached version of the original image file + */ + protected $cache_original_filepath = null; + + /** + * @var string The image category (i.e. the subdirectory in image cache) + */ + protected $category = null; + + /** + * @var integer the required image width + */ + protected $width = null; + + /** + * @var int the required image height + */ + protected $height = null; + + /** + * @var string the resize mode, either crop, bands, none + */ + protected $resize_mode = null; + + /** + * @var string the background color in RGB format (eg. #ff8000) + */ + protected $background_color = null; + + /** + * @var array a list of effects (grayscale, negative, mirror...), applied in the specified order. + */ + protected $effects = array(); + + /** + * @var int the rotation angle in degrees, none if zero or null + */ + protected $rotation = null; + + /** + * @var int the quality of the result image, from 0 (!) to 100 + */ + protected $quality = null; + + /** + * @return boolean true if the required image is the original image (resize_mode and background_color are not significant) + */ + public function isOriginalImage() + { + return empty($this->width) && empty($this->height) /* && empty($this->resize_mode) && empty($this->background_color) not significant */ + && empty($this->effects) && empty($this->rotation) && empty($this->quality); + } + + /** + * @return string a hash identifiying the processing options + */ + public function getOptionsHash() + { + return md5( + $this->width . $this->height . $this->resize_mode . $this->background_color . implode(',', $this->effects) + . $this->rotation); + } + + public function getCategory() + { + return $this->category; + } + + public function setCategory($category) + { + $this->category = $category; + } + + public function getWidth() + { + return $this->width; + } + + public function setWidth($width) + { + $this->width = $width; + } + + public function getHeight() + { + return $this->height; + } + + public function setHeight($height) + { + $this->height = $height; + } + + public function getResizeMode() + { + return $this->resize_mode; + } + + public function setResizeMode($resize_mode) + { + $this->resize_mode = $resize_mode; + } + + public function getBackgroundColor() + { + return $this->background_color; + } + + public function setBackgroundColor($background_color) + { + $this->background_color = $background_color; + } + + public function getEffects() + { + return $this->effects; + } + + public function setEffects(array $effects) + { + $this->effects = $effects; + } + + public function getRotation() + { + return $this->rotation; + } + + public function setRotation($rotation) + { + $this->rotation = $rotation; + } + + public function getFileUrl() + { + return $this->file_url; + } + + public function setFileUrl($file_url) + { + $this->file_url = $file_url; + } + + public function getCacheFilepath() + { + return $this->cache_filepath; + } + + public function setCacheFilepath($cache_filepath) + { + $this->cache_filepath = $cache_filepath; + } + + public function getSourceFilepath() + { + return $this->source_filepath; + } + + public function setSourceFilepath($source_filepath) + { + $this->source_filepath = $source_filepath; + } + + public function getCacheSubdirectory() + { + return $this->cache_subdirectory; + } + + public function setCacheSubdirectory($cache_subdirectory) + { + $this->cache_subdirectory = $cache_subdirectory; + } + + public function getQuality() + { + return $this->quality; + } + + public function setQuality($quality) + { + $this->quality = $quality; + } + + public function getOriginalFileUrl() + { + return $this->original_file_url; + } + + public function setOriginalFileUrl($original_file_url) + { + $this->original_file_url = $original_file_url; + } + + public function getCacheOriginalFilepath() + { + return $this->cache_original_filepath; + } + + public function setCacheOriginalFilepath($cache_original_filepath) + { + $this->cache_original_filepath = $cache_original_filepath; + } +} diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index ac3306c6a..f64a071c7 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -134,4 +134,15 @@ final class TheliaEvents const CART_CHANGEITEM = "action.changeArticle"; const CART_DELETEITEM = "action.deleteArticle"; + + /** + * Sent on image processing + */ + const IMAGE_PROCESS = "action.processImage"; + + /** + * Sent on cimage cache clear request + */ + const IMAGE_CLEAR_CACHE = "action.clearImageCache"; + } diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php index bcc7837dc..b5ee03955 100755 --- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php +++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php @@ -163,7 +163,7 @@ abstract class BaseLoop * @throws \InvalidArgumentException if argument is not found in loop argument list * @return Argument the loop argument. */ - public function getArg($argumentName) + protected function getArg($argumentName) { $arg = $this->args->get($argumentName); @@ -181,7 +181,7 @@ abstract class BaseLoop * @throws \InvalidArgumentException if argument is not found in loop argument list * @return Argument the loop argument. */ - public function getArgValue($argumentName) + protected function getArgValue($argumentName) { return $this->getArg($argumentName)->getValue(); } @@ -192,7 +192,7 @@ abstract class BaseLoop * * @return array|mixed|\PropelModelPager|\PropelObjectCollection */ - public function search(ModelCriteria $search, &$pagination = null) + protected function search(ModelCriteria $search, &$pagination = null) { if ($this->getArgValue('page') !== null) { return $this->searchWithPagination($search, $pagination); @@ -206,7 +206,7 @@ abstract class BaseLoop * * @return array|mixed|\PropelObjectCollection */ - public function searchWithOffset(ModelCriteria $search) + protected function searchWithOffset(ModelCriteria $search) { if ($this->getArgValue('limit') >= 0) { $search->limit($this->getArgValue('limit')); @@ -222,7 +222,7 @@ abstract class BaseLoop * * @return array|\PropelModelPager */ - public function searchWithPagination(ModelCriteria $search, &$pagination) + protected function searchWithPagination(ModelCriteria $search, &$pagination) { $pagination = $search->paginate($this->getArgValue('page'), $this->getArgValue('limit')); diff --git a/core/lib/Thelia/Core/Template/Loop/Category.php b/core/lib/Thelia/Core/Template/Loop/Category.php index a0e636926..4cde51824 100755 --- a/core/lib/Thelia/Core/Template/Loop/Category.php +++ b/core/lib/Thelia/Core/Template/Loop/Category.php @@ -46,7 +46,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 : @@ -77,7 +77,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', 'random')) ), 'manual' ), @@ -130,7 +130,7 @@ class Category extends BaseLoop case "alpha": $search->addAscendingOrderByColumn(\Thelia\Model\Map\CategoryI18nTableMap::TITLE); break; - case "alpha_reverse": + case "alpha-reverse": $search->addDescendingOrderByColumn(\Thelia\Model\Map\CategoryI18nTableMap::TITLE); break; case "manual-reverse": diff --git a/core/lib/Thelia/Core/Template/Loop/Content.php b/core/lib/Thelia/Core/Template/Loop/Content.php index 7131c1d7e..15bb2068c 100755 --- a/core/lib/Thelia/Core/Template/Loop/Content.php +++ b/core/lib/Thelia/Core/Template/Loop/Content.php @@ -66,7 +66,7 @@ class Content extends BaseLoop new Argument( 'order', new TypeCollection( - new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'random', 'given_id')) + new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse', 'random', 'given_id')) ), 'alpha' ), @@ -155,7 +155,7 @@ class Content extends BaseLoop case "alpha": $search->addAscendingOrderByColumn(\Thelia\Model\Map\ContentI18nTableMap::TITLE); break; - case "alpha_reverse": + case "alpha-reverse": $search->addDescendingOrderByColumn(\Thelia\Model\Map\ContentI18nTableMap::TITLE); break; case "manual": diff --git a/core/lib/Thelia/Core/Template/Loop/Feature.php b/core/lib/Thelia/Core/Template/Loop/Feature.php index 15ef6af99..cf8dcc563 100755 --- a/core/lib/Thelia/Core/Template/Loop/Feature.php +++ b/core/lib/Thelia/Core/Template/Loop/Feature.php @@ -65,7 +65,7 @@ class Feature extends BaseLoop 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' ) @@ -124,7 +124,7 @@ class Feature extends BaseLoop case "alpha": $search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE); break; - case "alpha_reverse": + case "alpha-reverse": $search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE); break; case "manual": diff --git a/core/lib/Thelia/Core/Template/Loop/FeatureAvailable.php b/core/lib/Thelia/Core/Template/Loop/FeatureAvailable.php index 2ef701cc9..838937558 100755 --- a/core/lib/Thelia/Core/Template/Loop/FeatureAvailable.php +++ b/core/lib/Thelia/Core/Template/Loop/FeatureAvailable.php @@ -59,7 +59,7 @@ class FeatureAvailable extends BaseLoop 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' ) @@ -100,7 +100,7 @@ class FeatureAvailable extends BaseLoop case "alpha": $search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureAvI18nTableMap::TITLE); break; - case "alpha_reverse": + case "alpha-reverse": $search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureAvI18nTableMap::TITLE); break; case "manual": diff --git a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php index 43f6df506..9988c500f 100755 --- a/core/lib/Thelia/Core/Template/Loop/FeatureValue.php +++ b/core/lib/Thelia/Core/Template/Loop/FeatureValue.php @@ -61,7 +61,7 @@ class FeatureValue extends BaseLoop 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' ) @@ -108,7 +108,7 @@ class FeatureValue extends BaseLoop case "alpha": $search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE); break; - case "alpha_reverse": + case "alpha-reverse": $search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE); break; case "manual": diff --git a/core/lib/Thelia/Core/Template/Loop/Folder.php b/core/lib/Thelia/Core/Template/Loop/Folder.php index 7f4ee120d..c2f45682a 100755 --- a/core/lib/Thelia/Core/Template/Loop/Folder.php +++ b/core/lib/Thelia/Core/Template/Loop/Folder.php @@ -59,7 +59,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' ), @@ -113,7 +113,7 @@ class Folder extends BaseLoop case "alpha": $search->addAscendingOrderByColumn(\Thelia\Model\Map\FolderI18nTableMap::TITLE); break; - case "alpha_reverse": + case "alpha-reverse": $search->addDescendingOrderByColumn(\Thelia\Model\Map\FolderI18nTableMap::TITLE); break; case "manual-reverse": diff --git a/core/lib/Thelia/Core/Template/Loop/Image.php b/core/lib/Thelia/Core/Template/Loop/Image.php new file mode 100644 index 000000000..a1e866cb2 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Image.php @@ -0,0 +1,336 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Loop; +use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Core\Event\ImageEvent; +use Thelia\Model\CategoryImageQuery; +use Thelia\Model\ProductImageQuery; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Type\TypeCollection; +use Thelia\Type\EnumListType; +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Model\ConfigQuery; +use Thelia\Core\Template\Element\LoopResultRow; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Type\EnumType; +use Thelia\Log\Tlog; + +/** + * The image loop + * + * @author Franck Allimant + */ +class Image extends BaseLoop +{ + /** + * @var array Possible image sources + */ + protected $possible_sources = array('category', 'product', 'folder', 'content'); + + /** + * Dynamically create the search query, and set the proper filter and order + * + * @param string $source a valid source identifier (@see $possible_sources) + * @param int $object_id the source object ID + * @return ModelCriteria the propel Query object + */ + protected function createSearchQuery($source, $object_id) { + + $object = ucfirst($source); + + $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'); + $search = $method->invoke(null); // Static ! + + // $query->filterByXXX(id) + $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); + break; + case "alpha-reverse": + $search->addDescendingOrderByColumn($title_map); + break; + case "manual-reverse": + $search->orderByPosition(Criteria::DESC); + break; + case "manual": + $search->orderByPosition(Criteria::ASC); + break; + case "random": + $search->clearOrderByColumns(); + $search->addAscendingOrderByColumn('RAND()'); + break(2); + break; + } + } + + return $search; + } + + /** + * Dynamically create the search query, and set the proper filter and order + * + * @param string $object_type (returned) the a valid source identifier (@see $possible_sources) + * @param string $object_id (returned) the ID of the source object + * @return ModelCriteria the propel Query object + */ + protected function getSearchQuery(&$object_type, &$object_id) { + + $search = null; + + // Check form source="product" source_id="123" style arguments + $source = $this->getSource(); + + if (! is_null($source)) { + + $source_id = $this->getSourceId(); + + // echo "source = ".$this->getSource().", id=".$id."
"; + + if (is_null($source_id)) { + throw new \InvalidArgumentException("'source_id' argument cannot be null if 'source' argument is specified."); + } + + $search = $this->createSearchQuery($source, $source_id); + + $object_type = $source; + $object_id = $source_id; + } + else { + // Check for product="id" folder="id", etc. style arguments + foreach($this->possible_sources as $source) { + + $argValue = intval($this->getArgValue($source)); + + if ($argValue > 0) { + + $search = $this->createSearchQuery($source, $argValue); + + $object_type = $source; + $object_id = $argValue; + + break; + } + } + } + + if ($search == null) + throw new \InvalidArgumentException(sprintf("Unable to find image source. Valid sources are %s", implode(',', $this->possible_sources))); + + return $search; + } + + /** + * @param unknown $pagination + */ + public function exec(&$pagination) + { + // Select the proper query to use, and get the object type + $object_type = $object_id = null; + + $search = $this->getSearchQuery($object_type, $object_id); + + $id = $this->getId(); + + if (! is_null($id)) { + $search->filterById($id, Criteria::IN); + } + + $exclude = $this->getExclude(); + if (!is_null($exclude)) + $search->filterById($exclude, Criteria::NOT_IN); + + // Create image processing event + $event = new ImageEvent($this->request); + + // Prepare tranformations + $width = $this->getWidth(); + $height = $this->getHeight(); + $rotation = $this->getRotation(); + $background_color = $this->getBackgroundColor(); + $quality = $this->getQuality(); + $effects = $this->getEffects(); + $effects = $this->getEffects(); + if (! is_null($effects)) { + $effects = explode(',', $effects); + } + + switch($this->getResizeMode()) { + case 'crop' : + $resize_mode = \Thelia\Action\Image::EXACT_RATIO_WITH_CROP; + break; + + case 'borders' : + $resize_mode = \Thelia\Action\Image::EXACT_RATIO_WITH_BORDERS; + break; + + case 'none' : + default: + $resize_mode = \Thelia\Action\Image::KEEP_IMAGE_RATIO; + + } + + /** + * \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 + ); + + $results = $this->search($search, $pagination); + + $loopResult = new LoopResult(); + + foreach ($results as $result) { + + // Create image processing event + $event = new ImageEvent($this->request); + + // Setup required transformations + if (! is_null($width)) $event->setWidth($width); + if (! is_null($height)) $event->setHeight($height); + $event->setResizeMode($resize_mode); + if (! is_null($rotation)) $event->setRotation($rotation); + if (! is_null($background_color)) $event->setBackgroundColor($background_color); + if (! is_null($quality)) $event->setQuality($quality); + if (! is_null($effects)) $event->setEffects($effects); + + // Put source image file path + $source_filepath = sprintf("%s%s/%s/%s", + THELIA_ROOT, + ConfigQuery::read('documents_library_path', 'local/media/images'), + $object_type, + $result->getFile() + ); + + $event->setSourceFilepath($source_filepath); + $event->setCacheSubdirectory($object_type); + + try { + // Dispatch image processing event + $this->dispatcher->dispatch(TheliaEvents::IMAGE_PROCESS, $event); + + $loopResultRow = new LoopResultRow(); + + $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) + ; + + $loopResult->addRow($loopResultRow); + } + catch (\Exception $ex) { + // Ignore the result and log an error + Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args); + } + } + + 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/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php index 1d93515cb..88f33c3b3 100755 --- a/core/lib/Thelia/Core/Template/Loop/Product.php +++ b/core/lib/Thelia/Core/Template/Loop/Product.php @@ -79,7 +79,7 @@ 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' ), @@ -256,7 +256,7 @@ class Product extends BaseLoop case "alpha": $search->addAscendingOrderByColumn(\Thelia\Model\Map\ProductI18nTableMap::TITLE); break; - case "alpha_reverse": + case "alpha-reverse": $search->addDescendingOrderByColumn(\Thelia\Model\Map\ProductI18nTableMap::TITLE); break; /*case "min_price": diff --git a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php index e3365be85..a07eba565 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php +++ b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php @@ -70,7 +70,7 @@ 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, array(), true /* path only */), + URL::absoluteUrl($this->path_relative_to_web_root, null, URL::PATH_TO_FILE /* path only */), $assetType, $filters, $debug diff --git a/core/lib/Thelia/Exception/ImageException.php b/core/lib/Thelia/Exception/ImageException.php new file mode 100644 index 000000000..60774dabf --- /dev/null +++ b/core/lib/Thelia/Exception/ImageException.php @@ -0,0 +1,36 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Exception; + +use Thelia\Log\Tlog; + +class ImageException extends \RuntimeException +{ + public function __construct($message, $code = null, $previous = null) { + + Tlog::getInstance()->addError($message); + + parent::__construct($message, $code, $previous); + } +} diff --git a/core/lib/Thelia/Model/Base/Currency.php b/core/lib/Thelia/Model/Base/Currency.php index 5ab40a742..77718992f 100644 --- a/core/lib/Thelia/Model/Base/Currency.php +++ b/core/lib/Thelia/Model/Base/Currency.php @@ -87,6 +87,12 @@ abstract class Currency implements ActiveRecordInterface */ protected $rate; + /** + * The value for the position field. + * @var int + */ + protected $position; + /** * The value for the by_default field. * @var int @@ -473,6 +479,17 @@ abstract class Currency implements ActiveRecordInterface return $this->rate; } + /** + * Get the [position] column value. + * + * @return int + */ + public function getPosition() + { + + return $this->position; + } + /** * Get the [by_default] column value. * @@ -608,6 +625,27 @@ abstract class Currency implements ActiveRecordInterface return $this; } // setRate() + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return \Thelia\Model\Currency 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[] = CurrencyTableMap::POSITION; + } + + + return $this; + } // setPosition() + /** * Set the value of [by_default] column. * @@ -720,16 +758,19 @@ abstract class Currency implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CurrencyTableMap::translateFieldName('Rate', TableMap::TYPE_PHPNAME, $indexType)]; $this->rate = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CurrencyTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CurrencyTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $this->position = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CurrencyTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)]; $this->by_default = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CurrencyTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CurrencyTableMap::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 : CurrencyTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CurrencyTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -742,7 +783,7 @@ abstract class Currency implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 7; // 7 = CurrencyTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 8; // 8 = CurrencyTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Currency object", 0, $e); @@ -1052,6 +1093,9 @@ abstract class Currency implements ActiveRecordInterface if ($this->isColumnModified(CurrencyTableMap::RATE)) { $modifiedColumns[':p' . $index++] = 'RATE'; } + if ($this->isColumnModified(CurrencyTableMap::POSITION)) { + $modifiedColumns[':p' . $index++] = 'POSITION'; + } if ($this->isColumnModified(CurrencyTableMap::BY_DEFAULT)) { $modifiedColumns[':p' . $index++] = 'BY_DEFAULT'; } @@ -1084,6 +1128,9 @@ abstract class Currency implements ActiveRecordInterface case 'RATE': $stmt->bindValue($identifier, $this->rate, PDO::PARAM_STR); break; + case 'POSITION': + $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); + break; case 'BY_DEFAULT': $stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT); break; @@ -1168,12 +1215,15 @@ abstract class Currency implements ActiveRecordInterface return $this->getRate(); break; case 4: - return $this->getByDefault(); + return $this->getPosition(); break; case 5: - return $this->getCreatedAt(); + return $this->getByDefault(); break; case 6: + return $this->getCreatedAt(); + break; + case 7: return $this->getUpdatedAt(); break; default: @@ -1209,9 +1259,10 @@ abstract class Currency implements ActiveRecordInterface $keys[1] => $this->getCode(), $keys[2] => $this->getSymbol(), $keys[3] => $this->getRate(), - $keys[4] => $this->getByDefault(), - $keys[5] => $this->getCreatedAt(), - $keys[6] => $this->getUpdatedAt(), + $keys[4] => $this->getPosition(), + $keys[5] => $this->getByDefault(), + $keys[6] => $this->getCreatedAt(), + $keys[7] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1279,12 +1330,15 @@ abstract class Currency implements ActiveRecordInterface $this->setRate($value); break; case 4: - $this->setByDefault($value); + $this->setPosition($value); break; case 5: - $this->setCreatedAt($value); + $this->setByDefault($value); break; case 6: + $this->setCreatedAt($value); + break; + case 7: $this->setUpdatedAt($value); break; } // switch() @@ -1315,9 +1369,10 @@ abstract class Currency implements ActiveRecordInterface if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setSymbol($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setRate($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setByDefault($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[4], $arr)) $this->setPosition($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setByDefault($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]]); } /** @@ -1333,6 +1388,7 @@ abstract class Currency implements ActiveRecordInterface if ($this->isColumnModified(CurrencyTableMap::CODE)) $criteria->add(CurrencyTableMap::CODE, $this->code); if ($this->isColumnModified(CurrencyTableMap::SYMBOL)) $criteria->add(CurrencyTableMap::SYMBOL, $this->symbol); if ($this->isColumnModified(CurrencyTableMap::RATE)) $criteria->add(CurrencyTableMap::RATE, $this->rate); + if ($this->isColumnModified(CurrencyTableMap::POSITION)) $criteria->add(CurrencyTableMap::POSITION, $this->position); if ($this->isColumnModified(CurrencyTableMap::BY_DEFAULT)) $criteria->add(CurrencyTableMap::BY_DEFAULT, $this->by_default); if ($this->isColumnModified(CurrencyTableMap::CREATED_AT)) $criteria->add(CurrencyTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(CurrencyTableMap::UPDATED_AT)) $criteria->add(CurrencyTableMap::UPDATED_AT, $this->updated_at); @@ -1402,6 +1458,7 @@ abstract class Currency implements ActiveRecordInterface $copyObj->setCode($this->getCode()); $copyObj->setSymbol($this->getSymbol()); $copyObj->setRate($this->getRate()); + $copyObj->setPosition($this->getPosition()); $copyObj->setByDefault($this->getByDefault()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -2578,6 +2635,7 @@ abstract class Currency implements ActiveRecordInterface $this->code = null; $this->symbol = null; $this->rate = null; + $this->position = null; $this->by_default = null; $this->created_at = null; $this->updated_at = null; diff --git a/core/lib/Thelia/Model/Base/CurrencyQuery.php b/core/lib/Thelia/Model/Base/CurrencyQuery.php index 140b70463..eb4b1b2f7 100644 --- a/core/lib/Thelia/Model/Base/CurrencyQuery.php +++ b/core/lib/Thelia/Model/Base/CurrencyQuery.php @@ -26,6 +26,7 @@ use Thelia\Model\Map\CurrencyTableMap; * @method ChildCurrencyQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildCurrencyQuery orderBySymbol($order = Criteria::ASC) Order by the symbol column * @method ChildCurrencyQuery orderByRate($order = Criteria::ASC) Order by the rate column + * @method ChildCurrencyQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildCurrencyQuery orderByByDefault($order = Criteria::ASC) Order by the by_default column * @method ChildCurrencyQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildCurrencyQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column @@ -34,6 +35,7 @@ use Thelia\Model\Map\CurrencyTableMap; * @method ChildCurrencyQuery groupByCode() Group by the code column * @method ChildCurrencyQuery groupBySymbol() Group by the symbol column * @method ChildCurrencyQuery groupByRate() Group by the rate column + * @method ChildCurrencyQuery groupByPosition() Group by the position column * @method ChildCurrencyQuery groupByByDefault() Group by the by_default column * @method ChildCurrencyQuery groupByCreatedAt() Group by the created_at column * @method ChildCurrencyQuery groupByUpdatedAt() Group by the updated_at column @@ -65,6 +67,7 @@ use Thelia\Model\Map\CurrencyTableMap; * @method ChildCurrency findOneByCode(string $code) Return the first ChildCurrency filtered by the code column * @method ChildCurrency findOneBySymbol(string $symbol) Return the first ChildCurrency filtered by the symbol column * @method ChildCurrency findOneByRate(double $rate) Return the first ChildCurrency filtered by the rate column + * @method ChildCurrency findOneByPosition(int $position) Return the first ChildCurrency filtered by the position column * @method ChildCurrency findOneByByDefault(int $by_default) Return the first ChildCurrency filtered by the by_default column * @method ChildCurrency findOneByCreatedAt(string $created_at) Return the first ChildCurrency filtered by the created_at column * @method ChildCurrency findOneByUpdatedAt(string $updated_at) Return the first ChildCurrency filtered by the updated_at column @@ -73,6 +76,7 @@ use Thelia\Model\Map\CurrencyTableMap; * @method array findByCode(string $code) Return ChildCurrency objects filtered by the code column * @method array findBySymbol(string $symbol) Return ChildCurrency objects filtered by the symbol column * @method array findByRate(double $rate) Return ChildCurrency objects filtered by the rate column + * @method array findByPosition(int $position) Return ChildCurrency objects filtered by the position column * @method array findByByDefault(int $by_default) Return ChildCurrency objects filtered by the by_default column * @method array findByCreatedAt(string $created_at) Return ChildCurrency objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildCurrency objects filtered by the updated_at column @@ -164,7 +168,7 @@ abstract class CurrencyQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, SYMBOL, RATE, BY_DEFAULT, CREATED_AT, UPDATED_AT FROM currency WHERE ID = :p0'; + $sql = 'SELECT ID, CODE, SYMBOL, RATE, POSITION, BY_DEFAULT, CREATED_AT, UPDATED_AT FROM currency WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -393,6 +397,47 @@ abstract class CurrencyQuery extends ModelCriteria return $this->addUsingAlias(CurrencyTableMap::RATE, $rate, $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 ChildCurrencyQuery 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(CurrencyTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($position['max'])) { + $this->addUsingAlias(CurrencyTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CurrencyTableMap::POSITION, $position, $comparison); + } + /** * Filter the query on the by_default column * diff --git a/core/lib/Thelia/Model/Base/Lang.php b/core/lib/Thelia/Model/Base/Lang.php index 694f86bc5..3379594ef 100644 --- a/core/lib/Thelia/Model/Base/Lang.php +++ b/core/lib/Thelia/Model/Base/Lang.php @@ -84,6 +84,12 @@ abstract class Lang implements ActiveRecordInterface */ protected $url; + /** + * The value for the position field. + * @var int + */ + protected $position; + /** * The value for the by_default field. * @var int @@ -419,6 +425,17 @@ abstract class Lang implements ActiveRecordInterface return $this->url; } + /** + * Get the [position] column value. + * + * @return int + */ + public function getPosition() + { + + return $this->position; + } + /** * Get the [by_default] column value. * @@ -575,6 +592,27 @@ abstract class Lang implements ActiveRecordInterface return $this; } // setUrl() + /** + * 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() + /** * Set the value of [by_default] column. * @@ -690,16 +728,19 @@ 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('ByDefault', TableMap::TYPE_PHPNAME, $indexType)]; + $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 ? 6 + $startcol : LangTableMap::translateFieldName('ByDefault', TableMap::TYPE_PHPNAME, $indexType)]; $this->by_default = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : LangTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $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 ? 7 + $startcol : LangTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : LangTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -712,7 +753,7 @@ abstract class Lang implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 8; // 8 = LangTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 9; // 9 = LangTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Lang object", 0, $e); @@ -947,6 +988,9 @@ 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::BY_DEFAULT)) { $modifiedColumns[':p' . $index++] = 'BY_DEFAULT'; } @@ -982,6 +1026,9 @@ 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); + break; case 'BY_DEFAULT': $stmt->bindValue($identifier, $this->by_default, PDO::PARAM_INT); break; @@ -1069,12 +1116,15 @@ abstract class Lang implements ActiveRecordInterface return $this->getUrl(); break; case 5: - return $this->getByDefault(); + return $this->getPosition(); break; case 6: - return $this->getCreatedAt(); + return $this->getByDefault(); break; case 7: + return $this->getCreatedAt(); + break; + case 8: return $this->getUpdatedAt(); break; default: @@ -1110,9 +1160,10 @@ abstract class Lang implements ActiveRecordInterface $keys[2] => $this->getCode(), $keys[3] => $this->getLocale(), $keys[4] => $this->getUrl(), - $keys[5] => $this->getByDefault(), - $keys[6] => $this->getCreatedAt(), - $keys[7] => $this->getUpdatedAt(), + $keys[5] => $this->getPosition(), + $keys[6] => $this->getByDefault(), + $keys[7] => $this->getCreatedAt(), + $keys[8] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1169,12 +1220,15 @@ abstract class Lang implements ActiveRecordInterface $this->setUrl($value); break; case 5: - $this->setByDefault($value); + $this->setPosition($value); break; case 6: - $this->setCreatedAt($value); + $this->setByDefault($value); break; case 7: + $this->setCreatedAt($value); + break; + case 8: $this->setUpdatedAt($value); break; } // switch() @@ -1206,9 +1260,10 @@ 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->setByDefault($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[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]]); } /** @@ -1225,6 +1280,7 @@ 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::BY_DEFAULT)) $criteria->add(LangTableMap::BY_DEFAULT, $this->by_default); 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); @@ -1295,6 +1351,7 @@ abstract class Lang implements ActiveRecordInterface $copyObj->setCode($this->getCode()); $copyObj->setLocale($this->getLocale()); $copyObj->setUrl($this->getUrl()); + $copyObj->setPosition($this->getPosition()); $copyObj->setByDefault($this->getByDefault()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1336,6 +1393,7 @@ abstract class Lang implements ActiveRecordInterface $this->code = null; $this->locale = null; $this->url = null; + $this->position = null; $this->by_default = null; $this->created_at = null; $this->updated_at = null; diff --git a/core/lib/Thelia/Model/Base/LangQuery.php b/core/lib/Thelia/Model/Base/LangQuery.php index 1a99ff28a..a5100c5f8 100644 --- a/core/lib/Thelia/Model/Base/LangQuery.php +++ b/core/lib/Thelia/Model/Base/LangQuery.php @@ -23,6 +23,7 @@ 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 orderByByDefault($order = Criteria::ASC) Order by the by_default 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 @@ -32,6 +33,7 @@ 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 groupByByDefault() Group by the by_default column * @method ChildLangQuery groupByCreatedAt() Group by the created_at column * @method ChildLangQuery groupByUpdatedAt() Group by the updated_at column @@ -48,6 +50,7 @@ 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 findOneByByDefault(int $by_default) Return the first ChildLang filtered by the by_default 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 @@ -57,6 +60,7 @@ 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 findByByDefault(int $by_default) Return ChildLang objects filtered by the by_default 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 @@ -148,7 +152,7 @@ abstract class LangQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, TITLE, CODE, LOCALE, URL, BY_DEFAULT, CREATED_AT, UPDATED_AT FROM lang WHERE ID = :p0'; + $sql = 'SELECT ID, TITLE, CODE, LOCALE, URL, POSITION, BY_DEFAULT, CREATED_AT, UPDATED_AT FROM lang WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -394,6 +398,47 @@ abstract class LangQuery extends ModelCriteria return $this->addUsingAlias(LangTableMap::URL, $url, $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 by_default column * diff --git a/core/lib/Thelia/Model/Base/Product.php b/core/lib/Thelia/Model/Base/Product.php index 854c88ccb..9a1828e25 100644 --- a/core/lib/Thelia/Model/Base/Product.php +++ b/core/lib/Thelia/Model/Base/Product.php @@ -34,13 +34,13 @@ use Thelia\Model\ProductDocument as ChildProductDocument; use Thelia\Model\ProductDocumentQuery as ChildProductDocumentQuery; use Thelia\Model\ProductI18n as ChildProductI18n; use Thelia\Model\ProductI18nQuery as ChildProductI18nQuery; +use Thelia\Model\ProductImage as ChildProductImage; +use Thelia\Model\ProductImageQuery as ChildProductImageQuery; use Thelia\Model\ProductQuery as ChildProductQuery; 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\ProdutImage as ChildProdutImage; -use Thelia\Model\ProdutImageQuery as ChildProdutImageQuery; use Thelia\Model\Rewriting as ChildRewriting; use Thelia\Model\RewritingQuery as ChildRewritingQuery; use Thelia\Model\TaxRule as ChildTaxRule; @@ -174,10 +174,10 @@ abstract class Product implements ActiveRecordInterface protected $collContentAssocsPartial; /** - * @var ObjectCollection|ChildProdutImage[] Collection to store aggregation of ChildProdutImage objects. + * @var ObjectCollection|ChildProductImage[] Collection to store aggregation of ChildProductImage objects. */ - protected $collProdutImages; - protected $collProdutImagesPartial; + protected $collProductImages; + protected $collProductImagesPartial; /** * @var ObjectCollection|ChildProductDocument[] Collection to store aggregation of ChildProductDocument objects. @@ -312,7 +312,7 @@ abstract class Product implements ActiveRecordInterface * An array of objects scheduled for deletion. * @var ObjectCollection */ - protected $produtImagesScheduledForDeletion = null; + protected $productImagesScheduledForDeletion = null; /** * An array of objects scheduled for deletion. @@ -1139,7 +1139,7 @@ abstract class Product implements ActiveRecordInterface $this->collContentAssocs = null; - $this->collProdutImages = null; + $this->collProductImages = null; $this->collProductDocuments = null; @@ -1464,17 +1464,17 @@ abstract class Product implements ActiveRecordInterface } } - if ($this->produtImagesScheduledForDeletion !== null) { - if (!$this->produtImagesScheduledForDeletion->isEmpty()) { - \Thelia\Model\ProdutImageQuery::create() - ->filterByPrimaryKeys($this->produtImagesScheduledForDeletion->getPrimaryKeys(false)) + if ($this->productImagesScheduledForDeletion !== null) { + if (!$this->productImagesScheduledForDeletion->isEmpty()) { + \Thelia\Model\ProductImageQuery::create() + ->filterByPrimaryKeys($this->productImagesScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); - $this->produtImagesScheduledForDeletion = null; + $this->productImagesScheduledForDeletion = null; } } - if ($this->collProdutImages !== null) { - foreach ($this->collProdutImages as $referrerFK) { + if ($this->collProductImages !== null) { + foreach ($this->collProductImages as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } @@ -1851,8 +1851,8 @@ abstract class Product implements ActiveRecordInterface if (null !== $this->collContentAssocs) { $result['ContentAssocs'] = $this->collContentAssocs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } - if (null !== $this->collProdutImages) { - $result['ProdutImages'] = $this->collProdutImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + if (null !== $this->collProductImages) { + $result['ProductImages'] = $this->collProductImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collProductDocuments) { $result['ProductDocuments'] = $this->collProductDocuments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); @@ -2096,9 +2096,9 @@ abstract class Product implements ActiveRecordInterface } } - foreach ($this->getProdutImages() as $relObj) { + foreach ($this->getProductImages() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addProdutImage($relObj->copy($deepCopy)); + $copyObj->addProductImage($relObj->copy($deepCopy)); } } @@ -2248,8 +2248,8 @@ abstract class Product implements ActiveRecordInterface if ('ContentAssoc' == $relationName) { return $this->initContentAssocs(); } - if ('ProdutImage' == $relationName) { - return $this->initProdutImages(); + if ('ProductImage' == $relationName) { + return $this->initProductImages(); } if ('ProductDocument' == $relationName) { return $this->initProductDocuments(); @@ -3275,31 +3275,31 @@ abstract class Product implements ActiveRecordInterface } /** - * Clears out the collProdutImages collection + * Clears out the collProductImages 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 addProdutImages() + * @see addProductImages() */ - public function clearProdutImages() + public function clearProductImages() { - $this->collProdutImages = null; // important to set this to NULL since that means it is uninitialized + $this->collProductImages = null; // important to set this to NULL since that means it is uninitialized } /** - * Reset is the collProdutImages collection loaded partially. + * Reset is the collProductImages collection loaded partially. */ - public function resetPartialProdutImages($v = true) + public function resetPartialProductImages($v = true) { - $this->collProdutImagesPartial = $v; + $this->collProductImagesPartial = $v; } /** - * Initializes the collProdutImages collection. + * Initializes the collProductImages collection. * - * By default this just sets the collProdutImages collection to an empty array (like clearcollProdutImages()); + * By default this just sets the collProductImages collection to an empty array (like clearcollProductImages()); * 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. * @@ -3308,17 +3308,17 @@ abstract class Product implements ActiveRecordInterface * * @return void */ - public function initProdutImages($overrideExisting = true) + public function initProductImages($overrideExisting = true) { - if (null !== $this->collProdutImages && !$overrideExisting) { + if (null !== $this->collProductImages && !$overrideExisting) { return; } - $this->collProdutImages = new ObjectCollection(); - $this->collProdutImages->setModel('\Thelia\Model\ProdutImage'); + $this->collProductImages = new ObjectCollection(); + $this->collProductImages->setModel('\Thelia\Model\ProductImage'); } /** - * Gets an array of ChildProdutImage objects which contain a foreign key that references this object. + * Gets an array of ChildProductImage 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. @@ -3328,109 +3328,109 @@ abstract class Product implements ActiveRecordInterface * * @param Criteria $criteria optional Criteria object to narrow the query * @param ConnectionInterface $con optional connection object - * @return Collection|ChildProdutImage[] List of ChildProdutImage objects + * @return Collection|ChildProductImage[] List of ChildProductImage objects * @throws PropelException */ - public function getProdutImages($criteria = null, ConnectionInterface $con = null) + public function getProductImages($criteria = null, ConnectionInterface $con = null) { - $partial = $this->collProdutImagesPartial && !$this->isNew(); - if (null === $this->collProdutImages || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collProdutImages) { + $partial = $this->collProductImagesPartial && !$this->isNew(); + if (null === $this->collProductImages || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collProductImages) { // return empty collection - $this->initProdutImages(); + $this->initProductImages(); } else { - $collProdutImages = ChildProdutImageQuery::create(null, $criteria) + $collProductImages = ChildProductImageQuery::create(null, $criteria) ->filterByProduct($this) ->find($con); if (null !== $criteria) { - if (false !== $this->collProdutImagesPartial && count($collProdutImages)) { - $this->initProdutImages(false); + if (false !== $this->collProductImagesPartial && count($collProductImages)) { + $this->initProductImages(false); - foreach ($collProdutImages as $obj) { - if (false == $this->collProdutImages->contains($obj)) { - $this->collProdutImages->append($obj); + foreach ($collProductImages as $obj) { + if (false == $this->collProductImages->contains($obj)) { + $this->collProductImages->append($obj); } } - $this->collProdutImagesPartial = true; + $this->collProductImagesPartial = true; } - $collProdutImages->getInternalIterator()->rewind(); + $collProductImages->getInternalIterator()->rewind(); - return $collProdutImages; + return $collProductImages; } - if ($partial && $this->collProdutImages) { - foreach ($this->collProdutImages as $obj) { + if ($partial && $this->collProductImages) { + foreach ($this->collProductImages as $obj) { if ($obj->isNew()) { - $collProdutImages[] = $obj; + $collProductImages[] = $obj; } } } - $this->collProdutImages = $collProdutImages; - $this->collProdutImagesPartial = false; + $this->collProductImages = $collProductImages; + $this->collProductImagesPartial = false; } } - return $this->collProdutImages; + return $this->collProductImages; } /** - * Sets a collection of ProdutImage objects related by a one-to-many relationship + * Sets a collection of ProductImage 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 $produtImages A Propel collection. + * @param Collection $productImages A Propel collection. * @param ConnectionInterface $con Optional connection object * @return ChildProduct The current object (for fluent API support) */ - public function setProdutImages(Collection $produtImages, ConnectionInterface $con = null) + public function setProductImages(Collection $productImages, ConnectionInterface $con = null) { - $produtImagesToDelete = $this->getProdutImages(new Criteria(), $con)->diff($produtImages); + $productImagesToDelete = $this->getProductImages(new Criteria(), $con)->diff($productImages); - $this->produtImagesScheduledForDeletion = $produtImagesToDelete; + $this->productImagesScheduledForDeletion = $productImagesToDelete; - foreach ($produtImagesToDelete as $produtImageRemoved) { - $produtImageRemoved->setProduct(null); + foreach ($productImagesToDelete as $productImageRemoved) { + $productImageRemoved->setProduct(null); } - $this->collProdutImages = null; - foreach ($produtImages as $produtImage) { - $this->addProdutImage($produtImage); + $this->collProductImages = null; + foreach ($productImages as $productImage) { + $this->addProductImage($productImage); } - $this->collProdutImages = $produtImages; - $this->collProdutImagesPartial = false; + $this->collProductImages = $productImages; + $this->collProductImagesPartial = false; return $this; } /** - * Returns the number of related ProdutImage objects. + * Returns the number of related ProductImage objects. * * @param Criteria $criteria * @param boolean $distinct * @param ConnectionInterface $con - * @return int Count of related ProdutImage objects. + * @return int Count of related ProductImage objects. * @throws PropelException */ - public function countProdutImages(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countProductImages(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { - $partial = $this->collProdutImagesPartial && !$this->isNew(); - if (null === $this->collProdutImages || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collProdutImages) { + $partial = $this->collProductImagesPartial && !$this->isNew(); + if (null === $this->collProductImages || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collProductImages) { return 0; } if ($partial && !$criteria) { - return count($this->getProdutImages()); + return count($this->getProductImages()); } - $query = ChildProdutImageQuery::create(null, $criteria); + $query = ChildProductImageQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } @@ -3440,53 +3440,53 @@ abstract class Product implements ActiveRecordInterface ->count($con); } - return count($this->collProdutImages); + return count($this->collProductImages); } /** - * Method called to associate a ChildProdutImage object to this object - * through the ChildProdutImage foreign key attribute. + * Method called to associate a ChildProductImage object to this object + * through the ChildProductImage foreign key attribute. * - * @param ChildProdutImage $l ChildProdutImage + * @param ChildProductImage $l ChildProductImage * @return \Thelia\Model\Product The current object (for fluent API support) */ - public function addProdutImage(ChildProdutImage $l) + public function addProductImage(ChildProductImage $l) { - if ($this->collProdutImages === null) { - $this->initProdutImages(); - $this->collProdutImagesPartial = true; + if ($this->collProductImages === null) { + $this->initProductImages(); + $this->collProductImagesPartial = true; } - if (!in_array($l, $this->collProdutImages->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddProdutImage($l); + if (!in_array($l, $this->collProductImages->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddProductImage($l); } return $this; } /** - * @param ProdutImage $produtImage The produtImage object to add. + * @param ProductImage $productImage The productImage object to add. */ - protected function doAddProdutImage($produtImage) + protected function doAddProductImage($productImage) { - $this->collProdutImages[]= $produtImage; - $produtImage->setProduct($this); + $this->collProductImages[]= $productImage; + $productImage->setProduct($this); } /** - * @param ProdutImage $produtImage The produtImage object to remove. + * @param ProductImage $productImage The productImage object to remove. * @return ChildProduct The current object (for fluent API support) */ - public function removeProdutImage($produtImage) + public function removeProductImage($productImage) { - if ($this->getProdutImages()->contains($produtImage)) { - $this->collProdutImages->remove($this->collProdutImages->search($produtImage)); - if (null === $this->produtImagesScheduledForDeletion) { - $this->produtImagesScheduledForDeletion = clone $this->collProdutImages; - $this->produtImagesScheduledForDeletion->clear(); + if ($this->getProductImages()->contains($productImage)) { + $this->collProductImages->remove($this->collProductImages->search($productImage)); + if (null === $this->productImagesScheduledForDeletion) { + $this->productImagesScheduledForDeletion = clone $this->collProductImages; + $this->productImagesScheduledForDeletion->clear(); } - $this->produtImagesScheduledForDeletion[]= clone $produtImage; - $produtImage->setProduct(null); + $this->productImagesScheduledForDeletion[]= clone $productImage; + $productImage->setProduct(null); } return $this; @@ -5757,8 +5757,8 @@ abstract class Product implements ActiveRecordInterface $o->clearAllReferences($deep); } } - if ($this->collProdutImages) { - foreach ($this->collProdutImages as $o) { + if ($this->collProductImages) { + foreach ($this->collProductImages as $o) { $o->clearAllReferences($deep); } } @@ -5834,10 +5834,10 @@ abstract class Product implements ActiveRecordInterface $this->collContentAssocs->clearIterator(); } $this->collContentAssocs = null; - if ($this->collProdutImages instanceof Collection) { - $this->collProdutImages->clearIterator(); + if ($this->collProductImages instanceof Collection) { + $this->collProductImages->clearIterator(); } - $this->collProdutImages = null; + $this->collProductImages = null; if ($this->collProductDocuments instanceof Collection) { $this->collProductDocuments->clearIterator(); } diff --git a/core/lib/Thelia/Model/Base/ProdutImage.php b/core/lib/Thelia/Model/Base/ProductImage.php similarity index 78% rename from core/lib/Thelia/Model/Base/ProdutImage.php rename to core/lib/Thelia/Model/Base/ProductImage.php index 99a39d319..0b4030ccb 100644 --- a/core/lib/Thelia/Model/Base/ProdutImage.php +++ b/core/lib/Thelia/Model/Base/ProductImage.php @@ -18,19 +18,19 @@ use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; use Thelia\Model\Product as ChildProduct; +use Thelia\Model\ProductImage as ChildProductImage; +use Thelia\Model\ProductImageI18n as ChildProductImageI18n; +use Thelia\Model\ProductImageI18nQuery as ChildProductImageI18nQuery; +use Thelia\Model\ProductImageQuery as ChildProductImageQuery; use Thelia\Model\ProductQuery as ChildProductQuery; -use Thelia\Model\ProdutImage as ChildProdutImage; -use Thelia\Model\ProdutImageI18n as ChildProdutImageI18n; -use Thelia\Model\ProdutImageI18nQuery as ChildProdutImageI18nQuery; -use Thelia\Model\ProdutImageQuery as ChildProdutImageQuery; -use Thelia\Model\Map\ProdutImageTableMap; +use Thelia\Model\Map\ProductImageTableMap; -abstract class ProdutImage implements ActiveRecordInterface +abstract class ProductImage implements ActiveRecordInterface { /** * TableMap class name */ - const TABLE_MAP = '\\Thelia\\Model\\Map\\ProdutImageTableMap'; + const TABLE_MAP = '\\Thelia\\Model\\Map\\ProductImageTableMap'; /** @@ -101,10 +101,10 @@ abstract class ProdutImage implements ActiveRecordInterface protected $aProduct; /** - * @var ObjectCollection|ChildProdutImageI18n[] Collection to store aggregation of ChildProdutImageI18n objects. + * @var ObjectCollection|ChildProductImageI18n[] Collection to store aggregation of ChildProductImageI18n objects. */ - protected $collProdutImageI18ns; - protected $collProdutImageI18nsPartial; + protected $collProductImageI18ns; + protected $collProductImageI18nsPartial; /** * Flag to prevent endless save loop, if this object is referenced @@ -124,7 +124,7 @@ abstract class ProdutImage implements ActiveRecordInterface /** * Current translation objects - * @var array[ChildProdutImageI18n] + * @var array[ChildProductImageI18n] */ protected $currentTranslations; @@ -132,10 +132,10 @@ abstract class ProdutImage implements ActiveRecordInterface * An array of objects scheduled for deletion. * @var ObjectCollection */ - protected $produtImageI18nsScheduledForDeletion = null; + protected $productImageI18nsScheduledForDeletion = null; /** - * Initializes internal state of Thelia\Model\Base\ProdutImage object. + * Initializes internal state of Thelia\Model\Base\ProductImage object. */ public function __construct() { @@ -230,9 +230,9 @@ abstract class ProdutImage implements ActiveRecordInterface } /** - * Compares this with another ProdutImage instance. If - * obj is an instance of ProdutImage, delegates to - * equals(ProdutImage). Otherwise, returns false. + * Compares this with another ProductImage instance. If + * obj is an instance of ProductImage, delegates to + * equals(ProductImage). Otherwise, returns false. * * @param obj The object to compare to. * @return Whether equal to the object specified. @@ -313,7 +313,7 @@ abstract class ProdutImage implements ActiveRecordInterface * @param string $name The virtual column name * @param mixed $value The value to give to the virtual column * - * @return ProdutImage The current object, for fluid interface + * @return ProductImage The current object, for fluid interface */ public function setVirtualColumn($name, $value) { @@ -345,7 +345,7 @@ abstract class ProdutImage implements ActiveRecordInterface * or a format name ('XML', 'YAML', 'JSON', 'CSV') * @param string $data The source data to import from * - * @return ProdutImage The current object, for fluid interface + * @return ProductImage The current object, for fluid interface */ public function importFrom($parser, $data) { @@ -476,7 +476,7 @@ abstract class ProdutImage implements ActiveRecordInterface * Set the value of [id] column. * * @param int $v new value - * @return \Thelia\Model\ProdutImage The current object (for fluent API support) + * @return \Thelia\Model\ProductImage The current object (for fluent API support) */ public function setId($v) { @@ -486,7 +486,7 @@ abstract class ProdutImage implements ActiveRecordInterface if ($this->id !== $v) { $this->id = $v; - $this->modifiedColumns[] = ProdutImageTableMap::ID; + $this->modifiedColumns[] = ProductImageTableMap::ID; } @@ -497,7 +497,7 @@ abstract class ProdutImage implements ActiveRecordInterface * Set the value of [product_id] column. * * @param int $v new value - * @return \Thelia\Model\ProdutImage The current object (for fluent API support) + * @return \Thelia\Model\ProductImage The current object (for fluent API support) */ public function setProductId($v) { @@ -507,7 +507,7 @@ abstract class ProdutImage implements ActiveRecordInterface if ($this->product_id !== $v) { $this->product_id = $v; - $this->modifiedColumns[] = ProdutImageTableMap::PRODUCT_ID; + $this->modifiedColumns[] = ProductImageTableMap::PRODUCT_ID; } if ($this->aProduct !== null && $this->aProduct->getId() !== $v) { @@ -522,7 +522,7 @@ abstract class ProdutImage implements ActiveRecordInterface * Set the value of [file] column. * * @param string $v new value - * @return \Thelia\Model\ProdutImage The current object (for fluent API support) + * @return \Thelia\Model\ProductImage The current object (for fluent API support) */ public function setFile($v) { @@ -532,7 +532,7 @@ abstract class ProdutImage implements ActiveRecordInterface if ($this->file !== $v) { $this->file = $v; - $this->modifiedColumns[] = ProdutImageTableMap::FILE; + $this->modifiedColumns[] = ProductImageTableMap::FILE; } @@ -543,7 +543,7 @@ abstract class ProdutImage implements ActiveRecordInterface * Set the value of [position] column. * * @param int $v new value - * @return \Thelia\Model\ProdutImage The current object (for fluent API support) + * @return \Thelia\Model\ProductImage The current object (for fluent API support) */ public function setPosition($v) { @@ -553,7 +553,7 @@ abstract class ProdutImage implements ActiveRecordInterface if ($this->position !== $v) { $this->position = $v; - $this->modifiedColumns[] = ProdutImageTableMap::POSITION; + $this->modifiedColumns[] = ProductImageTableMap::POSITION; } @@ -565,7 +565,7 @@ abstract class ProdutImage implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\ProdutImage The current object (for fluent API support) + * @return \Thelia\Model\ProductImage The current object (for fluent API support) */ public function setCreatedAt($v) { @@ -573,7 +573,7 @@ abstract class ProdutImage implements ActiveRecordInterface if ($this->created_at !== null || $dt !== null) { if ($dt !== $this->created_at) { $this->created_at = $dt; - $this->modifiedColumns[] = ProdutImageTableMap::CREATED_AT; + $this->modifiedColumns[] = ProductImageTableMap::CREATED_AT; } } // if either are not null @@ -586,7 +586,7 @@ abstract class ProdutImage implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\ProdutImage The current object (for fluent API support) + * @return \Thelia\Model\ProductImage The current object (for fluent API support) */ public function setUpdatedAt($v) { @@ -594,7 +594,7 @@ abstract class ProdutImage implements ActiveRecordInterface if ($this->updated_at !== null || $dt !== null) { if ($dt !== $this->updated_at) { $this->updated_at = $dt; - $this->modifiedColumns[] = ProdutImageTableMap::UPDATED_AT; + $this->modifiedColumns[] = ProductImageTableMap::UPDATED_AT; } } // if either are not null @@ -639,25 +639,25 @@ abstract class ProdutImage implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProdutImageTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProductImageTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProdutImageTableMap::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductImageTableMap::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)]; $this->product_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProdutImageTableMap::translateFieldName('File', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductImageTableMap::translateFieldName('File', TableMap::TYPE_PHPNAME, $indexType)]; $this->file = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProdutImageTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductImageTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; $this->position = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProdutImageTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductImageTableMap::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 : ProdutImageTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductImageTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -670,10 +670,10 @@ abstract class ProdutImage implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 6; // 6 = ProdutImageTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = ProductImageTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException("Error populating \Thelia\Model\ProdutImage object", 0, $e); + throw new PropelException("Error populating \Thelia\Model\ProductImage object", 0, $e); } } @@ -718,13 +718,13 @@ abstract class ProdutImage implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ProdutImageTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ProductImageTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. - $dataFetcher = ChildProdutImageQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $dataFetcher = ChildProductImageQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { @@ -735,7 +735,7 @@ abstract class ProdutImage implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? $this->aProduct = null; - $this->collProdutImageI18ns = null; + $this->collProductImageI18ns = null; } // if (deep) } @@ -746,8 +746,8 @@ abstract class ProdutImage implements ActiveRecordInterface * @param ConnectionInterface $con * @return void * @throws PropelException - * @see ProdutImage::setDeleted() - * @see ProdutImage::isDeleted() + * @see ProductImage::setDeleted() + * @see ProductImage::isDeleted() */ public function delete(ConnectionInterface $con = null) { @@ -756,12 +756,12 @@ abstract class ProdutImage implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageTableMap::DATABASE_NAME); } $con->beginTransaction(); try { - $deleteQuery = ChildProdutImageQuery::create() + $deleteQuery = ChildProductImageQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { @@ -798,7 +798,7 @@ abstract class ProdutImage implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageTableMap::DATABASE_NAME); } $con->beginTransaction(); @@ -808,16 +808,16 @@ abstract class ProdutImage implements ActiveRecordInterface if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - if (!$this->isColumnModified(ProdutImageTableMap::CREATED_AT)) { + if (!$this->isColumnModified(ProductImageTableMap::CREATED_AT)) { $this->setCreatedAt(time()); } - if (!$this->isColumnModified(ProdutImageTableMap::UPDATED_AT)) { + if (!$this->isColumnModified(ProductImageTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } else { $ret = $ret && $this->preUpdate($con); // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ProdutImageTableMap::UPDATED_AT)) { + if ($this->isModified() && !$this->isColumnModified(ProductImageTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } @@ -829,7 +829,7 @@ abstract class ProdutImage implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - ProdutImageTableMap::addInstanceToPool($this); + ProductImageTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -882,17 +882,17 @@ abstract class ProdutImage implements ActiveRecordInterface $this->resetModified(); } - if ($this->produtImageI18nsScheduledForDeletion !== null) { - if (!$this->produtImageI18nsScheduledForDeletion->isEmpty()) { - \Thelia\Model\ProdutImageI18nQuery::create() - ->filterByPrimaryKeys($this->produtImageI18nsScheduledForDeletion->getPrimaryKeys(false)) + if ($this->productImageI18nsScheduledForDeletion !== null) { + if (!$this->productImageI18nsScheduledForDeletion->isEmpty()) { + \Thelia\Model\ProductImageI18nQuery::create() + ->filterByPrimaryKeys($this->productImageI18nsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); - $this->produtImageI18nsScheduledForDeletion = null; + $this->productImageI18nsScheduledForDeletion = null; } } - if ($this->collProdutImageI18ns !== null) { - foreach ($this->collProdutImageI18ns as $referrerFK) { + if ($this->collProductImageI18ns !== null) { + foreach ($this->collProductImageI18ns as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } @@ -919,33 +919,33 @@ abstract class ProdutImage implements ActiveRecordInterface $modifiedColumns = array(); $index = 0; - $this->modifiedColumns[] = ProdutImageTableMap::ID; + $this->modifiedColumns[] = ProductImageTableMap::ID; if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ProdutImageTableMap::ID . ')'); + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ProductImageTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ProdutImageTableMap::ID)) { + if ($this->isColumnModified(ProductImageTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(ProdutImageTableMap::PRODUCT_ID)) { + if ($this->isColumnModified(ProductImageTableMap::PRODUCT_ID)) { $modifiedColumns[':p' . $index++] = 'PRODUCT_ID'; } - if ($this->isColumnModified(ProdutImageTableMap::FILE)) { + if ($this->isColumnModified(ProductImageTableMap::FILE)) { $modifiedColumns[':p' . $index++] = 'FILE'; } - if ($this->isColumnModified(ProdutImageTableMap::POSITION)) { + if ($this->isColumnModified(ProductImageTableMap::POSITION)) { $modifiedColumns[':p' . $index++] = 'POSITION'; } - if ($this->isColumnModified(ProdutImageTableMap::CREATED_AT)) { + if ($this->isColumnModified(ProductImageTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } - if ($this->isColumnModified(ProdutImageTableMap::UPDATED_AT)) { + if ($this->isColumnModified(ProductImageTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = 'UPDATED_AT'; } $sql = sprintf( - 'INSERT INTO produt_image (%s) VALUES (%s)', + 'INSERT INTO product_image (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -1018,7 +1018,7 @@ abstract class ProdutImage implements ActiveRecordInterface */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { - $pos = ProdutImageTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ProductImageTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); return $field; @@ -1075,11 +1075,11 @@ abstract class ProdutImage implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['ProdutImage'][$this->getPrimaryKey()])) { + if (isset($alreadyDumpedObjects['ProductImage'][$this->getPrimaryKey()])) { return '*RECURSION*'; } - $alreadyDumpedObjects['ProdutImage'][$this->getPrimaryKey()] = true; - $keys = ProdutImageTableMap::getFieldNames($keyType); + $alreadyDumpedObjects['ProductImage'][$this->getPrimaryKey()] = true; + $keys = ProductImageTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getProductId(), @@ -1098,8 +1098,8 @@ abstract class ProdutImage implements ActiveRecordInterface if (null !== $this->aProduct) { $result['Product'] = $this->aProduct->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } - if (null !== $this->collProdutImageI18ns) { - $result['ProdutImageI18ns'] = $this->collProdutImageI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + if (null !== $this->collProductImageI18ns) { + $result['ProductImageI18ns'] = $this->collProductImageI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } @@ -1119,7 +1119,7 @@ abstract class ProdutImage implements ActiveRecordInterface */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) { - $pos = ProdutImageTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ProductImageTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); return $this->setByPosition($pos, $value); } @@ -1175,7 +1175,7 @@ abstract class ProdutImage implements ActiveRecordInterface */ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { - $keys = ProdutImageTableMap::getFieldNames($keyType); + $keys = ProductImageTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setProductId($arr[$keys[1]]); @@ -1192,14 +1192,14 @@ abstract class ProdutImage implements ActiveRecordInterface */ public function buildCriteria() { - $criteria = new Criteria(ProdutImageTableMap::DATABASE_NAME); + $criteria = new Criteria(ProductImageTableMap::DATABASE_NAME); - if ($this->isColumnModified(ProdutImageTableMap::ID)) $criteria->add(ProdutImageTableMap::ID, $this->id); - if ($this->isColumnModified(ProdutImageTableMap::PRODUCT_ID)) $criteria->add(ProdutImageTableMap::PRODUCT_ID, $this->product_id); - if ($this->isColumnModified(ProdutImageTableMap::FILE)) $criteria->add(ProdutImageTableMap::FILE, $this->file); - if ($this->isColumnModified(ProdutImageTableMap::POSITION)) $criteria->add(ProdutImageTableMap::POSITION, $this->position); - if ($this->isColumnModified(ProdutImageTableMap::CREATED_AT)) $criteria->add(ProdutImageTableMap::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ProdutImageTableMap::UPDATED_AT)) $criteria->add(ProdutImageTableMap::UPDATED_AT, $this->updated_at); + if ($this->isColumnModified(ProductImageTableMap::ID)) $criteria->add(ProductImageTableMap::ID, $this->id); + if ($this->isColumnModified(ProductImageTableMap::PRODUCT_ID)) $criteria->add(ProductImageTableMap::PRODUCT_ID, $this->product_id); + if ($this->isColumnModified(ProductImageTableMap::FILE)) $criteria->add(ProductImageTableMap::FILE, $this->file); + if ($this->isColumnModified(ProductImageTableMap::POSITION)) $criteria->add(ProductImageTableMap::POSITION, $this->position); + if ($this->isColumnModified(ProductImageTableMap::CREATED_AT)) $criteria->add(ProductImageTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(ProductImageTableMap::UPDATED_AT)) $criteria->add(ProductImageTableMap::UPDATED_AT, $this->updated_at); return $criteria; } @@ -1214,8 +1214,8 @@ abstract class ProdutImage implements ActiveRecordInterface */ public function buildPkeyCriteria() { - $criteria = new Criteria(ProdutImageTableMap::DATABASE_NAME); - $criteria->add(ProdutImageTableMap::ID, $this->id); + $criteria = new Criteria(ProductImageTableMap::DATABASE_NAME); + $criteria->add(ProductImageTableMap::ID, $this->id); return $criteria; } @@ -1256,7 +1256,7 @@ abstract class ProdutImage implements ActiveRecordInterface * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \Thelia\Model\ProdutImage (or compatible) type. + * @param object $copyObj An object of \Thelia\Model\ProductImage (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 @@ -1274,9 +1274,9 @@ abstract class ProdutImage implements ActiveRecordInterface // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getProdutImageI18ns() as $relObj) { + foreach ($this->getProductImageI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addProdutImageI18n($relObj->copy($deepCopy)); + $copyObj->addProductImageI18n($relObj->copy($deepCopy)); } } @@ -1297,7 +1297,7 @@ abstract class ProdutImage implements ActiveRecordInterface * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return \Thelia\Model\ProdutImage Clone of current object. + * @return \Thelia\Model\ProductImage Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) @@ -1314,7 +1314,7 @@ abstract class ProdutImage implements ActiveRecordInterface * Declares an association between this object and a ChildProduct object. * * @param ChildProduct $v - * @return \Thelia\Model\ProdutImage The current object (for fluent API support) + * @return \Thelia\Model\ProductImage The current object (for fluent API support) * @throws PropelException */ public function setProduct(ChildProduct $v = null) @@ -1330,7 +1330,7 @@ abstract class ProdutImage 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->addProdutImage($this); + $v->addProductImage($this); } @@ -1354,7 +1354,7 @@ abstract class ProdutImage 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->addProdutImages($this); + $this->aProduct->addProductImages($this); */ } @@ -1372,37 +1372,37 @@ abstract class ProdutImage implements ActiveRecordInterface */ public function initRelation($relationName) { - if ('ProdutImageI18n' == $relationName) { - return $this->initProdutImageI18ns(); + if ('ProductImageI18n' == $relationName) { + return $this->initProductImageI18ns(); } } /** - * Clears out the collProdutImageI18ns collection + * Clears out the collProductImageI18ns 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 addProdutImageI18ns() + * @see addProductImageI18ns() */ - public function clearProdutImageI18ns() + public function clearProductImageI18ns() { - $this->collProdutImageI18ns = null; // important to set this to NULL since that means it is uninitialized + $this->collProductImageI18ns = null; // important to set this to NULL since that means it is uninitialized } /** - * Reset is the collProdutImageI18ns collection loaded partially. + * Reset is the collProductImageI18ns collection loaded partially. */ - public function resetPartialProdutImageI18ns($v = true) + public function resetPartialProductImageI18ns($v = true) { - $this->collProdutImageI18nsPartial = $v; + $this->collProductImageI18nsPartial = $v; } /** - * Initializes the collProdutImageI18ns collection. + * Initializes the collProductImageI18ns collection. * - * By default this just sets the collProdutImageI18ns collection to an empty array (like clearcollProdutImageI18ns()); + * By default this just sets the collProductImageI18ns collection to an empty array (like clearcollProductImageI18ns()); * 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. * @@ -1411,192 +1411,192 @@ abstract class ProdutImage implements ActiveRecordInterface * * @return void */ - public function initProdutImageI18ns($overrideExisting = true) + public function initProductImageI18ns($overrideExisting = true) { - if (null !== $this->collProdutImageI18ns && !$overrideExisting) { + if (null !== $this->collProductImageI18ns && !$overrideExisting) { return; } - $this->collProdutImageI18ns = new ObjectCollection(); - $this->collProdutImageI18ns->setModel('\Thelia\Model\ProdutImageI18n'); + $this->collProductImageI18ns = new ObjectCollection(); + $this->collProductImageI18ns->setModel('\Thelia\Model\ProductImageI18n'); } /** - * Gets an array of ChildProdutImageI18n objects which contain a foreign key that references this object. + * Gets an array of ChildProductImageI18n 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 ChildProdutImage is new, it will return + * If this ChildProductImage 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|ChildProdutImageI18n[] List of ChildProdutImageI18n objects + * @return Collection|ChildProductImageI18n[] List of ChildProductImageI18n objects * @throws PropelException */ - public function getProdutImageI18ns($criteria = null, ConnectionInterface $con = null) + public function getProductImageI18ns($criteria = null, ConnectionInterface $con = null) { - $partial = $this->collProdutImageI18nsPartial && !$this->isNew(); - if (null === $this->collProdutImageI18ns || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collProdutImageI18ns) { + $partial = $this->collProductImageI18nsPartial && !$this->isNew(); + if (null === $this->collProductImageI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collProductImageI18ns) { // return empty collection - $this->initProdutImageI18ns(); + $this->initProductImageI18ns(); } else { - $collProdutImageI18ns = ChildProdutImageI18nQuery::create(null, $criteria) - ->filterByProdutImage($this) + $collProductImageI18ns = ChildProductImageI18nQuery::create(null, $criteria) + ->filterByProductImage($this) ->find($con); if (null !== $criteria) { - if (false !== $this->collProdutImageI18nsPartial && count($collProdutImageI18ns)) { - $this->initProdutImageI18ns(false); + if (false !== $this->collProductImageI18nsPartial && count($collProductImageI18ns)) { + $this->initProductImageI18ns(false); - foreach ($collProdutImageI18ns as $obj) { - if (false == $this->collProdutImageI18ns->contains($obj)) { - $this->collProdutImageI18ns->append($obj); + foreach ($collProductImageI18ns as $obj) { + if (false == $this->collProductImageI18ns->contains($obj)) { + $this->collProductImageI18ns->append($obj); } } - $this->collProdutImageI18nsPartial = true; + $this->collProductImageI18nsPartial = true; } - $collProdutImageI18ns->getInternalIterator()->rewind(); + $collProductImageI18ns->getInternalIterator()->rewind(); - return $collProdutImageI18ns; + return $collProductImageI18ns; } - if ($partial && $this->collProdutImageI18ns) { - foreach ($this->collProdutImageI18ns as $obj) { + if ($partial && $this->collProductImageI18ns) { + foreach ($this->collProductImageI18ns as $obj) { if ($obj->isNew()) { - $collProdutImageI18ns[] = $obj; + $collProductImageI18ns[] = $obj; } } } - $this->collProdutImageI18ns = $collProdutImageI18ns; - $this->collProdutImageI18nsPartial = false; + $this->collProductImageI18ns = $collProductImageI18ns; + $this->collProductImageI18nsPartial = false; } } - return $this->collProdutImageI18ns; + return $this->collProductImageI18ns; } /** - * Sets a collection of ProdutImageI18n objects related by a one-to-many relationship + * Sets a collection of ProductImageI18n 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 $produtImageI18ns A Propel collection. + * @param Collection $productImageI18ns A Propel collection. * @param ConnectionInterface $con Optional connection object - * @return ChildProdutImage The current object (for fluent API support) + * @return ChildProductImage The current object (for fluent API support) */ - public function setProdutImageI18ns(Collection $produtImageI18ns, ConnectionInterface $con = null) + public function setProductImageI18ns(Collection $productImageI18ns, ConnectionInterface $con = null) { - $produtImageI18nsToDelete = $this->getProdutImageI18ns(new Criteria(), $con)->diff($produtImageI18ns); + $productImageI18nsToDelete = $this->getProductImageI18ns(new Criteria(), $con)->diff($productImageI18ns); //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->produtImageI18nsScheduledForDeletion = clone $produtImageI18nsToDelete; + $this->productImageI18nsScheduledForDeletion = clone $productImageI18nsToDelete; - foreach ($produtImageI18nsToDelete as $produtImageI18nRemoved) { - $produtImageI18nRemoved->setProdutImage(null); + foreach ($productImageI18nsToDelete as $productImageI18nRemoved) { + $productImageI18nRemoved->setProductImage(null); } - $this->collProdutImageI18ns = null; - foreach ($produtImageI18ns as $produtImageI18n) { - $this->addProdutImageI18n($produtImageI18n); + $this->collProductImageI18ns = null; + foreach ($productImageI18ns as $productImageI18n) { + $this->addProductImageI18n($productImageI18n); } - $this->collProdutImageI18ns = $produtImageI18ns; - $this->collProdutImageI18nsPartial = false; + $this->collProductImageI18ns = $productImageI18ns; + $this->collProductImageI18nsPartial = false; return $this; } /** - * Returns the number of related ProdutImageI18n objects. + * Returns the number of related ProductImageI18n objects. * * @param Criteria $criteria * @param boolean $distinct * @param ConnectionInterface $con - * @return int Count of related ProdutImageI18n objects. + * @return int Count of related ProductImageI18n objects. * @throws PropelException */ - public function countProdutImageI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countProductImageI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { - $partial = $this->collProdutImageI18nsPartial && !$this->isNew(); - if (null === $this->collProdutImageI18ns || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collProdutImageI18ns) { + $partial = $this->collProductImageI18nsPartial && !$this->isNew(); + if (null === $this->collProductImageI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collProductImageI18ns) { return 0; } if ($partial && !$criteria) { - return count($this->getProdutImageI18ns()); + return count($this->getProductImageI18ns()); } - $query = ChildProdutImageI18nQuery::create(null, $criteria); + $query = ChildProductImageI18nQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query - ->filterByProdutImage($this) + ->filterByProductImage($this) ->count($con); } - return count($this->collProdutImageI18ns); + return count($this->collProductImageI18ns); } /** - * Method called to associate a ChildProdutImageI18n object to this object - * through the ChildProdutImageI18n foreign key attribute. + * Method called to associate a ChildProductImageI18n object to this object + * through the ChildProductImageI18n foreign key attribute. * - * @param ChildProdutImageI18n $l ChildProdutImageI18n - * @return \Thelia\Model\ProdutImage The current object (for fluent API support) + * @param ChildProductImageI18n $l ChildProductImageI18n + * @return \Thelia\Model\ProductImage The current object (for fluent API support) */ - public function addProdutImageI18n(ChildProdutImageI18n $l) + public function addProductImageI18n(ChildProductImageI18n $l) { if ($l && $locale = $l->getLocale()) { $this->setLocale($locale); $this->currentTranslations[$locale] = $l; } - if ($this->collProdutImageI18ns === null) { - $this->initProdutImageI18ns(); - $this->collProdutImageI18nsPartial = true; + if ($this->collProductImageI18ns === null) { + $this->initProductImageI18ns(); + $this->collProductImageI18nsPartial = true; } - if (!in_array($l, $this->collProdutImageI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddProdutImageI18n($l); + if (!in_array($l, $this->collProductImageI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddProductImageI18n($l); } return $this; } /** - * @param ProdutImageI18n $produtImageI18n The produtImageI18n object to add. + * @param ProductImageI18n $productImageI18n The productImageI18n object to add. */ - protected function doAddProdutImageI18n($produtImageI18n) + protected function doAddProductImageI18n($productImageI18n) { - $this->collProdutImageI18ns[]= $produtImageI18n; - $produtImageI18n->setProdutImage($this); + $this->collProductImageI18ns[]= $productImageI18n; + $productImageI18n->setProductImage($this); } /** - * @param ProdutImageI18n $produtImageI18n The produtImageI18n object to remove. - * @return ChildProdutImage The current object (for fluent API support) + * @param ProductImageI18n $productImageI18n The productImageI18n object to remove. + * @return ChildProductImage The current object (for fluent API support) */ - public function removeProdutImageI18n($produtImageI18n) + public function removeProductImageI18n($productImageI18n) { - if ($this->getProdutImageI18ns()->contains($produtImageI18n)) { - $this->collProdutImageI18ns->remove($this->collProdutImageI18ns->search($produtImageI18n)); - if (null === $this->produtImageI18nsScheduledForDeletion) { - $this->produtImageI18nsScheduledForDeletion = clone $this->collProdutImageI18ns; - $this->produtImageI18nsScheduledForDeletion->clear(); + if ($this->getProductImageI18ns()->contains($productImageI18n)) { + $this->collProductImageI18ns->remove($this->collProductImageI18ns->search($productImageI18n)); + if (null === $this->productImageI18nsScheduledForDeletion) { + $this->productImageI18nsScheduledForDeletion = clone $this->collProductImageI18ns; + $this->productImageI18nsScheduledForDeletion->clear(); } - $this->produtImageI18nsScheduledForDeletion[]= clone $produtImageI18n; - $produtImageI18n->setProdutImage(null); + $this->productImageI18nsScheduledForDeletion[]= clone $productImageI18n; + $productImageI18n->setProductImage(null); } return $this; @@ -1632,8 +1632,8 @@ abstract class ProdutImage implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collProdutImageI18ns) { - foreach ($this->collProdutImageI18ns as $o) { + if ($this->collProductImageI18ns) { + foreach ($this->collProductImageI18ns as $o) { $o->clearAllReferences($deep); } } @@ -1643,10 +1643,10 @@ abstract class ProdutImage implements ActiveRecordInterface $this->currentLocale = 'en_US'; $this->currentTranslations = null; - if ($this->collProdutImageI18ns instanceof Collection) { - $this->collProdutImageI18ns->clearIterator(); + if ($this->collProductImageI18ns instanceof Collection) { + $this->collProductImageI18ns->clearIterator(); } - $this->collProdutImageI18ns = null; + $this->collProductImageI18ns = null; $this->aProduct = null; } @@ -1657,7 +1657,7 @@ abstract class ProdutImage implements ActiveRecordInterface */ public function __toString() { - return (string) $this->exportTo(ProdutImageTableMap::DEFAULT_STRING_FORMAT); + return (string) $this->exportTo(ProductImageTableMap::DEFAULT_STRING_FORMAT); } // timestampable behavior @@ -1665,11 +1665,11 @@ abstract class ProdutImage implements ActiveRecordInterface /** * Mark the current object so that the update date doesn't get updated during next save * - * @return ChildProdutImage The current object (for fluent API support) + * @return ChildProductImage The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { - $this->modifiedColumns[] = ProdutImageTableMap::UPDATED_AT; + $this->modifiedColumns[] = ProductImageTableMap::UPDATED_AT; return $this; } @@ -1681,7 +1681,7 @@ abstract class ProdutImage implements ActiveRecordInterface * * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * - * @return ChildProdutImage The current object (for fluent API support) + * @return ChildProductImage The current object (for fluent API support) */ public function setLocale($locale = 'en_US') { @@ -1706,12 +1706,12 @@ abstract class ProdutImage implements ActiveRecordInterface * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * @param ConnectionInterface $con an optional connection object * - * @return ChildProdutImageI18n */ + * @return ChildProductImageI18n */ public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { - if (null !== $this->collProdutImageI18ns) { - foreach ($this->collProdutImageI18ns as $translation) { + if (null !== $this->collProductImageI18ns) { + foreach ($this->collProductImageI18ns as $translation) { if ($translation->getLocale() == $locale) { $this->currentTranslations[$locale] = $translation; @@ -1720,15 +1720,15 @@ abstract class ProdutImage implements ActiveRecordInterface } } if ($this->isNew()) { - $translation = new ChildProdutImageI18n(); + $translation = new ChildProductImageI18n(); $translation->setLocale($locale); } else { - $translation = ChildProdutImageI18nQuery::create() + $translation = ChildProductImageI18nQuery::create() ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) ->findOneOrCreate($con); $this->currentTranslations[$locale] = $translation; } - $this->addProdutImageI18n($translation); + $this->addProductImageI18n($translation); } return $this->currentTranslations[$locale]; @@ -1740,21 +1740,21 @@ abstract class ProdutImage implements ActiveRecordInterface * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * @param ConnectionInterface $con an optional connection object * - * @return ChildProdutImage The current object (for fluent API support) + * @return ChildProductImage The current object (for fluent API support) */ public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { - ChildProdutImageI18nQuery::create() + ChildProductImageI18nQuery::create() ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) ->delete($con); } if (isset($this->currentTranslations[$locale])) { unset($this->currentTranslations[$locale]); } - foreach ($this->collProdutImageI18ns as $key => $translation) { + foreach ($this->collProductImageI18ns as $key => $translation) { if ($translation->getLocale() == $locale) { - unset($this->collProdutImageI18ns[$key]); + unset($this->collProductImageI18ns[$key]); break; } } @@ -1767,7 +1767,7 @@ abstract class ProdutImage implements ActiveRecordInterface * * @param ConnectionInterface $con an optional connection object * - * @return ChildProdutImageI18n */ + * @return ChildProductImageI18n */ public function getCurrentTranslation(ConnectionInterface $con = null) { return $this->getTranslation($this->getLocale(), $con); @@ -1789,7 +1789,7 @@ abstract class ProdutImage implements ActiveRecordInterface * Set the value of [title] column. * * @param string $v new value - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) */ public function setTitle($v) { $this->getCurrentTranslation()->setTitle($v); @@ -1813,7 +1813,7 @@ abstract class ProdutImage implements ActiveRecordInterface * Set the value of [description] column. * * @param string $v new value - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) */ public function setDescription($v) { $this->getCurrentTranslation()->setDescription($v); @@ -1837,7 +1837,7 @@ abstract class ProdutImage implements ActiveRecordInterface * Set the value of [chapo] column. * * @param string $v new value - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) */ public function setChapo($v) { $this->getCurrentTranslation()->setChapo($v); @@ -1861,7 +1861,7 @@ abstract class ProdutImage implements ActiveRecordInterface * Set the value of [postscriptum] column. * * @param string $v new value - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) */ public function setPostscriptum($v) { $this->getCurrentTranslation()->setPostscriptum($v); diff --git a/core/lib/Thelia/Model/Base/ProdutImageI18n.php b/core/lib/Thelia/Model/Base/ProductImageI18n.php similarity index 84% rename from core/lib/Thelia/Model/Base/ProdutImageI18n.php rename to core/lib/Thelia/Model/Base/ProductImageI18n.php index 819081db2..634f726a3 100644 --- a/core/lib/Thelia/Model/Base/ProdutImageI18n.php +++ b/core/lib/Thelia/Model/Base/ProductImageI18n.php @@ -14,17 +14,17 @@ use Propel\Runtime\Exception\BadMethodCallException; use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; -use Thelia\Model\ProdutImage as ChildProdutImage; -use Thelia\Model\ProdutImageI18nQuery as ChildProdutImageI18nQuery; -use Thelia\Model\ProdutImageQuery as ChildProdutImageQuery; -use Thelia\Model\Map\ProdutImageI18nTableMap; +use Thelia\Model\ProductImage as ChildProductImage; +use Thelia\Model\ProductImageI18nQuery as ChildProductImageI18nQuery; +use Thelia\Model\ProductImageQuery as ChildProductImageQuery; +use Thelia\Model\Map\ProductImageI18nTableMap; -abstract class ProdutImageI18n implements ActiveRecordInterface +abstract class ProductImageI18n implements ActiveRecordInterface { /** * TableMap class name */ - const TABLE_MAP = '\\Thelia\\Model\\Map\\ProdutImageI18nTableMap'; + const TABLE_MAP = '\\Thelia\\Model\\Map\\ProductImageI18nTableMap'; /** @@ -91,9 +91,9 @@ abstract class ProdutImageI18n implements ActiveRecordInterface protected $postscriptum; /** - * @var ProdutImage + * @var ProductImage */ - protected $aProdutImage; + protected $aProductImage; /** * Flag to prevent endless save loop, if this object is referenced @@ -115,7 +115,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface } /** - * Initializes internal state of Thelia\Model\Base\ProdutImageI18n object. + * Initializes internal state of Thelia\Model\Base\ProductImageI18n object. * @see applyDefaults() */ public function __construct() @@ -212,9 +212,9 @@ abstract class ProdutImageI18n implements ActiveRecordInterface } /** - * Compares this with another ProdutImageI18n instance. If - * obj is an instance of ProdutImageI18n, delegates to - * equals(ProdutImageI18n). Otherwise, returns false. + * Compares this with another ProductImageI18n instance. If + * obj is an instance of ProductImageI18n, delegates to + * equals(ProductImageI18n). Otherwise, returns false. * * @param obj The object to compare to. * @return Whether equal to the object specified. @@ -295,7 +295,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * @param string $name The virtual column name * @param mixed $value The value to give to the virtual column * - * @return ProdutImageI18n The current object, for fluid interface + * @return ProductImageI18n The current object, for fluid interface */ public function setVirtualColumn($name, $value) { @@ -327,7 +327,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * or a format name ('XML', 'YAML', 'JSON', 'CSV') * @param string $data The source data to import from * - * @return ProdutImageI18n The current object, for fluid interface + * @return ProductImageI18n The current object, for fluid interface */ public function importFrom($parser, $data) { @@ -440,7 +440,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * Set the value of [id] column. * * @param int $v new value - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) */ public function setId($v) { @@ -450,11 +450,11 @@ abstract class ProdutImageI18n implements ActiveRecordInterface if ($this->id !== $v) { $this->id = $v; - $this->modifiedColumns[] = ProdutImageI18nTableMap::ID; + $this->modifiedColumns[] = ProductImageI18nTableMap::ID; } - if ($this->aProdutImage !== null && $this->aProdutImage->getId() !== $v) { - $this->aProdutImage = null; + if ($this->aProductImage !== null && $this->aProductImage->getId() !== $v) { + $this->aProductImage = null; } @@ -465,7 +465,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * Set the value of [locale] column. * * @param string $v new value - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) */ public function setLocale($v) { @@ -475,7 +475,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface if ($this->locale !== $v) { $this->locale = $v; - $this->modifiedColumns[] = ProdutImageI18nTableMap::LOCALE; + $this->modifiedColumns[] = ProductImageI18nTableMap::LOCALE; } @@ -486,7 +486,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * Set the value of [title] column. * * @param string $v new value - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) */ public function setTitle($v) { @@ -496,7 +496,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface if ($this->title !== $v) { $this->title = $v; - $this->modifiedColumns[] = ProdutImageI18nTableMap::TITLE; + $this->modifiedColumns[] = ProductImageI18nTableMap::TITLE; } @@ -507,7 +507,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * Set the value of [description] column. * * @param string $v new value - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) */ public function setDescription($v) { @@ -517,7 +517,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface if ($this->description !== $v) { $this->description = $v; - $this->modifiedColumns[] = ProdutImageI18nTableMap::DESCRIPTION; + $this->modifiedColumns[] = ProductImageI18nTableMap::DESCRIPTION; } @@ -528,7 +528,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * Set the value of [chapo] column. * * @param string $v new value - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) */ public function setChapo($v) { @@ -538,7 +538,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface if ($this->chapo !== $v) { $this->chapo = $v; - $this->modifiedColumns[] = ProdutImageI18nTableMap::CHAPO; + $this->modifiedColumns[] = ProductImageI18nTableMap::CHAPO; } @@ -549,7 +549,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * Set the value of [postscriptum] column. * * @param string $v new value - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) */ public function setPostscriptum($v) { @@ -559,7 +559,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface if ($this->postscriptum !== $v) { $this->postscriptum = $v; - $this->modifiedColumns[] = ProdutImageI18nTableMap::POSTSCRIPTUM; + $this->modifiedColumns[] = ProductImageI18nTableMap::POSTSCRIPTUM; } @@ -607,22 +607,22 @@ abstract class ProdutImageI18n implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProdutImageI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ProductImageI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProdutImageI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductImageI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; $this->locale = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProdutImageI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductImageI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; $this->title = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProdutImageI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductImageI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; $this->description = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProdutImageI18nTableMap::translateFieldName('Chapo', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductImageI18nTableMap::translateFieldName('Chapo', TableMap::TYPE_PHPNAME, $indexType)]; $this->chapo = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProdutImageI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductImageI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)]; $this->postscriptum = (null !== $col) ? (string) $col : null; $this->resetModified(); @@ -632,10 +632,10 @@ abstract class ProdutImageI18n implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 6; // 6 = ProdutImageI18nTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = ProductImageI18nTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException("Error populating \Thelia\Model\ProdutImageI18n object", 0, $e); + throw new PropelException("Error populating \Thelia\Model\ProductImageI18n object", 0, $e); } } @@ -654,8 +654,8 @@ abstract class ProdutImageI18n implements ActiveRecordInterface */ public function ensureConsistency() { - if ($this->aProdutImage !== null && $this->id !== $this->aProdutImage->getId()) { - $this->aProdutImage = null; + if ($this->aProductImage !== null && $this->id !== $this->aProductImage->getId()) { + $this->aProductImage = null; } } // ensureConsistency @@ -680,13 +680,13 @@ abstract class ProdutImageI18n implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ProdutImageI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ProductImageI18nTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. - $dataFetcher = ChildProdutImageI18nQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $dataFetcher = ChildProductImageI18nQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { @@ -696,7 +696,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->aProdutImage = null; + $this->aProductImage = null; } // if (deep) } @@ -706,8 +706,8 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * @param ConnectionInterface $con * @return void * @throws PropelException - * @see ProdutImageI18n::setDeleted() - * @see ProdutImageI18n::isDeleted() + * @see ProductImageI18n::setDeleted() + * @see ProductImageI18n::isDeleted() */ public function delete(ConnectionInterface $con = null) { @@ -716,12 +716,12 @@ abstract class ProdutImageI18n implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageI18nTableMap::DATABASE_NAME); } $con->beginTransaction(); try { - $deleteQuery = ChildProdutImageI18nQuery::create() + $deleteQuery = ChildProductImageI18nQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { @@ -758,7 +758,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageI18nTableMap::DATABASE_NAME); } $con->beginTransaction(); @@ -778,7 +778,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - ProdutImageI18nTableMap::addInstanceToPool($this); + ProductImageI18nTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -813,11 +813,11 @@ abstract class ProdutImageI18n implements ActiveRecordInterface // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aProdutImage !== null) { - if ($this->aProdutImage->isModified() || $this->aProdutImage->isNew()) { - $affectedRows += $this->aProdutImage->save($con); + if ($this->aProductImage !== null) { + if ($this->aProductImage->isModified() || $this->aProductImage->isNew()) { + $affectedRows += $this->aProductImage->save($con); } - $this->setProdutImage($this->aProdutImage); + $this->setProductImage($this->aProductImage); } if ($this->isNew() || $this->isModified()) { @@ -853,27 +853,27 @@ abstract class ProdutImageI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ProdutImageI18nTableMap::ID)) { + if ($this->isColumnModified(ProductImageI18nTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(ProdutImageI18nTableMap::LOCALE)) { + if ($this->isColumnModified(ProductImageI18nTableMap::LOCALE)) { $modifiedColumns[':p' . $index++] = 'LOCALE'; } - if ($this->isColumnModified(ProdutImageI18nTableMap::TITLE)) { + if ($this->isColumnModified(ProductImageI18nTableMap::TITLE)) { $modifiedColumns[':p' . $index++] = 'TITLE'; } - if ($this->isColumnModified(ProdutImageI18nTableMap::DESCRIPTION)) { + if ($this->isColumnModified(ProductImageI18nTableMap::DESCRIPTION)) { $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; } - if ($this->isColumnModified(ProdutImageI18nTableMap::CHAPO)) { + if ($this->isColumnModified(ProductImageI18nTableMap::CHAPO)) { $modifiedColumns[':p' . $index++] = 'CHAPO'; } - if ($this->isColumnModified(ProdutImageI18nTableMap::POSTSCRIPTUM)) { + if ($this->isColumnModified(ProductImageI18nTableMap::POSTSCRIPTUM)) { $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; } $sql = sprintf( - 'INSERT INTO produt_image_i18n (%s) VALUES (%s)', + 'INSERT INTO product_image_i18n (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -939,7 +939,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { - $pos = ProdutImageI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ProductImageI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); return $field; @@ -996,11 +996,11 @@ abstract class ProdutImageI18n implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['ProdutImageI18n'][serialize($this->getPrimaryKey())])) { + if (isset($alreadyDumpedObjects['ProductImageI18n'][serialize($this->getPrimaryKey())])) { return '*RECURSION*'; } - $alreadyDumpedObjects['ProdutImageI18n'][serialize($this->getPrimaryKey())] = true; - $keys = ProdutImageI18nTableMap::getFieldNames($keyType); + $alreadyDumpedObjects['ProductImageI18n'][serialize($this->getPrimaryKey())] = true; + $keys = ProductImageI18nTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getLocale(), @@ -1016,8 +1016,8 @@ abstract class ProdutImageI18n implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->aProdutImage) { - $result['ProdutImage'] = $this->aProdutImage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + if (null !== $this->aProductImage) { + $result['ProductImage'] = $this->aProductImage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -1037,7 +1037,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) { - $pos = ProdutImageI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ProductImageI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); return $this->setByPosition($pos, $value); } @@ -1093,7 +1093,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface */ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { - $keys = ProdutImageI18nTableMap::getFieldNames($keyType); + $keys = ProductImageI18nTableMap::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]]); @@ -1110,14 +1110,14 @@ abstract class ProdutImageI18n implements ActiveRecordInterface */ public function buildCriteria() { - $criteria = new Criteria(ProdutImageI18nTableMap::DATABASE_NAME); + $criteria = new Criteria(ProductImageI18nTableMap::DATABASE_NAME); - if ($this->isColumnModified(ProdutImageI18nTableMap::ID)) $criteria->add(ProdutImageI18nTableMap::ID, $this->id); - if ($this->isColumnModified(ProdutImageI18nTableMap::LOCALE)) $criteria->add(ProdutImageI18nTableMap::LOCALE, $this->locale); - if ($this->isColumnModified(ProdutImageI18nTableMap::TITLE)) $criteria->add(ProdutImageI18nTableMap::TITLE, $this->title); - if ($this->isColumnModified(ProdutImageI18nTableMap::DESCRIPTION)) $criteria->add(ProdutImageI18nTableMap::DESCRIPTION, $this->description); - if ($this->isColumnModified(ProdutImageI18nTableMap::CHAPO)) $criteria->add(ProdutImageI18nTableMap::CHAPO, $this->chapo); - if ($this->isColumnModified(ProdutImageI18nTableMap::POSTSCRIPTUM)) $criteria->add(ProdutImageI18nTableMap::POSTSCRIPTUM, $this->postscriptum); + if ($this->isColumnModified(ProductImageI18nTableMap::ID)) $criteria->add(ProductImageI18nTableMap::ID, $this->id); + if ($this->isColumnModified(ProductImageI18nTableMap::LOCALE)) $criteria->add(ProductImageI18nTableMap::LOCALE, $this->locale); + if ($this->isColumnModified(ProductImageI18nTableMap::TITLE)) $criteria->add(ProductImageI18nTableMap::TITLE, $this->title); + if ($this->isColumnModified(ProductImageI18nTableMap::DESCRIPTION)) $criteria->add(ProductImageI18nTableMap::DESCRIPTION, $this->description); + if ($this->isColumnModified(ProductImageI18nTableMap::CHAPO)) $criteria->add(ProductImageI18nTableMap::CHAPO, $this->chapo); + if ($this->isColumnModified(ProductImageI18nTableMap::POSTSCRIPTUM)) $criteria->add(ProductImageI18nTableMap::POSTSCRIPTUM, $this->postscriptum); return $criteria; } @@ -1132,9 +1132,9 @@ abstract class ProdutImageI18n implements ActiveRecordInterface */ public function buildPkeyCriteria() { - $criteria = new Criteria(ProdutImageI18nTableMap::DATABASE_NAME); - $criteria->add(ProdutImageI18nTableMap::ID, $this->id); - $criteria->add(ProdutImageI18nTableMap::LOCALE, $this->locale); + $criteria = new Criteria(ProductImageI18nTableMap::DATABASE_NAME); + $criteria->add(ProductImageI18nTableMap::ID, $this->id); + $criteria->add(ProductImageI18nTableMap::LOCALE, $this->locale); return $criteria; } @@ -1181,7 +1181,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \Thelia\Model\ProdutImageI18n (or compatible) type. + * @param object $copyObj An object of \Thelia\Model\ProductImageI18n (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 @@ -1208,7 +1208,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return \Thelia\Model\ProdutImageI18n Clone of current object. + * @return \Thelia\Model\ProductImageI18n Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) @@ -1222,13 +1222,13 @@ abstract class ProdutImageI18n implements ActiveRecordInterface } /** - * Declares an association between this object and a ChildProdutImage object. + * Declares an association between this object and a ChildProductImage object. * - * @param ChildProdutImage $v - * @return \Thelia\Model\ProdutImageI18n The current object (for fluent API support) + * @param ChildProductImage $v + * @return \Thelia\Model\ProductImageI18n The current object (for fluent API support) * @throws PropelException */ - public function setProdutImage(ChildProdutImage $v = null) + public function setProductImage(ChildProductImage $v = null) { if ($v === null) { $this->setId(NULL); @@ -1236,12 +1236,12 @@ abstract class ProdutImageI18n implements ActiveRecordInterface $this->setId($v->getId()); } - $this->aProdutImage = $v; + $this->aProductImage = $v; // Add binding for other direction of this n:n relationship. - // If this object has already been added to the ChildProdutImage object, it will not be re-added. + // If this object has already been added to the ChildProductImage object, it will not be re-added. if ($v !== null) { - $v->addProdutImageI18n($this); + $v->addProductImageI18n($this); } @@ -1250,26 +1250,26 @@ abstract class ProdutImageI18n implements ActiveRecordInterface /** - * Get the associated ChildProdutImage object + * Get the associated ChildProductImage object * * @param ConnectionInterface $con Optional Connection object. - * @return ChildProdutImage The associated ChildProdutImage object. + * @return ChildProductImage The associated ChildProductImage object. * @throws PropelException */ - public function getProdutImage(ConnectionInterface $con = null) + public function getProductImage(ConnectionInterface $con = null) { - if ($this->aProdutImage === null && ($this->id !== null)) { - $this->aProdutImage = ChildProdutImageQuery::create()->findPk($this->id, $con); + if ($this->aProductImage === null && ($this->id !== null)) { + $this->aProductImage = ChildProductImageQuery::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->aProdutImage->addProdutImageI18ns($this); + $this->aProductImage->addProductImageI18ns($this); */ } - return $this->aProdutImage; + return $this->aProductImage; } /** @@ -1305,7 +1305,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface if ($deep) { } // if ($deep) - $this->aProdutImage = null; + $this->aProductImage = null; } /** @@ -1315,7 +1315,7 @@ abstract class ProdutImageI18n implements ActiveRecordInterface */ public function __toString() { - return (string) $this->exportTo(ProdutImageI18nTableMap::DEFAULT_STRING_FORMAT); + return (string) $this->exportTo(ProductImageI18nTableMap::DEFAULT_STRING_FORMAT); } /** diff --git a/core/lib/Thelia/Model/Base/ProdutImageI18nQuery.php b/core/lib/Thelia/Model/Base/ProductImageI18nQuery.php similarity index 62% rename from core/lib/Thelia/Model/Base/ProdutImageI18nQuery.php rename to core/lib/Thelia/Model/Base/ProductImageI18nQuery.php index 438a7d91b..c1f34fbb9 100644 --- a/core/lib/Thelia/Model/Base/ProdutImageI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ProductImageI18nQuery.php @@ -12,84 +12,84 @@ use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; -use Thelia\Model\ProdutImageI18n as ChildProdutImageI18n; -use Thelia\Model\ProdutImageI18nQuery as ChildProdutImageI18nQuery; -use Thelia\Model\Map\ProdutImageI18nTableMap; +use Thelia\Model\ProductImageI18n as ChildProductImageI18n; +use Thelia\Model\ProductImageI18nQuery as ChildProductImageI18nQuery; +use Thelia\Model\Map\ProductImageI18nTableMap; /** - * Base class that represents a query for the 'produt_image_i18n' table. + * Base class that represents a query for the 'product_image_i18n' table. * * * - * @method ChildProdutImageI18nQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildProdutImageI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column - * @method ChildProdutImageI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column - * @method ChildProdutImageI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column - * @method ChildProdutImageI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column - * @method ChildProdutImageI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column + * @method ChildProductImageI18nQuery orderById($order = Criteria::ASC) Order by the id column + * @method ChildProductImageI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column + * @method ChildProductImageI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column + * @method ChildProductImageI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column + * @method ChildProductImageI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column + * @method ChildProductImageI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column * - * @method ChildProdutImageI18nQuery groupById() Group by the id column - * @method ChildProdutImageI18nQuery groupByLocale() Group by the locale column - * @method ChildProdutImageI18nQuery groupByTitle() Group by the title column - * @method ChildProdutImageI18nQuery groupByDescription() Group by the description column - * @method ChildProdutImageI18nQuery groupByChapo() Group by the chapo column - * @method ChildProdutImageI18nQuery groupByPostscriptum() Group by the postscriptum column + * @method ChildProductImageI18nQuery groupById() Group by the id column + * @method ChildProductImageI18nQuery groupByLocale() Group by the locale column + * @method ChildProductImageI18nQuery groupByTitle() Group by the title column + * @method ChildProductImageI18nQuery groupByDescription() Group by the description column + * @method ChildProductImageI18nQuery groupByChapo() Group by the chapo column + * @method ChildProductImageI18nQuery groupByPostscriptum() Group by the postscriptum column * - * @method ChildProdutImageI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query - * @method ChildProdutImageI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query - * @method ChildProdutImageI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query + * @method ChildProductImageI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query + * @method ChildProductImageI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query + * @method ChildProductImageI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildProdutImageI18nQuery leftJoinProdutImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProdutImage relation - * @method ChildProdutImageI18nQuery rightJoinProdutImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProdutImage relation - * @method ChildProdutImageI18nQuery innerJoinProdutImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ProdutImage relation + * @method ChildProductImageI18nQuery leftJoinProductImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductImage relation + * @method ChildProductImageI18nQuery rightJoinProductImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductImage relation + * @method ChildProductImageI18nQuery innerJoinProductImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductImage relation * - * @method ChildProdutImageI18n findOne(ConnectionInterface $con = null) Return the first ChildProdutImageI18n matching the query - * @method ChildProdutImageI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildProdutImageI18n matching the query, or a new ChildProdutImageI18n object populated from the query conditions when no match is found + * @method ChildProductImageI18n findOne(ConnectionInterface $con = null) Return the first ChildProductImageI18n matching the query + * @method ChildProductImageI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildProductImageI18n matching the query, or a new ChildProductImageI18n object populated from the query conditions when no match is found * - * @method ChildProdutImageI18n findOneById(int $id) Return the first ChildProdutImageI18n filtered by the id column - * @method ChildProdutImageI18n findOneByLocale(string $locale) Return the first ChildProdutImageI18n filtered by the locale column - * @method ChildProdutImageI18n findOneByTitle(string $title) Return the first ChildProdutImageI18n filtered by the title column - * @method ChildProdutImageI18n findOneByDescription(string $description) Return the first ChildProdutImageI18n filtered by the description column - * @method ChildProdutImageI18n findOneByChapo(string $chapo) Return the first ChildProdutImageI18n filtered by the chapo column - * @method ChildProdutImageI18n findOneByPostscriptum(string $postscriptum) Return the first ChildProdutImageI18n filtered by the postscriptum column + * @method ChildProductImageI18n findOneById(int $id) Return the first ChildProductImageI18n filtered by the id column + * @method ChildProductImageI18n findOneByLocale(string $locale) Return the first ChildProductImageI18n filtered by the locale column + * @method ChildProductImageI18n findOneByTitle(string $title) Return the first ChildProductImageI18n filtered by the title column + * @method ChildProductImageI18n findOneByDescription(string $description) Return the first ChildProductImageI18n filtered by the description column + * @method ChildProductImageI18n findOneByChapo(string $chapo) Return the first ChildProductImageI18n filtered by the chapo column + * @method ChildProductImageI18n findOneByPostscriptum(string $postscriptum) Return the first ChildProductImageI18n filtered by the postscriptum column * - * @method array findById(int $id) Return ChildProdutImageI18n objects filtered by the id column - * @method array findByLocale(string $locale) Return ChildProdutImageI18n objects filtered by the locale column - * @method array findByTitle(string $title) Return ChildProdutImageI18n objects filtered by the title column - * @method array findByDescription(string $description) Return ChildProdutImageI18n objects filtered by the description column - * @method array findByChapo(string $chapo) Return ChildProdutImageI18n objects filtered by the chapo column - * @method array findByPostscriptum(string $postscriptum) Return ChildProdutImageI18n objects filtered by the postscriptum column + * @method array findById(int $id) Return ChildProductImageI18n objects filtered by the id column + * @method array findByLocale(string $locale) Return ChildProductImageI18n objects filtered by the locale column + * @method array findByTitle(string $title) Return ChildProductImageI18n objects filtered by the title column + * @method array findByDescription(string $description) Return ChildProductImageI18n objects filtered by the description column + * @method array findByChapo(string $chapo) Return ChildProductImageI18n objects filtered by the chapo column + * @method array findByPostscriptum(string $postscriptum) Return ChildProductImageI18n objects filtered by the postscriptum column * */ -abstract class ProdutImageI18nQuery extends ModelCriteria +abstract class ProductImageI18nQuery extends ModelCriteria { /** - * Initializes internal state of \Thelia\Model\Base\ProdutImageI18nQuery object. + * Initializes internal state of \Thelia\Model\Base\ProductImageI18nQuery 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\\ProdutImageI18n', $modelAlias = null) + public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ProductImageI18n', $modelAlias = null) { parent::__construct($dbName, $modelName, $modelAlias); } /** - * Returns a new ChildProdutImageI18nQuery object. + * Returns a new ChildProductImageI18nQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * - * @return ChildProdutImageI18nQuery + * @return ChildProductImageI18nQuery */ public static function create($modelAlias = null, $criteria = null) { - if ($criteria instanceof \Thelia\Model\ProdutImageI18nQuery) { + if ($criteria instanceof \Thelia\Model\ProductImageI18nQuery) { return $criteria; } - $query = new \Thelia\Model\ProdutImageI18nQuery(); + $query = new \Thelia\Model\ProductImageI18nQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } @@ -112,19 +112,19 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * @param array[$id, $locale] $key Primary key to use for the query * @param ConnectionInterface $con an optional connection object * - * @return ChildProdutImageI18n|array|mixed the result, formatted by the current formatter + * @return ChildProductImageI18n|array|mixed the result, formatted by the current formatter */ public function findPk($key, $con = null) { if ($key === null) { return null; } - if ((null !== ($obj = ProdutImageI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) { + if ((null !== ($obj = ProductImageI18nTableMap::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(ProdutImageI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ProductImageI18nTableMap::DATABASE_NAME); } $this->basePreSelect($con); if ($this->formatter || $this->modelAlias || $this->with || $this->select @@ -143,11 +143,11 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildProdutImageI18n A model object, or null if the key is not found + * @return ChildProductImageI18n A model object, or null if the key is not found */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM produt_image_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM product_image_i18n WHERE ID = :p0 AND LOCALE = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -159,9 +159,9 @@ abstract class ProdutImageI18nQuery extends ModelCriteria } $obj = null; if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new ChildProdutImageI18n(); + $obj = new ChildProductImageI18n(); $obj->hydrate($row); - ProdutImageI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); + ProductImageI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); } $stmt->closeCursor(); @@ -174,7 +174,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildProdutImageI18n|array|mixed the result, formatted by the current formatter + * @return ChildProductImageI18n|array|mixed the result, formatted by the current formatter */ protected function findPkComplex($key, $con) { @@ -216,12 +216,12 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * * @param mixed $key Primary key to use for the query * - * @return ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery The current query, for fluid interface */ public function filterByPrimaryKey($key) { - $this->addUsingAlias(ProdutImageI18nTableMap::ID, $key[0], Criteria::EQUAL); - $this->addUsingAlias(ProdutImageI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); + $this->addUsingAlias(ProductImageI18nTableMap::ID, $key[0], Criteria::EQUAL); + $this->addUsingAlias(ProductImageI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); return $this; } @@ -231,7 +231,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * * @param array $keys The list of primary key to use for the query * - * @return ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { @@ -239,8 +239,8 @@ abstract class ProdutImageI18nQuery extends ModelCriteria return $this->add(null, '1<>1', Criteria::CUSTOM); } foreach ($keys as $key) { - $cton0 = $this->getNewCriterion(ProdutImageI18nTableMap::ID, $key[0], Criteria::EQUAL); - $cton1 = $this->getNewCriterion(ProdutImageI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); + $cton0 = $this->getNewCriterion(ProductImageI18nTableMap::ID, $key[0], Criteria::EQUAL); + $cton1 = $this->getNewCriterion(ProductImageI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); $cton0->addAnd($cton1); $this->addOr($cton0); } @@ -258,7 +258,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @see filterByProdutImage() + * @see filterByProductImage() * * @param mixed $id The value to use as filter. * Use scalar values for equality. @@ -266,18 +266,18 @@ abstract class ProdutImageI18nQuery 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 ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery 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(ProdutImageI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ProductImageI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($id['max'])) { - $this->addUsingAlias(ProdutImageI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ProductImageI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -288,7 +288,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageI18nTableMap::ID, $id, $comparison); + return $this->addUsingAlias(ProductImageI18nTableMap::ID, $id, $comparison); } /** @@ -304,7 +304,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery The current query, for fluid interface */ public function filterByLocale($locale = null, $comparison = null) { @@ -317,7 +317,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageI18nTableMap::LOCALE, $locale, $comparison); + return $this->addUsingAlias(ProductImageI18nTableMap::LOCALE, $locale, $comparison); } /** @@ -333,7 +333,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery The current query, for fluid interface */ public function filterByTitle($title = null, $comparison = null) { @@ -346,7 +346,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageI18nTableMap::TITLE, $title, $comparison); + return $this->addUsingAlias(ProductImageI18nTableMap::TITLE, $title, $comparison); } /** @@ -362,7 +362,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery The current query, for fluid interface */ public function filterByDescription($description = null, $comparison = null) { @@ -375,7 +375,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageI18nTableMap::DESCRIPTION, $description, $comparison); + return $this->addUsingAlias(ProductImageI18nTableMap::DESCRIPTION, $description, $comparison); } /** @@ -391,7 +391,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery The current query, for fluid interface */ public function filterByChapo($chapo = null, $comparison = null) { @@ -404,7 +404,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageI18nTableMap::CHAPO, $chapo, $comparison); + return $this->addUsingAlias(ProductImageI18nTableMap::CHAPO, $chapo, $comparison); } /** @@ -420,7 +420,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery The current query, for fluid interface */ public function filterByPostscriptum($postscriptum = null, $comparison = null) { @@ -433,46 +433,46 @@ abstract class ProdutImageI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison); + return $this->addUsingAlias(ProductImageI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison); } /** - * Filter the query by a related \Thelia\Model\ProdutImage object + * Filter the query by a related \Thelia\Model\ProductImage object * - * @param \Thelia\Model\ProdutImage|ObjectCollection $produtImage The related object(s) to use as filter + * @param \Thelia\Model\ProductImage|ObjectCollection $productImage The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery The current query, for fluid interface */ - public function filterByProdutImage($produtImage, $comparison = null) + public function filterByProductImage($productImage, $comparison = null) { - if ($produtImage instanceof \Thelia\Model\ProdutImage) { + if ($productImage instanceof \Thelia\Model\ProductImage) { return $this - ->addUsingAlias(ProdutImageI18nTableMap::ID, $produtImage->getId(), $comparison); - } elseif ($produtImage instanceof ObjectCollection) { + ->addUsingAlias(ProductImageI18nTableMap::ID, $productImage->getId(), $comparison); + } elseif ($productImage instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this - ->addUsingAlias(ProdutImageI18nTableMap::ID, $produtImage->toKeyValue('PrimaryKey', 'Id'), $comparison); + ->addUsingAlias(ProductImageI18nTableMap::ID, $productImage->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { - throw new PropelException('filterByProdutImage() only accepts arguments of type \Thelia\Model\ProdutImage or Collection'); + throw new PropelException('filterByProductImage() only accepts arguments of type \Thelia\Model\ProductImage or Collection'); } } /** - * Adds a JOIN clause to the query using the ProdutImage relation + * Adds a JOIN clause to the query using the ProductImage relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery The current query, for fluid interface */ - public function joinProdutImage($relationAlias = null, $joinType = 'LEFT JOIN') + public function joinProductImage($relationAlias = null, $joinType = 'LEFT JOIN') { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ProdutImage'); + $relationMap = $tableMap->getRelation('ProductImage'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -487,14 +487,14 @@ abstract class ProdutImageI18nQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'ProdutImage'); + $this->addJoinObject($join, 'ProductImage'); } return $this; } /** - * Use the ProdutImage relation ProdutImage object + * Use the ProductImage relation ProductImage object * * @see useQuery() * @@ -502,27 +502,27 @@ abstract class ProdutImageI18nQuery 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\ProdutImageQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\ProductImageQuery A secondary query class using the current class as primary query */ - public function useProdutImageQuery($relationAlias = null, $joinType = 'LEFT JOIN') + public function useProductImageQuery($relationAlias = null, $joinType = 'LEFT JOIN') { return $this - ->joinProdutImage($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ProdutImage', '\Thelia\Model\ProdutImageQuery'); + ->joinProductImage($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ProductImage', '\Thelia\Model\ProductImageQuery'); } /** * Exclude object from result * - * @param ChildProdutImageI18n $produtImageI18n Object to remove from the list of results + * @param ChildProductImageI18n $productImageI18n Object to remove from the list of results * - * @return ChildProdutImageI18nQuery The current query, for fluid interface + * @return ChildProductImageI18nQuery The current query, for fluid interface */ - public function prune($produtImageI18n = null) + public function prune($productImageI18n = null) { - if ($produtImageI18n) { - $this->addCond('pruneCond0', $this->getAliasedColName(ProdutImageI18nTableMap::ID), $produtImageI18n->getId(), Criteria::NOT_EQUAL); - $this->addCond('pruneCond1', $this->getAliasedColName(ProdutImageI18nTableMap::LOCALE), $produtImageI18n->getLocale(), Criteria::NOT_EQUAL); + if ($productImageI18n) { + $this->addCond('pruneCond0', $this->getAliasedColName(ProductImageI18nTableMap::ID), $productImageI18n->getId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond1', $this->getAliasedColName(ProductImageI18nTableMap::LOCALE), $productImageI18n->getLocale(), Criteria::NOT_EQUAL); $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); } @@ -530,7 +530,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria } /** - * Deletes all rows from the produt_image_i18n table. + * Deletes all rows from the product_image_i18n table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). @@ -538,7 +538,7 @@ abstract class ProdutImageI18nQuery extends ModelCriteria public function doDeleteAll(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageI18nTableMap::DATABASE_NAME); } $affectedRows = 0; // initialize var to track total num of affected rows try { @@ -549,8 +549,8 @@ abstract class ProdutImageI18nQuery 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). - ProdutImageI18nTableMap::clearInstancePool(); - ProdutImageI18nTableMap::clearRelatedInstancePool(); + ProductImageI18nTableMap::clearInstancePool(); + ProductImageI18nTableMap::clearRelatedInstancePool(); $con->commit(); } catch (PropelException $e) { @@ -562,9 +562,9 @@ abstract class ProdutImageI18nQuery extends ModelCriteria } /** - * Performs a DELETE on the database, given a ChildProdutImageI18n or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ChildProductImageI18n or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ChildProdutImageI18n object or primary key or array of primary keys + * @param mixed $values Criteria or ChildProductImageI18n 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 @@ -575,13 +575,13 @@ abstract class ProdutImageI18nQuery extends ModelCriteria public function delete(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageI18nTableMap::DATABASE_NAME); } $criteria = $this; // Set the correct dbName - $criteria->setDbName(ProdutImageI18nTableMap::DATABASE_NAME); + $criteria->setDbName(ProductImageI18nTableMap::DATABASE_NAME); $affectedRows = 0; // initialize var to track total num of affected rows @@ -591,10 +591,10 @@ abstract class ProdutImageI18nQuery extends ModelCriteria $con->beginTransaction(); - ProdutImageI18nTableMap::removeInstanceFromPool($criteria); + ProductImageI18nTableMap::removeInstanceFromPool($criteria); $affectedRows += ModelCriteria::delete($con); - ProdutImageI18nTableMap::clearRelatedInstancePool(); + ProductImageI18nTableMap::clearRelatedInstancePool(); $con->commit(); return $affectedRows; @@ -604,4 +604,4 @@ abstract class ProdutImageI18nQuery extends ModelCriteria } } -} // ProdutImageI18nQuery +} // ProductImageI18nQuery diff --git a/core/lib/Thelia/Model/Base/ProdutImageQuery.php b/core/lib/Thelia/Model/Base/ProductImageQuery.php similarity index 64% rename from core/lib/Thelia/Model/Base/ProdutImageQuery.php rename to core/lib/Thelia/Model/Base/ProductImageQuery.php index 65376b641..94cb1b361 100644 --- a/core/lib/Thelia/Model/Base/ProdutImageQuery.php +++ b/core/lib/Thelia/Model/Base/ProductImageQuery.php @@ -12,89 +12,89 @@ use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; -use Thelia\Model\ProdutImage as ChildProdutImage; -use Thelia\Model\ProdutImageI18nQuery as ChildProdutImageI18nQuery; -use Thelia\Model\ProdutImageQuery as ChildProdutImageQuery; -use Thelia\Model\Map\ProdutImageTableMap; +use Thelia\Model\ProductImage as ChildProductImage; +use Thelia\Model\ProductImageI18nQuery as ChildProductImageI18nQuery; +use Thelia\Model\ProductImageQuery as ChildProductImageQuery; +use Thelia\Model\Map\ProductImageTableMap; /** - * Base class that represents a query for the 'produt_image' table. + * Base class that represents a query for the 'product_image' table. * * * - * @method ChildProdutImageQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildProdutImageQuery orderByProductId($order = Criteria::ASC) Order by the product_id column - * @method ChildProdutImageQuery orderByFile($order = Criteria::ASC) Order by the file column - * @method ChildProdutImageQuery orderByPosition($order = Criteria::ASC) Order by the position column - * @method ChildProdutImageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column - * @method ChildProdutImageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column + * @method ChildProductImageQuery orderById($order = Criteria::ASC) Order by the id column + * @method ChildProductImageQuery orderByProductId($order = Criteria::ASC) Order by the product_id column + * @method ChildProductImageQuery orderByFile($order = Criteria::ASC) Order by the file column + * @method ChildProductImageQuery orderByPosition($order = Criteria::ASC) Order by the position column + * @method ChildProductImageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column + * @method ChildProductImageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * - * @method ChildProdutImageQuery groupById() Group by the id column - * @method ChildProdutImageQuery groupByProductId() Group by the product_id column - * @method ChildProdutImageQuery groupByFile() Group by the file column - * @method ChildProdutImageQuery groupByPosition() Group by the position column - * @method ChildProdutImageQuery groupByCreatedAt() Group by the created_at column - * @method ChildProdutImageQuery groupByUpdatedAt() Group by the updated_at column + * @method ChildProductImageQuery groupById() Group by the id column + * @method ChildProductImageQuery groupByProductId() Group by the product_id column + * @method ChildProductImageQuery groupByFile() Group by the file column + * @method ChildProductImageQuery groupByPosition() Group by the position column + * @method ChildProductImageQuery groupByCreatedAt() Group by the created_at column + * @method ChildProductImageQuery groupByUpdatedAt() Group by the updated_at column * - * @method ChildProdutImageQuery leftJoin($relation) Adds a LEFT JOIN clause to the query - * @method ChildProdutImageQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query - * @method ChildProdutImageQuery innerJoin($relation) Adds a INNER JOIN clause to the query + * @method ChildProductImageQuery leftJoin($relation) Adds a LEFT JOIN clause to the query + * @method ChildProductImageQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query + * @method ChildProductImageQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildProdutImageQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation - * @method ChildProdutImageQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation - * @method ChildProdutImageQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation + * @method ChildProductImageQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation + * @method ChildProductImageQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation + * @method ChildProductImageQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation * - * @method ChildProdutImageQuery leftJoinProdutImageI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProdutImageI18n relation - * @method ChildProdutImageQuery rightJoinProdutImageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProdutImageI18n relation - * @method ChildProdutImageQuery innerJoinProdutImageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ProdutImageI18n relation + * @method ChildProductImageQuery leftJoinProductImageI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductImageI18n relation + * @method ChildProductImageQuery rightJoinProductImageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductImageI18n relation + * @method ChildProductImageQuery innerJoinProductImageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductImageI18n relation * - * @method ChildProdutImage findOne(ConnectionInterface $con = null) Return the first ChildProdutImage matching the query - * @method ChildProdutImage findOneOrCreate(ConnectionInterface $con = null) Return the first ChildProdutImage matching the query, or a new ChildProdutImage object populated from the query conditions when no match is found + * @method ChildProductImage findOne(ConnectionInterface $con = null) Return the first ChildProductImage matching the query + * @method ChildProductImage findOneOrCreate(ConnectionInterface $con = null) Return the first ChildProductImage matching the query, or a new ChildProductImage object populated from the query conditions when no match is found * - * @method ChildProdutImage findOneById(int $id) Return the first ChildProdutImage filtered by the id column - * @method ChildProdutImage findOneByProductId(int $product_id) Return the first ChildProdutImage filtered by the product_id column - * @method ChildProdutImage findOneByFile(string $file) Return the first ChildProdutImage filtered by the file column - * @method ChildProdutImage findOneByPosition(int $position) Return the first ChildProdutImage filtered by the position column - * @method ChildProdutImage findOneByCreatedAt(string $created_at) Return the first ChildProdutImage filtered by the created_at column - * @method ChildProdutImage findOneByUpdatedAt(string $updated_at) Return the first ChildProdutImage filtered by the updated_at column + * @method ChildProductImage findOneById(int $id) Return the first ChildProductImage filtered by the id column + * @method ChildProductImage findOneByProductId(int $product_id) Return the first ChildProductImage filtered by the product_id column + * @method ChildProductImage findOneByFile(string $file) Return the first ChildProductImage filtered by the file column + * @method ChildProductImage findOneByPosition(int $position) Return the first ChildProductImage filtered by the position column + * @method ChildProductImage findOneByCreatedAt(string $created_at) Return the first ChildProductImage filtered by the created_at column + * @method ChildProductImage findOneByUpdatedAt(string $updated_at) Return the first ChildProductImage filtered by the updated_at column * - * @method array findById(int $id) Return ChildProdutImage objects filtered by the id column - * @method array findByProductId(int $product_id) Return ChildProdutImage objects filtered by the product_id column - * @method array findByFile(string $file) Return ChildProdutImage objects filtered by the file column - * @method array findByPosition(int $position) Return ChildProdutImage objects filtered by the position column - * @method array findByCreatedAt(string $created_at) Return ChildProdutImage objects filtered by the created_at column - * @method array findByUpdatedAt(string $updated_at) Return ChildProdutImage objects filtered by the updated_at column + * @method array findById(int $id) Return ChildProductImage objects filtered by the id column + * @method array findByProductId(int $product_id) Return ChildProductImage objects filtered by the product_id column + * @method array findByFile(string $file) Return ChildProductImage objects filtered by the file column + * @method array findByPosition(int $position) Return ChildProductImage objects filtered by the position column + * @method array findByCreatedAt(string $created_at) Return ChildProductImage objects filtered by the created_at column + * @method array findByUpdatedAt(string $updated_at) Return ChildProductImage objects filtered by the updated_at column * */ -abstract class ProdutImageQuery extends ModelCriteria +abstract class ProductImageQuery extends ModelCriteria { /** - * Initializes internal state of \Thelia\Model\Base\ProdutImageQuery object. + * Initializes internal state of \Thelia\Model\Base\ProductImageQuery 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\\ProdutImage', $modelAlias = null) + public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ProductImage', $modelAlias = null) { parent::__construct($dbName, $modelName, $modelAlias); } /** - * Returns a new ChildProdutImageQuery object. + * Returns a new ChildProductImageQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * - * @return ChildProdutImageQuery + * @return ChildProductImageQuery */ public static function create($modelAlias = null, $criteria = null) { - if ($criteria instanceof \Thelia\Model\ProdutImageQuery) { + if ($criteria instanceof \Thelia\Model\ProductImageQuery) { return $criteria; } - $query = new \Thelia\Model\ProdutImageQuery(); + $query = new \Thelia\Model\ProductImageQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } @@ -117,19 +117,19 @@ abstract class ProdutImageQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con an optional connection object * - * @return ChildProdutImage|array|mixed the result, formatted by the current formatter + * @return ChildProductImage|array|mixed the result, formatted by the current formatter */ public function findPk($key, $con = null) { if ($key === null) { return null; } - if ((null !== ($obj = ProdutImageTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + if ((null !== ($obj = ProductImageTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { // the object is already in the instance pool return $obj; } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ProdutImageTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ProductImageTableMap::DATABASE_NAME); } $this->basePreSelect($con); if ($this->formatter || $this->modelAlias || $this->with || $this->select @@ -148,11 +148,11 @@ abstract class ProdutImageQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildProdutImage A model object, or null if the key is not found + * @return ChildProductImage A model object, or null if the key is not found */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, PRODUCT_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM produt_image WHERE ID = :p0'; + $sql = 'SELECT ID, PRODUCT_ID, FILE, POSITION, CREATED_AT, UPDATED_AT FROM product_image WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -163,9 +163,9 @@ abstract class ProdutImageQuery extends ModelCriteria } $obj = null; if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new ChildProdutImage(); + $obj = new ChildProductImage(); $obj->hydrate($row); - ProdutImageTableMap::addInstanceToPool($obj, (string) $key); + ProductImageTableMap::addInstanceToPool($obj, (string) $key); } $stmt->closeCursor(); @@ -178,7 +178,7 @@ abstract class ProdutImageQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildProdutImage|array|mixed the result, formatted by the current formatter + * @return ChildProductImage|array|mixed the result, formatted by the current formatter */ protected function findPkComplex($key, $con) { @@ -220,12 +220,12 @@ abstract class ProdutImageQuery extends ModelCriteria * * @param mixed $key Primary key to use for the query * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(ProdutImageTableMap::ID, $key, Criteria::EQUAL); + return $this->addUsingAlias(ProductImageTableMap::ID, $key, Criteria::EQUAL); } /** @@ -233,12 +233,12 @@ abstract class ProdutImageQuery extends ModelCriteria * * @param array $keys The list of primary key to use for the query * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(ProdutImageTableMap::ID, $keys, Criteria::IN); + return $this->addUsingAlias(ProductImageTableMap::ID, $keys, Criteria::IN); } /** @@ -257,18 +257,18 @@ abstract class ProdutImageQuery 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 ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery 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(ProdutImageTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ProductImageTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($id['max'])) { - $this->addUsingAlias(ProdutImageTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ProductImageTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -279,7 +279,7 @@ abstract class ProdutImageQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageTableMap::ID, $id, $comparison); + return $this->addUsingAlias(ProductImageTableMap::ID, $id, $comparison); } /** @@ -300,18 +300,18 @@ abstract class ProdutImageQuery 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 ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery 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(ProdutImageTableMap::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ProductImageTableMap::PRODUCT_ID, $productId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($productId['max'])) { - $this->addUsingAlias(ProdutImageTableMap::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ProductImageTableMap::PRODUCT_ID, $productId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -322,7 +322,7 @@ abstract class ProdutImageQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageTableMap::PRODUCT_ID, $productId, $comparison); + return $this->addUsingAlias(ProductImageTableMap::PRODUCT_ID, $productId, $comparison); } /** @@ -338,7 +338,7 @@ abstract class ProdutImageQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function filterByFile($file = null, $comparison = null) { @@ -351,7 +351,7 @@ abstract class ProdutImageQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageTableMap::FILE, $file, $comparison); + return $this->addUsingAlias(ProductImageTableMap::FILE, $file, $comparison); } /** @@ -370,18 +370,18 @@ abstract class ProdutImageQuery 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 ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery 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(ProdutImageTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ProductImageTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($position['max'])) { - $this->addUsingAlias(ProdutImageTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ProductImageTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -392,7 +392,7 @@ abstract class ProdutImageQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageTableMap::POSITION, $position, $comparison); + return $this->addUsingAlias(ProductImageTableMap::POSITION, $position, $comparison); } /** @@ -413,18 +413,18 @@ abstract class ProdutImageQuery 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 ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery 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(ProdutImageTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ProductImageTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($createdAt['max'])) { - $this->addUsingAlias(ProdutImageTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ProductImageTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -435,7 +435,7 @@ abstract class ProdutImageQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageTableMap::CREATED_AT, $createdAt, $comparison); + return $this->addUsingAlias(ProductImageTableMap::CREATED_AT, $createdAt, $comparison); } /** @@ -456,18 +456,18 @@ abstract class ProdutImageQuery 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 ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery 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(ProdutImageTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ProductImageTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($updatedAt['max'])) { - $this->addUsingAlias(ProdutImageTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ProductImageTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -478,7 +478,7 @@ abstract class ProdutImageQuery extends ModelCriteria } } - return $this->addUsingAlias(ProdutImageTableMap::UPDATED_AT, $updatedAt, $comparison); + return $this->addUsingAlias(ProductImageTableMap::UPDATED_AT, $updatedAt, $comparison); } /** @@ -487,20 +487,20 @@ abstract class ProdutImageQuery extends ModelCriteria * @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 ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function filterByProduct($product, $comparison = null) { if ($product instanceof \Thelia\Model\Product) { return $this - ->addUsingAlias(ProdutImageTableMap::PRODUCT_ID, $product->getId(), $comparison); + ->addUsingAlias(ProductImageTableMap::PRODUCT_ID, $product->getId(), $comparison); } elseif ($product instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this - ->addUsingAlias(ProdutImageTableMap::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison); + ->addUsingAlias(ProductImageTableMap::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection'); } @@ -512,7 +512,7 @@ abstract class ProdutImageQuery extends ModelCriteria * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN) { @@ -557,40 +557,40 @@ abstract class ProdutImageQuery extends ModelCriteria } /** - * Filter the query by a related \Thelia\Model\ProdutImageI18n object + * Filter the query by a related \Thelia\Model\ProductImageI18n object * - * @param \Thelia\Model\ProdutImageI18n|ObjectCollection $produtImageI18n the related object to use as filter + * @param \Thelia\Model\ProductImageI18n|ObjectCollection $productImageI18n the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ - public function filterByProdutImageI18n($produtImageI18n, $comparison = null) + public function filterByProductImageI18n($productImageI18n, $comparison = null) { - if ($produtImageI18n instanceof \Thelia\Model\ProdutImageI18n) { + if ($productImageI18n instanceof \Thelia\Model\ProductImageI18n) { return $this - ->addUsingAlias(ProdutImageTableMap::ID, $produtImageI18n->getId(), $comparison); - } elseif ($produtImageI18n instanceof ObjectCollection) { + ->addUsingAlias(ProductImageTableMap::ID, $productImageI18n->getId(), $comparison); + } elseif ($productImageI18n instanceof ObjectCollection) { return $this - ->useProdutImageI18nQuery() - ->filterByPrimaryKeys($produtImageI18n->getPrimaryKeys()) + ->useProductImageI18nQuery() + ->filterByPrimaryKeys($productImageI18n->getPrimaryKeys()) ->endUse(); } else { - throw new PropelException('filterByProdutImageI18n() only accepts arguments of type \Thelia\Model\ProdutImageI18n or Collection'); + throw new PropelException('filterByProductImageI18n() only accepts arguments of type \Thelia\Model\ProductImageI18n or Collection'); } } /** - * Adds a JOIN clause to the query using the ProdutImageI18n relation + * Adds a JOIN clause to the query using the ProductImageI18n relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ - public function joinProdutImageI18n($relationAlias = null, $joinType = 'LEFT JOIN') + public function joinProductImageI18n($relationAlias = null, $joinType = 'LEFT JOIN') { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ProdutImageI18n'); + $relationMap = $tableMap->getRelation('ProductImageI18n'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -605,14 +605,14 @@ abstract class ProdutImageQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'ProdutImageI18n'); + $this->addJoinObject($join, 'ProductImageI18n'); } return $this; } /** - * Use the ProdutImageI18n relation ProdutImageI18n object + * Use the ProductImageI18n relation ProductImageI18n object * * @see useQuery() * @@ -620,33 +620,33 @@ abstract class ProdutImageQuery 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\ProdutImageI18nQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\ProductImageI18nQuery A secondary query class using the current class as primary query */ - public function useProdutImageI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') + public function useProductImageI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') { return $this - ->joinProdutImageI18n($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ProdutImageI18n', '\Thelia\Model\ProdutImageI18nQuery'); + ->joinProductImageI18n($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ProductImageI18n', '\Thelia\Model\ProductImageI18nQuery'); } /** * Exclude object from result * - * @param ChildProdutImage $produtImage Object to remove from the list of results + * @param ChildProductImage $productImage Object to remove from the list of results * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ - public function prune($produtImage = null) + public function prune($productImage = null) { - if ($produtImage) { - $this->addUsingAlias(ProdutImageTableMap::ID, $produtImage->getId(), Criteria::NOT_EQUAL); + if ($productImage) { + $this->addUsingAlias(ProductImageTableMap::ID, $productImage->getId(), Criteria::NOT_EQUAL); } return $this; } /** - * Deletes all rows from the produt_image table. + * Deletes all rows from the product_image table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). @@ -654,7 +654,7 @@ abstract class ProdutImageQuery extends ModelCriteria public function doDeleteAll(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageTableMap::DATABASE_NAME); } $affectedRows = 0; // initialize var to track total num of affected rows try { @@ -665,8 +665,8 @@ abstract class ProdutImageQuery 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). - ProdutImageTableMap::clearInstancePool(); - ProdutImageTableMap::clearRelatedInstancePool(); + ProductImageTableMap::clearInstancePool(); + ProductImageTableMap::clearRelatedInstancePool(); $con->commit(); } catch (PropelException $e) { @@ -678,9 +678,9 @@ abstract class ProdutImageQuery extends ModelCriteria } /** - * Performs a DELETE on the database, given a ChildProdutImage or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ChildProductImage or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ChildProdutImage object or primary key or array of primary keys + * @param mixed $values Criteria or ChildProductImage 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 @@ -691,13 +691,13 @@ abstract class ProdutImageQuery extends ModelCriteria public function delete(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageTableMap::DATABASE_NAME); } $criteria = $this; // Set the correct dbName - $criteria->setDbName(ProdutImageTableMap::DATABASE_NAME); + $criteria->setDbName(ProductImageTableMap::DATABASE_NAME); $affectedRows = 0; // initialize var to track total num of affected rows @@ -707,10 +707,10 @@ abstract class ProdutImageQuery extends ModelCriteria $con->beginTransaction(); - ProdutImageTableMap::removeInstanceFromPool($criteria); + ProductImageTableMap::removeInstanceFromPool($criteria); $affectedRows += ModelCriteria::delete($con); - ProdutImageTableMap::clearRelatedInstancePool(); + ProductImageTableMap::clearRelatedInstancePool(); $con->commit(); return $affectedRows; @@ -727,11 +727,11 @@ abstract class ProdutImageQuery extends ModelCriteria * * @param int $nbDays Maximum age of the latest update in days * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(ProdutImageTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + return $this->addUsingAlias(ProductImageTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); } /** @@ -739,51 +739,51 @@ abstract class ProdutImageQuery extends ModelCriteria * * @param int $nbDays Maximum age of in days * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(ProdutImageTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + return $this->addUsingAlias(ProductImageTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); } /** * Order by update date desc * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(ProdutImageTableMap::UPDATED_AT); + return $this->addDescendingOrderByColumn(ProductImageTableMap::UPDATED_AT); } /** * Order by update date asc * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(ProdutImageTableMap::UPDATED_AT); + return $this->addAscendingOrderByColumn(ProductImageTableMap::UPDATED_AT); } /** * Order by create date desc * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(ProdutImageTableMap::CREATED_AT); + return $this->addDescendingOrderByColumn(ProductImageTableMap::CREATED_AT); } /** * Order by create date asc * - * @return ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(ProdutImageTableMap::CREATED_AT); + return $this->addAscendingOrderByColumn(ProductImageTableMap::CREATED_AT); } // i18n behavior @@ -795,14 +795,14 @@ abstract class ProdutImageQuery extends ModelCriteria * @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 ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { - $relationName = $relationAlias ? $relationAlias : 'ProdutImageI18n'; + $relationName = $relationAlias ? $relationAlias : 'ProductImageI18n'; return $this - ->joinProdutImageI18n($relationAlias, $joinType) + ->joinProductImageI18n($relationAlias, $joinType) ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale); } @@ -813,14 +813,14 @@ abstract class ProdutImageQuery extends ModelCriteria * @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 ChildProdutImageQuery The current query, for fluid interface + * @return ChildProductImageQuery The current query, for fluid interface */ public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) - ->with('ProdutImageI18n'); - $this->with['ProdutImageI18n']->setIsWithOneToMany(false); + ->with('ProductImageI18n'); + $this->with['ProductImageI18n']->setIsWithOneToMany(false); return $this; } @@ -834,13 +834,13 @@ abstract class ProdutImageQuery extends ModelCriteria * @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 ChildProdutImageI18nQuery A secondary query class using the current class as primary query + * @return ChildProductImageI18nQuery 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 : 'ProdutImageI18n', '\Thelia\Model\ProdutImageI18nQuery'); + ->useQuery($relationAlias ? $relationAlias : 'ProductImageI18n', '\Thelia\Model\ProductImageI18nQuery'); } -} // ProdutImageQuery +} // ProductImageQuery diff --git a/core/lib/Thelia/Model/Base/ProductQuery.php b/core/lib/Thelia/Model/Base/ProductQuery.php index 3b3ca6309..3df8ecbae 100644 --- a/core/lib/Thelia/Model/Base/ProductQuery.php +++ b/core/lib/Thelia/Model/Base/ProductQuery.php @@ -68,9 +68,9 @@ use Thelia\Model\Map\ProductTableMap; * @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 leftJoinProdutImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProdutImage relation - * @method ChildProductQuery rightJoinProdutImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProdutImage relation - * @method ChildProductQuery innerJoinProdutImage($relationAlias = null) Adds a INNER JOIN clause to the query using the ProdutImage 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 * * @method ChildProductQuery leftJoinProductDocument($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductDocument relation * @method ChildProductQuery rightJoinProductDocument($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductDocument relation @@ -1070,40 +1070,40 @@ abstract class ProductQuery extends ModelCriteria } /** - * Filter the query by a related \Thelia\Model\ProdutImage object + * Filter the query by a related \Thelia\Model\ProductImage object * - * @param \Thelia\Model\ProdutImage|ObjectCollection $produtImage the related object to use as filter + * @param \Thelia\Model\ProductImage|ObjectCollection $productImage 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 filterByProdutImage($produtImage, $comparison = null) + public function filterByProductImage($productImage, $comparison = null) { - if ($produtImage instanceof \Thelia\Model\ProdutImage) { + if ($productImage instanceof \Thelia\Model\ProductImage) { return $this - ->addUsingAlias(ProductTableMap::ID, $produtImage->getProductId(), $comparison); - } elseif ($produtImage instanceof ObjectCollection) { + ->addUsingAlias(ProductTableMap::ID, $productImage->getProductId(), $comparison); + } elseif ($productImage instanceof ObjectCollection) { return $this - ->useProdutImageQuery() - ->filterByPrimaryKeys($produtImage->getPrimaryKeys()) + ->useProductImageQuery() + ->filterByPrimaryKeys($productImage->getPrimaryKeys()) ->endUse(); } else { - throw new PropelException('filterByProdutImage() only accepts arguments of type \Thelia\Model\ProdutImage or Collection'); + throw new PropelException('filterByProductImage() only accepts arguments of type \Thelia\Model\ProductImage or Collection'); } } /** - * Adds a JOIN clause to the query using the ProdutImage relation + * Adds a JOIN clause to the query using the ProductImage 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 joinProdutImage($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinProductImage($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ProdutImage'); + $relationMap = $tableMap->getRelation('ProductImage'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -1118,14 +1118,14 @@ abstract class ProductQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'ProdutImage'); + $this->addJoinObject($join, 'ProductImage'); } return $this; } /** - * Use the ProdutImage relation ProdutImage object + * Use the ProductImage relation ProductImage object * * @see useQuery() * @@ -1133,13 +1133,13 @@ abstract class ProductQuery 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\ProdutImageQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\ProductImageQuery A secondary query class using the current class as primary query */ - public function useProdutImageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function useProductImageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this - ->joinProdutImage($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ProdutImage', '\Thelia\Model\ProdutImageQuery'); + ->joinProductImage($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ProductImage', '\Thelia\Model\ProductImageQuery'); } /** diff --git a/core/lib/Thelia/Model/Map/CurrencyTableMap.php b/core/lib/Thelia/Model/Map/CurrencyTableMap.php index b1251801a..b37a6b30a 100644 --- a/core/lib/Thelia/Model/Map/CurrencyTableMap.php +++ b/core/lib/Thelia/Model/Map/CurrencyTableMap.php @@ -57,7 +57,7 @@ class CurrencyTableMap 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 CurrencyTableMap 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 @@ -89,6 +89,11 @@ class CurrencyTableMap extends TableMap */ const RATE = 'currency.RATE'; + /** + * the column name for the POSITION field + */ + const POSITION = 'currency.POSITION'; + /** * the column name for the BY_DEFAULT field */ @@ -125,12 +130,12 @@ class CurrencyTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Symbol', 'Rate', 'ByDefault', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'symbol', 'rate', 'byDefault', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(CurrencyTableMap::ID, CurrencyTableMap::CODE, CurrencyTableMap::SYMBOL, CurrencyTableMap::RATE, CurrencyTableMap::BY_DEFAULT, CurrencyTableMap::CREATED_AT, CurrencyTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'SYMBOL', 'RATE', 'BY_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'code', 'symbol', 'rate', 'by_default', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) + self::TYPE_PHPNAME => array('Id', 'Code', 'Symbol', 'Rate', 'Position', 'ByDefault', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'code', 'symbol', 'rate', 'position', 'byDefault', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(CurrencyTableMap::ID, CurrencyTableMap::CODE, CurrencyTableMap::SYMBOL, CurrencyTableMap::RATE, CurrencyTableMap::POSITION, CurrencyTableMap::BY_DEFAULT, CurrencyTableMap::CREATED_AT, CurrencyTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'SYMBOL', 'RATE', 'POSITION', 'BY_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'code', 'symbol', 'rate', 'position', 'by_default', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -140,12 +145,12 @@ class CurrencyTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Symbol' => 2, 'Rate' => 3, 'ByDefault' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'symbol' => 2, 'rate' => 3, 'byDefault' => 4, 'createdAt' => 5, 'updatedAt' => 6, ), - self::TYPE_COLNAME => array(CurrencyTableMap::ID => 0, CurrencyTableMap::CODE => 1, CurrencyTableMap::SYMBOL => 2, CurrencyTableMap::RATE => 3, CurrencyTableMap::BY_DEFAULT => 4, CurrencyTableMap::CREATED_AT => 5, CurrencyTableMap::UPDATED_AT => 6, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'SYMBOL' => 2, 'RATE' => 3, 'BY_DEFAULT' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'symbol' => 2, 'rate' => 3, 'by_default' => 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, 'Symbol' => 2, 'Rate' => 3, 'Position' => 4, 'ByDefault' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'symbol' => 2, 'rate' => 3, 'position' => 4, 'byDefault' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), + self::TYPE_COLNAME => array(CurrencyTableMap::ID => 0, CurrencyTableMap::CODE => 1, CurrencyTableMap::SYMBOL => 2, CurrencyTableMap::RATE => 3, CurrencyTableMap::POSITION => 4, CurrencyTableMap::BY_DEFAULT => 5, CurrencyTableMap::CREATED_AT => 6, CurrencyTableMap::UPDATED_AT => 7, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'SYMBOL' => 2, 'RATE' => 3, 'POSITION' => 4, 'BY_DEFAULT' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), + self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'symbol' => 2, 'rate' => 3, 'position' => 4, 'by_default' => 5, 'created_at' => 6, 'updated_at' => 7, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) ); /** @@ -168,6 +173,7 @@ class CurrencyTableMap extends TableMap $this->addColumn('CODE', 'Code', 'VARCHAR', false, 45, null); $this->addColumn('SYMBOL', 'Symbol', 'VARCHAR', false, 45, null); $this->addColumn('RATE', 'Rate', 'FLOAT', false, null, null); + $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null); $this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -351,6 +357,7 @@ class CurrencyTableMap extends TableMap $criteria->addSelectColumn(CurrencyTableMap::CODE); $criteria->addSelectColumn(CurrencyTableMap::SYMBOL); $criteria->addSelectColumn(CurrencyTableMap::RATE); + $criteria->addSelectColumn(CurrencyTableMap::POSITION); $criteria->addSelectColumn(CurrencyTableMap::BY_DEFAULT); $criteria->addSelectColumn(CurrencyTableMap::CREATED_AT); $criteria->addSelectColumn(CurrencyTableMap::UPDATED_AT); @@ -359,6 +366,7 @@ class CurrencyTableMap extends TableMap $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.SYMBOL'); $criteria->addSelectColumn($alias . '.RATE'); + $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.BY_DEFAULT'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); diff --git a/core/lib/Thelia/Model/Map/LangTableMap.php b/core/lib/Thelia/Model/Map/LangTableMap.php index 86e3ebe16..9eb864388 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 = 8; + const NUM_COLUMNS = 9; /** * 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 = 8; + const NUM_HYDRATE_COLUMNS = 9; /** * the column name for the ID field @@ -94,6 +94,11 @@ class LangTableMap extends TableMap */ const URL = 'lang.URL'; + /** + * the column name for the POSITION field + */ + const POSITION = 'lang.POSITION'; + /** * the column name for the BY_DEFAULT field */ @@ -121,12 +126,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', 'ByDefault', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'title', 'code', 'locale', 'url', 'byDefault', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(LangTableMap::ID, LangTableMap::TITLE, LangTableMap::CODE, LangTableMap::LOCALE, LangTableMap::URL, LangTableMap::BY_DEFAULT, LangTableMap::CREATED_AT, LangTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CODE', 'LOCALE', 'URL', 'BY_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'title', 'code', 'locale', 'url', 'by_default', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) + 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, ) ); /** @@ -136,12 +141,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, 'ByDefault' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'byDefault' => 5, 'createdAt' => 6, 'updatedAt' => 7, ), - self::TYPE_COLNAME => array(LangTableMap::ID => 0, LangTableMap::TITLE => 1, LangTableMap::CODE => 2, LangTableMap::LOCALE => 3, LangTableMap::URL => 4, LangTableMap::BY_DEFAULT => 5, LangTableMap::CREATED_AT => 6, LangTableMap::UPDATED_AT => 7, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CODE' => 2, 'LOCALE' => 3, 'URL' => 4, 'BY_DEFAULT' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ), - self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'locale' => 3, 'url' => 4, 'by_default' => 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, '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, ) ); /** @@ -165,6 +170,7 @@ 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('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -333,6 +339,7 @@ class LangTableMap extends TableMap $criteria->addSelectColumn(LangTableMap::CODE); $criteria->addSelectColumn(LangTableMap::LOCALE); $criteria->addSelectColumn(LangTableMap::URL); + $criteria->addSelectColumn(LangTableMap::POSITION); $criteria->addSelectColumn(LangTableMap::BY_DEFAULT); $criteria->addSelectColumn(LangTableMap::CREATED_AT); $criteria->addSelectColumn(LangTableMap::UPDATED_AT); @@ -342,6 +349,7 @@ class LangTableMap extends TableMap $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.LOCALE'); $criteria->addSelectColumn($alias . '.URL'); + $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.BY_DEFAULT'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); diff --git a/core/lib/Thelia/Model/Map/ProdutImageI18nTableMap.php b/core/lib/Thelia/Model/Map/ProductImageI18nTableMap.php similarity index 77% rename from core/lib/Thelia/Model/Map/ProdutImageI18nTableMap.php rename to core/lib/Thelia/Model/Map/ProductImageI18nTableMap.php index affc799e2..39ad567f9 100644 --- a/core/lib/Thelia/Model/Map/ProdutImageI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductImageI18nTableMap.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\ProdutImageI18n; -use Thelia\Model\ProdutImageI18nQuery; +use Thelia\Model\ProductImageI18n; +use Thelia\Model\ProductImageI18nQuery; /** - * This class defines the structure of the 'produt_image_i18n' table. + * This class defines the structure of the 'product_image_i18n' table. * * * @@ -25,14 +25,14 @@ use Thelia\Model\ProdutImageI18nQuery; * (i.e. if it's a text column type). * */ -class ProdutImageI18nTableMap extends TableMap +class ProductImageI18nTableMap extends TableMap { use InstancePoolTrait; use TableMapTrait; /** * The (dot-path) name of this class */ - const CLASS_NAME = 'Thelia.Model.Map.ProdutImageI18nTableMap'; + const CLASS_NAME = 'Thelia.Model.Map.ProductImageI18nTableMap'; /** * The default database name for this class @@ -42,17 +42,17 @@ class ProdutImageI18nTableMap extends TableMap /** * The table name for this class */ - const TABLE_NAME = 'produt_image_i18n'; + const TABLE_NAME = 'product_image_i18n'; /** * The related Propel class for this table */ - const OM_CLASS = '\\Thelia\\Model\\ProdutImageI18n'; + const OM_CLASS = '\\Thelia\\Model\\ProductImageI18n'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'Thelia.Model.ProdutImageI18n'; + const CLASS_DEFAULT = 'Thelia.Model.ProductImageI18n'; /** * The total number of columns @@ -72,32 +72,32 @@ class ProdutImageI18nTableMap extends TableMap /** * the column name for the ID field */ - const ID = 'produt_image_i18n.ID'; + const ID = 'product_image_i18n.ID'; /** * the column name for the LOCALE field */ - const LOCALE = 'produt_image_i18n.LOCALE'; + const LOCALE = 'product_image_i18n.LOCALE'; /** * the column name for the TITLE field */ - const TITLE = 'produt_image_i18n.TITLE'; + const TITLE = 'product_image_i18n.TITLE'; /** * the column name for the DESCRIPTION field */ - const DESCRIPTION = 'produt_image_i18n.DESCRIPTION'; + const DESCRIPTION = 'product_image_i18n.DESCRIPTION'; /** * the column name for the CHAPO field */ - const CHAPO = 'produt_image_i18n.CHAPO'; + const CHAPO = 'product_image_i18n.CHAPO'; /** * the column name for the POSTSCRIPTUM field */ - const POSTSCRIPTUM = 'produt_image_i18n.POSTSCRIPTUM'; + const POSTSCRIPTUM = 'product_image_i18n.POSTSCRIPTUM'; /** * The default string format for model objects of the related table @@ -113,7 +113,7 @@ class ProdutImageI18nTableMap extends TableMap protected static $fieldNames = array ( self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ), self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ), - self::TYPE_COLNAME => array(ProdutImageI18nTableMap::ID, ProdutImageI18nTableMap::LOCALE, ProdutImageI18nTableMap::TITLE, ProdutImageI18nTableMap::DESCRIPTION, ProdutImageI18nTableMap::CHAPO, ProdutImageI18nTableMap::POSTSCRIPTUM, ), + self::TYPE_COLNAME => array(ProductImageI18nTableMap::ID, ProductImageI18nTableMap::LOCALE, ProductImageI18nTableMap::TITLE, ProductImageI18nTableMap::DESCRIPTION, ProductImageI18nTableMap::CHAPO, ProductImageI18nTableMap::POSTSCRIPTUM, ), self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ), self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) @@ -128,7 +128,7 @@ class ProdutImageI18nTableMap extends TableMap protected static $fieldKeys = array ( self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ), - self::TYPE_COLNAME => array(ProdutImageI18nTableMap::ID => 0, ProdutImageI18nTableMap::LOCALE => 1, ProdutImageI18nTableMap::TITLE => 2, ProdutImageI18nTableMap::DESCRIPTION => 3, ProdutImageI18nTableMap::CHAPO => 4, ProdutImageI18nTableMap::POSTSCRIPTUM => 5, ), + self::TYPE_COLNAME => array(ProductImageI18nTableMap::ID => 0, ProductImageI18nTableMap::LOCALE => 1, ProductImageI18nTableMap::TITLE => 2, ProductImageI18nTableMap::DESCRIPTION => 3, ProductImageI18nTableMap::CHAPO => 4, ProductImageI18nTableMap::POSTSCRIPTUM => 5, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ), self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) @@ -144,13 +144,13 @@ class ProdutImageI18nTableMap extends TableMap public function initialize() { // attributes - $this->setName('produt_image_i18n'); - $this->setPhpName('ProdutImageI18n'); - $this->setClassName('\\Thelia\\Model\\ProdutImageI18n'); + $this->setName('product_image_i18n'); + $this->setPhpName('ProductImageI18n'); + $this->setClassName('\\Thelia\\Model\\ProductImageI18n'); $this->setPackage('Thelia.Model'); $this->setUseIdGenerator(false); // columns - $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'produt_image', 'ID', true, null, null); + $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product_image', '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', 'CLOB', false, null, null); @@ -163,7 +163,7 @@ class ProdutImageI18nTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('ProdutImage', '\\Thelia\\Model\\ProdutImage', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null); + $this->addRelation('ProductImage', '\\Thelia\\Model\\ProductImage', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null); } // buildRelations() /** @@ -174,7 +174,7 @@ class ProdutImageI18nTableMap extends TableMap * to the cache in order to ensure that the same objects are always returned by find*() * and findPk*() calls. * - * @param \Thelia\Model\ProdutImageI18n $obj A \Thelia\Model\ProdutImageI18n object. + * @param \Thelia\Model\ProductImageI18n $obj A \Thelia\Model\ProductImageI18n 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) @@ -195,12 +195,12 @@ class ProdutImageI18nTableMap extends TableMap * 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\ProdutImageI18n object or a primary key value. + * @param mixed $value A \Thelia\Model\ProductImageI18n object or a primary key value. */ public static function removeInstanceFromPool($value) { if (Propel::isInstancePoolingEnabled() && null !== $value) { - if (is_object($value) && $value instanceof \Thelia\Model\ProdutImageI18n) { + if (is_object($value) && $value instanceof \Thelia\Model\ProductImageI18n) { $key = serialize(array((string) $value->getId(), (string) $value->getLocale())); } elseif (is_array($value) && count($value) === 2) { @@ -211,7 +211,7 @@ class ProdutImageI18nTableMap extends TableMap return; } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\ProdutImageI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\ProductImageI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); throw $e; } @@ -271,7 +271,7 @@ class ProdutImageI18nTableMap extends TableMap */ public static function getOMClass($withPrefix = true) { - return $withPrefix ? ProdutImageI18nTableMap::CLASS_DEFAULT : ProdutImageI18nTableMap::OM_CLASS; + return $withPrefix ? ProductImageI18nTableMap::CLASS_DEFAULT : ProductImageI18nTableMap::OM_CLASS; } /** @@ -285,21 +285,21 @@ class ProdutImageI18nTableMap extends TableMap * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (ProdutImageI18n object, last column rank) + * @return array (ProductImageI18n object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - $key = ProdutImageI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = ProdutImageI18nTableMap::getInstanceFromPool($key))) { + $key = ProductImageI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ProductImageI18nTableMap::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 + ProdutImageI18nTableMap::NUM_HYDRATE_COLUMNS; + $col = $offset + ProductImageI18nTableMap::NUM_HYDRATE_COLUMNS; } else { - $cls = ProdutImageI18nTableMap::OM_CLASS; + $cls = ProductImageI18nTableMap::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); - ProdutImageI18nTableMap::addInstanceToPool($obj, $key); + ProductImageI18nTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); @@ -322,8 +322,8 @@ class ProdutImageI18nTableMap extends TableMap $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { - $key = ProdutImageI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = ProdutImageI18nTableMap::getInstanceFromPool($key))) { + $key = ProductImageI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ProductImageI18nTableMap::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 @@ -332,7 +332,7 @@ class ProdutImageI18nTableMap extends TableMap $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; - ProdutImageI18nTableMap::addInstanceToPool($obj, $key); + ProductImageI18nTableMap::addInstanceToPool($obj, $key); } // if key exists } @@ -353,12 +353,12 @@ class ProdutImageI18nTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(ProdutImageI18nTableMap::ID); - $criteria->addSelectColumn(ProdutImageI18nTableMap::LOCALE); - $criteria->addSelectColumn(ProdutImageI18nTableMap::TITLE); - $criteria->addSelectColumn(ProdutImageI18nTableMap::DESCRIPTION); - $criteria->addSelectColumn(ProdutImageI18nTableMap::CHAPO); - $criteria->addSelectColumn(ProdutImageI18nTableMap::POSTSCRIPTUM); + $criteria->addSelectColumn(ProductImageI18nTableMap::ID); + $criteria->addSelectColumn(ProductImageI18nTableMap::LOCALE); + $criteria->addSelectColumn(ProductImageI18nTableMap::TITLE); + $criteria->addSelectColumn(ProductImageI18nTableMap::DESCRIPTION); + $criteria->addSelectColumn(ProductImageI18nTableMap::CHAPO); + $criteria->addSelectColumn(ProductImageI18nTableMap::POSTSCRIPTUM); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.LOCALE'); @@ -378,7 +378,7 @@ class ProdutImageI18nTableMap extends TableMap */ public static function getTableMap() { - return Propel::getServiceContainer()->getDatabaseMap(ProdutImageI18nTableMap::DATABASE_NAME)->getTable(ProdutImageI18nTableMap::TABLE_NAME); + return Propel::getServiceContainer()->getDatabaseMap(ProductImageI18nTableMap::DATABASE_NAME)->getTable(ProductImageI18nTableMap::TABLE_NAME); } /** @@ -386,16 +386,16 @@ class ProdutImageI18nTableMap extends TableMap */ public static function buildTableMap() { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(ProdutImageI18nTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(ProdutImageI18nTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new ProdutImageI18nTableMap()); + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ProductImageI18nTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ProductImageI18nTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ProductImageI18nTableMap()); } } /** - * Performs a DELETE on the database, given a ProdutImageI18n or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ProductImageI18n or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ProdutImageI18n object or primary key or array of primary keys + * @param mixed $values Criteria or ProductImageI18n 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 @@ -406,17 +406,17 @@ class ProdutImageI18nTableMap extends TableMap public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageI18nTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; - } elseif ($values instanceof \Thelia\Model\ProdutImageI18n) { // it's a model object + } elseif ($values instanceof \Thelia\Model\ProductImageI18n) { // 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(ProdutImageI18nTableMap::DATABASE_NAME); + $criteria = new Criteria(ProductImageI18nTableMap::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)) { @@ -424,17 +424,17 @@ class ProdutImageI18nTableMap extends TableMap $values = array($values); } foreach ($values as $value) { - $criterion = $criteria->getNewCriterion(ProdutImageI18nTableMap::ID, $value[0]); - $criterion->addAnd($criteria->getNewCriterion(ProdutImageI18nTableMap::LOCALE, $value[1])); + $criterion = $criteria->getNewCriterion(ProductImageI18nTableMap::ID, $value[0]); + $criterion->addAnd($criteria->getNewCriterion(ProductImageI18nTableMap::LOCALE, $value[1])); $criteria->addOr($criterion); } } - $query = ProdutImageI18nQuery::create()->mergeWith($criteria); + $query = ProductImageI18nQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { ProdutImageI18nTableMap::clearInstancePool(); + if ($values instanceof Criteria) { ProductImageI18nTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { ProdutImageI18nTableMap::removeInstanceFromPool($singleval); + foreach ((array) $values as $singleval) { ProductImageI18nTableMap::removeInstanceFromPool($singleval); } } @@ -442,20 +442,20 @@ class ProdutImageI18nTableMap extends TableMap } /** - * Deletes all rows from the produt_image_i18n table. + * Deletes all rows from the product_image_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 ProdutImageI18nQuery::create()->doDeleteAll($con); + return ProductImageI18nQuery::create()->doDeleteAll($con); } /** - * Performs an INSERT on the database, given a ProdutImageI18n or Criteria object. + * Performs an INSERT on the database, given a ProductImageI18n or Criteria object. * - * @param mixed $criteria Criteria or ProdutImageI18n object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or ProductImageI18n 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 @@ -464,18 +464,18 @@ class ProdutImageI18nTableMap extends TableMap public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageI18nTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { - $criteria = $criteria->buildCriteria(); // build Criteria from ProdutImageI18n object + $criteria = $criteria->buildCriteria(); // build Criteria from ProductImageI18n object } // Set the correct dbName - $query = ProdutImageI18nQuery::create()->mergeWith($criteria); + $query = ProductImageI18nQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info @@ -491,7 +491,7 @@ class ProdutImageI18nTableMap extends TableMap return $pk; } -} // ProdutImageI18nTableMap +} // ProductImageI18nTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // -ProdutImageI18nTableMap::buildTableMap(); +ProductImageI18nTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/ProdutImageTableMap.php b/core/lib/Thelia/Model/Map/ProductImageTableMap.php similarity index 76% rename from core/lib/Thelia/Model/Map/ProdutImageTableMap.php rename to core/lib/Thelia/Model/Map/ProductImageTableMap.php index a415ba991..36aabed3e 100644 --- a/core/lib/Thelia/Model/Map/ProdutImageTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductImageTableMap.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\ProdutImage; -use Thelia\Model\ProdutImageQuery; +use Thelia\Model\ProductImage; +use Thelia\Model\ProductImageQuery; /** - * This class defines the structure of the 'produt_image' table. + * This class defines the structure of the 'product_image' table. * * * @@ -25,14 +25,14 @@ use Thelia\Model\ProdutImageQuery; * (i.e. if it's a text column type). * */ -class ProdutImageTableMap extends TableMap +class ProductImageTableMap extends TableMap { use InstancePoolTrait; use TableMapTrait; /** * The (dot-path) name of this class */ - const CLASS_NAME = 'Thelia.Model.Map.ProdutImageTableMap'; + const CLASS_NAME = 'Thelia.Model.Map.ProductImageTableMap'; /** * The default database name for this class @@ -42,17 +42,17 @@ class ProdutImageTableMap extends TableMap /** * The table name for this class */ - const TABLE_NAME = 'produt_image'; + const TABLE_NAME = 'product_image'; /** * The related Propel class for this table */ - const OM_CLASS = '\\Thelia\\Model\\ProdutImage'; + const OM_CLASS = '\\Thelia\\Model\\ProductImage'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'Thelia.Model.ProdutImage'; + const CLASS_DEFAULT = 'Thelia.Model.ProductImage'; /** * The total number of columns @@ -72,32 +72,32 @@ class ProdutImageTableMap extends TableMap /** * the column name for the ID field */ - const ID = 'produt_image.ID'; + const ID = 'product_image.ID'; /** * the column name for the PRODUCT_ID field */ - const PRODUCT_ID = 'produt_image.PRODUCT_ID'; + const PRODUCT_ID = 'product_image.PRODUCT_ID'; /** * the column name for the FILE field */ - const FILE = 'produt_image.FILE'; + const FILE = 'product_image.FILE'; /** * the column name for the POSITION field */ - const POSITION = 'produt_image.POSITION'; + const POSITION = 'product_image.POSITION'; /** * the column name for the CREATED_AT field */ - const CREATED_AT = 'produt_image.CREATED_AT'; + const CREATED_AT = 'product_image.CREATED_AT'; /** * the column name for the UPDATED_AT field */ - const UPDATED_AT = 'produt_image.UPDATED_AT'; + const UPDATED_AT = 'product_image.UPDATED_AT'; /** * The default string format for model objects of the related table @@ -122,7 +122,7 @@ class ProdutImageTableMap extends TableMap protected static $fieldNames = array ( self::TYPE_PHPNAME => array('Id', 'ProductId', 'File', 'Position', 'CreatedAt', 'UpdatedAt', ), self::TYPE_STUDLYPHPNAME => array('id', 'productId', 'file', 'position', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(ProdutImageTableMap::ID, ProdutImageTableMap::PRODUCT_ID, ProdutImageTableMap::FILE, ProdutImageTableMap::POSITION, ProdutImageTableMap::CREATED_AT, ProdutImageTableMap::UPDATED_AT, ), + self::TYPE_COLNAME => array(ProductImageTableMap::ID, ProductImageTableMap::PRODUCT_ID, ProductImageTableMap::FILE, ProductImageTableMap::POSITION, ProductImageTableMap::CREATED_AT, ProductImageTableMap::UPDATED_AT, ), self::TYPE_RAW_COLNAME => array('ID', 'PRODUCT_ID', 'FILE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_FIELDNAME => array('id', 'product_id', 'file', 'position', 'created_at', 'updated_at', ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) @@ -137,7 +137,7 @@ class ProdutImageTableMap extends TableMap protected static $fieldKeys = array ( self::TYPE_PHPNAME => array('Id' => 0, 'ProductId' => 1, 'File' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'productId' => 1, 'file' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), - self::TYPE_COLNAME => array(ProdutImageTableMap::ID => 0, ProdutImageTableMap::PRODUCT_ID => 1, ProdutImageTableMap::FILE => 2, ProdutImageTableMap::POSITION => 3, ProdutImageTableMap::CREATED_AT => 4, ProdutImageTableMap::UPDATED_AT => 5, ), + self::TYPE_COLNAME => array(ProductImageTableMap::ID => 0, ProductImageTableMap::PRODUCT_ID => 1, ProductImageTableMap::FILE => 2, ProductImageTableMap::POSITION => 3, ProductImageTableMap::CREATED_AT => 4, ProductImageTableMap::UPDATED_AT => 5, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'PRODUCT_ID' => 1, 'FILE' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), self::TYPE_FIELDNAME => array('id' => 0, 'product_id' => 1, 'file' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) @@ -153,9 +153,9 @@ class ProdutImageTableMap extends TableMap public function initialize() { // attributes - $this->setName('produt_image'); - $this->setPhpName('ProdutImage'); - $this->setClassName('\\Thelia\\Model\\ProdutImage'); + $this->setName('product_image'); + $this->setPhpName('ProductImage'); + $this->setClassName('\\Thelia\\Model\\ProductImage'); $this->setPackage('Thelia.Model'); $this->setUseIdGenerator(true); // columns @@ -173,7 +173,7 @@ class ProdutImageTableMap extends TableMap public function buildRelations() { $this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT'); - $this->addRelation('ProdutImageI18n', '\\Thelia\\Model\\ProdutImageI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProdutImageI18ns'); + $this->addRelation('ProductImageI18n', '\\Thelia\\Model\\ProductImageI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductImageI18ns'); } // buildRelations() /** @@ -190,13 +190,13 @@ class ProdutImageTableMap extends TableMap ); } // getBehaviors() /** - * Method to invalidate the instance pool of all tables related to produt_image * by a foreign key with ON DELETE CASCADE + * Method to invalidate the instance pool of all tables related to product_image * 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. - ProdutImageI18nTableMap::clearInstancePool(); + ProductImageI18nTableMap::clearInstancePool(); } /** @@ -255,7 +255,7 @@ class ProdutImageTableMap extends TableMap */ public static function getOMClass($withPrefix = true) { - return $withPrefix ? ProdutImageTableMap::CLASS_DEFAULT : ProdutImageTableMap::OM_CLASS; + return $withPrefix ? ProductImageTableMap::CLASS_DEFAULT : ProductImageTableMap::OM_CLASS; } /** @@ -269,21 +269,21 @@ class ProdutImageTableMap extends TableMap * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (ProdutImage object, last column rank) + * @return array (ProductImage object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - $key = ProdutImageTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = ProdutImageTableMap::getInstanceFromPool($key))) { + $key = ProductImageTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ProductImageTableMap::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 + ProdutImageTableMap::NUM_HYDRATE_COLUMNS; + $col = $offset + ProductImageTableMap::NUM_HYDRATE_COLUMNS; } else { - $cls = ProdutImageTableMap::OM_CLASS; + $cls = ProductImageTableMap::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); - ProdutImageTableMap::addInstanceToPool($obj, $key); + ProductImageTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); @@ -306,8 +306,8 @@ class ProdutImageTableMap extends TableMap $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { - $key = ProdutImageTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = ProdutImageTableMap::getInstanceFromPool($key))) { + $key = ProductImageTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ProductImageTableMap::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 @@ -316,7 +316,7 @@ class ProdutImageTableMap extends TableMap $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; - ProdutImageTableMap::addInstanceToPool($obj, $key); + ProductImageTableMap::addInstanceToPool($obj, $key); } // if key exists } @@ -337,12 +337,12 @@ class ProdutImageTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(ProdutImageTableMap::ID); - $criteria->addSelectColumn(ProdutImageTableMap::PRODUCT_ID); - $criteria->addSelectColumn(ProdutImageTableMap::FILE); - $criteria->addSelectColumn(ProdutImageTableMap::POSITION); - $criteria->addSelectColumn(ProdutImageTableMap::CREATED_AT); - $criteria->addSelectColumn(ProdutImageTableMap::UPDATED_AT); + $criteria->addSelectColumn(ProductImageTableMap::ID); + $criteria->addSelectColumn(ProductImageTableMap::PRODUCT_ID); + $criteria->addSelectColumn(ProductImageTableMap::FILE); + $criteria->addSelectColumn(ProductImageTableMap::POSITION); + $criteria->addSelectColumn(ProductImageTableMap::CREATED_AT); + $criteria->addSelectColumn(ProductImageTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.PRODUCT_ID'); @@ -362,7 +362,7 @@ class ProdutImageTableMap extends TableMap */ public static function getTableMap() { - return Propel::getServiceContainer()->getDatabaseMap(ProdutImageTableMap::DATABASE_NAME)->getTable(ProdutImageTableMap::TABLE_NAME); + return Propel::getServiceContainer()->getDatabaseMap(ProductImageTableMap::DATABASE_NAME)->getTable(ProductImageTableMap::TABLE_NAME); } /** @@ -370,16 +370,16 @@ class ProdutImageTableMap extends TableMap */ public static function buildTableMap() { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(ProdutImageTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(ProdutImageTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new ProdutImageTableMap()); + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ProductImageTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ProductImageTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ProductImageTableMap()); } } /** - * Performs a DELETE on the database, given a ProdutImage or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ProductImage or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ProdutImage object or primary key or array of primary keys + * @param mixed $values Criteria or ProductImage 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 @@ -390,25 +390,25 @@ class ProdutImageTableMap extends TableMap public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; - } elseif ($values instanceof \Thelia\Model\ProdutImage) { // it's a model object + } elseif ($values instanceof \Thelia\Model\ProductImage) { // 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(ProdutImageTableMap::DATABASE_NAME); - $criteria->add(ProdutImageTableMap::ID, (array) $values, Criteria::IN); + $criteria = new Criteria(ProductImageTableMap::DATABASE_NAME); + $criteria->add(ProductImageTableMap::ID, (array) $values, Criteria::IN); } - $query = ProdutImageQuery::create()->mergeWith($criteria); + $query = ProductImageQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { ProdutImageTableMap::clearInstancePool(); + if ($values instanceof Criteria) { ProductImageTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { ProdutImageTableMap::removeInstanceFromPool($singleval); + foreach ((array) $values as $singleval) { ProductImageTableMap::removeInstanceFromPool($singleval); } } @@ -416,20 +416,20 @@ class ProdutImageTableMap extends TableMap } /** - * Deletes all rows from the produt_image table. + * Deletes all rows from the product_image 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 ProdutImageQuery::create()->doDeleteAll($con); + return ProductImageQuery::create()->doDeleteAll($con); } /** - * Performs an INSERT on the database, given a ProdutImage or Criteria object. + * Performs an INSERT on the database, given a ProductImage or Criteria object. * - * @param mixed $criteria Criteria or ProdutImage object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or ProductImage 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 @@ -438,22 +438,22 @@ class ProdutImageTableMap extends TableMap public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ProdutImageTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ProductImageTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { - $criteria = $criteria->buildCriteria(); // build Criteria from ProdutImage object + $criteria = $criteria->buildCriteria(); // build Criteria from ProductImage object } - if ($criteria->containsKey(ProdutImageTableMap::ID) && $criteria->keyContainsValue(ProdutImageTableMap::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ProdutImageTableMap::ID.')'); + if ($criteria->containsKey(ProductImageTableMap::ID) && $criteria->keyContainsValue(ProductImageTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ProductImageTableMap::ID.')'); } // Set the correct dbName - $query = ProdutImageQuery::create()->mergeWith($criteria); + $query = ProductImageQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info @@ -469,7 +469,7 @@ class ProdutImageTableMap extends TableMap return $pk; } -} // ProdutImageTableMap +} // ProductImageTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // -ProdutImageTableMap::buildTableMap(); +ProductImageTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/ProductTableMap.php b/core/lib/Thelia/Model/Map/ProductTableMap.php index 5fa712cce..75bf5e4e6 100644 --- a/core/lib/Thelia/Model/Map/ProductTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductTableMap.php @@ -201,7 +201,7 @@ class ProductTableMap extends TableMap $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('ProdutImage', '\\Thelia\\Model\\ProdutImage', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProdutImages'); + $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'); @@ -239,7 +239,7 @@ class ProductTableMap extends TableMap FeatureProductTableMap::clearInstancePool(); ProductSaleElementsTableMap::clearInstancePool(); ContentAssocTableMap::clearInstancePool(); - ProdutImageTableMap::clearInstancePool(); + ProductImageTableMap::clearInstancePool(); ProductDocumentTableMap::clearInstancePool(); AccessoryTableMap::clearInstancePool(); RewritingTableMap::clearInstancePool(); diff --git a/core/lib/Thelia/Model/ProductImage.php b/core/lib/Thelia/Model/ProductImage.php new file mode 100644 index 000000000..9fe5b78e0 --- /dev/null +++ b/core/lib/Thelia/Model/ProductImage.php @@ -0,0 +1,10 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Action\ImageTest; + +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; +use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\HttpFoundation\Session\Session; + +use Thelia\Action\Image; +use Thelia\Core\Event\ImageEvent; +use Thelia\Model\ConfigQuery; + +/** + * Class ImageTest + * + * @package Thelia\Tests\Action\ImageTest + */ +class ImageTest extends \PHPUnit_Framework_TestCase +{ + protected $request; + + protected $session; + + 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 setUp() + { + $this->session = new Session(new MockArraySessionStorage()); + $this->request = new Request(); + + $this->request->setSession($this->session); + + // mock cache configuration. + $config = ConfigQuery::create()->filterByName('image_cache_dir_from_web_root')->findOne(); + + if ($config != null) { + $this->cache_dir_from_web_root = $config->getValue(); + + $config->setValue(__DIR__."/assets/images/cache"); + + $config->setValue($this->cache_dir_from_web_root)->save(); + } + } + + public static function setUpBeforeClass() { + $dir = THELIA_WEB_DIR."/cache/tests"; + if ($dh = @opendir($dir)) { + while ($file = readdir($dh)) { + if ($file == '.' || $file == '..') continue; + + unlink(sprintf("%s/%s", $dir, $file)); + } + + closedir($dh); + } + } + + public function tearDown() { + // restore cache configuration. + $config = ConfigQuery::create()->filterByName('image_cache_dir_from_web_root')->findOne(); + + if ($config != null) { + $config->setValue($this->cache_dir_from_web_root)->save(); + } + } + + /** + * + * Imageevent is empty, mandatory parameters not specified. + * + * @expectedException \InvalidArgumentException + */ + public function testProcessEmptyImageEvent() + { + $event = new ImageEvent($this->request); + + $image = new Image($this->getContainer()); + + $image->processImage($event); + } + + /** + * + * Try to process a non-existent file + * + * @expectedException \InvalidArgumentException + */ + public function testProcessNonExistentImage() + { + $event = new ImageEvent($this->request); + + $image = new Image($this->getContainer()); + + $event->setCacheFilepath("blablabla.png"); + $event->setCacheSubdirectory("tests"); + + $image->processImage($event); + } + + /** + * + * Try to process a file outside of the cache + * + * @expectedException \InvalidArgumentException + */ + public function testProcessImageOutsideValidPath() + { + $event = new ImageEvent($this->request); + + $image = new Image($this->getContainer()); + + $event->setCacheFilepath("blablabla.png"); + $event->setCacheSubdirectory("../../../"); + + $image->processImage($event); + } + + /** + * No operation done on source file -> copie ! + */ + public function testProcessImageWithoutAnyTransformationsCopy() + { + $event = new ImageEvent($this->request); + + $event->setSourceFilepath(__DIR__."/assets/images/sources/test-image-1.png"); + $event->setCacheSubdirectory("tests"); + + $image = new Image($this->getContainer()); + + // mock cache configuration. + $config = ConfigQuery::create()->filterByName('original_image_delivery_mode')->findOne(); + + if ($config != null) { + $oldval = $config->getValue(); + $config->setValue('copy')->save(); + } + + $image->processImage($event); + + if ($config != null) $config->setValue($oldval)->save(); + + $this->assertFileExists(THELIA_WEB_DIR."/cache/tests/test-image-1.png"); + } + + /** + * No operation done on source file -> copie ! + */ + public function testProcessImageWithoutAnyTransformationsSymlink() + { + $event = new ImageEvent($this->request); + + $event->setSourceFilepath(__DIR__."/assets/images/sources/test-image-9.png"); + $event->setCacheSubdirectory("tests"); + + $image = new Image($this->getContainer()); + + // mock cache configuration. + $config = ConfigQuery::create()->filterByName('original_image_delivery_mode')->findOne(); + + if ($config != null) { + $oldval = $config->getValue(); + $config->setValue('symlink')->save(); + } + + $image->processImage($event); + + if ($config != null) $config->setValue($oldval)->save(); + + $this->assertFileExists(THELIA_WEB_DIR."/cache/tests/test-image-9.png"); + } + + /** + * Resize image with bands width > height + */ + public function testProcessImageResizeHorizWithBands() + { + $event = new ImageEvent($this->request); + + $event->setSourceFilepath(__DIR__."/assets/images/sources/test-image-2.png"); + $event->setCacheSubdirectory("tests"); + + $event->setBackgroundColor('#ff0000'); + $event->setWidth(100); + $event->setHeight(100); + $event->setResizeMode(Image::EXACT_RATIO_WITH_BORDERS); + + $image = new Image($this->getContainer()); + + $image->processImage($event); + } + + /** + * Resize image with bands height > width + */ + public function testProcessImageResizeVertWithBands() + { + $event = new ImageEvent($this->request); + + $event->setSourceFilepath(__DIR__."/assets/images/sources/test-image-3.png"); + $event->setCacheSubdirectory("tests"); + + $event->setBackgroundColor('#ff0000'); + $event->setWidth(100); + $event->setHeight(100); + $event->setResizeMode(Image::EXACT_RATIO_WITH_BORDERS); + + $image = new Image($this->getContainer()); + + $image->processImage($event); + } + + + /** + * Apply all transformations + */ + public function testProcessImageWithTransformations() + { + $event = new ImageEvent($this->request); + + $event->setSourceFilepath(__DIR__."/assets/images/sources/test-image-4.png"); + $event->setCacheSubdirectory("tests"); + + $event->setEffects(array("grayscale", "vertical_flip", "horizontal_flip", 'colorize:#00ff00', 'gamma: 0.2')); + + $image = new Image($this->getContainer()); + + $image->processImage($event); + } + + /** + * Resize image with crop width > height + */ + public function testProcessImageResizeHorizWithCrop() + { + $event = new ImageEvent($this->request); + + $event->setSourceFilepath(__DIR__."/assets/images/sources/test-image-5.png"); + $event->setCacheSubdirectory("tests"); + + $event->setBackgroundColor('#ff0000'); + $event->setWidth(180); + $event->setHeight(100); + $event->setResizeMode(Image::EXACT_RATIO_WITH_CROP); + + $image = new Image($this->getContainer()); + + $image->processImage($event); + } + + /** + * Resize image with crop height > width + */ + public function testProcessImageResizeVertWithCrop() + { + $event = new ImageEvent($this->request); + + $event->setSourceFilepath(__DIR__."/assets/images/sources/test-image-6.png"); + $event->setCacheSubdirectory("tests"); + + $event->setBackgroundColor('#ff0000'); + $event->setWidth(100); + $event->setHeight(150); + $event->setResizeMode(Image::EXACT_RATIO_WITH_CROP); + + $image = new Image($this->getContainer()); + + $image->processImage($event); + } + + /** + * Resize image keeping image ration + */ + public function testProcessImageResizeHorizKeepRatio() + { + $event = new ImageEvent($this->request); + + $event->setSourceFilepath(__DIR__."/assets/images/sources/test-image-7.png"); + $event->setCacheSubdirectory("tests"); + + $event->setWidth(100); + $event->setHeight(100); + + $image = new Image($this->getContainer()); + + $image->processImage($event); + } + + /** + * Resize image with crop height > width + */ + public function testProcessImageResizeVertKeepRatio() + { + $event = new ImageEvent($this->request); + + $event->setSourceFilepath(__DIR__."/assets/images/sources/test-image-8.png"); + $event->setCacheSubdirectory("tests"); + + $event->setWidth(100); + $event->setHeight(100); + + $image = new Image($this->getContainer()); + + $image->processImage($event); + } + + public function testClearTestsCache() { + $event = new ImageEvent($this->request); + + $event->setCacheSubdirectory('tests'); + + $image = new Image($this->getContainer()); + + $image->clearCache($event); + } + + public function testClearWholeCache() { + $event = new ImageEvent($this->request); + + $image = new Image($this->getContainer()); + + $image->clearCache($event); + } + + /** + * Try to clear directory ouside of the cache + * + * @expectedException \InvalidArgumentException + */ + public function testClearUnallowedPathCache() { + $event = new ImageEvent($this->request); + + $event->setCacheSubdirectory('../../../..'); + + $image = new Image($this->getContainer()); + + $image->clearCache($event); + } + +} \ No newline at end of file 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 new file mode 100644 index 000000000..84a6899a6 Binary files /dev/null and b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-1.png differ 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 new file mode 100644 index 000000000..f6b7f9a53 Binary files /dev/null and b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-2.png differ 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 new file mode 100644 index 000000000..51d05ea15 Binary files /dev/null and b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-3.png differ 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 new file mode 100644 index 000000000..c6d5d3834 Binary files /dev/null and b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-4.png differ 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 new file mode 100644 index 000000000..a933abd26 Binary files /dev/null and b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-5.png differ 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 new file mode 100644 index 000000000..e7d6b950b Binary files /dev/null and b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-6.png differ 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 new file mode 100644 index 000000000..f46514478 Binary files /dev/null and b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-7.png differ 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 new file mode 100644 index 000000000..8631b4e78 Binary files /dev/null and b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-8.png differ 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 new file mode 100644 index 000000000..6ca361372 Binary files /dev/null and b/core/lib/Thelia/Tests/Action/assets/images/sources/test-image-9.png differ diff --git a/core/lib/Thelia/Tests/Command/CacheClearTest.php b/core/lib/Thelia/Tests/Command/CacheClearTest.php index 8d0fbb925..4e05e5611 100755 --- a/core/lib/Thelia/Tests/Command/CacheClearTest.php +++ b/core/lib/Thelia/Tests/Command/CacheClearTest.php @@ -44,24 +44,26 @@ class CacheClearTest extends \PHPUnit_Framework_TestCase public function testCacheClear() { - $application = new Application($this->getKernel()); + // Fails on windows - do not execute this test on windows + if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $application = new Application($this->getKernel()); - $cacheClear = new CacheClear(); - $cacheClear->setContainer($this->getContainer()); + $cacheClear = new CacheClear(); + $cacheClear->setContainer($this->getContainer()); - $application->add($cacheClear); + $application->add($cacheClear); - $command = $application->find("cache:clear"); - $commandTester = new CommandTester($command); - $commandTester->execute(array( - "command" => $command->getName(), - "--env" => "test" - )); + $command = $application->find("cache:clear"); + $commandTester = new CommandTester($command); + $commandTester->execute(array( + "command" => $command->getName(), + "--env" => "test" + )); - $fs = new Filesystem(); - - $this->assertFalse($fs->exists($this->cache_dir)); + $fs = new Filesystem(); + $this->assertFalse($fs->exists($this->cache_dir)); + } } /** @@ -69,22 +71,28 @@ class CacheClearTest extends \PHPUnit_Framework_TestCase */ public function testCacheClearWithoutWritePermission() { - $fs = new Filesystem(); - $fs->chmod($this->cache_dir,0100); + // Fails on windows - mock this test on windows + if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $fs = new Filesystem(); + $fs->chmod($this->cache_dir,0100); - $application = new Application($this->getKernel()); + $application = new Application($this->getKernel()); - $cacheClear = new CacheClear(); - $cacheClear->setContainer($this->getContainer()); + $cacheClear = new CacheClear(); + $cacheClear->setContainer($this->getContainer()); - $application->add($cacheClear); + $application->add($cacheClear); - $command = $application->find("cache:clear"); - $commandTester = new CommandTester($command); - $commandTester->execute(array( - "command" => $command->getName(), - "--env" => "test" - )); + $command = $application->find("cache:clear"); + $commandTester = new CommandTester($command); + $commandTester->execute(array( + "command" => $command->getName(), + "--env" => "test" + )); + } + else { + throw new \RuntimeException(""); + } } public function getKernel() diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php index accd4fd8b..5a88fa922 100644 --- a/core/lib/Thelia/Tools/URL.php +++ b/core/lib/Thelia/Tools/URL.php @@ -27,6 +27,9 @@ use Thelia\Model\ConfigQuery; class URL { + const PATH_TO_FILE = true; + const WITH_INDEX_PAGE = false; + public static function getIndexPage() { return ConfigQuery::read('base_url', '/') . "index_dev.php"; // FIXME ! @@ -39,25 +42,28 @@ class URL * * @param string $path the relative path * @param array $parameters An array of parameters - * @param boolean $path_only if true, getIndexPage() will not be added + * @param boolean $path_only if true (PATH_TO_FILE), getIndexPage() will not be added * * @return string The generated URL */ - public static function absoluteUrl($path, array $parameters = array(), $path_only = false) + public static function absoluteUrl($path, array $parameters = null, $path_only = self::WITH_INDEX_PAGE) { // Already absolute ? if (substr($path, 0, 4) != 'http') { - $root = $path_only ? ConfigQuery::read('base_url', '/') : self::getIndexPage(); + $root = $path_only == self::PATH_TO_FILE ? ConfigQuery::read('base_url', '/') : self::getIndexPage(); - $base = $root . '/' . ltrim($path, '/'); + $base = rtrim($root, '/') . '/' . ltrim($path, '/'); } else $base = $path; + $queryString = ''; - foreach ($parameters as $name => $value) { - $queryString .= sprintf("%s=%s&", urlencode($name), urlencode($value)); + if (! is_null($parameters)) { + foreach ($parameters as $name => $value) { + $queryString .= sprintf("%s=%s&", urlencode($name), urlencode($value)); + } } $sepChar = strstr($base, '?') === false ? '?' : '&'; diff --git a/install/INSTALL-TODO.txt b/install/INSTALL-TODO.txt index e1ffb2202..8ea68554e 100644 --- a/install/INSTALL-TODO.txt +++ b/install/INSTALL-TODO.txt @@ -19,3 +19,8 @@ Variables Config à initialiser: - password.length : longueur du mot de passe, défaut 4 - form.secret : token csrf - verifyStock : vérification du stock lors du paiement/ajout au panier. Defaut 1 +- default_images_quality_percent : qualité par défaut des images générées (0 à 100, défaut: 75). +- original_image_delivery_mode : mode de mise à disposition des images originales (full resolution) dans le cache. 'symlink' pour un lien symbolique, 'copy' pour une copie +- images_library_path : chemin vers le répertoire où sont stockés les images source (defaut: local/media/images) +- image_cache_dir_from_web_root : le repértoire de base où sont cachées les images, relatif à /web (cache/images) +- imagine_graphic_driver : le drivers utilisé par Imagine (gd, imagik, gmagick), defaut: 'gd' diff --git a/install/faker-assets/FreeSans.ttf b/install/faker-assets/FreeSans.ttf new file mode 100644 index 000000000..9db958532 Binary files /dev/null and b/install/faker-assets/FreeSans.ttf differ diff --git a/install/faker.php b/install/faker.php index 23bbed2bb..b262a8460 100755 --- a/install/faker.php +++ b/install/faker.php @@ -1,4 +1,11 @@ beginTransaction(); $currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne(); +function generate_image($image, $position, $typeobj, $id) { + + global $faker; + + $image + ->setTitle($faker->text(20)) + ->setDescription($faker->text(250)) + ->setChapo($faker->text(40)) + ->setPostscriptum($faker->text(40)) + ->setPosition($position) + ->setFile(sprintf("sample-image-%s.png", $id)) + ->save() + ; + + // Generate images + $imagine = new Imagine\Gd\Imagine(); + $image = $imagine->create(new Imagine\Image\Box(320,240), new Color('#E9730F')); + + $white = new Color('#FFF'); + + $font = $imagine->font(__DIR__.'/faker-assets/FreeSans.ttf', 14, $white); + + $tbox = $font->box("THELIA"); + $image->draw()->text("THELIA", $font, new Point((320 - $tbox->getWidth()) / 2, 30)); + + $str = sprintf("%s sample image", ucfirst($typeobj)); + $tbox = $font->box($str); + $image->draw()->text($str, $font, new Point((320 - $tbox->getWidth()) / 2, 80)); + + $font = $imagine->font(__DIR__.'/faker-assets/FreeSans.ttf', 18, $white); + + $str = sprintf("%s ID %d", strtoupper($typeobj), $id); + $tbox = $font->box($str); + $image->draw()->text($str, $font, new Point((320 - $tbox->getWidth()) / 2, 180)); + + $image->draw() + ->line(new Point(0, 0), new Point(319, 0), $white) + ->line(new Point(319, 0), new Point(319, 239), $white) + ->line(new Point(319, 239), new Point(0,239), $white) + ->line(new Point(0, 239), new Point(0, 0), $white) + ; + + $image_file = sprintf("%s/../local/media/images/%s/sample-image-%s.png", __DIR__, $typeobj, $id); + + if (! is_dir(dirname($image_file))) mkdir(dirname($image_file), 0777, true); + + $image->save($image_file); +} + try { + $stmt = $con->prepare("SET foreign_key_checks = 0"); + $stmt->execute(); + $category = Thelia\Model\CategoryQuery::create() ->find(); $category->delete(); @@ -50,6 +109,9 @@ try { ->find(); $content->delete(); + $stmt = $con->prepare("SET foreign_key_checks = 1"); + $stmt->execute(); + //first category $sweet = new Thelia\Model\Category(); $sweet->setParent(0); @@ -60,6 +122,10 @@ try { $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); @@ -70,6 +136,10 @@ try { $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()); @@ -80,6 +150,10 @@ try { $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); @@ -102,8 +176,12 @@ try { $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++) { @@ -130,6 +208,10 @@ try { $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 @@ -143,6 +225,10 @@ try { $folder->save(); + $image = new FolderImage(); + $image->setFolderId($folder->getId()); + generate_image($image, $i, 'folder', $folder->getId()); + for($j=0; $jsetParent($folder->getId()); @@ -153,6 +239,10 @@ try { $subfolder->save(); + $image = new FolderImage(); + $image->setFolderId($subfolder->getId()); + generate_image($image, $j, 'folder', $subfolder->getId()); + for($k=0; $kaddFolder($subfolder); @@ -162,6 +252,11 @@ try { $content->setDescription($faker->text(255)); $content->save(); + + $image = new ContentImage(); + $image->setContentId($content->getId()); + generate_image($image, $k, 'content', $content->getId()); + } } } @@ -188,8 +283,13 @@ try { } $con->commit(); -} catch (Exception $e) { - echo "error : ".$e->getMessage()."\n"; +} +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/insert.sql b/install/insert.sql index ab349e09a..c9b740dac 100755 --- a/install/insert.sql +++ b/install/insert.sql @@ -7,6 +7,13 @@ INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`by_default`,`position`,`c 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()); + + INSERT INTO `module` (`code`, `type`, `activate`, `position`, `created_at`, `updated_at`) VALUES ('test', '1', '1', '1', NOW(), NOW()); diff --git a/install/thelia.sql b/install/thelia.sql index 547f22786..6d16cfdc1 100755 --- a/install/thelia.sql +++ b/install/thelia.sql @@ -521,6 +521,7 @@ CREATE TABLE `lang` `code` VARCHAR(10), `locale` VARCHAR(45), `url` VARCHAR(255), + `position` INTEGER NOT NULL, `by_default` TINYINT, `created_at` DATETIME, `updated_at` DATETIME, @@ -603,12 +604,12 @@ CREATE TABLE `content_assoc` ) ENGINE=InnoDB; -- --------------------------------------------------------------------- --- produt_image +-- product_image -- --------------------------------------------------------------------- -DROP TABLE IF EXISTS `produt_image`; +DROP TABLE IF EXISTS `product_image`; -CREATE TABLE `produt_image` +CREATE TABLE `product_image` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `product_id` INTEGER NOT NULL, @@ -719,6 +720,7 @@ CREATE TABLE `currency` `code` VARCHAR(45), `symbol` VARCHAR(45), `rate` FLOAT, + `position` INTEGER NOT NULL, `by_default` TINYINT, `created_at` DATETIME, `updated_at` DATETIME, @@ -1721,12 +1723,12 @@ CREATE TABLE `content_i18n` ) ENGINE=InnoDB; -- --------------------------------------------------------------------- --- produt_image_i18n +-- product_image_i18n -- --------------------------------------------------------------------- -DROP TABLE IF EXISTS `produt_image_i18n`; +DROP TABLE IF EXISTS `product_image_i18n`; -CREATE TABLE `produt_image_i18n` +CREATE TABLE `product_image_i18n` ( `id` INTEGER NOT NULL, `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, @@ -1735,9 +1737,9 @@ CREATE TABLE `produt_image_i18n` `chapo` TEXT, `postscriptum` TEXT, PRIMARY KEY (`id`,`locale`), - CONSTRAINT `produt_image_i18n_FK_1` + CONSTRAINT `product_image_i18n_FK_1` FOREIGN KEY (`id`) - REFERENCES `produt_image` (`id`) + REFERENCES `product_image` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB; diff --git a/local/config/database.yml.sample b/local/config/database.yml.sample old mode 100755 new mode 100644 index 3bb829965..e1afbf005 --- a/local/config/database.yml.sample +++ b/local/config/database.yml.sample @@ -3,4 +3,4 @@ database: driver: %DRIVER% user: %USERNAME% password: %PASSWORD% - dsn: %DSN% + dsn: %DSN% \ No newline at end of file diff --git a/local/config/schema.xml b/local/config/schema.xml index b52550e9c..460d1814b 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -385,7 +385,8 @@ - + + @@ -450,7 +451,7 @@ - +
@@ -545,6 +546,7 @@ + diff --git a/local/media/.gitkeep b/local/media/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/templates/default/images.html b/templates/default/images.html new file mode 100644 index 000000000..c72beaecd --- /dev/null +++ b/templates/default/images.html @@ -0,0 +1,104 @@ +{include file="includes/header.html"} + + +
+

Category Images

+
    + {loop type="category" name="jsvdfk"} +
  • Category id #ID: #TITLE

    +
      +
    • + {loop type="image" name="image_test" category="#ID" width="200" height="100" resize_mode="borders"} +

      Processed file URL: #IMAGE_URL

      +

      Original file URL: #ORIGINAL_IMAGE_URL

      + + {/loop} + + {loop type="image" name="image_test" category="#ID"} +

      Full size file URL: #IMAGE_URL

      + + {/loop} + + {loop type="image" name="image_test" source="category" source_id="#ID"} +

      source="category" source_id="x" argument style: Processed file URL: #IMAGE_URL

      + {/loop} +
    • +
    +
  • + {/loop} +
+
+ + +
+

Product Images

+
    + {loop type="product" name="jsvdfk"} +
  • Product id #ID: #TITLE

    +
      +
    • + {loop type="image" name="image_test" product="#ID" width="200" height="100" resize_mode="borders" effects="gamma:0.7" background_color="#cc8000"} +

      Processed file URL: #IMAGE_URL

      +

      Original file URL: #ORIGINAL_IMAGE_URL

      +

      Images:

      + + + {/loop} + {loop type="image" name="image_test" product="#ID" width="200" height="100" resize_mode="crop"} + + {/loop} + {loop type="image" name="image_test" product="#ID" width="100" height="200" resize_mode="borders" background_color="#cc8000"} + + {/loop} + {loop type="image" name="image_test" product="#ID" width="100" rotation="-20" background_color="#facabe"} + + {/loop} + {loop type="image" name="image_test" product="#ID" width="200" height="100" resize_mode="borders" background_color="#facabe" effects="negative"} + + {/loop} +

      +
    • +
  • + {/loop} +
+
+ +
+

Folder Images

+
    + {loop type="folder" name="jsvdfk"} +
  • Folder id #ID: #TITLE

    +
      +
    • + {loop type="image" name="image_test" folder="#ID" width="200" height="100" resize_mode="borders"} +

      Processed file URL: #IMAGE_URL

      +

      Original file URL: #ORIGINAL_IMAGE_URL

      + + {/loop} +
    • +
    +
  • + {/loop} +
+
+ +
+

Content Images

+
    + {loop type="content" name="jsvdfk"} +
  • Content id #ID: #TITLE

    +
      +
    • + {loop type="image" name="image_test" content="#ID" width="200" height="100" resize_mode="borders"} +

      Processed file URL: #IMAGE_URL

      +

      Original file URL: #ORIGINAL_IMAGE_URL

      + + {/loop} +
    • +
    +
  • + {/loop} +
+
+ +{include file="includes/footer.html"} \ No newline at end of file