From 0ae5d00054cfbc696a04e622f33214a1ef50b926 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Sep 2013 10:09:40 +0200 Subject: [PATCH 01/32] change module routing priority to 1 --- .../Core/DependencyInjection/Compiler/RegisterRouterPass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php index 2d7110ee5..505d7a3fa 100755 --- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php @@ -84,7 +84,7 @@ class RegisterRouterPass implements CompilerPassInterface $container->setDefinition("router.".$moduleCode, $definition); - $chainRouter->addMethodCall("add", array(new Reference("router.".$moduleCode), -1)); + $chainRouter->addMethodCall("add", array(new Reference("router.".$moduleCode), 1)); } } } From 3f078b8c81d9ab0a70f76a8afdc227b20bcec339 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Sep 2013 13:17:55 +0200 Subject: [PATCH 02/32] add some phpdoc to customer front controller --- .../Controller/Front/CustomerController.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/core/lib/Thelia/Controller/Front/CustomerController.php b/core/lib/Thelia/Controller/Front/CustomerController.php index 7ff7cb496..d1cdb4d89 100755 --- a/core/lib/Thelia/Controller/Front/CustomerController.php +++ b/core/lib/Thelia/Controller/Front/CustomerController.php @@ -40,6 +40,11 @@ use Thelia\Tools\URL; use Thelia\Log\Tlog; use Thelia\Core\Security\Exception\WrongPasswordException; +/** + * Class CustomerController + * @package Thelia\Controller\Front + * @author Manuel Raynaud + */ class CustomerController extends BaseFrontController { /** @@ -146,11 +151,10 @@ class CustomerController extends BaseFrontController $message = false; $request = $this->getRequest(); + $customerLoginForm = new CustomerLogin($request); try { - $customerLoginForm = new CustomerLogin($request); - $form = $this->validateForm($customerLoginForm, "post"); $authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm); @@ -190,8 +194,6 @@ class CustomerController extends BaseFrontController /** * Perform customer logout. - * - * @param Customer $customer */ public function logoutAction() { @@ -203,6 +205,11 @@ class CustomerController extends BaseFrontController $this->redirect(URL::getIndexPage()); } + /** + * Dispatch event for customer login action + * + * @param Customer $customer + */ protected function processLogin(Customer $customer) { $this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer)); From 7d0d1a90a1810c4aeb0010209f764275d0cbac3d Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Sep 2013 15:10:29 +0200 Subject: [PATCH 03/32] create action install file --- core/lib/Thelia/Action/Install.php | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 core/lib/Thelia/Action/Install.php diff --git a/core/lib/Thelia/Action/Install.php b/core/lib/Thelia/Action/Install.php new file mode 100644 index 000000000..4c5d31df4 --- /dev/null +++ b/core/lib/Thelia/Action/Install.php @@ -0,0 +1,61 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + + +/** + * Class Install + * @package Thelia\Action + * @author Manuel Raynaud + */ +class Install extends BaseAction implements EventSubscriberInterface { + + /** + * Returns an array of event names this subscriber wants to listen to. + * + * The array keys are event names and the value can be: + * + * * The method name to call (priority defaults to 0) + * * An array composed of the method name to call and the priority + * * An array of arrays composed of the method names to call and respective + * priorities, or 0 if unset + * + * For instance: + * + * * array('eventName' => 'methodName') + * * array('eventName' => array('methodName', $priority)) + * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) + * + * @return array The event names to listen to + * + * @api + */ + public static function getSubscribedEvents() + { + array( + + ); + } +} \ No newline at end of file From 4e1cc9e810a624c3ca7651e67197f9d6df135d45 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Sep 2013 16:54:18 +0200 Subject: [PATCH 04/32] start refacroting install process --- .../Install.php => Install/BaseInstall.php} | 43 ++++------ core/lib/Thelia/Install/CheckPermission.php | 78 +++++++++++++++++++ .../Exception/AlreadyInstallException.php | 35 +++++++++ .../Install/Exception/InstallException.php | 32 ++++++++ 4 files changed, 159 insertions(+), 29 deletions(-) rename core/lib/Thelia/{Action/Install.php => Install/BaseInstall.php} (66%) create mode 100644 core/lib/Thelia/Install/CheckPermission.php create mode 100644 core/lib/Thelia/Install/Exception/AlreadyInstallException.php create mode 100644 core/lib/Thelia/Install/Exception/InstallException.php diff --git a/core/lib/Thelia/Action/Install.php b/core/lib/Thelia/Install/BaseInstall.php similarity index 66% rename from core/lib/Thelia/Action/Install.php rename to core/lib/Thelia/Install/BaseInstall.php index 4c5d31df4..58c510267 100644 --- a/core/lib/Thelia/Action/Install.php +++ b/core/lib/Thelia/Install/BaseInstall.php @@ -20,42 +20,27 @@ /* along with this program. If not, see . */ /* */ /*************************************************************************************/ - -namespace Thelia\Action; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - +namespace Thelia\Install; +use Thelia\Install\Exception\AlreadyInstallException; /** - * Class Install - * @package Thelia\Action + * Class BaseInstall * @author Manuel Raynaud */ -class Install extends BaseAction implements EventSubscriberInterface { - +abstract class BaseInstall +{ /** - * Returns an array of event names this subscriber wants to listen to. - * - * The array keys are event names and the value can be: - * - * * The method name to call (priority defaults to 0) - * * An array composed of the method name to call and the priority - * * An array of arrays composed of the method names to call and respective - * priorities, or 0 if unset - * - * For instance: - * - * * array('eventName' => 'methodName') - * * array('eventName' => array('methodName', $priority)) - * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) - * - * @return array The event names to listen to - * - * @api + * Verify if an installation already exists */ - public static function getSubscribedEvents() + public function __construct($verifyInstall = true) { - array( + if (file_exists(THELIA_ROOT . '/local/config/database.yml') && $verifyInstall) { + throw new AlreadyInstallException("Thelia is already installed"); + } - ); + + $this->exec(); } + + abstract public function exec(); } \ No newline at end of file diff --git a/core/lib/Thelia/Install/CheckPermission.php b/core/lib/Thelia/Install/CheckPermission.php new file mode 100644 index 000000000..db73330cf --- /dev/null +++ b/core/lib/Thelia/Install/CheckPermission.php @@ -0,0 +1,78 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Install; + + +/** + * Class CheckPermission + * @package Thelia\Install + * @author Manuel Raynaud + */ +class CheckPermission extends BaseInstall +{ + const CONF = "const"; + const LOG = "log"; + const CACHE = "cache"; + + private $directories = array(); + private $validation = array(); + private $valid = true; + + public function __construct($verifyInstall = true) + { + + + $this->directories = array( + self::CONF => THELIA_ROOT . "local/config", + self::LOG => THELIA_ROOT . "log", + self::CACHE => THELIA_ROOT . "cache" + ); + + $this->validation = array( + self::CONF => array( + "text" => sprintf("config directory(%s)...", $this->directories[self::CONF]), + "status" => true + ), + self::LOG => array( + "text" => sprintf("cache directory(%s)...", $this->directories[self::LOG]), + "status" => true + ), + self::CACHE => array( + "text" => sprintf("log directory(%s)...", $this->directories[self::CACHE]), + "status" => true + ) + ); + parent::__construct($verifyInstall); + } + + public function exec() + { + foreach ($this->directories as $key => $directory) { + if(is_writable($directory) === false) { + $this->valid = false; + $this->validation[$key]["status"] = false; + } + } + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Install/Exception/AlreadyInstallException.php b/core/lib/Thelia/Install/Exception/AlreadyInstallException.php new file mode 100644 index 000000000..1409c7cdd --- /dev/null +++ b/core/lib/Thelia/Install/Exception/AlreadyInstallException.php @@ -0,0 +1,35 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Install\Exception; + + +/** + * Class AlreadyInstallException + * @package Thelia\Install\Exception + * @author Manuel Raynaud + */ +class AlreadyInstallException extends InstallException +{ + +} \ No newline at end of file diff --git a/core/lib/Thelia/Install/Exception/InstallException.php b/core/lib/Thelia/Install/Exception/InstallException.php new file mode 100644 index 000000000..6924bcfe5 --- /dev/null +++ b/core/lib/Thelia/Install/Exception/InstallException.php @@ -0,0 +1,32 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Install\Exception; + +/** + * Class InstallException + * @author Manuel Raynaud + */ +class InstallException extends \RuntimeException +{ + +} \ No newline at end of file From ac5c6b9f5aa7e553758b1785e7ff7db2c00c79eb Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Sep 2013 16:59:10 +0200 Subject: [PATCH 05/32] create install router --- core/lib/Thelia/Config/Resources/routing.xml | 11 ++++++ .../Config/Resources/routing/install.xml | 12 +++++++ .../Controller/Install/InstallController.php | 35 +++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 core/lib/Thelia/Config/Resources/routing/install.xml create mode 100644 core/lib/Thelia/Controller/Install/InstallController.php diff --git a/core/lib/Thelia/Config/Resources/routing.xml b/core/lib/Thelia/Config/Resources/routing.xml index 9c61c55a8..5200aefc1 100755 --- a/core/lib/Thelia/Config/Resources/routing.xml +++ b/core/lib/Thelia/Config/Resources/routing.xml @@ -56,6 +56,17 @@ + + + install.xml + + %kernel.cache_dir% + %kernel.debug% + + + + + front.xml diff --git a/core/lib/Thelia/Config/Resources/routing/install.xml b/core/lib/Thelia/Config/Resources/routing/install.xml new file mode 100644 index 000000000..8e0357fe0 --- /dev/null +++ b/core/lib/Thelia/Config/Resources/routing/install.xml @@ -0,0 +1,12 @@ + + + + + + Thelia\Controller\Front\DefaultController::noAction + index + + + diff --git a/core/lib/Thelia/Controller/Install/InstallController.php b/core/lib/Thelia/Controller/Install/InstallController.php new file mode 100644 index 000000000..1906d25ae --- /dev/null +++ b/core/lib/Thelia/Controller/Install/InstallController.php @@ -0,0 +1,35 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Install; +use Thelia\Controller\BaseController; + + +/** + * Class InstallController + * @package Thelia\Controller\Install + * @author Manuel Raynaud + */ +class InstallController extends BaseController { + +} \ No newline at end of file From 39d17fe30dea72d5dd1ffe51a4ecccf83fa2e9eb Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Sep 2013 17:12:30 +0200 Subject: [PATCH 06/32] create BaseAdminController --- core/lib/Thelia/Config/Resources/routing/install.xml | 3 +-- core/lib/Thelia/Controller/Install/InstallController.php | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/lib/Thelia/Config/Resources/routing/install.xml b/core/lib/Thelia/Config/Resources/routing/install.xml index 8e0357fe0..fb5c25bcc 100644 --- a/core/lib/Thelia/Config/Resources/routing/install.xml +++ b/core/lib/Thelia/Config/Resources/routing/install.xml @@ -5,8 +5,7 @@ xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - Thelia\Controller\Front\DefaultController::noAction - index + Thelia\Controller\Install\InstallController::index diff --git a/core/lib/Thelia/Controller/Install/InstallController.php b/core/lib/Thelia/Controller/Install/InstallController.php index 1906d25ae..1d20bc9d6 100644 --- a/core/lib/Thelia/Controller/Install/InstallController.php +++ b/core/lib/Thelia/Controller/Install/InstallController.php @@ -22,14 +22,13 @@ /*************************************************************************************/ namespace Thelia\Controller\Install; -use Thelia\Controller\BaseController; - +use Thelia\Install\BaseInstall; /** * Class InstallController * @package Thelia\Controller\Install * @author Manuel Raynaud */ -class InstallController extends BaseController { +class InstallController extends BaseInstallController { } \ No newline at end of file From 347d3050f3eeff4d1af5594ca90fa12e0ad60a14 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Sep 2013 17:13:01 +0200 Subject: [PATCH 07/32] add missinf files --- .../Install/BaseInstallController.php | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 core/lib/Thelia/Controller/Install/BaseInstallController.php diff --git a/core/lib/Thelia/Controller/Install/BaseInstallController.php b/core/lib/Thelia/Controller/Install/BaseInstallController.php new file mode 100644 index 000000000..fb04f85e8 --- /dev/null +++ b/core/lib/Thelia/Controller/Install/BaseInstallController.php @@ -0,0 +1,60 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Install; +use Symfony\Component\HttpFoundation\Response; +use Thelia\Controller\BaseController; + + +/** + * Class BaseInstallController + * @package Thelia\Controller\Install + * @author Manuel Raynaud + */ +class BaseInstallController extends BaseController +{ + /** + * @return a ParserInterface instance parser + */ + protected function getParser() + { + $parser = $this->container->get("thelia.parser"); + + // Define the template thant shoud be used + $parser->setTemplate("install/default"); + + return $parser; + } + + public function render($templateName, $args) + { + return new Response($this->renderRaw($templateName, $args)); + } + + public function renderRaw($templateName, $args) + { + $data = $this->getParser()->render($templateName, $args); + + return $data; + } +} \ No newline at end of file From 384b0cd355a685a0b8bfab242e4631a6691a088d Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Sep 2013 17:27:11 +0200 Subject: [PATCH 08/32] start to create install template --- .../Install/BaseInstallController.php | 6 ++--- .../Controller/Install/InstallController.php | 4 ++++ templates/install/includes/footer.inc.html | 17 +++++++++++++ templates/install/includes/header.inc.html | 24 +++++++++++++++++++ templates/install/index.html | 0 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 templates/install/includes/footer.inc.html create mode 100644 templates/install/includes/header.inc.html create mode 100644 templates/install/index.html diff --git a/core/lib/Thelia/Controller/Install/BaseInstallController.php b/core/lib/Thelia/Controller/Install/BaseInstallController.php index fb04f85e8..a5cbbd506 100644 --- a/core/lib/Thelia/Controller/Install/BaseInstallController.php +++ b/core/lib/Thelia/Controller/Install/BaseInstallController.php @@ -41,17 +41,17 @@ class BaseInstallController extends BaseController $parser = $this->container->get("thelia.parser"); // Define the template thant shoud be used - $parser->setTemplate("install/default"); + $parser->setTemplate("install"); return $parser; } - public function render($templateName, $args) + public function render($templateName, $args = array()) { return new Response($this->renderRaw($templateName, $args)); } - public function renderRaw($templateName, $args) + public function renderRaw($templateName, $args = array()) { $data = $this->getParser()->render($templateName, $args); diff --git a/core/lib/Thelia/Controller/Install/InstallController.php b/core/lib/Thelia/Controller/Install/InstallController.php index 1d20bc9d6..0c7770e4b 100644 --- a/core/lib/Thelia/Controller/Install/InstallController.php +++ b/core/lib/Thelia/Controller/Install/InstallController.php @@ -31,4 +31,8 @@ use Thelia\Install\BaseInstall; */ class InstallController extends BaseInstallController { + public function index() + { + $this->render("index.html"); + } } \ No newline at end of file diff --git a/templates/install/includes/footer.inc.html b/templates/install/includes/footer.inc.html new file mode 100644 index 000000000..c20b84adc --- /dev/null +++ b/templates/install/includes/footer.inc.html @@ -0,0 +1,17 @@ + +
+ + + + \ No newline at end of file diff --git a/templates/install/includes/header.inc.html b/templates/install/includes/header.inc.html new file mode 100644 index 000000000..39d7c42da --- /dev/null +++ b/templates/install/includes/header.inc.html @@ -0,0 +1,24 @@ + + + + {intl l='Thelia Back Office'}{if ! empty($page_title)} - {$page_title}{/if} + + {images file='../../admin/default/assets/img/favicon.ico'}{/images} + + + + {stylesheets file='../../admin/default/assets/bootstrap/css/bootstrap.css' filters='cssembed'} + + {/stylesheets} + + {stylesheets file='../../admin/default/assets/bootstrap/css/bootstrap-responsive.css' filters='cssembed'} + + {/stylesheets} + + + {stylesheets file='../../admin/default/assets/css/*' filters='less,cssembed'} + + {/stylesheets} + + + diff --git a/templates/install/index.html b/templates/install/index.html new file mode 100644 index 000000000..e69de29bb From 73508028b46c8967d915bff47d9786159e29c7a5 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Sep 2013 17:44:22 +0200 Subject: [PATCH 09/32] create layout for install template --- templates/install/includes/footer.inc.html | 17 -------- templates/install/includes/header.inc.html | 24 ----------- templates/install/index.html | 4 ++ templates/install/layout.html | 49 ++++++++++++++++++++++ 4 files changed, 53 insertions(+), 41 deletions(-) delete mode 100644 templates/install/includes/footer.inc.html delete mode 100644 templates/install/includes/header.inc.html create mode 100644 templates/install/layout.html diff --git a/templates/install/includes/footer.inc.html b/templates/install/includes/footer.inc.html deleted file mode 100644 index c20b84adc..000000000 --- a/templates/install/includes/footer.inc.html +++ /dev/null @@ -1,17 +0,0 @@ - -
- - - - \ No newline at end of file diff --git a/templates/install/includes/header.inc.html b/templates/install/includes/header.inc.html deleted file mode 100644 index 39d7c42da..000000000 --- a/templates/install/includes/header.inc.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - {intl l='Thelia Back Office'}{if ! empty($page_title)} - {$page_title}{/if} - - {images file='../../admin/default/assets/img/favicon.ico'}{/images} - - - - {stylesheets file='../../admin/default/assets/bootstrap/css/bootstrap.css' filters='cssembed'} - - {/stylesheets} - - {stylesheets file='../../admin/default/assets/bootstrap/css/bootstrap-responsive.css' filters='cssembed'} - - {/stylesheets} - - - {stylesheets file='../../admin/default/assets/css/*' filters='less,cssembed'} - - {/stylesheets} - - - diff --git a/templates/install/index.html b/templates/install/index.html index e69de29bb..888f8b943 100644 --- a/templates/install/index.html +++ b/templates/install/index.html @@ -0,0 +1,4 @@ +{extends file="layout.html"} +{block name="content"} + Hello World ! +{/block} \ No newline at end of file diff --git a/templates/install/layout.html b/templates/install/layout.html new file mode 100644 index 000000000..0a13586ad --- /dev/null +++ b/templates/install/layout.html @@ -0,0 +1,49 @@ + + + + {block name="title"}Thelia Install{/block} + + {images file='../admin/default/assets/img/favicon.ico'}{/images} + + + + {stylesheets file='../admin/default/assets/bootstrap/css/bootstrap.css' filters='cssembed'} + + {/stylesheets} + + {stylesheets file='../admin/default/assets/bootstrap/css/bootstrap-responsive.css' filters='cssembed'} + + {/stylesheets} + + + {stylesheets file='../admin/default/assets/css/*' filters='less,cssembed'} + + {/stylesheets} + + + +
+
+
{intl l='Version %ver' ver="{$THELIA_VERSION}"}
+
+
+
+ {block name="content"}{/block} +
+ +
+ + + + \ No newline at end of file From 50e585044f6168d9918f7c38d582391244bdacc7 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 2 Sep 2013 19:56:34 +0200 Subject: [PATCH 10/32] initialize step 2 --- .../Config/Resources/routing/install.xml | 4 +++ core/lib/Thelia/Controller/BaseController.php | 2 +- .../Controller/Install/InstallController.php | 31 +++++++++++++++++++ templates/install/index.html | 10 +++++- 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/core/lib/Thelia/Config/Resources/routing/install.xml b/core/lib/Thelia/Config/Resources/routing/install.xml index fb5c25bcc..d53763948 100644 --- a/core/lib/Thelia/Config/Resources/routing/install.xml +++ b/core/lib/Thelia/Config/Resources/routing/install.xml @@ -8,4 +8,8 @@ Thelia\Controller\Install\InstallController::index + + Thelia\Controller\Install\InstallController::checkPermission + + diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index c7c9f6f14..d4c8b5854 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -179,7 +179,7 @@ class BaseController extends ContainerAware */ public function redirect($url) { - Redirect::exec($url); + Redirect::exec(URL::absoluteUrl($url)); } /** diff --git a/core/lib/Thelia/Controller/Install/InstallController.php b/core/lib/Thelia/Controller/Install/InstallController.php index 0c7770e4b..209eea82b 100644 --- a/core/lib/Thelia/Controller/Install/InstallController.php +++ b/core/lib/Thelia/Controller/Install/InstallController.php @@ -23,6 +23,7 @@ namespace Thelia\Controller\Install; use Thelia\Install\BaseInstall; +use Thelia\Install\CheckPermission; /** * Class InstallController @@ -33,6 +34,36 @@ class InstallController extends BaseInstallController { public function index() { + $this->verifyStep(1); + + $this->getSession()->set("step", 1); + $this->render("index.html"); } + + public function checkPermission() + { + $this->verifyStep(2); + + $permission = new CheckPermission(); + } + + protected function verifyStep($step) + { + $session = $this->getSession(); + + if ($session->has("step")) { + $sessionStep = $session->get("step"); + } else { + return true; + } + + switch($step) { + case "1" : + if ($sessionStep > 1) { + $this->redirect("/install/step/2"); + } + break; + } + } } \ No newline at end of file diff --git a/templates/install/index.html b/templates/install/index.html index 888f8b943..a996cc241 100644 --- a/templates/install/index.html +++ b/templates/install/index.html @@ -1,4 +1,12 @@ {extends file="layout.html"} {block name="content"} - Hello World ! +

{intl l="Thelia installation wizard"}

+
+ + {intl l="Bienvenue au sein du programme d'installation de Thelia."}
+ {intl l="Nous allons vous guider tout au long de ce processus afin d'installer l'application sur votre système."}

+ +
+ +
{/block} \ No newline at end of file From 3de03dc8762fd2031e3d6074079c0ff8ffbb492f Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Tue, 3 Sep 2013 10:09:51 +0200 Subject: [PATCH 11/32] SID : rewriting --- .../Thelia/Config/Resources/routing/front.xml | 4 + core/lib/Thelia/Controller/BaseController.php | 4 +- .../Controller/Front/DefaultController.php | 13 +++ .../Front/UrlRewritingController.php | 84 +++++++++++++++++++ .../Exception/UrlRewritingException.php | 40 +++++++++ .../Thelia/Rewriting/RewritingResolver.php | 47 +++++++++++ .../Thelia/Rewriting/RewritingRetriever.php | 4 + core/lib/Thelia/Tools/URL.php | 24 +++++- 8 files changed, 216 insertions(+), 4 deletions(-) create mode 100755 core/lib/Thelia/Controller/Front/UrlRewritingController.php create mode 100755 core/lib/Thelia/Exception/UrlRewritingException.php diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index c420e1550..b235df3ee 100755 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -36,4 +36,8 @@ Thelia\Controller\Front\CartController::changeItem cart + + + Thelia\Controller\Front\UrlRewritingController::check + diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index 1a610768d..4b245a9e4 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -148,9 +148,9 @@ class BaseController extends ContainerAware * redirect request to specify url * @param string $url */ - public function redirect($url) + public function redirect($url, $status = 302) { - Redirect::exec($url); + Redirect::exec($url, $status); } /** diff --git a/core/lib/Thelia/Controller/Front/DefaultController.php b/core/lib/Thelia/Controller/Front/DefaultController.php index 235e1bb64..75588ca31 100755 --- a/core/lib/Thelia/Controller/Front/DefaultController.php +++ b/core/lib/Thelia/Controller/Front/DefaultController.php @@ -23,6 +23,9 @@ namespace Thelia\Controller\Front; use Symfony\Component\HttpFoundation\Request; +use Thelia\Model\ConfigQuery; +use Thelia\Tools\Redirect; +use Thelia\Tools\URL; /** * @@ -43,6 +46,16 @@ class DefaultController extends BaseFrontController */ public function noAction(Request $request) { + if(ConfigQuery::isRewritingEnable()) { + + /* Does the query GET parameters match a rewritten URL ? */ + $rewrittenUrl = URL::retrieveCurrent($request, true); + if($rewrittenUrl !== null) { + /* 301 redirection to rewritten URL */ + $this->redirect($rewrittenUrl, 301); + } + } + if (! $view = $request->query->get('view')) { $view = "index"; if ($request->request->has('view')) { diff --git a/core/lib/Thelia/Controller/Front/UrlRewritingController.php b/core/lib/Thelia/Controller/Front/UrlRewritingController.php new file mode 100755 index 000000000..ffdc95832 --- /dev/null +++ b/core/lib/Thelia/Controller/Front/UrlRewritingController.php @@ -0,0 +1,84 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Controller\Front; + +//use Propel\Runtime\Exception\PropelException; +//use Thelia\Form\Exception\FormValidationException; +//use Thelia\Core\Event\CartEvent; +//use Thelia\Core\Event\TheliaEvents; +//use Symfony\Component\HttpFoundation\Request; +//use Thelia\Form\CartAdd; + +use Thelia\Core\HttpFoundation\Request; +use Thelia\Exception\UrlRewritingException; +use Thelia\Model\ConfigQuery; +use Thelia\Tools\URL; + +class UrlRewritingController extends BaseFrontController +{ + public function check(Request $request) + { + if(ConfigQuery::isRewritingEnable()) { + try { + $rewrittentUrlData = URL::resolveCurrent($request); + } catch(UrlRewritingException $e) { + $code = $e->getCode(); + switch($e->getCode()) { + case UrlRewritingException::URL_NOT_FOUND : + /* TODO : redirect 404 */ + throw $e; + break; + default: + throw $e; + } + } + + /* define GET arguments in request */ + + if(null !== $rewrittentUrlData->view) { + $request->query->set('view', $rewrittentUrlData->view); + if(null !== $rewrittentUrlData->viewId) { + $request->query->set($rewrittentUrlData->view . '_id', $rewrittentUrlData->viewId); + } + } + if(null !== $rewrittentUrlData->locale) { + $request->query->set('locale', $rewrittentUrlData->locale); + } + + foreach($rewrittentUrlData->otherParameters as $parameter => $value) { + $request->query->set($parameter, $value); + } + } + + if (! $view = $request->query->get('view')) { + $view = "index"; + if ($request->request->has('view')) { + $view = $request->request->get('view'); + } + } + + $request->attributes->set('_view', $view); + + } + +} diff --git a/core/lib/Thelia/Exception/UrlRewritingException.php b/core/lib/Thelia/Exception/UrlRewritingException.php new file mode 100755 index 000000000..507058ce4 --- /dev/null +++ b/core/lib/Thelia/Exception/UrlRewritingException.php @@ -0,0 +1,40 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Exception; + +use Thelia\Log\Tlog; + +class UrlRewritingException extends \Exception +{ + const UNKNOWN_EXCEPTION = 0; + + const URL_NOT_FOUND = 404; + + public function __construct($message, $code = null, $previous = null) { + if($code === null) { + $code = self::UNKNOWN_EXCEPTION; + } + parent::__construct($message, $code, $previous); + } +} diff --git a/core/lib/Thelia/Rewriting/RewritingResolver.php b/core/lib/Thelia/Rewriting/RewritingResolver.php index 818dbec32..83d9840d6 100755 --- a/core/lib/Thelia/Rewriting/RewritingResolver.php +++ b/core/lib/Thelia/Rewriting/RewritingResolver.php @@ -22,6 +22,11 @@ /*************************************************************************************/ namespace Thelia\Rewriting; +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Exception\RewritingUrlException; +use Thelia\Exception\UrlRewritingException; +use Thelia\Model\RewritingArgumentQuery; + /** * Class RewritingResolver * @package Thelia\Rewriting @@ -31,5 +36,47 @@ namespace Thelia\Rewriting; */ class RewritingResolver { + public $view; + public $viewId; + public $locale; + public $otherParameters; + public function __construct($url = null) + { + if($url !== null) { + $this->load($url); + } + } + + public function load($rewrittenUrl) + { + $search = RewritingArgumentQuery::create() + //->filterByUrl($rewrittenUrl) + ->joinRewritingUrl('ru', Criteria::RIGHT_JOIN) + ->where('`ru`.URL = ?', $rewrittenUrl, \PDO::PARAM_STR) + ->withColumn('`ru`.URL', 'ru_url') + ->withColumn('`ru`.VIEW', 'ru_view') + ->withColumn('`ru`.VIEW_LOCALE', 'ru_locale') + ->withColumn('`ru`.VIEW_ID', 'ru_viewId') + ->find(); + + if($search->count() == 0) { + throw new UrlRewritingException('URL NOT FOUND', UrlRewritingException::URL_NOT_FOUND); + } + + $otherParameters = array(); + foreach($search as $result) { + $parameter = $result->getParameter(); + $value = $result->getValue(); + + if(null !== $parameter) { + $otherParameters[$parameter] = $value; + } + } + + $this->view = $search->getFirst()->getVirtualColumn('ru_view'); + $this->viewId = $search->getFirst()->getVirtualColumn('ru_viewId'); + $this->locale = $search->getFirst()->getVirtualColumn('ru_locale'); + $this->otherParameters = $otherParameters; + } } diff --git a/core/lib/Thelia/Rewriting/RewritingRetriever.php b/core/lib/Thelia/Rewriting/RewritingRetriever.php index 0deb7de45..c47fb2a84 100755 --- a/core/lib/Thelia/Rewriting/RewritingRetriever.php +++ b/core/lib/Thelia/Rewriting/RewritingRetriever.php @@ -79,6 +79,10 @@ class RewritingRetriever */ public function getSpecificUrl($view, $viewLocale, $viewId = null, $viewOtherParameters = array()) { + if(empty($viewOtherParameters)) { + return $this->getViewUrl($view, $viewLocale, $viewId); + } + $urlQuery = RewritingUrlQuery::create() ->joinRewritingArgument('ra', Criteria::LEFT_JOIN) ->withColumn('`ra`.REWRITING_URL_ID', 'ra_REWRITING_URL_ID') diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php index 1bf0e566c..e51ed5abb 100755 --- a/core/lib/Thelia/Tools/URL.php +++ b/core/lib/Thelia/Tools/URL.php @@ -25,6 +25,7 @@ namespace Thelia\Tools; use Symfony\Component\HttpFoundation\Request; use Thelia\Model\ConfigQuery; +use Thelia\Rewriting\RewritingResolver; use Thelia\Rewriting\RewritingRetriever; class URL @@ -126,7 +127,7 @@ class URL return $rewrittenUrl === null ? self::viewUrl($view, array($view . '_id' => $viewId, 'locale' => $viewLocale)) : $rewrittenUrl; } - public static function retrieveCurrent(Request $request) + public static function retrieveCurrent(Request $request, $rewrittenUrlOnly = false) { $rewrittenUrl = null; if(ConfigQuery::isRewritingEnable()) { @@ -151,6 +152,25 @@ class URL $rewrittenUrl = $retriever->getSpecificUrl($view, $viewLocale, $viewId, $allOtherParameters); } - return $rewrittenUrl === null ? self::viewUrl($view, $allParametersWithoutView) : $rewrittenUrl; + if($rewrittenUrlOnly) { + return $rewrittenUrl !== null ? $rewrittenUrl : null; + } else { + return $rewrittenUrl !== null ? $rewrittenUrl : self::viewUrl($view, $allParametersWithoutView); + } + } + + public static function resolve($url) + { + $resolver = new RewritingResolver($url); + return $resolver; + } + + public static function resolveCurrent(Request $request) + { + if(ConfigQuery::isRewritingEnable()) { + return self::resolve($request->get('rewritten_url')); + } + + return null; } } From 9f96b830e7de06c2e7d0e064875ef1dcf60a2965 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 3 Sep 2013 11:07:32 +0200 Subject: [PATCH 12/32] create task for reloaded database --- .../Thelia/Command/ReloadDatabaseCommand.php | 70 ++++++++++++ core/lib/Thelia/Config/Resources/config.xml | 1 + core/lib/Thelia/Install/Database.php | 103 ++++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 core/lib/Thelia/Command/ReloadDatabaseCommand.php create mode 100644 core/lib/Thelia/Install/Database.php diff --git a/core/lib/Thelia/Command/ReloadDatabaseCommand.php b/core/lib/Thelia/Command/ReloadDatabaseCommand.php new file mode 100644 index 000000000..d25add644 --- /dev/null +++ b/core/lib/Thelia/Command/ReloadDatabaseCommand.php @@ -0,0 +1,70 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Command; +use Propel\Runtime\Propel; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Thelia\Install\Database; + + +/** + * Class ReloadDatabasesCommand + * @package Thelia\Command + * @author Manuel Raynaud + */ +class ReloadDatabaseCommand extends BaseModuleGenerate +{ + public function configure() + { + $this + ->setName("thelia:dev:reloadDB") + ->setDescription("erase current database and create new one") +/* ->addOption( + "load-fixtures", + null, + InputOption::VALUE_NONE, + "load fixtures in databases" + )*/ + ; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + $connection = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME); + $connection = $connection->getWrappedConnection(); + + $database = new Database($connection); + $output->writeln(array( + '', + 'starting reloaded database, please wait' + )); + $database->insertSql(); + $output->writeln(array( + '', + 'Database reloaded with success', + '' + )); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 4c1bf61f8..df4ca0049 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -64,6 +64,7 @@ + diff --git a/core/lib/Thelia/Install/Database.php b/core/lib/Thelia/Install/Database.php new file mode 100644 index 000000000..34ca97dae --- /dev/null +++ b/core/lib/Thelia/Install/Database.php @@ -0,0 +1,103 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Install; + + +/** + * Class Database + * @package Thelia\Install + * @author Manuel Raynaud + */ +class Database +{ + public $connection; + + public function __construct(\PDO $connection) + { + $this->connection = $connection; + } + + /** + * Insert all sql needed in database + * + * @param $dbName + */ + public function insertSql($dbName = null) + { + if($dbName) { + $this->connection->query(sprintf("use %s", $dbName)); + } + + $sql = array(); + $sql = array_merge( + $sql, + $this->prepareSql(file_get_contents(THELIA_ROOT . "/install/thelia.sql")), + $this->prepareSql(file_get_contents(THELIA_ROOT . "/install/insert.sql")) + ); + + for ($i = 0; $i < count($sql); $i ++) { + if (!empty($sql[$i])) { + $this->connection->query($sql[$i]); + } + } + } + + /** + * Separate each sql instruction in an array + * + * @param $sql + * @return array + */ + protected function prepareSql($sql) + { + $sql = str_replace(";',", "-CODE-", $sql); + $sql = trim($sql); + $query = array(); + + $tab = explode(";", $sql); + + for ($i=0; $iconnection->query( + sprintf( + "CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8", + $dbName + ) + ); + } +} \ No newline at end of file From 15a91a9fd95a8ab95d7112408a50caf5e5881f4d Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 3 Sep 2013 11:09:27 +0200 Subject: [PATCH 13/32] refactor install process, database management in dedicated class --- core/lib/Thelia/Command/Install.php | 66 +++-------------------------- 1 file changed, 5 insertions(+), 61 deletions(-) diff --git a/core/lib/Thelia/Command/Install.php b/core/lib/Thelia/Command/Install.php index 2e10d77ee..03b7fda48 100755 --- a/core/lib/Thelia/Command/Install.php +++ b/core/lib/Thelia/Command/Install.php @@ -28,6 +28,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; use Thelia\Command\ContainerAwareCommand; +use Thelia\Install\Database; /** * try to install a new instance of Thelia @@ -97,14 +98,16 @@ class Install extends ContainerAwareCommand $connectionInfo = $this->getConnectionInfo($input, $output); } - $this->createDatabase($connection, $connectionInfo["dbName"]); + $database = new Database($connection); + + $database->createDatabase($connectionInfo["dbName"]); $output->writeln(array( "", "Creating Thelia database, please wait", "" )); - $this->insertSql($connection, $connectionInfo["dbName"]); + $database->insertSql($connectionInfo["dbName"]); $output->writeln(array( "", @@ -203,65 +206,6 @@ class Install extends ContainerAwareCommand } - /** - * Insert all sql needed in database - * - * @param \PDO $connection - * @param $dbName - */ - protected function insertSql(\PDO $connection, $dbName) - { - $connection->query(sprintf("use %s", $dbName)); - $sql = array(); - $sql = array_merge( - $sql, - $this->prepareSql(file_get_contents(THELIA_ROOT . "/install/thelia.sql")), - $this->prepareSql(file_get_contents(THELIA_ROOT . "/install/insert.sql")) - ); - - for ($i = 0; $i < count($sql); $i ++) { - $connection->query($sql[$i]); - } - } - - /** - * Separate each sql instruction in an array - * - * @param $sql - * @return array - */ - protected function prepareSql($sql) - { - $sql = str_replace(";',", "-CODE-", $sql); - $query = array(); - - $tab = explode(";", $sql); - - for ($i=0; $iquery( - sprintf( - "CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8", - $dbName - ) - ); - } - /** * test database access * From 1496f51c0e672f25fe46425b6949c21b4893246e Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 3 Sep 2013 11:14:44 +0200 Subject: [PATCH 14/32] refactor reset_install script --- core/lib/Thelia/Model/Category.php | 1 + reset_install.sh | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php index ac3b2fff6..ae999ccc8 100755 --- a/core/lib/Thelia/Model/Category.php +++ b/core/lib/Thelia/Model/Category.php @@ -2,6 +2,7 @@ namespace Thelia\Model; +use Thelia\Core\Event\CategoryEvent; use Thelia\Model\Base\Category as BaseCategory; use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Tools\URL; diff --git a/reset_install.sh b/reset_install.sh index 5c51ac60c..ef725e313 100755 --- a/reset_install.sh +++ b/reset_install.sh @@ -5,7 +5,6 @@ echo -e "\033[47m\033[1;31m\n[WARN] This script will reset this Thelia2 install\n\033[0m" if [ ! -f local/config/database.yml ]; then - cp local/config/database.yml.sample local/config/database.yml echo "[FAILED] Please add your database informations in local/config/database.yml and start this script again." else echo -e "\n\e[01;34m[INFO] Downloading vendors\e[00m\n" @@ -19,14 +18,11 @@ else echo -e "\n\e[01;34m[INFO] Building SQL CREATE file\e[00m\n" ../../bin/propel sql:build -v --output-dir=../../install/ - # Not working : insert manually - # echo -e "\n\e[01;34m[INFO] Inserting SQL\e[00m\n" - # ../../bin/propel insert-sql -v --output-dir=../../install/ - # install/thelia.sql - # install/insert.sql - echo -e "\n\e[01;34m[INFO] Reinstalling Thelia2\e[00m\n" + + echo -e "\n\e[01;34m[INFO] Reloaded Thelia2 database\e[00m\n" cd ../.. - php Thelia thelia:install + rm install/sqldb.map + php Thelia thelia:dev:reloadDB echo -e "\n\e[01;34m[INFO] Installing fixtures\e[00m\n" php install/faker.php From 8a84af399d1c21e9c81703a0277f6e8ab756c50f Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 3 Sep 2013 12:25:47 +0200 Subject: [PATCH 15/32] fix redirect process in viewListener --- core/lib/Thelia/Core/EventListener/ViewListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php index 22c31a2e4..d55826d56 100755 --- a/core/lib/Thelia/Core/EventListener/ViewListener.php +++ b/core/lib/Thelia/Core/EventListener/ViewListener.php @@ -86,7 +86,7 @@ class ViewListener implements EventSubscriberInterface } catch (AuthenticationException $ex) { // Redirect to the login template - $event->setResponse(Redirect::exec(URL::viewUrl($ex->getLoginTemplate()))); + Redirect::exec(URL::viewUrl($ex->getLoginTemplate())); } } From 483710afd21ae9ca4c0a97c691d00d9ec5993638 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 3 Sep 2013 14:01:07 +0200 Subject: [PATCH 16/32] update address model --- .../Thelia/Config/Resources/routing/front.xml | 10 + core/lib/Thelia/Model/Base/Address.php | 48 +- core/lib/Thelia/Model/Base/AddressQuery.php | 28 +- core/lib/Thelia/Model/Base/Coupon.php | 667 +---- core/lib/Thelia/Model/Base/CouponI18n.php | 176 +- .../lib/Thelia/Model/Base/CouponI18nQuery.php | 101 +- core/lib/Thelia/Model/Base/CouponOrder.php | 165 +- .../Thelia/Model/Base/CouponOrderQuery.php | 114 +- core/lib/Thelia/Model/Base/CouponQuery.php | 178 +- core/lib/Thelia/Model/Base/CouponVersion.php | 292 +-- .../Thelia/Model/Base/CouponVersionQuery.php | 101 +- core/lib/Thelia/Model/Base/Order.php | 25 - core/lib/Thelia/Model/Map/AddressTableMap.php | 30 +- .../Thelia/Model/Map/CouponI18nTableMap.php | 52 +- .../Thelia/Model/Map/CouponOrderTableMap.php | 37 +- core/lib/Thelia/Model/Map/CouponTableMap.php | 55 +- .../Model/Map/CouponVersionTableMap.php | 56 +- install/thelia.sql | 18 +- local/config/schema.xml | 2265 ++++++++--------- 19 files changed, 1763 insertions(+), 2655 deletions(-) diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index 9329b22ad..4e78afd1f 100755 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -9,6 +9,7 @@ index + Thelia\Controller\Front\CustomerController::createAction connexion @@ -25,7 +26,15 @@ Thelia\Controller\Front\CustomerController::logoutAction + + + + Thelia\Controller\Front\CustomerAddressController::createAction + + + + Thelia\Controller\Front\CartController::addItem cart @@ -40,4 +49,5 @@ Thelia\Controller\Front\CartController::changeItem cart + diff --git a/core/lib/Thelia/Model/Base/Address.php b/core/lib/Thelia/Model/Base/Address.php index a6ab068d1..2dc666a08 100755 --- a/core/lib/Thelia/Model/Base/Address.php +++ b/core/lib/Thelia/Model/Base/Address.php @@ -70,10 +70,10 @@ abstract class Address implements ActiveRecordInterface protected $id; /** - * The value for the name field. + * The value for the label field. * @var string */ - protected $name; + protected $label; /** * The value for the customer_id field. @@ -498,14 +498,14 @@ abstract class Address implements ActiveRecordInterface } /** - * Get the [name] column value. + * Get the [label] column value. * * @return string */ - public function getName() + public function getLabel() { - return $this->name; + return $this->label; } /** @@ -724,25 +724,25 @@ abstract class Address implements ActiveRecordInterface } // setId() /** - * Set the value of [name] column. + * Set the value of [label] column. * * @param string $v new value * @return \Thelia\Model\Address The current object (for fluent API support) */ - public function setName($v) + public function setLabel($v) { if ($v !== null) { $v = (string) $v; } - if ($this->name !== $v) { - $this->name = $v; - $this->modifiedColumns[] = AddressTableMap::NAME; + if ($this->label !== $v) { + $this->label = $v; + $this->modifiedColumns[] = AddressTableMap::LABEL; } return $this; - } // setName() + } // setLabel() /** * Set the value of [customer_id] column. @@ -1136,8 +1136,8 @@ abstract class Address implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AddressTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AddressTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]; - $this->name = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AddressTableMap::translateFieldName('Label', TableMap::TYPE_PHPNAME, $indexType)]; + $this->label = (null !== $col) ? (string) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AddressTableMap::translateFieldName('CustomerId', TableMap::TYPE_PHPNAME, $indexType)]; $this->customer_id = (null !== $col) ? (int) $col : null; @@ -1501,8 +1501,8 @@ abstract class Address implements ActiveRecordInterface if ($this->isColumnModified(AddressTableMap::ID)) { $modifiedColumns[':p' . $index++] = 'ID'; } - if ($this->isColumnModified(AddressTableMap::NAME)) { - $modifiedColumns[':p' . $index++] = 'NAME'; + if ($this->isColumnModified(AddressTableMap::LABEL)) { + $modifiedColumns[':p' . $index++] = 'LABEL'; } if ($this->isColumnModified(AddressTableMap::CUSTOMER_ID)) { $modifiedColumns[':p' . $index++] = 'CUSTOMER_ID'; @@ -1566,8 +1566,8 @@ abstract class Address implements ActiveRecordInterface case 'ID': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case 'NAME': - $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); + case 'LABEL': + $stmt->bindValue($identifier, $this->label, PDO::PARAM_STR); break; case 'CUSTOMER_ID': $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT); @@ -1683,7 +1683,7 @@ abstract class Address implements ActiveRecordInterface return $this->getId(); break; case 1: - return $this->getName(); + return $this->getLabel(); break; case 2: return $this->getCustomerId(); @@ -1763,7 +1763,7 @@ abstract class Address implements ActiveRecordInterface $keys = AddressTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), - $keys[1] => $this->getName(), + $keys[1] => $this->getLabel(), $keys[2] => $this->getCustomerId(), $keys[3] => $this->getTitleId(), $keys[4] => $this->getCompany(), @@ -1841,7 +1841,7 @@ abstract class Address implements ActiveRecordInterface $this->setId($value); break; case 1: - $this->setName($value); + $this->setLabel($value); break; case 2: $this->setCustomerId($value); @@ -1916,7 +1916,7 @@ abstract class Address implements ActiveRecordInterface $keys = AddressTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]); + if (array_key_exists($keys[1], $arr)) $this->setLabel($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setCustomerId($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setTitleId($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setCompany($arr[$keys[4]]); @@ -1945,7 +1945,7 @@ abstract class Address implements ActiveRecordInterface $criteria = new Criteria(AddressTableMap::DATABASE_NAME); if ($this->isColumnModified(AddressTableMap::ID)) $criteria->add(AddressTableMap::ID, $this->id); - if ($this->isColumnModified(AddressTableMap::NAME)) $criteria->add(AddressTableMap::NAME, $this->name); + if ($this->isColumnModified(AddressTableMap::LABEL)) $criteria->add(AddressTableMap::LABEL, $this->label); if ($this->isColumnModified(AddressTableMap::CUSTOMER_ID)) $criteria->add(AddressTableMap::CUSTOMER_ID, $this->customer_id); if ($this->isColumnModified(AddressTableMap::TITLE_ID)) $criteria->add(AddressTableMap::TITLE_ID, $this->title_id); if ($this->isColumnModified(AddressTableMap::COMPANY)) $criteria->add(AddressTableMap::COMPANY, $this->company); @@ -2025,7 +2025,7 @@ abstract class Address implements ActiveRecordInterface */ public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { - $copyObj->setName($this->getName()); + $copyObj->setLabel($this->getLabel()); $copyObj->setCustomerId($this->getCustomerId()); $copyObj->setTitleId($this->getTitleId()); $copyObj->setCompany($this->getCompany()); @@ -2804,7 +2804,7 @@ abstract class Address implements ActiveRecordInterface public function clear() { $this->id = null; - $this->name = null; + $this->label = null; $this->customer_id = null; $this->title_id = null; $this->company = null; diff --git a/core/lib/Thelia/Model/Base/AddressQuery.php b/core/lib/Thelia/Model/Base/AddressQuery.php index c67c79b02..dc6827868 100755 --- a/core/lib/Thelia/Model/Base/AddressQuery.php +++ b/core/lib/Thelia/Model/Base/AddressQuery.php @@ -22,7 +22,7 @@ use Thelia\Model\Map\AddressTableMap; * * * @method ChildAddressQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildAddressQuery orderByName($order = Criteria::ASC) Order by the name column + * @method ChildAddressQuery orderByLabel($order = Criteria::ASC) Order by the label column * @method ChildAddressQuery orderByCustomerId($order = Criteria::ASC) Order by the customer_id column * @method ChildAddressQuery orderByTitleId($order = Criteria::ASC) Order by the title_id column * @method ChildAddressQuery orderByCompany($order = Criteria::ASC) Order by the company column @@ -41,7 +41,7 @@ use Thelia\Model\Map\AddressTableMap; * @method ChildAddressQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildAddressQuery groupById() Group by the id column - * @method ChildAddressQuery groupByName() Group by the name column + * @method ChildAddressQuery groupByLabel() Group by the label column * @method ChildAddressQuery groupByCustomerId() Group by the customer_id column * @method ChildAddressQuery groupByTitleId() Group by the title_id column * @method ChildAddressQuery groupByCompany() Group by the company column @@ -87,7 +87,7 @@ use Thelia\Model\Map\AddressTableMap; * @method ChildAddress findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAddress matching the query, or a new ChildAddress object populated from the query conditions when no match is found * * @method ChildAddress findOneById(int $id) Return the first ChildAddress filtered by the id column - * @method ChildAddress findOneByName(string $name) Return the first ChildAddress filtered by the name column + * @method ChildAddress findOneByLabel(string $label) Return the first ChildAddress filtered by the label column * @method ChildAddress findOneByCustomerId(int $customer_id) Return the first ChildAddress filtered by the customer_id column * @method ChildAddress findOneByTitleId(int $title_id) Return the first ChildAddress filtered by the title_id column * @method ChildAddress findOneByCompany(string $company) Return the first ChildAddress filtered by the company column @@ -106,7 +106,7 @@ use Thelia\Model\Map\AddressTableMap; * @method ChildAddress findOneByUpdatedAt(string $updated_at) Return the first ChildAddress filtered by the updated_at column * * @method array findById(int $id) Return ChildAddress objects filtered by the id column - * @method array findByName(string $name) Return ChildAddress objects filtered by the name column + * @method array findByLabel(string $label) Return ChildAddress objects filtered by the label column * @method array findByCustomerId(int $customer_id) Return ChildAddress objects filtered by the customer_id column * @method array findByTitleId(int $title_id) Return ChildAddress objects filtered by the title_id column * @method array findByCompany(string $company) Return ChildAddress objects filtered by the company column @@ -211,7 +211,7 @@ abstract class AddressQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, NAME, CUSTOMER_ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0'; + $sql = 'SELECT ID, LABEL, CUSTOMER_ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -342,32 +342,32 @@ abstract class AddressQuery extends ModelCriteria } /** - * Filter the query on the name column + * Filter the query on the label column * * Example usage: * - * $query->filterByName('fooValue'); // WHERE name = 'fooValue' - * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' + * $query->filterByLabel('fooValue'); // WHERE label = 'fooValue' + * $query->filterByLabel('%fooValue%'); // WHERE label LIKE '%fooValue%' * * - * @param string $name The value to use as filter. + * @param string $label The value to use as filter. * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildAddressQuery The current query, for fluid interface */ - public function filterByName($name = null, $comparison = null) + public function filterByLabel($label = null, $comparison = null) { if (null === $comparison) { - if (is_array($name)) { + if (is_array($label)) { $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $name)) { - $name = str_replace('*', '%', $name); + } elseif (preg_match('/[\%\*]/', $label)) { + $label = str_replace('*', '%', $label); $comparison = Criteria::LIKE; } } - return $this->addUsingAlias(AddressTableMap::NAME, $name, $comparison); + return $this->addUsingAlias(AddressTableMap::LABEL, $label, $comparison); } /** diff --git a/core/lib/Thelia/Model/Base/Coupon.php b/core/lib/Thelia/Model/Base/Coupon.php index a8db4b459..4c5dcd917 100755 --- a/core/lib/Thelia/Model/Base/Coupon.php +++ b/core/lib/Thelia/Model/Base/Coupon.php @@ -20,8 +20,6 @@ use Propel\Runtime\Util\PropelDateTime; use Thelia\Model\Coupon as ChildCoupon; use Thelia\Model\CouponI18n as ChildCouponI18n; use Thelia\Model\CouponI18nQuery as ChildCouponI18nQuery; -use Thelia\Model\CouponOrder as ChildCouponOrder; -use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery; use Thelia\Model\CouponQuery as ChildCouponQuery; use Thelia\Model\CouponVersion as ChildCouponVersion; use Thelia\Model\CouponVersionQuery as ChildCouponVersionQuery; @@ -80,24 +78,6 @@ abstract class Coupon implements ActiveRecordInterface */ protected $type; - /** - * The value for the title field. - * @var string - */ - protected $title; - - /** - * The value for the short_description field. - * @var string - */ - protected $short_description; - - /** - * The value for the description field. - * @var string - */ - protected $description; - /** * The value for the amount field. * @var double @@ -171,12 +151,6 @@ abstract class Coupon implements ActiveRecordInterface */ protected $version; - /** - * @var ObjectCollection|ChildCouponOrder[] Collection to store aggregation of ChildCouponOrder objects. - */ - protected $collCouponOrders; - protected $collCouponOrdersPartial; - /** * @var ObjectCollection|ChildCouponI18n[] Collection to store aggregation of ChildCouponI18n objects. */ @@ -219,12 +193,6 @@ abstract class Coupon implements ActiveRecordInterface */ protected $enforceVersion = false; - /** - * An array of objects scheduled for deletion. - * @var ObjectCollection - */ - protected $couponOrdersScheduledForDeletion = null; - /** * An array of objects scheduled for deletion. * @var ObjectCollection @@ -537,39 +505,6 @@ abstract class Coupon implements ActiveRecordInterface return $this->type; } - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - - return $this->title; - } - - /** - * Get the [short_description] column value. - * - * @return string - */ - public function getShortDescription() - { - - return $this->short_description; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - - return $this->description; - } - /** * Get the [amount] column value. * @@ -792,69 +727,6 @@ abstract class Coupon implements ActiveRecordInterface return $this; } // setType() - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return \Thelia\Model\Coupon The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = CouponTableMap::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [short_description] column. - * - * @param string $v new value - * @return \Thelia\Model\Coupon The current object (for fluent API support) - */ - public function setShortDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->short_description !== $v) { - $this->short_description = $v; - $this->modifiedColumns[] = CouponTableMap::SHORT_DESCRIPTION; - } - - - return $this; - } // setShortDescription() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return \Thelia\Model\Coupon The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = CouponTableMap::DESCRIPTION; - } - - - return $this; - } // setDescription() - /** * Set the value of [amount] column. * @@ -1165,58 +1037,49 @@ abstract class Coupon implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)]; $this->type = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; - $this->title = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)]; - $this->short_description = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; - $this->description = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; $this->amount = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_used = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_enabled = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)]; $this->serialized_rules = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_cumulative = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_removing_postage = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; $this->max_usage = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_available_on_special_offers = (null !== $col) ? (boolean) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $this->version = (null !== $col) ? (int) $col : null; $this->resetModified(); @@ -1226,7 +1089,7 @@ abstract class Coupon implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 18; // 18 = CouponTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 15; // 15 = CouponTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Coupon object", 0, $e); @@ -1287,8 +1150,6 @@ abstract class Coupon implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->collCouponOrders = null; - $this->collCouponI18ns = null; $this->collCouponVersions = null; @@ -1435,23 +1296,6 @@ abstract class Coupon implements ActiveRecordInterface $this->resetModified(); } - if ($this->couponOrdersScheduledForDeletion !== null) { - if (!$this->couponOrdersScheduledForDeletion->isEmpty()) { - \Thelia\Model\CouponOrderQuery::create() - ->filterByPrimaryKeys($this->couponOrdersScheduledForDeletion->getPrimaryKeys(false)) - ->delete($con); - $this->couponOrdersScheduledForDeletion = null; - } - } - - if ($this->collCouponOrders !== null) { - foreach ($this->collCouponOrders as $referrerFK) { - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { - $affectedRows += $referrerFK->save($con); - } - } - } - if ($this->couponI18nsScheduledForDeletion !== null) { if (!$this->couponI18nsScheduledForDeletion->isEmpty()) { \Thelia\Model\CouponI18nQuery::create() @@ -1521,15 +1365,6 @@ abstract class Coupon implements ActiveRecordInterface if ($this->isColumnModified(CouponTableMap::TYPE)) { $modifiedColumns[':p' . $index++] = 'TYPE'; } - if ($this->isColumnModified(CouponTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; - } - if ($this->isColumnModified(CouponTableMap::SHORT_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION'; - } - if ($this->isColumnModified(CouponTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; - } if ($this->isColumnModified(CouponTableMap::AMOUNT)) { $modifiedColumns[':p' . $index++] = 'AMOUNT'; } @@ -1586,15 +1421,6 @@ abstract class Coupon implements ActiveRecordInterface case 'TYPE': $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); break; - case 'TITLE': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case 'SHORT_DESCRIPTION': - $stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR); - break; - case 'DESCRIPTION': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; case 'AMOUNT': $stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR); break; @@ -1703,48 +1529,39 @@ abstract class Coupon implements ActiveRecordInterface return $this->getType(); break; case 3: - return $this->getTitle(); - break; - case 4: - return $this->getShortDescription(); - break; - case 5: - return $this->getDescription(); - break; - case 6: return $this->getAmount(); break; - case 7: + case 4: return $this->getIsUsed(); break; - case 8: + case 5: return $this->getIsEnabled(); break; - case 9: + case 6: return $this->getExpirationDate(); break; - case 10: + case 7: return $this->getSerializedRules(); break; - case 11: + case 8: return $this->getIsCumulative(); break; - case 12: + case 9: return $this->getIsRemovingPostage(); break; - case 13: + case 10: return $this->getMaxUsage(); break; - case 14: + case 11: return $this->getIsAvailableOnSpecialOffers(); break; - case 15: + case 12: return $this->getCreatedAt(); break; - case 16: + case 13: return $this->getUpdatedAt(); break; - case 17: + case 14: return $this->getVersion(); break; default: @@ -1779,21 +1596,18 @@ abstract class Coupon implements ActiveRecordInterface $keys[0] => $this->getId(), $keys[1] => $this->getCode(), $keys[2] => $this->getType(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getShortDescription(), - $keys[5] => $this->getDescription(), - $keys[6] => $this->getAmount(), - $keys[7] => $this->getIsUsed(), - $keys[8] => $this->getIsEnabled(), - $keys[9] => $this->getExpirationDate(), - $keys[10] => $this->getSerializedRules(), - $keys[11] => $this->getIsCumulative(), - $keys[12] => $this->getIsRemovingPostage(), - $keys[13] => $this->getMaxUsage(), - $keys[14] => $this->getIsAvailableOnSpecialOffers(), - $keys[15] => $this->getCreatedAt(), - $keys[16] => $this->getUpdatedAt(), - $keys[17] => $this->getVersion(), + $keys[3] => $this->getAmount(), + $keys[4] => $this->getIsUsed(), + $keys[5] => $this->getIsEnabled(), + $keys[6] => $this->getExpirationDate(), + $keys[7] => $this->getSerializedRules(), + $keys[8] => $this->getIsCumulative(), + $keys[9] => $this->getIsRemovingPostage(), + $keys[10] => $this->getMaxUsage(), + $keys[11] => $this->getIsAvailableOnSpecialOffers(), + $keys[12] => $this->getCreatedAt(), + $keys[13] => $this->getUpdatedAt(), + $keys[14] => $this->getVersion(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1802,9 +1616,6 @@ abstract class Coupon implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->collCouponOrders) { - $result['CouponOrders'] = $this->collCouponOrders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); - } if (null !== $this->collCouponI18ns) { $result['CouponI18ns'] = $this->collCouponI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } @@ -1855,48 +1666,39 @@ abstract class Coupon implements ActiveRecordInterface $this->setType($value); break; case 3: - $this->setTitle($value); - break; - case 4: - $this->setShortDescription($value); - break; - case 5: - $this->setDescription($value); - break; - case 6: $this->setAmount($value); break; - case 7: + case 4: $this->setIsUsed($value); break; - case 8: + case 5: $this->setIsEnabled($value); break; - case 9: + case 6: $this->setExpirationDate($value); break; - case 10: + case 7: $this->setSerializedRules($value); break; - case 11: + case 8: $this->setIsCumulative($value); break; - case 12: + case 9: $this->setIsRemovingPostage($value); break; - case 13: + case 10: $this->setMaxUsage($value); break; - case 14: + case 11: $this->setIsAvailableOnSpecialOffers($value); break; - case 15: + case 12: $this->setCreatedAt($value); break; - case 16: + case 13: $this->setUpdatedAt($value); break; - case 17: + case 14: $this->setVersion($value); break; } // switch() @@ -1926,21 +1728,18 @@ abstract class Coupon implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setShortDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDescription($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setAmount($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setIsUsed($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setIsEnabled($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setExpirationDate($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setSerializedRules($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setIsCumulative($arr[$keys[11]]); - if (array_key_exists($keys[12], $arr)) $this->setIsRemovingPostage($arr[$keys[12]]); - if (array_key_exists($keys[13], $arr)) $this->setMaxUsage($arr[$keys[13]]); - if (array_key_exists($keys[14], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[14]]); - if (array_key_exists($keys[15], $arr)) $this->setCreatedAt($arr[$keys[15]]); - if (array_key_exists($keys[16], $arr)) $this->setUpdatedAt($arr[$keys[16]]); - if (array_key_exists($keys[17], $arr)) $this->setVersion($arr[$keys[17]]); + if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setIsUsed($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setIsEnabled($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setExpirationDate($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setSerializedRules($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setIsCumulative($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setIsRemovingPostage($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setMaxUsage($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]); } /** @@ -1955,9 +1754,6 @@ abstract class Coupon implements ActiveRecordInterface if ($this->isColumnModified(CouponTableMap::ID)) $criteria->add(CouponTableMap::ID, $this->id); if ($this->isColumnModified(CouponTableMap::CODE)) $criteria->add(CouponTableMap::CODE, $this->code); if ($this->isColumnModified(CouponTableMap::TYPE)) $criteria->add(CouponTableMap::TYPE, $this->type); - if ($this->isColumnModified(CouponTableMap::TITLE)) $criteria->add(CouponTableMap::TITLE, $this->title); - if ($this->isColumnModified(CouponTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponTableMap::SHORT_DESCRIPTION, $this->short_description); - if ($this->isColumnModified(CouponTableMap::DESCRIPTION)) $criteria->add(CouponTableMap::DESCRIPTION, $this->description); if ($this->isColumnModified(CouponTableMap::AMOUNT)) $criteria->add(CouponTableMap::AMOUNT, $this->amount); if ($this->isColumnModified(CouponTableMap::IS_USED)) $criteria->add(CouponTableMap::IS_USED, $this->is_used); if ($this->isColumnModified(CouponTableMap::IS_ENABLED)) $criteria->add(CouponTableMap::IS_ENABLED, $this->is_enabled); @@ -2035,9 +1831,6 @@ abstract class Coupon implements ActiveRecordInterface { $copyObj->setCode($this->getCode()); $copyObj->setType($this->getType()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setShortDescription($this->getShortDescription()); - $copyObj->setDescription($this->getDescription()); $copyObj->setAmount($this->getAmount()); $copyObj->setIsUsed($this->getIsUsed()); $copyObj->setIsEnabled($this->getIsEnabled()); @@ -2056,12 +1849,6 @@ abstract class Coupon implements ActiveRecordInterface // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getCouponOrders() as $relObj) { - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addCouponOrder($relObj->copy($deepCopy)); - } - } - foreach ($this->getCouponI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCouponI18n($relObj->copy($deepCopy)); @@ -2115,9 +1902,6 @@ abstract class Coupon implements ActiveRecordInterface */ public function initRelation($relationName) { - if ('CouponOrder' == $relationName) { - return $this->initCouponOrders(); - } if ('CouponI18n' == $relationName) { return $this->initCouponI18ns(); } @@ -2126,249 +1910,6 @@ abstract class Coupon implements ActiveRecordInterface } } - /** - * Clears out the collCouponOrders 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 addCouponOrders() - */ - public function clearCouponOrders() - { - $this->collCouponOrders = null; // important to set this to NULL since that means it is uninitialized - } - - /** - * Reset is the collCouponOrders collection loaded partially. - */ - public function resetPartialCouponOrders($v = true) - { - $this->collCouponOrdersPartial = $v; - } - - /** - * Initializes the collCouponOrders collection. - * - * By default this just sets the collCouponOrders collection to an empty array (like clearcollCouponOrders()); - * however, you may wish to override this method in your stub class to provide setting appropriate - * to your application -- for example, setting the initial array to the values stored in database. - * - * @param boolean $overrideExisting If set to true, the method call initializes - * the collection even if it is not empty - * - * @return void - */ - public function initCouponOrders($overrideExisting = true) - { - if (null !== $this->collCouponOrders && !$overrideExisting) { - return; - } - $this->collCouponOrders = new ObjectCollection(); - $this->collCouponOrders->setModel('\Thelia\Model\CouponOrder'); - } - - /** - * Gets an array of ChildCouponOrder objects which contain a foreign key that references this object. - * - * If the $criteria is not null, it is used to always fetch the results from the database. - * Otherwise the results are fetched from the database the first time, then cached. - * Next time the same method is called without $criteria, the cached collection is returned. - * If this ChildCoupon is new, it will return - * an empty collection or the current collection; the criteria is ignored on a new object. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects - * @throws PropelException - */ - public function getCouponOrders($criteria = null, ConnectionInterface $con = null) - { - $partial = $this->collCouponOrdersPartial && !$this->isNew(); - if (null === $this->collCouponOrders || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCouponOrders) { - // return empty collection - $this->initCouponOrders(); - } else { - $collCouponOrders = ChildCouponOrderQuery::create(null, $criteria) - ->filterByCoupon($this) - ->find($con); - - if (null !== $criteria) { - if (false !== $this->collCouponOrdersPartial && count($collCouponOrders)) { - $this->initCouponOrders(false); - - foreach ($collCouponOrders as $obj) { - if (false == $this->collCouponOrders->contains($obj)) { - $this->collCouponOrders->append($obj); - } - } - - $this->collCouponOrdersPartial = true; - } - - $collCouponOrders->getInternalIterator()->rewind(); - - return $collCouponOrders; - } - - if ($partial && $this->collCouponOrders) { - foreach ($this->collCouponOrders as $obj) { - if ($obj->isNew()) { - $collCouponOrders[] = $obj; - } - } - } - - $this->collCouponOrders = $collCouponOrders; - $this->collCouponOrdersPartial = false; - } - } - - return $this->collCouponOrders; - } - - /** - * Sets a collection of CouponOrder 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 $couponOrders A Propel collection. - * @param ConnectionInterface $con Optional connection object - * @return ChildCoupon The current object (for fluent API support) - */ - public function setCouponOrders(Collection $couponOrders, ConnectionInterface $con = null) - { - $couponOrdersToDelete = $this->getCouponOrders(new Criteria(), $con)->diff($couponOrders); - - - $this->couponOrdersScheduledForDeletion = $couponOrdersToDelete; - - foreach ($couponOrdersToDelete as $couponOrderRemoved) { - $couponOrderRemoved->setCoupon(null); - } - - $this->collCouponOrders = null; - foreach ($couponOrders as $couponOrder) { - $this->addCouponOrder($couponOrder); - } - - $this->collCouponOrders = $couponOrders; - $this->collCouponOrdersPartial = false; - - return $this; - } - - /** - * Returns the number of related CouponOrder objects. - * - * @param Criteria $criteria - * @param boolean $distinct - * @param ConnectionInterface $con - * @return int Count of related CouponOrder objects. - * @throws PropelException - */ - public function countCouponOrders(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) - { - $partial = $this->collCouponOrdersPartial && !$this->isNew(); - if (null === $this->collCouponOrders || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collCouponOrders) { - return 0; - } - - if ($partial && !$criteria) { - return count($this->getCouponOrders()); - } - - $query = ChildCouponOrderQuery::create(null, $criteria); - if ($distinct) { - $query->distinct(); - } - - return $query - ->filterByCoupon($this) - ->count($con); - } - - return count($this->collCouponOrders); - } - - /** - * Method called to associate a ChildCouponOrder object to this object - * through the ChildCouponOrder foreign key attribute. - * - * @param ChildCouponOrder $l ChildCouponOrder - * @return \Thelia\Model\Coupon The current object (for fluent API support) - */ - public function addCouponOrder(ChildCouponOrder $l) - { - if ($this->collCouponOrders === null) { - $this->initCouponOrders(); - $this->collCouponOrdersPartial = true; - } - - if (!in_array($l, $this->collCouponOrders->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddCouponOrder($l); - } - - return $this; - } - - /** - * @param CouponOrder $couponOrder The couponOrder object to add. - */ - protected function doAddCouponOrder($couponOrder) - { - $this->collCouponOrders[]= $couponOrder; - $couponOrder->setCoupon($this); - } - - /** - * @param CouponOrder $couponOrder The couponOrder object to remove. - * @return ChildCoupon The current object (for fluent API support) - */ - public function removeCouponOrder($couponOrder) - { - if ($this->getCouponOrders()->contains($couponOrder)) { - $this->collCouponOrders->remove($this->collCouponOrders->search($couponOrder)); - if (null === $this->couponOrdersScheduledForDeletion) { - $this->couponOrdersScheduledForDeletion = clone $this->collCouponOrders; - $this->couponOrdersScheduledForDeletion->clear(); - } - $this->couponOrdersScheduledForDeletion[]= clone $couponOrder; - $couponOrder->setCoupon(null); - } - - return $this; - } - - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Coupon is new, it will return - * an empty collection; or if this Coupon has previously - * been saved, it will retrieve related CouponOrders from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Coupon. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects - */ - public function getCouponOrdersJoinOrder($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildCouponOrderQuery::create(null, $criteria); - $query->joinWith('Order', $joinBehavior); - - return $this->getCouponOrders($query, $con); - } - /** * Clears out the collCouponI18ns collection * @@ -2823,9 +2364,6 @@ abstract class Coupon implements ActiveRecordInterface $this->id = null; $this->code = null; $this->type = null; - $this->title = null; - $this->short_description = null; - $this->description = null; $this->amount = null; $this->is_used = null; $this->is_enabled = null; @@ -2858,11 +2396,6 @@ abstract class Coupon implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collCouponOrders) { - foreach ($this->collCouponOrders as $o) { - $o->clearAllReferences($deep); - } - } if ($this->collCouponI18ns) { foreach ($this->collCouponI18ns as $o) { $o->clearAllReferences($deep); @@ -2879,10 +2412,6 @@ abstract class Coupon implements ActiveRecordInterface $this->currentLocale = 'en_US'; $this->currentTranslations = null; - if ($this->collCouponOrders instanceof Collection) { - $this->collCouponOrders->clearIterator(); - } - $this->collCouponOrders = null; if ($this->collCouponI18ns instanceof Collection) { $this->collCouponI18ns->clearIterator(); } @@ -3016,6 +2545,78 @@ abstract class Coupon implements ActiveRecordInterface return $this->getTranslation($this->getLocale(), $con); } + + /** + * Get the [title] column value. + * + * @return string + */ + public function getTitle() + { + return $this->getCurrentTranslation()->getTitle(); + } + + + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setTitle($v) + { $this->getCurrentTranslation()->setTitle($v); + + return $this; + } + + + /** + * Get the [short_description] column value. + * + * @return string + */ + public function getShortDescription() + { + return $this->getCurrentTranslation()->getShortDescription(); + } + + + /** + * Set the value of [short_description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setShortDescription($v) + { $this->getCurrentTranslation()->setShortDescription($v); + + return $this; + } + + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + return $this->getCurrentTranslation()->getDescription(); + } + + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setDescription($v) + { $this->getCurrentTranslation()->setDescription($v); + + return $this; + } + // versionable behavior /** @@ -3067,9 +2668,6 @@ abstract class Coupon implements ActiveRecordInterface $version->setId($this->getId()); $version->setCode($this->getCode()); $version->setType($this->getType()); - $version->setTitle($this->getTitle()); - $version->setShortDescription($this->getShortDescription()); - $version->setDescription($this->getDescription()); $version->setAmount($this->getAmount()); $version->setIsUsed($this->getIsUsed()); $version->setIsEnabled($this->getIsEnabled()); @@ -3122,9 +2720,6 @@ abstract class Coupon implements ActiveRecordInterface $this->setId($version->getId()); $this->setCode($version->getCode()); $this->setType($version->getType()); - $this->setTitle($version->getTitle()); - $this->setShortDescription($version->getShortDescription()); - $this->setDescription($version->getDescription()); $this->setAmount($version->getAmount()); $this->setIsUsed($version->getIsUsed()); $this->setIsEnabled($version->getIsEnabled()); diff --git a/core/lib/Thelia/Model/Base/CouponI18n.php b/core/lib/Thelia/Model/Base/CouponI18n.php index a2849556d..0ea9027b6 100644 --- a/core/lib/Thelia/Model/Base/CouponI18n.php +++ b/core/lib/Thelia/Model/Base/CouponI18n.php @@ -66,6 +66,24 @@ abstract class CouponI18n implements ActiveRecordInterface */ protected $locale; + /** + * The value for the title field. + * @var string + */ + protected $title; + + /** + * The value for the short_description field. + * @var string + */ + protected $short_description; + + /** + * The value for the description field. + * @var string + */ + protected $description; + /** * @var Coupon */ @@ -368,6 +386,39 @@ abstract class CouponI18n implements ActiveRecordInterface return $this->locale; } + /** + * Get the [title] column value. + * + * @return string + */ + public function getTitle() + { + + return $this->title; + } + + /** + * Get the [short_description] column value. + * + * @return string + */ + public function getShortDescription() + { + + return $this->short_description; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDescription() + { + + return $this->description; + } + /** * Set the value of [id] column. * @@ -414,6 +465,69 @@ abstract class CouponI18n implements ActiveRecordInterface return $this; } // setLocale() + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setTitle($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->title !== $v) { + $this->title = $v; + $this->modifiedColumns[] = CouponI18nTableMap::TITLE; + } + + + return $this; + } // setTitle() + + /** + * Set the value of [short_description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setShortDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->short_description !== $v) { + $this->short_description = $v; + $this->modifiedColumns[] = CouponI18nTableMap::SHORT_DESCRIPTION; + } + + + return $this; + } // setShortDescription() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return \Thelia\Model\CouponI18n The current object (for fluent API support) + */ + public function setDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = CouponI18nTableMap::DESCRIPTION; + } + + + return $this; + } // setDescription() + /** * Indicates whether the columns in this object are only set to default values. * @@ -460,6 +574,15 @@ abstract class CouponI18n implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; $this->locale = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $this->title = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponI18nTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)]; + $this->short_description = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; + $this->description = (null !== $col) ? (string) $col : null; $this->resetModified(); $this->setNew(false); @@ -468,7 +591,7 @@ abstract class CouponI18n implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 2; // 2 = CouponI18nTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 5; // 5 = CouponI18nTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\CouponI18n object", 0, $e); @@ -695,6 +818,15 @@ abstract class CouponI18n implements ActiveRecordInterface if ($this->isColumnModified(CouponI18nTableMap::LOCALE)) { $modifiedColumns[':p' . $index++] = 'LOCALE'; } + if ($this->isColumnModified(CouponI18nTableMap::TITLE)) { + $modifiedColumns[':p' . $index++] = 'TITLE'; + } + if ($this->isColumnModified(CouponI18nTableMap::SHORT_DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION'; + } + if ($this->isColumnModified(CouponI18nTableMap::DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; + } $sql = sprintf( 'INSERT INTO coupon_i18n (%s) VALUES (%s)', @@ -712,6 +844,15 @@ abstract class CouponI18n implements ActiveRecordInterface case 'LOCALE': $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR); break; + case 'TITLE': + $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); + break; + case 'SHORT_DESCRIPTION': + $stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR); + break; + case 'DESCRIPTION': + $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; } } $stmt->execute(); @@ -773,6 +914,15 @@ abstract class CouponI18n implements ActiveRecordInterface case 1: return $this->getLocale(); break; + case 2: + return $this->getTitle(); + break; + case 3: + return $this->getShortDescription(); + break; + case 4: + return $this->getDescription(); + break; default: return null; break; @@ -804,6 +954,9 @@ abstract class CouponI18n implements ActiveRecordInterface $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getLocale(), + $keys[2] => $this->getTitle(), + $keys[3] => $this->getShortDescription(), + $keys[4] => $this->getDescription(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -855,6 +1008,15 @@ abstract class CouponI18n implements ActiveRecordInterface case 1: $this->setLocale($value); break; + case 2: + $this->setTitle($value); + break; + case 3: + $this->setShortDescription($value); + break; + case 4: + $this->setDescription($value); + break; } // switch() } @@ -881,6 +1043,9 @@ abstract class CouponI18n implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setShortDescription($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]); } /** @@ -894,6 +1059,9 @@ abstract class CouponI18n implements ActiveRecordInterface if ($this->isColumnModified(CouponI18nTableMap::ID)) $criteria->add(CouponI18nTableMap::ID, $this->id); if ($this->isColumnModified(CouponI18nTableMap::LOCALE)) $criteria->add(CouponI18nTableMap::LOCALE, $this->locale); + if ($this->isColumnModified(CouponI18nTableMap::TITLE)) $criteria->add(CouponI18nTableMap::TITLE, $this->title); + if ($this->isColumnModified(CouponI18nTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponI18nTableMap::SHORT_DESCRIPTION, $this->short_description); + if ($this->isColumnModified(CouponI18nTableMap::DESCRIPTION)) $criteria->add(CouponI18nTableMap::DESCRIPTION, $this->description); return $criteria; } @@ -966,6 +1134,9 @@ abstract class CouponI18n implements ActiveRecordInterface { $copyObj->setId($this->getId()); $copyObj->setLocale($this->getLocale()); + $copyObj->setTitle($this->getTitle()); + $copyObj->setShortDescription($this->getShortDescription()); + $copyObj->setDescription($this->getDescription()); if ($makeNew) { $copyObj->setNew(true); } @@ -1051,6 +1222,9 @@ abstract class CouponI18n implements ActiveRecordInterface { $this->id = null; $this->locale = null; + $this->title = null; + $this->short_description = null; + $this->description = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->applyDefaultValues(); diff --git a/core/lib/Thelia/Model/Base/CouponI18nQuery.php b/core/lib/Thelia/Model/Base/CouponI18nQuery.php index 9468f787f..5dfbdbcdc 100644 --- a/core/lib/Thelia/Model/Base/CouponI18nQuery.php +++ b/core/lib/Thelia/Model/Base/CouponI18nQuery.php @@ -23,9 +23,15 @@ use Thelia\Model\Map\CouponI18nTableMap; * * @method ChildCouponI18nQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCouponI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column + * @method ChildCouponI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column + * @method ChildCouponI18nQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column + * @method ChildCouponI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column * * @method ChildCouponI18nQuery groupById() Group by the id column * @method ChildCouponI18nQuery groupByLocale() Group by the locale column + * @method ChildCouponI18nQuery groupByTitle() Group by the title column + * @method ChildCouponI18nQuery groupByShortDescription() Group by the short_description column + * @method ChildCouponI18nQuery groupByDescription() Group by the description column * * @method ChildCouponI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildCouponI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -40,9 +46,15 @@ use Thelia\Model\Map\CouponI18nTableMap; * * @method ChildCouponI18n findOneById(int $id) Return the first ChildCouponI18n filtered by the id column * @method ChildCouponI18n findOneByLocale(string $locale) Return the first ChildCouponI18n filtered by the locale column + * @method ChildCouponI18n findOneByTitle(string $title) Return the first ChildCouponI18n filtered by the title column + * @method ChildCouponI18n findOneByShortDescription(string $short_description) Return the first ChildCouponI18n filtered by the short_description column + * @method ChildCouponI18n findOneByDescription(string $description) Return the first ChildCouponI18n filtered by the description column * * @method array findById(int $id) Return ChildCouponI18n objects filtered by the id column * @method array findByLocale(string $locale) Return ChildCouponI18n objects filtered by the locale column + * @method array findByTitle(string $title) Return ChildCouponI18n objects filtered by the title column + * @method array findByShortDescription(string $short_description) Return ChildCouponI18n objects filtered by the short_description column + * @method array findByDescription(string $description) Return ChildCouponI18n objects filtered by the description column * */ abstract class CouponI18nQuery extends ModelCriteria @@ -131,7 +143,7 @@ abstract class CouponI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE FROM coupon_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT ID, LOCALE, TITLE, SHORT_DESCRIPTION, DESCRIPTION FROM coupon_i18n WHERE ID = :p0 AND LOCALE = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -304,6 +316,93 @@ abstract class CouponI18nQuery extends ModelCriteria return $this->addUsingAlias(CouponI18nTableMap::LOCALE, $locale, $comparison); } + /** + * Filter the query on the title column + * + * Example usage: + * + * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' + * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' + * + * + * @param string $title The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByTitle($title = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($title)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $title)) { + $title = str_replace('*', '%', $title); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponI18nTableMap::TITLE, $title, $comparison); + } + + /** + * Filter the query on the short_description column + * + * Example usage: + * + * $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue' + * $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%' + * + * + * @param string $shortDescription The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByShortDescription($shortDescription = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($shortDescription)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $shortDescription)) { + $shortDescription = str_replace('*', '%', $shortDescription); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponI18nTableMap::SHORT_DESCRIPTION, $shortDescription, $comparison); + } + + /** + * Filter the query on the description column + * + * Example usage: + * + * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' + * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' + * + * + * @param string $description The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildCouponI18nQuery The current query, for fluid interface + */ + public function filterByDescription($description = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($description)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $description)) { + $description = str_replace('*', '%', $description); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(CouponI18nTableMap::DESCRIPTION, $description, $comparison); + } + /** * Filter the query by a related \Thelia\Model\Coupon object * diff --git a/core/lib/Thelia/Model/Base/CouponOrder.php b/core/lib/Thelia/Model/Base/CouponOrder.php index a183f262e..b2685ea74 100755 --- a/core/lib/Thelia/Model/Base/CouponOrder.php +++ b/core/lib/Thelia/Model/Base/CouponOrder.php @@ -16,10 +16,8 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; -use Thelia\Model\Coupon as ChildCoupon; use Thelia\Model\CouponOrder as ChildCouponOrder; use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery; -use Thelia\Model\CouponQuery as ChildCouponQuery; use Thelia\Model\Order as ChildOrder; use Thelia\Model\OrderQuery as ChildOrderQuery; use Thelia\Model\Map\CouponOrderTableMap; @@ -70,12 +68,6 @@ abstract class CouponOrder implements ActiveRecordInterface */ protected $order_id; - /** - * The value for the code field. - * @var string - */ - protected $code; - /** * The value for the value field. * @var double @@ -99,11 +91,6 @@ abstract class CouponOrder implements ActiveRecordInterface */ protected $aOrder; - /** - * @var Coupon - */ - protected $aCoupon; - /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -388,17 +375,6 @@ abstract class CouponOrder implements ActiveRecordInterface return $this->order_id; } - /** - * Get the [code] column value. - * - * @return string - */ - public function getCode() - { - - return $this->code; - } - /** * Get the [value] column value. * @@ -496,31 +472,6 @@ abstract class CouponOrder implements ActiveRecordInterface return $this; } // setOrderId() - /** - * Set the value of [code] column. - * - * @param string $v new value - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) - */ - public function setCode($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->code !== $v) { - $this->code = $v; - $this->modifiedColumns[] = CouponOrderTableMap::CODE; - } - - if ($this->aCoupon !== null && $this->aCoupon->getCode() !== $v) { - $this->aCoupon = null; - } - - - return $this; - } // setCode() - /** * Set the value of [value] column. * @@ -627,19 +578,16 @@ abstract class CouponOrder implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponOrderTableMap::translateFieldName('OrderId', TableMap::TYPE_PHPNAME, $indexType)]; $this->order_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponOrderTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; - $this->code = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponOrderTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponOrderTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)]; $this->value = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponOrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponOrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponOrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponOrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -652,7 +600,7 @@ abstract class CouponOrder implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 6; // 6 = CouponOrderTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 5; // 5 = CouponOrderTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\CouponOrder object", 0, $e); @@ -677,9 +625,6 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->aOrder !== null && $this->order_id !== $this->aOrder->getId()) { $this->aOrder = null; } - if ($this->aCoupon !== null && $this->code !== $this->aCoupon->getCode()) { - $this->aCoupon = null; - } } // ensureConsistency /** @@ -720,7 +665,6 @@ abstract class CouponOrder implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? $this->aOrder = null; - $this->aCoupon = null; } // if (deep) } @@ -855,13 +799,6 @@ abstract class CouponOrder implements ActiveRecordInterface $this->setOrder($this->aOrder); } - if ($this->aCoupon !== null) { - if ($this->aCoupon->isModified() || $this->aCoupon->isNew()) { - $affectedRows += $this->aCoupon->save($con); - } - $this->setCoupon($this->aCoupon); - } - if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { @@ -905,9 +842,6 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->isColumnModified(CouponOrderTableMap::ORDER_ID)) { $modifiedColumns[':p' . $index++] = 'ORDER_ID'; } - if ($this->isColumnModified(CouponOrderTableMap::CODE)) { - $modifiedColumns[':p' . $index++] = 'CODE'; - } if ($this->isColumnModified(CouponOrderTableMap::VALUE)) { $modifiedColumns[':p' . $index++] = 'VALUE'; } @@ -934,9 +868,6 @@ abstract class CouponOrder implements ActiveRecordInterface case 'ORDER_ID': $stmt->bindValue($identifier, $this->order_id, PDO::PARAM_INT); break; - case 'CODE': - $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); - break; case 'VALUE': $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR); break; @@ -1015,15 +946,12 @@ abstract class CouponOrder implements ActiveRecordInterface return $this->getOrderId(); break; case 2: - return $this->getCode(); - break; - case 3: return $this->getValue(); break; - case 4: + case 3: return $this->getCreatedAt(); break; - case 5: + case 4: return $this->getUpdatedAt(); break; default: @@ -1057,10 +985,9 @@ abstract class CouponOrder implements ActiveRecordInterface $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getOrderId(), - $keys[2] => $this->getCode(), - $keys[3] => $this->getValue(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), + $keys[2] => $this->getValue(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1072,9 +999,6 @@ abstract class CouponOrder implements ActiveRecordInterface if (null !== $this->aOrder) { $result['Order'] = $this->aOrder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } - if (null !== $this->aCoupon) { - $result['Coupon'] = $this->aCoupon->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); - } } return $result; @@ -1116,15 +1040,12 @@ abstract class CouponOrder implements ActiveRecordInterface $this->setOrderId($value); break; case 2: - $this->setCode($value); - break; - case 3: $this->setValue($value); break; - case 4: + case 3: $this->setCreatedAt($value); break; - case 5: + case 4: $this->setUpdatedAt($value); break; } // switch() @@ -1153,10 +1074,9 @@ abstract class CouponOrder implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setOrderId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setValue($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); + if (array_key_exists($keys[2], $arr)) $this->setValue($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); } /** @@ -1170,7 +1090,6 @@ abstract class CouponOrder implements ActiveRecordInterface if ($this->isColumnModified(CouponOrderTableMap::ID)) $criteria->add(CouponOrderTableMap::ID, $this->id); if ($this->isColumnModified(CouponOrderTableMap::ORDER_ID)) $criteria->add(CouponOrderTableMap::ORDER_ID, $this->order_id); - if ($this->isColumnModified(CouponOrderTableMap::CODE)) $criteria->add(CouponOrderTableMap::CODE, $this->code); if ($this->isColumnModified(CouponOrderTableMap::VALUE)) $criteria->add(CouponOrderTableMap::VALUE, $this->value); if ($this->isColumnModified(CouponOrderTableMap::CREATED_AT)) $criteria->add(CouponOrderTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(CouponOrderTableMap::UPDATED_AT)) $criteria->add(CouponOrderTableMap::UPDATED_AT, $this->updated_at); @@ -1238,7 +1157,6 @@ abstract class CouponOrder implements ActiveRecordInterface public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setOrderId($this->getOrderId()); - $copyObj->setCode($this->getCode()); $copyObj->setValue($this->getValue()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1321,59 +1239,6 @@ abstract class CouponOrder implements ActiveRecordInterface return $this->aOrder; } - /** - * Declares an association between this object and a ChildCoupon object. - * - * @param ChildCoupon $v - * @return \Thelia\Model\CouponOrder The current object (for fluent API support) - * @throws PropelException - */ - public function setCoupon(ChildCoupon $v = null) - { - if ($v === null) { - $this->setCode(NULL); - } else { - $this->setCode($v->getCode()); - } - - $this->aCoupon = $v; - - // Add binding for other direction of this n:n relationship. - // If this object has already been added to the ChildCoupon object, it will not be re-added. - if ($v !== null) { - $v->addCouponOrder($this); - } - - - return $this; - } - - - /** - * Get the associated ChildCoupon object - * - * @param ConnectionInterface $con Optional Connection object. - * @return ChildCoupon The associated ChildCoupon object. - * @throws PropelException - */ - public function getCoupon(ConnectionInterface $con = null) - { - if ($this->aCoupon === null && (($this->code !== "" && $this->code !== null))) { - $this->aCoupon = ChildCouponQuery::create() - ->filterByCouponOrder($this) // here - ->findOne($con); - /* The following can be used additionally to - guarantee the related object contains a reference - to this object. This level of coupling may, however, be - undesirable since it could result in an only partially populated collection - in the referenced object. - $this->aCoupon->addCouponOrders($this); - */ - } - - return $this->aCoupon; - } - /** * Clears the current object and sets all attributes to their default values */ @@ -1381,7 +1246,6 @@ abstract class CouponOrder implements ActiveRecordInterface { $this->id = null; $this->order_id = null; - $this->code = null; $this->value = null; $this->created_at = null; $this->updated_at = null; @@ -1407,7 +1271,6 @@ abstract class CouponOrder implements ActiveRecordInterface } // if ($deep) $this->aOrder = null; - $this->aCoupon = null; } /** diff --git a/core/lib/Thelia/Model/Base/CouponOrderQuery.php b/core/lib/Thelia/Model/Base/CouponOrderQuery.php index e3a95ea1a..255d69504 100755 --- a/core/lib/Thelia/Model/Base/CouponOrderQuery.php +++ b/core/lib/Thelia/Model/Base/CouponOrderQuery.php @@ -23,14 +23,12 @@ use Thelia\Model\Map\CouponOrderTableMap; * * @method ChildCouponOrderQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCouponOrderQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column - * @method ChildCouponOrderQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildCouponOrderQuery orderByValue($order = Criteria::ASC) Order by the value column * @method ChildCouponOrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildCouponOrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildCouponOrderQuery groupById() Group by the id column * @method ChildCouponOrderQuery groupByOrderId() Group by the order_id column - * @method ChildCouponOrderQuery groupByCode() Group by the code column * @method ChildCouponOrderQuery groupByValue() Group by the value column * @method ChildCouponOrderQuery groupByCreatedAt() Group by the created_at column * @method ChildCouponOrderQuery groupByUpdatedAt() Group by the updated_at column @@ -43,23 +41,17 @@ use Thelia\Model\Map\CouponOrderTableMap; * @method ChildCouponOrderQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation * @method ChildCouponOrderQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation * - * @method ChildCouponOrderQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation - * @method ChildCouponOrderQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation - * @method ChildCouponOrderQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation - * * @method ChildCouponOrder findOne(ConnectionInterface $con = null) Return the first ChildCouponOrder matching the query * @method ChildCouponOrder findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponOrder matching the query, or a new ChildCouponOrder object populated from the query conditions when no match is found * * @method ChildCouponOrder findOneById(int $id) Return the first ChildCouponOrder filtered by the id column * @method ChildCouponOrder findOneByOrderId(int $order_id) Return the first ChildCouponOrder filtered by the order_id column - * @method ChildCouponOrder findOneByCode(string $code) Return the first ChildCouponOrder filtered by the code column * @method ChildCouponOrder findOneByValue(double $value) Return the first ChildCouponOrder filtered by the value column * @method ChildCouponOrder findOneByCreatedAt(string $created_at) Return the first ChildCouponOrder filtered by the created_at column * @method ChildCouponOrder findOneByUpdatedAt(string $updated_at) Return the first ChildCouponOrder filtered by the updated_at column * * @method array findById(int $id) Return ChildCouponOrder objects filtered by the id column * @method array findByOrderId(int $order_id) Return ChildCouponOrder objects filtered by the order_id column - * @method array findByCode(string $code) Return ChildCouponOrder objects filtered by the code column * @method array findByValue(double $value) Return ChildCouponOrder objects filtered by the value column * @method array findByCreatedAt(string $created_at) Return ChildCouponOrder objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildCouponOrder objects filtered by the updated_at column @@ -151,7 +143,7 @@ abstract class CouponOrderQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, ORDER_ID, CODE, VALUE, CREATED_AT, UPDATED_AT FROM coupon_order WHERE ID = :p0'; + $sql = 'SELECT ID, ORDER_ID, VALUE, CREATED_AT, UPDATED_AT FROM coupon_order WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -324,35 +316,6 @@ abstract class CouponOrderQuery extends ModelCriteria return $this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId, $comparison); } - /** - * Filter the query on the code column - * - * Example usage: - * - * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' - * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' - * - * - * @param string $code The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByCode($code = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($code)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $code)) { - $code = str_replace('*', '%', $code); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponOrderTableMap::CODE, $code, $comparison); - } - /** * Filter the query on the value column * @@ -555,81 +518,6 @@ abstract class CouponOrderQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery'); } - /** - * Filter the query by a related \Thelia\Model\Coupon object - * - * @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function filterByCoupon($coupon, $comparison = null) - { - if ($coupon instanceof \Thelia\Model\Coupon) { - return $this - ->addUsingAlias(CouponOrderTableMap::CODE, $coupon->getCode(), $comparison); - } elseif ($coupon instanceof ObjectCollection) { - if (null === $comparison) { - $comparison = Criteria::IN; - } - - return $this - ->addUsingAlias(CouponOrderTableMap::CODE, $coupon->toKeyValue('PrimaryKey', 'Code'), $comparison); - } else { - throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the Coupon relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildCouponOrderQuery The current query, for fluid interface - */ - public function joinCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('Coupon'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'Coupon'); - } - - return $this; - } - - /** - * Use the Coupon relation Coupon object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\CouponQuery A secondary query class using the current class as primary query - */ - public function useCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinCoupon($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery'); - } - /** * Exclude object from result * diff --git a/core/lib/Thelia/Model/Base/CouponQuery.php b/core/lib/Thelia/Model/Base/CouponQuery.php index 1e7a95408..e92380879 100755 --- a/core/lib/Thelia/Model/Base/CouponQuery.php +++ b/core/lib/Thelia/Model/Base/CouponQuery.php @@ -25,9 +25,6 @@ use Thelia\Model\Map\CouponTableMap; * @method ChildCouponQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCouponQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildCouponQuery orderByType($order = Criteria::ASC) Order by the type column - * @method ChildCouponQuery orderByTitle($order = Criteria::ASC) Order by the title column - * @method ChildCouponQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column - * @method ChildCouponQuery orderByDescription($order = Criteria::ASC) Order by the description column * @method ChildCouponQuery orderByAmount($order = Criteria::ASC) Order by the amount column * @method ChildCouponQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column * @method ChildCouponQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column @@ -44,9 +41,6 @@ use Thelia\Model\Map\CouponTableMap; * @method ChildCouponQuery groupById() Group by the id column * @method ChildCouponQuery groupByCode() Group by the code column * @method ChildCouponQuery groupByType() Group by the type column - * @method ChildCouponQuery groupByTitle() Group by the title column - * @method ChildCouponQuery groupByShortDescription() Group by the short_description column - * @method ChildCouponQuery groupByDescription() Group by the description column * @method ChildCouponQuery groupByAmount() Group by the amount column * @method ChildCouponQuery groupByIsUsed() Group by the is_used column * @method ChildCouponQuery groupByIsEnabled() Group by the is_enabled column @@ -64,10 +58,6 @@ use Thelia\Model\Map\CouponTableMap; * @method ChildCouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildCouponQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildCouponQuery leftJoinCouponOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponOrder relation - * @method ChildCouponQuery rightJoinCouponOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponOrder relation - * @method ChildCouponQuery innerJoinCouponOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponOrder relation - * * @method ChildCouponQuery leftJoinCouponI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponI18n relation * @method ChildCouponQuery rightJoinCouponI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponI18n relation * @method ChildCouponQuery innerJoinCouponI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponI18n relation @@ -82,9 +72,6 @@ use Thelia\Model\Map\CouponTableMap; * @method ChildCoupon findOneById(int $id) Return the first ChildCoupon filtered by the id column * @method ChildCoupon findOneByCode(string $code) Return the first ChildCoupon filtered by the code column * @method ChildCoupon findOneByType(string $type) Return the first ChildCoupon filtered by the type column - * @method ChildCoupon findOneByTitle(string $title) Return the first ChildCoupon filtered by the title column - * @method ChildCoupon findOneByShortDescription(string $short_description) Return the first ChildCoupon filtered by the short_description column - * @method ChildCoupon findOneByDescription(string $description) Return the first ChildCoupon filtered by the description column * @method ChildCoupon findOneByAmount(double $amount) Return the first ChildCoupon filtered by the amount column * @method ChildCoupon findOneByIsUsed(int $is_used) Return the first ChildCoupon filtered by the is_used column * @method ChildCoupon findOneByIsEnabled(int $is_enabled) Return the first ChildCoupon filtered by the is_enabled column @@ -101,9 +88,6 @@ use Thelia\Model\Map\CouponTableMap; * @method array findById(int $id) Return ChildCoupon objects filtered by the id column * @method array findByCode(string $code) Return ChildCoupon objects filtered by the code column * @method array findByType(string $type) Return ChildCoupon objects filtered by the type column - * @method array findByTitle(string $title) Return ChildCoupon objects filtered by the title column - * @method array findByShortDescription(string $short_description) Return ChildCoupon objects filtered by the short_description column - * @method array findByDescription(string $description) Return ChildCoupon objects filtered by the description column * @method array findByAmount(double $amount) Return ChildCoupon objects filtered by the amount column * @method array findByIsUsed(int $is_used) Return ChildCoupon objects filtered by the is_used column * @method array findByIsEnabled(int $is_enabled) Return ChildCoupon objects filtered by the is_enabled column @@ -211,7 +195,7 @@ abstract class CouponQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, TYPE, TITLE, SHORT_DESCRIPTION, DESCRIPTION, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0'; + $sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -399,93 +383,6 @@ abstract class CouponQuery extends ModelCriteria return $this->addUsingAlias(CouponTableMap::TYPE, $type, $comparison); } - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponTableMap::TITLE, $title, $comparison); - } - - /** - * Filter the query on the short_description column - * - * Example usage: - * - * $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue' - * $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%' - * - * - * @param string $shortDescription The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponQuery The current query, for fluid interface - */ - public function filterByShortDescription($shortDescription = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($shortDescription)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $shortDescription)) { - $shortDescription = str_replace('*', '%', $shortDescription); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponTableMap::SHORT_DESCRIPTION, $shortDescription, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponTableMap::DESCRIPTION, $description, $comparison); - } - /** * Filter the query on the amount column * @@ -958,79 +855,6 @@ abstract class CouponQuery extends ModelCriteria return $this->addUsingAlias(CouponTableMap::VERSION, $version, $comparison); } - /** - * Filter the query by a related \Thelia\Model\CouponOrder object - * - * @param \Thelia\Model\CouponOrder|ObjectCollection $couponOrder the related object to use as filter - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponQuery The current query, for fluid interface - */ - public function filterByCouponOrder($couponOrder, $comparison = null) - { - if ($couponOrder instanceof \Thelia\Model\CouponOrder) { - return $this - ->addUsingAlias(CouponTableMap::CODE, $couponOrder->getCode(), $comparison); - } elseif ($couponOrder instanceof ObjectCollection) { - return $this - ->useCouponOrderQuery() - ->filterByPrimaryKeys($couponOrder->getPrimaryKeys()) - ->endUse(); - } else { - throw new PropelException('filterByCouponOrder() only accepts arguments of type \Thelia\Model\CouponOrder or Collection'); - } - } - - /** - * Adds a JOIN clause to the query using the CouponOrder relation - * - * @param string $relationAlias optional alias for the relation - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return ChildCouponQuery The current query, for fluid interface - */ - public function joinCouponOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('CouponOrder'); - - // create a ModelJoin object for this join - $join = new ModelJoin(); - $join->setJoinType($joinType); - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); - if ($previousJoin = $this->getPreviousJoin()) { - $join->setPreviousJoin($previousJoin); - } - - // add the ModelJoin to the current object - if ($relationAlias) { - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); - $this->addJoinObject($join, $relationAlias); - } else { - $this->addJoinObject($join, 'CouponOrder'); - } - - return $this; - } - - /** - * Use the CouponOrder relation CouponOrder object - * - * @see useQuery() - * - * @param string $relationAlias optional alias for the relation, - * to be used as main alias in the secondary query - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' - * - * @return \Thelia\Model\CouponOrderQuery A secondary query class using the current class as primary query - */ - public function useCouponOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) - { - return $this - ->joinCouponOrder($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'CouponOrder', '\Thelia\Model\CouponOrderQuery'); - } - /** * Filter the query by a related \Thelia\Model\CouponI18n object * diff --git a/core/lib/Thelia/Model/Base/CouponVersion.php b/core/lib/Thelia/Model/Base/CouponVersion.php index 55edbe3ed..efa4898f4 100644 --- a/core/lib/Thelia/Model/Base/CouponVersion.php +++ b/core/lib/Thelia/Model/Base/CouponVersion.php @@ -73,24 +73,6 @@ abstract class CouponVersion implements ActiveRecordInterface */ protected $type; - /** - * The value for the title field. - * @var string - */ - protected $title; - - /** - * The value for the short_description field. - * @var string - */ - protected $short_description; - - /** - * The value for the description field. - * @var string - */ - protected $description; - /** * The value for the amount field. * @var double @@ -477,39 +459,6 @@ abstract class CouponVersion implements ActiveRecordInterface return $this->type; } - /** - * Get the [title] column value. - * - * @return string - */ - public function getTitle() - { - - return $this->title; - } - - /** - * Get the [short_description] column value. - * - * @return string - */ - public function getShortDescription() - { - - return $this->short_description; - } - - /** - * Get the [description] column value. - * - * @return string - */ - public function getDescription() - { - - return $this->description; - } - /** * Get the [amount] column value. * @@ -736,69 +685,6 @@ abstract class CouponVersion implements ActiveRecordInterface return $this; } // setType() - /** - * Set the value of [title] column. - * - * @param string $v new value - * @return \Thelia\Model\CouponVersion The current object (for fluent API support) - */ - public function setTitle($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->title !== $v) { - $this->title = $v; - $this->modifiedColumns[] = CouponVersionTableMap::TITLE; - } - - - return $this; - } // setTitle() - - /** - * Set the value of [short_description] column. - * - * @param string $v new value - * @return \Thelia\Model\CouponVersion The current object (for fluent API support) - */ - public function setShortDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->short_description !== $v) { - $this->short_description = $v; - $this->modifiedColumns[] = CouponVersionTableMap::SHORT_DESCRIPTION; - } - - - return $this; - } // setShortDescription() - - /** - * Set the value of [description] column. - * - * @param string $v new value - * @return \Thelia\Model\CouponVersion The current object (for fluent API support) - */ - public function setDescription($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->description !== $v) { - $this->description = $v; - $this->modifiedColumns[] = CouponVersionTableMap::DESCRIPTION; - } - - - return $this; - } // setDescription() - /** * Set the value of [amount] column. * @@ -1109,58 +995,49 @@ abstract class CouponVersion implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponVersionTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)]; $this->type = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponVersionTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; - $this->title = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponVersionTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)]; - $this->short_description = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponVersionTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; - $this->description = (null !== $col) ? (string) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponVersionTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponVersionTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)]; $this->amount = (null !== $col) ? (double) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponVersionTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponVersionTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_used = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponVersionTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponVersionTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_enabled = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponVersionTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponVersionTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponVersionTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponVersionTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)]; $this->serialized_rules = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponVersionTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponVersionTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_cumulative = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponVersionTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_removing_postage = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponVersionTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponVersionTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)]; $this->max_usage = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponVersionTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)]; $this->is_available_on_special_offers = (null !== $col) ? (boolean) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $this->version = (null !== $col) ? (int) $col : null; $this->resetModified(); @@ -1170,7 +1047,7 @@ abstract class CouponVersion implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 18; // 18 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 15; // 15 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\CouponVersion object", 0, $e); @@ -1400,15 +1277,6 @@ abstract class CouponVersion implements ActiveRecordInterface if ($this->isColumnModified(CouponVersionTableMap::TYPE)) { $modifiedColumns[':p' . $index++] = 'TYPE'; } - if ($this->isColumnModified(CouponVersionTableMap::TITLE)) { - $modifiedColumns[':p' . $index++] = 'TITLE'; - } - if ($this->isColumnModified(CouponVersionTableMap::SHORT_DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION'; - } - if ($this->isColumnModified(CouponVersionTableMap::DESCRIPTION)) { - $modifiedColumns[':p' . $index++] = 'DESCRIPTION'; - } if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) { $modifiedColumns[':p' . $index++] = 'AMOUNT'; } @@ -1465,15 +1333,6 @@ abstract class CouponVersion implements ActiveRecordInterface case 'TYPE': $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); break; - case 'TITLE': - $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); - break; - case 'SHORT_DESCRIPTION': - $stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR); - break; - case 'DESCRIPTION': - $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); - break; case 'AMOUNT': $stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR); break; @@ -1575,48 +1434,39 @@ abstract class CouponVersion implements ActiveRecordInterface return $this->getType(); break; case 3: - return $this->getTitle(); - break; - case 4: - return $this->getShortDescription(); - break; - case 5: - return $this->getDescription(); - break; - case 6: return $this->getAmount(); break; - case 7: + case 4: return $this->getIsUsed(); break; - case 8: + case 5: return $this->getIsEnabled(); break; - case 9: + case 6: return $this->getExpirationDate(); break; - case 10: + case 7: return $this->getSerializedRules(); break; - case 11: + case 8: return $this->getIsCumulative(); break; - case 12: + case 9: return $this->getIsRemovingPostage(); break; - case 13: + case 10: return $this->getMaxUsage(); break; - case 14: + case 11: return $this->getIsAvailableOnSpecialOffers(); break; - case 15: + case 12: return $this->getCreatedAt(); break; - case 16: + case 13: return $this->getUpdatedAt(); break; - case 17: + case 14: return $this->getVersion(); break; default: @@ -1651,21 +1501,18 @@ abstract class CouponVersion implements ActiveRecordInterface $keys[0] => $this->getId(), $keys[1] => $this->getCode(), $keys[2] => $this->getType(), - $keys[3] => $this->getTitle(), - $keys[4] => $this->getShortDescription(), - $keys[5] => $this->getDescription(), - $keys[6] => $this->getAmount(), - $keys[7] => $this->getIsUsed(), - $keys[8] => $this->getIsEnabled(), - $keys[9] => $this->getExpirationDate(), - $keys[10] => $this->getSerializedRules(), - $keys[11] => $this->getIsCumulative(), - $keys[12] => $this->getIsRemovingPostage(), - $keys[13] => $this->getMaxUsage(), - $keys[14] => $this->getIsAvailableOnSpecialOffers(), - $keys[15] => $this->getCreatedAt(), - $keys[16] => $this->getUpdatedAt(), - $keys[17] => $this->getVersion(), + $keys[3] => $this->getAmount(), + $keys[4] => $this->getIsUsed(), + $keys[5] => $this->getIsEnabled(), + $keys[6] => $this->getExpirationDate(), + $keys[7] => $this->getSerializedRules(), + $keys[8] => $this->getIsCumulative(), + $keys[9] => $this->getIsRemovingPostage(), + $keys[10] => $this->getMaxUsage(), + $keys[11] => $this->getIsAvailableOnSpecialOffers(), + $keys[12] => $this->getCreatedAt(), + $keys[13] => $this->getUpdatedAt(), + $keys[14] => $this->getVersion(), ); $virtualColumns = $this->virtualColumns; foreach($virtualColumns as $key => $virtualColumn) @@ -1721,48 +1568,39 @@ abstract class CouponVersion implements ActiveRecordInterface $this->setType($value); break; case 3: - $this->setTitle($value); - break; - case 4: - $this->setShortDescription($value); - break; - case 5: - $this->setDescription($value); - break; - case 6: $this->setAmount($value); break; - case 7: + case 4: $this->setIsUsed($value); break; - case 8: + case 5: $this->setIsEnabled($value); break; - case 9: + case 6: $this->setExpirationDate($value); break; - case 10: + case 7: $this->setSerializedRules($value); break; - case 11: + case 8: $this->setIsCumulative($value); break; - case 12: + case 9: $this->setIsRemovingPostage($value); break; - case 13: + case 10: $this->setMaxUsage($value); break; - case 14: + case 11: $this->setIsAvailableOnSpecialOffers($value); break; - case 15: + case 12: $this->setCreatedAt($value); break; - case 16: + case 13: $this->setUpdatedAt($value); break; - case 17: + case 14: $this->setVersion($value); break; } // switch() @@ -1792,21 +1630,18 @@ abstract class CouponVersion implements ActiveRecordInterface if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setShortDescription($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDescription($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setAmount($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setIsUsed($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setIsEnabled($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setExpirationDate($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setSerializedRules($arr[$keys[10]]); - if (array_key_exists($keys[11], $arr)) $this->setIsCumulative($arr[$keys[11]]); - if (array_key_exists($keys[12], $arr)) $this->setIsRemovingPostage($arr[$keys[12]]); - if (array_key_exists($keys[13], $arr)) $this->setMaxUsage($arr[$keys[13]]); - if (array_key_exists($keys[14], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[14]]); - if (array_key_exists($keys[15], $arr)) $this->setCreatedAt($arr[$keys[15]]); - if (array_key_exists($keys[16], $arr)) $this->setUpdatedAt($arr[$keys[16]]); - if (array_key_exists($keys[17], $arr)) $this->setVersion($arr[$keys[17]]); + if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setIsUsed($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setIsEnabled($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setExpirationDate($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setSerializedRules($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setIsCumulative($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setIsRemovingPostage($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setMaxUsage($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]); } /** @@ -1821,9 +1656,6 @@ abstract class CouponVersion implements ActiveRecordInterface if ($this->isColumnModified(CouponVersionTableMap::ID)) $criteria->add(CouponVersionTableMap::ID, $this->id); if ($this->isColumnModified(CouponVersionTableMap::CODE)) $criteria->add(CouponVersionTableMap::CODE, $this->code); if ($this->isColumnModified(CouponVersionTableMap::TYPE)) $criteria->add(CouponVersionTableMap::TYPE, $this->type); - if ($this->isColumnModified(CouponVersionTableMap::TITLE)) $criteria->add(CouponVersionTableMap::TITLE, $this->title); - if ($this->isColumnModified(CouponVersionTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponVersionTableMap::SHORT_DESCRIPTION, $this->short_description); - if ($this->isColumnModified(CouponVersionTableMap::DESCRIPTION)) $criteria->add(CouponVersionTableMap::DESCRIPTION, $this->description); if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) $criteria->add(CouponVersionTableMap::AMOUNT, $this->amount); if ($this->isColumnModified(CouponVersionTableMap::IS_USED)) $criteria->add(CouponVersionTableMap::IS_USED, $this->is_used); if ($this->isColumnModified(CouponVersionTableMap::IS_ENABLED)) $criteria->add(CouponVersionTableMap::IS_ENABLED, $this->is_enabled); @@ -1909,9 +1741,6 @@ abstract class CouponVersion implements ActiveRecordInterface $copyObj->setId($this->getId()); $copyObj->setCode($this->getCode()); $copyObj->setType($this->getType()); - $copyObj->setTitle($this->getTitle()); - $copyObj->setShortDescription($this->getShortDescription()); - $copyObj->setDescription($this->getDescription()); $copyObj->setAmount($this->getAmount()); $copyObj->setIsUsed($this->getIsUsed()); $copyObj->setIsEnabled($this->getIsEnabled()); @@ -2010,9 +1839,6 @@ abstract class CouponVersion implements ActiveRecordInterface $this->id = null; $this->code = null; $this->type = null; - $this->title = null; - $this->short_description = null; - $this->description = null; $this->amount = null; $this->is_used = null; $this->is_enabled = null; diff --git a/core/lib/Thelia/Model/Base/CouponVersionQuery.php b/core/lib/Thelia/Model/Base/CouponVersionQuery.php index 71ce72aee..ed7e587e7 100644 --- a/core/lib/Thelia/Model/Base/CouponVersionQuery.php +++ b/core/lib/Thelia/Model/Base/CouponVersionQuery.php @@ -24,9 +24,6 @@ use Thelia\Model\Map\CouponVersionTableMap; * @method ChildCouponVersionQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildCouponVersionQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildCouponVersionQuery orderByType($order = Criteria::ASC) Order by the type column - * @method ChildCouponVersionQuery orderByTitle($order = Criteria::ASC) Order by the title column - * @method ChildCouponVersionQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column - * @method ChildCouponVersionQuery orderByDescription($order = Criteria::ASC) Order by the description column * @method ChildCouponVersionQuery orderByAmount($order = Criteria::ASC) Order by the amount column * @method ChildCouponVersionQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column * @method ChildCouponVersionQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column @@ -43,9 +40,6 @@ use Thelia\Model\Map\CouponVersionTableMap; * @method ChildCouponVersionQuery groupById() Group by the id column * @method ChildCouponVersionQuery groupByCode() Group by the code column * @method ChildCouponVersionQuery groupByType() Group by the type column - * @method ChildCouponVersionQuery groupByTitle() Group by the title column - * @method ChildCouponVersionQuery groupByShortDescription() Group by the short_description column - * @method ChildCouponVersionQuery groupByDescription() Group by the description column * @method ChildCouponVersionQuery groupByAmount() Group by the amount column * @method ChildCouponVersionQuery groupByIsUsed() Group by the is_used column * @method ChildCouponVersionQuery groupByIsEnabled() Group by the is_enabled column @@ -73,9 +67,6 @@ use Thelia\Model\Map\CouponVersionTableMap; * @method ChildCouponVersion findOneById(int $id) Return the first ChildCouponVersion filtered by the id column * @method ChildCouponVersion findOneByCode(string $code) Return the first ChildCouponVersion filtered by the code column * @method ChildCouponVersion findOneByType(string $type) Return the first ChildCouponVersion filtered by the type column - * @method ChildCouponVersion findOneByTitle(string $title) Return the first ChildCouponVersion filtered by the title column - * @method ChildCouponVersion findOneByShortDescription(string $short_description) Return the first ChildCouponVersion filtered by the short_description column - * @method ChildCouponVersion findOneByDescription(string $description) Return the first ChildCouponVersion filtered by the description column * @method ChildCouponVersion findOneByAmount(double $amount) Return the first ChildCouponVersion filtered by the amount column * @method ChildCouponVersion findOneByIsUsed(int $is_used) Return the first ChildCouponVersion filtered by the is_used column * @method ChildCouponVersion findOneByIsEnabled(int $is_enabled) Return the first ChildCouponVersion filtered by the is_enabled column @@ -92,9 +83,6 @@ use Thelia\Model\Map\CouponVersionTableMap; * @method array findById(int $id) Return ChildCouponVersion objects filtered by the id column * @method array findByCode(string $code) Return ChildCouponVersion objects filtered by the code column * @method array findByType(string $type) Return ChildCouponVersion objects filtered by the type column - * @method array findByTitle(string $title) Return ChildCouponVersion objects filtered by the title column - * @method array findByShortDescription(string $short_description) Return ChildCouponVersion objects filtered by the short_description column - * @method array findByDescription(string $description) Return ChildCouponVersion objects filtered by the description column * @method array findByAmount(double $amount) Return ChildCouponVersion objects filtered by the amount column * @method array findByIsUsed(int $is_used) Return ChildCouponVersion objects filtered by the is_used column * @method array findByIsEnabled(int $is_enabled) Return ChildCouponVersion objects filtered by the is_enabled column @@ -195,7 +183,7 @@ abstract class CouponVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, CODE, TYPE, TITLE, SHORT_DESCRIPTION, DESCRIPTION, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon_version WHERE ID = :p0 AND VERSION = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -397,93 +385,6 @@ abstract class CouponVersionQuery extends ModelCriteria return $this->addUsingAlias(CouponVersionTableMap::TYPE, $type, $comparison); } - /** - * Filter the query on the title column - * - * Example usage: - * - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' - * - * - * @param string $title The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponVersionQuery The current query, for fluid interface - */ - public function filterByTitle($title = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($title)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $title)) { - $title = str_replace('*', '%', $title); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponVersionTableMap::TITLE, $title, $comparison); - } - - /** - * Filter the query on the short_description column - * - * Example usage: - * - * $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue' - * $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%' - * - * - * @param string $shortDescription The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponVersionQuery The current query, for fluid interface - */ - public function filterByShortDescription($shortDescription = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($shortDescription)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $shortDescription)) { - $shortDescription = str_replace('*', '%', $shortDescription); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponVersionTableMap::SHORT_DESCRIPTION, $shortDescription, $comparison); - } - - /** - * Filter the query on the description column - * - * Example usage: - * - * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue' - * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%' - * - * - * @param string $description The value to use as filter. - * Accepts wildcards (* and % trigger a LIKE) - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL - * - * @return ChildCouponVersionQuery The current query, for fluid interface - */ - public function filterByDescription($description = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($description)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $description)) { - $description = str_replace('*', '%', $description); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(CouponVersionTableMap::DESCRIPTION, $description, $comparison); - } - /** * Filter the query on the amount column * diff --git a/core/lib/Thelia/Model/Base/Order.php b/core/lib/Thelia/Model/Base/Order.php index 3c47ce415..6932ec6c4 100755 --- a/core/lib/Thelia/Model/Base/Order.php +++ b/core/lib/Thelia/Model/Base/Order.php @@ -2842,31 +2842,6 @@ abstract class Order implements ActiveRecordInterface return $this; } - - /** - * If this collection has already been initialized with - * an identical criteria, it returns the collection. - * Otherwise if this Order is new, it will return - * an empty collection; or if this Order has previously - * been saved, it will retrieve related CouponOrders from storage. - * - * This method is protected by default in order to keep the public - * api reasonable. You can provide public methods for those you - * actually need in Order. - * - * @param Criteria $criteria optional Criteria object to narrow the query - * @param ConnectionInterface $con optional connection object - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) - * @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects - */ - public function getCouponOrdersJoinCoupon($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) - { - $query = ChildCouponOrderQuery::create(null, $criteria); - $query->joinWith('Coupon', $joinBehavior); - - return $this->getCouponOrders($query, $con); - } - /** * Clears the current object and sets all attributes to their default values */ diff --git a/core/lib/Thelia/Model/Map/AddressTableMap.php b/core/lib/Thelia/Model/Map/AddressTableMap.php index dabd6a54e..46e2be02d 100755 --- a/core/lib/Thelia/Model/Map/AddressTableMap.php +++ b/core/lib/Thelia/Model/Map/AddressTableMap.php @@ -75,9 +75,9 @@ class AddressTableMap extends TableMap const ID = 'address.ID'; /** - * the column name for the NAME field + * the column name for the LABEL field */ - const NAME = 'address.NAME'; + const LABEL = 'address.LABEL'; /** * the column name for the CUSTOMER_ID field @@ -171,11 +171,11 @@ class AddressTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Name', 'CustomerId', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'name', 'customerId', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::NAME, AddressTableMap::CUSTOMER_ID, AddressTableMap::TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'CUSTOMER_ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'name', 'customer_id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ), + self::TYPE_PHPNAME => array('Id', 'Label', 'CustomerId', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'label', 'customerId', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::LABEL, AddressTableMap::CUSTOMER_ID, AddressTableMap::TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'LABEL', 'CUSTOMER_ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'label', 'customer_id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) ); @@ -186,11 +186,11 @@ class AddressTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'CustomerId' => 2, 'TitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'customerId' => 2, 'titleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ), - self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::NAME => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'CUSTOMER_ID' => 2, 'TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'customer_id' => 2, 'title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ), + self::TYPE_PHPNAME => array('Id' => 0, 'Label' => 1, 'CustomerId' => 2, 'TitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'label' => 1, 'customerId' => 2, 'titleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ), + self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::LABEL => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LABEL' => 1, 'CUSTOMER_ID' => 2, 'TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ), + self::TYPE_FIELDNAME => array('id' => 0, 'label' => 1, 'customer_id' => 2, 'title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) ); @@ -211,7 +211,7 @@ class AddressTableMap extends TableMap $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('NAME', 'Name', 'VARCHAR', false, 255, null); + $this->addColumn('LABEL', 'Label', 'VARCHAR', false, 255, null); $this->addForeignKey('CUSTOMER_ID', 'CustomerId', 'INTEGER', 'customer', 'ID', true, null, null); $this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null); $this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null); @@ -394,7 +394,7 @@ class AddressTableMap extends TableMap { if (null === $alias) { $criteria->addSelectColumn(AddressTableMap::ID); - $criteria->addSelectColumn(AddressTableMap::NAME); + $criteria->addSelectColumn(AddressTableMap::LABEL); $criteria->addSelectColumn(AddressTableMap::CUSTOMER_ID); $criteria->addSelectColumn(AddressTableMap::TITLE_ID); $criteria->addSelectColumn(AddressTableMap::COMPANY); @@ -413,7 +413,7 @@ class AddressTableMap extends TableMap $criteria->addSelectColumn(AddressTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.NAME'); + $criteria->addSelectColumn($alias . '.LABEL'); $criteria->addSelectColumn($alias . '.CUSTOMER_ID'); $criteria->addSelectColumn($alias . '.TITLE_ID'); $criteria->addSelectColumn($alias . '.COMPANY'); diff --git a/core/lib/Thelia/Model/Map/CouponI18nTableMap.php b/core/lib/Thelia/Model/Map/CouponI18nTableMap.php index 5718d6a74..46ecdce3b 100644 --- a/core/lib/Thelia/Model/Map/CouponI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponI18nTableMap.php @@ -57,7 +57,7 @@ class CouponI18nTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 2; + const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class CouponI18nTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 2; + const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the ID field @@ -79,6 +79,21 @@ class CouponI18nTableMap extends TableMap */ const LOCALE = 'coupon_i18n.LOCALE'; + /** + * the column name for the TITLE field + */ + const TITLE = 'coupon_i18n.TITLE'; + + /** + * the column name for the SHORT_DESCRIPTION field + */ + const SHORT_DESCRIPTION = 'coupon_i18n.SHORT_DESCRIPTION'; + + /** + * the column name for the DESCRIPTION field + */ + const DESCRIPTION = 'coupon_i18n.DESCRIPTION'; + /** * The default string format for model objects of the related table */ @@ -91,12 +106,12 @@ class CouponI18nTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Locale', ), - self::TYPE_STUDLYPHPNAME => array('id', 'locale', ), - self::TYPE_COLNAME => array(CouponI18nTableMap::ID, CouponI18nTableMap::LOCALE, ), - self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', ), - self::TYPE_FIELDNAME => array('id', 'locale', ), - self::TYPE_NUM => array(0, 1, ) + self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'ShortDescription', 'Description', ), + self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'shortDescription', 'description', ), + self::TYPE_COLNAME => array(CouponI18nTableMap::ID, CouponI18nTableMap::LOCALE, CouponI18nTableMap::TITLE, CouponI18nTableMap::SHORT_DESCRIPTION, CouponI18nTableMap::DESCRIPTION, ), + self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', ), + self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'short_description', 'description', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -106,12 +121,12 @@ class CouponI18nTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, ), - self::TYPE_COLNAME => array(CouponI18nTableMap::ID => 0, CouponI18nTableMap::LOCALE => 1, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, ), - self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, ), - self::TYPE_NUM => array(0, 1, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'ShortDescription' => 3, 'Description' => 4, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'shortDescription' => 3, 'description' => 4, ), + self::TYPE_COLNAME => array(CouponI18nTableMap::ID => 0, CouponI18nTableMap::LOCALE => 1, CouponI18nTableMap::TITLE => 2, CouponI18nTableMap::SHORT_DESCRIPTION => 3, CouponI18nTableMap::DESCRIPTION => 4, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'SHORT_DESCRIPTION' => 3, 'DESCRIPTION' => 4, ), + self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'short_description' => 3, 'description' => 4, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -132,6 +147,9 @@ class CouponI18nTableMap extends TableMap // columns $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null); $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); + $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); + $this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null); + $this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null); } // initialize() /** @@ -331,9 +349,15 @@ class CouponI18nTableMap extends TableMap if (null === $alias) { $criteria->addSelectColumn(CouponI18nTableMap::ID); $criteria->addSelectColumn(CouponI18nTableMap::LOCALE); + $criteria->addSelectColumn(CouponI18nTableMap::TITLE); + $criteria->addSelectColumn(CouponI18nTableMap::SHORT_DESCRIPTION); + $criteria->addSelectColumn(CouponI18nTableMap::DESCRIPTION); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.LOCALE'); + $criteria->addSelectColumn($alias . '.TITLE'); + $criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION'); + $criteria->addSelectColumn($alias . '.DESCRIPTION'); } } diff --git a/core/lib/Thelia/Model/Map/CouponOrderTableMap.php b/core/lib/Thelia/Model/Map/CouponOrderTableMap.php index 1826bcb70..d96183505 100755 --- a/core/lib/Thelia/Model/Map/CouponOrderTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponOrderTableMap.php @@ -57,7 +57,7 @@ class CouponOrderTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 6; + const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class CouponOrderTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 6; + const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the ID field @@ -79,11 +79,6 @@ class CouponOrderTableMap extends TableMap */ const ORDER_ID = 'coupon_order.ORDER_ID'; - /** - * the column name for the CODE field - */ - const CODE = 'coupon_order.CODE'; - /** * the column name for the VALUE field */ @@ -111,12 +106,12 @@ class CouponOrderTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'OrderId', 'Code', 'Value', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'code', 'value', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(CouponOrderTableMap::ID, CouponOrderTableMap::ORDER_ID, CouponOrderTableMap::CODE, CouponOrderTableMap::VALUE, CouponOrderTableMap::CREATED_AT, CouponOrderTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'CODE', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'order_id', 'code', 'value', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id', 'OrderId', 'Value', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'value', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(CouponOrderTableMap::ID, CouponOrderTableMap::ORDER_ID, CouponOrderTableMap::VALUE, CouponOrderTableMap::CREATED_AT, CouponOrderTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'order_id', 'value', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -126,12 +121,12 @@ class CouponOrderTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Code' => 2, 'Value' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'code' => 2, 'value' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), - self::TYPE_COLNAME => array(CouponOrderTableMap::ID => 0, CouponOrderTableMap::ORDER_ID => 1, CouponOrderTableMap::CODE => 2, CouponOrderTableMap::VALUE => 3, CouponOrderTableMap::CREATED_AT => 4, CouponOrderTableMap::UPDATED_AT => 5, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'CODE' => 2, 'VALUE' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), - self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'code' => 2, 'value' => 3, 'created_at' => 4, 'updated_at' => 5, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Value' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'value' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), + self::TYPE_COLNAME => array(CouponOrderTableMap::ID => 0, CouponOrderTableMap::ORDER_ID => 1, CouponOrderTableMap::VALUE => 2, CouponOrderTableMap::CREATED_AT => 3, CouponOrderTableMap::UPDATED_AT => 4, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'VALUE' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), + self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'value' => 2, 'created_at' => 3, 'updated_at' => 4, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -152,7 +147,6 @@ class CouponOrderTableMap extends TableMap // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null); - $this->addForeignKey('CODE', 'Code', 'VARCHAR', 'coupon', 'CODE', true, 45, null); $this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -164,7 +158,6 @@ class CouponOrderTableMap extends TableMap public function buildRelations() { $this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT'); - $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('code' => 'code', ), null, null); } // buildRelations() /** @@ -320,14 +313,12 @@ class CouponOrderTableMap extends TableMap if (null === $alias) { $criteria->addSelectColumn(CouponOrderTableMap::ID); $criteria->addSelectColumn(CouponOrderTableMap::ORDER_ID); - $criteria->addSelectColumn(CouponOrderTableMap::CODE); $criteria->addSelectColumn(CouponOrderTableMap::VALUE); $criteria->addSelectColumn(CouponOrderTableMap::CREATED_AT); $criteria->addSelectColumn(CouponOrderTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ORDER_ID'); - $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.VALUE'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); diff --git a/core/lib/Thelia/Model/Map/CouponTableMap.php b/core/lib/Thelia/Model/Map/CouponTableMap.php index 0daa3b0ed..bd9079be6 100755 --- a/core/lib/Thelia/Model/Map/CouponTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponTableMap.php @@ -57,7 +57,7 @@ class CouponTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 18; + const NUM_COLUMNS = 15; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class CouponTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 18; + const NUM_HYDRATE_COLUMNS = 15; /** * the column name for the ID field @@ -84,21 +84,6 @@ class CouponTableMap extends TableMap */ const TYPE = 'coupon.TYPE'; - /** - * the column name for the TITLE field - */ - const TITLE = 'coupon.TITLE'; - - /** - * the column name for the SHORT_DESCRIPTION field - */ - const SHORT_DESCRIPTION = 'coupon.SHORT_DESCRIPTION'; - - /** - * the column name for the DESCRIPTION field - */ - const DESCRIPTION = 'coupon.DESCRIPTION'; - /** * the column name for the AMOUNT field */ @@ -180,12 +165,12 @@ class CouponTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ), - self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::TITLE, CouponTableMap::SHORT_DESCRIPTION, CouponTableMap::DESCRIPTION, CouponTableMap::AMOUNT, CouponTableMap::IS_USED, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::SERIALIZED_RULES, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), - self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ), + self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ), + self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::AMOUNT, CouponTableMap::IS_USED, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::SERIALIZED_RULES, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ), + self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), + self::TYPE_FIELDNAME => array('id', 'code', 'type', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -195,12 +180,12 @@ class CouponTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Amount' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRules' => 10, 'IsCumulative' => 11, 'IsRemovingPostage' => 12, 'MaxUsage' => 13, 'IsAvailableOnSpecialOffers' => 14, 'CreatedAt' => 15, 'UpdatedAt' => 16, 'Version' => 17, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'amount' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRules' => 10, 'isCumulative' => 11, 'isRemovingPostage' => 12, 'maxUsage' => 13, 'isAvailableOnSpecialOffers' => 14, 'createdAt' => 15, 'updatedAt' => 16, 'version' => 17, ), - self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::TITLE => 3, CouponTableMap::SHORT_DESCRIPTION => 4, CouponTableMap::DESCRIPTION => 5, CouponTableMap::AMOUNT => 6, CouponTableMap::IS_USED => 7, CouponTableMap::IS_ENABLED => 8, CouponTableMap::EXPIRATION_DATE => 9, CouponTableMap::SERIALIZED_RULES => 10, CouponTableMap::IS_CUMULATIVE => 11, CouponTableMap::IS_REMOVING_POSTAGE => 12, CouponTableMap::MAX_USAGE => 13, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 14, CouponTableMap::CREATED_AT => 15, CouponTableMap::UPDATED_AT => 16, CouponTableMap::VERSION => 17, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'AMOUNT' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES' => 10, 'IS_CUMULATIVE' => 11, 'IS_REMOVING_POSTAGE' => 12, 'MAX_USAGE' => 13, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 14, 'CREATED_AT' => 15, 'UPDATED_AT' => 16, 'VERSION' => 17, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'amount' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules' => 10, 'is_cumulative' => 11, 'is_removing_postage' => 12, 'max_usage' => 13, 'is_available_on_special_offers' => 14, 'created_at' => 15, 'updated_at' => 16, 'version' => 17, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Amount' => 3, 'IsUsed' => 4, 'IsEnabled' => 5, 'ExpirationDate' => 6, 'SerializedRules' => 7, 'IsCumulative' => 8, 'IsRemovingPostage' => 9, 'MaxUsage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'isUsed' => 4, 'isEnabled' => 5, 'expirationDate' => 6, 'serializedRules' => 7, 'isCumulative' => 8, 'isRemovingPostage' => 9, 'maxUsage' => 10, 'isAvailableOnSpecialOffers' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, ), + self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::AMOUNT => 3, CouponTableMap::IS_USED => 4, CouponTableMap::IS_ENABLED => 5, CouponTableMap::EXPIRATION_DATE => 6, CouponTableMap::SERIALIZED_RULES => 7, CouponTableMap::IS_CUMULATIVE => 8, CouponTableMap::IS_REMOVING_POSTAGE => 9, CouponTableMap::MAX_USAGE => 10, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, CouponTableMap::CREATED_AT => 12, CouponTableMap::UPDATED_AT => 13, CouponTableMap::VERSION => 14, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'AMOUNT' => 3, 'IS_USED' => 4, 'IS_ENABLED' => 5, 'EXPIRATION_DATE' => 6, 'SERIALIZED_RULES' => 7, 'IS_CUMULATIVE' => 8, 'IS_REMOVING_POSTAGE' => 9, 'MAX_USAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, ), + self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'is_used' => 4, 'is_enabled' => 5, 'expiration_date' => 6, 'serialized_rules' => 7, 'is_cumulative' => 8, 'is_removing_postage' => 9, 'max_usage' => 10, 'is_available_on_special_offers' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -222,9 +207,6 @@ class CouponTableMap extends TableMap $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); - $this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null); - $this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null); $this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null); $this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null); $this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null); @@ -244,7 +226,6 @@ class CouponTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('CouponOrder', '\\Thelia\\Model\\CouponOrder', RelationMap::ONE_TO_MANY, array('code' => 'code', ), null, null, 'CouponOrders'); $this->addRelation('CouponI18n', '\\Thelia\\Model\\CouponI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponI18ns'); $this->addRelation('CouponVersion', '\\Thelia\\Model\\CouponVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponVersions'); } // buildRelations() @@ -259,7 +240,7 @@ class CouponTableMap extends TableMap { return array( 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), - 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => '', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), + 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, short_description, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'false', 'log_created_by' => 'false', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ), ); } // getBehaviors() @@ -415,9 +396,6 @@ class CouponTableMap extends TableMap $criteria->addSelectColumn(CouponTableMap::ID); $criteria->addSelectColumn(CouponTableMap::CODE); $criteria->addSelectColumn(CouponTableMap::TYPE); - $criteria->addSelectColumn(CouponTableMap::TITLE); - $criteria->addSelectColumn(CouponTableMap::SHORT_DESCRIPTION); - $criteria->addSelectColumn(CouponTableMap::DESCRIPTION); $criteria->addSelectColumn(CouponTableMap::AMOUNT); $criteria->addSelectColumn(CouponTableMap::IS_USED); $criteria->addSelectColumn(CouponTableMap::IS_ENABLED); @@ -434,9 +412,6 @@ class CouponTableMap extends TableMap $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.TYPE'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.AMOUNT'); $criteria->addSelectColumn($alias . '.IS_USED'); $criteria->addSelectColumn($alias . '.IS_ENABLED'); diff --git a/core/lib/Thelia/Model/Map/CouponVersionTableMap.php b/core/lib/Thelia/Model/Map/CouponVersionTableMap.php index 9db387a86..30ce279b8 100644 --- a/core/lib/Thelia/Model/Map/CouponVersionTableMap.php +++ b/core/lib/Thelia/Model/Map/CouponVersionTableMap.php @@ -57,7 +57,7 @@ class CouponVersionTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 18; + const NUM_COLUMNS = 15; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class CouponVersionTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 18; + const NUM_HYDRATE_COLUMNS = 15; /** * the column name for the ID field @@ -84,21 +84,6 @@ class CouponVersionTableMap extends TableMap */ const TYPE = 'coupon_version.TYPE'; - /** - * the column name for the TITLE field - */ - const TITLE = 'coupon_version.TITLE'; - - /** - * the column name for the SHORT_DESCRIPTION field - */ - const SHORT_DESCRIPTION = 'coupon_version.SHORT_DESCRIPTION'; - - /** - * the column name for the DESCRIPTION field - */ - const DESCRIPTION = 'coupon_version.DESCRIPTION'; - /** * the column name for the AMOUNT field */ @@ -171,12 +156,12 @@ class CouponVersionTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ), - self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ), - self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::TITLE, CouponVersionTableMap::SHORT_DESCRIPTION, CouponVersionTableMap::DESCRIPTION, CouponVersionTableMap::AMOUNT, CouponVersionTableMap::IS_USED, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::SERIALIZED_RULES, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ), - self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), - self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ), + self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ), + self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::AMOUNT, CouponVersionTableMap::IS_USED, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::SERIALIZED_RULES, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ), + self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ), + self::TYPE_FIELDNAME => array('id', 'code', 'type', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -186,12 +171,12 @@ class CouponVersionTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Amount' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRules' => 10, 'IsCumulative' => 11, 'IsRemovingPostage' => 12, 'MaxUsage' => 13, 'IsAvailableOnSpecialOffers' => 14, 'CreatedAt' => 15, 'UpdatedAt' => 16, 'Version' => 17, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'amount' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRules' => 10, 'isCumulative' => 11, 'isRemovingPostage' => 12, 'maxUsage' => 13, 'isAvailableOnSpecialOffers' => 14, 'createdAt' => 15, 'updatedAt' => 16, 'version' => 17, ), - self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::TITLE => 3, CouponVersionTableMap::SHORT_DESCRIPTION => 4, CouponVersionTableMap::DESCRIPTION => 5, CouponVersionTableMap::AMOUNT => 6, CouponVersionTableMap::IS_USED => 7, CouponVersionTableMap::IS_ENABLED => 8, CouponVersionTableMap::EXPIRATION_DATE => 9, CouponVersionTableMap::SERIALIZED_RULES => 10, CouponVersionTableMap::IS_CUMULATIVE => 11, CouponVersionTableMap::IS_REMOVING_POSTAGE => 12, CouponVersionTableMap::MAX_USAGE => 13, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 14, CouponVersionTableMap::CREATED_AT => 15, CouponVersionTableMap::UPDATED_AT => 16, CouponVersionTableMap::VERSION => 17, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'AMOUNT' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES' => 10, 'IS_CUMULATIVE' => 11, 'IS_REMOVING_POSTAGE' => 12, 'MAX_USAGE' => 13, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 14, 'CREATED_AT' => 15, 'UPDATED_AT' => 16, 'VERSION' => 17, ), - self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'amount' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules' => 10, 'is_cumulative' => 11, 'is_removing_postage' => 12, 'max_usage' => 13, 'is_available_on_special_offers' => 14, 'created_at' => 15, 'updated_at' => 16, 'version' => 17, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Amount' => 3, 'IsUsed' => 4, 'IsEnabled' => 5, 'ExpirationDate' => 6, 'SerializedRules' => 7, 'IsCumulative' => 8, 'IsRemovingPostage' => 9, 'MaxUsage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'isUsed' => 4, 'isEnabled' => 5, 'expirationDate' => 6, 'serializedRules' => 7, 'isCumulative' => 8, 'isRemovingPostage' => 9, 'maxUsage' => 10, 'isAvailableOnSpecialOffers' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, ), + self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::AMOUNT => 3, CouponVersionTableMap::IS_USED => 4, CouponVersionTableMap::IS_ENABLED => 5, CouponVersionTableMap::EXPIRATION_DATE => 6, CouponVersionTableMap::SERIALIZED_RULES => 7, CouponVersionTableMap::IS_CUMULATIVE => 8, CouponVersionTableMap::IS_REMOVING_POSTAGE => 9, CouponVersionTableMap::MAX_USAGE => 10, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, CouponVersionTableMap::CREATED_AT => 12, CouponVersionTableMap::UPDATED_AT => 13, CouponVersionTableMap::VERSION => 14, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'AMOUNT' => 3, 'IS_USED' => 4, 'IS_ENABLED' => 5, 'EXPIRATION_DATE' => 6, 'SERIALIZED_RULES' => 7, 'IS_CUMULATIVE' => 8, 'IS_REMOVING_POSTAGE' => 9, 'MAX_USAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, ), + self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'is_used' => 4, 'is_enabled' => 5, 'expiration_date' => 6, 'serialized_rules' => 7, 'is_cumulative' => 8, 'is_removing_postage' => 9, 'max_usage' => 10, 'is_available_on_special_offers' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ) ); /** @@ -213,9 +198,6 @@ class CouponVersionTableMap extends TableMap $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null); $this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null); $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null); - $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); - $this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null); - $this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null); $this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null); $this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null); $this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null); @@ -305,11 +287,11 @@ class CouponVersionTableMap extends TableMap public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { // If the PK cannot be derived from the row, return NULL. - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 17 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) { + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 14 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) { return null; } - return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 17 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); + return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 14 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); } /** @@ -428,9 +410,6 @@ class CouponVersionTableMap extends TableMap $criteria->addSelectColumn(CouponVersionTableMap::ID); $criteria->addSelectColumn(CouponVersionTableMap::CODE); $criteria->addSelectColumn(CouponVersionTableMap::TYPE); - $criteria->addSelectColumn(CouponVersionTableMap::TITLE); - $criteria->addSelectColumn(CouponVersionTableMap::SHORT_DESCRIPTION); - $criteria->addSelectColumn(CouponVersionTableMap::DESCRIPTION); $criteria->addSelectColumn(CouponVersionTableMap::AMOUNT); $criteria->addSelectColumn(CouponVersionTableMap::IS_USED); $criteria->addSelectColumn(CouponVersionTableMap::IS_ENABLED); @@ -447,9 +426,6 @@ class CouponVersionTableMap extends TableMap $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.TYPE'); - $criteria->addSelectColumn($alias . '.TITLE'); - $criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION'); - $criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.AMOUNT'); $criteria->addSelectColumn($alias . '.IS_USED'); $criteria->addSelectColumn($alias . '.IS_ENABLED'); diff --git a/install/thelia.sql b/install/thelia.sql index c62b8738d..85c00b369 100755 --- a/install/thelia.sql +++ b/install/thelia.sql @@ -455,7 +455,7 @@ DROP TABLE IF EXISTS `address`; CREATE TABLE `address` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `name` VARCHAR(255), + `label` VARCHAR(255), `customer_id` INTEGER NOT NULL, `title_id` INTEGER NOT NULL, `company` VARCHAR(255), @@ -1040,9 +1040,6 @@ CREATE TABLE `coupon` `id` INTEGER NOT NULL AUTO_INCREMENT, `code` VARCHAR(45) NOT NULL, `type` VARCHAR(255) NOT NULL, - `title` VARCHAR(255) NOT NULL, - `short_description` TEXT NOT NULL, - `description` LONGTEXT NOT NULL, `amount` FLOAT NOT NULL, `is_used` TINYINT NOT NULL, `is_enabled` TINYINT NOT NULL, @@ -1078,21 +1075,16 @@ CREATE TABLE `coupon_order` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `order_id` INTEGER NOT NULL, - `code` VARCHAR(45) NOT NULL, `value` FLOAT NOT NULL, `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`), INDEX `idx_coupon_order_order_id` (`order_id`), - INDEX `fk_coupon_order_coupon_idx` (`code`), CONSTRAINT `fk_coupon_order_order_id` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`) ON UPDATE RESTRICT - ON DELETE CASCADE, - CONSTRAINT `fk_coupon_order_coupon` - FOREIGN KEY (`code`) - REFERENCES `coupon` (`code`) + ON DELETE CASCADE ) ENGINE=InnoDB; -- --------------------------------------------------------------------- @@ -1923,6 +1915,9 @@ CREATE TABLE `coupon_i18n` ( `id` INTEGER NOT NULL, `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, + `title` VARCHAR(255) NOT NULL, + `short_description` TEXT NOT NULL, + `description` LONGTEXT NOT NULL, PRIMARY KEY (`id`,`locale`), CONSTRAINT `coupon_i18n_FK_1` FOREIGN KEY (`id`) @@ -2186,9 +2181,6 @@ CREATE TABLE `coupon_version` `id` INTEGER NOT NULL, `code` VARCHAR(45) NOT NULL, `type` VARCHAR(255) NOT NULL, - `title` VARCHAR(255) NOT NULL, - `short_description` TEXT NOT NULL, - `description` LONGTEXT NOT NULL, `amount` FLOAT NOT NULL, `is_used` TINYINT NOT NULL, `is_enabled` TINYINT NOT NULL, diff --git a/local/config/schema.xml b/local/config/schema.xml index 757e9141f..26023b117 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -1,1135 +1,1130 @@ - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
-
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+
From 394b533dd7411634866f204d6763fb1e59cd3041 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 3 Sep 2013 14:22:06 +0200 Subject: [PATCH 17/32] update customer model createOrUpdate method --- core/lib/Thelia/Model/Customer.php | 68 +++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php index 8f3de28d1..9572b6441 100755 --- a/core/lib/Thelia/Model/Customer.php +++ b/core/lib/Thelia/Model/Customer.php @@ -3,6 +3,7 @@ namespace Thelia\Model; use Symfony\Component\Config\Definition\Exception\Exception; +use Thelia\Model\AddressQuery; use Thelia\Model\Base\Customer as BaseCustomer; use Thelia\Model\Exception\InvalidArgumentException; @@ -74,28 +75,46 @@ class Customer extends BaseCustomer implements UserInterface $con = Propel::getWriteConnection(CustomerTableMap::DATABASE_NAME); $con->beginTransaction(); try { + if ($this->isNew()) { + $address = new Address(); + + $address + ->setTitleId($titleId) + ->setFirstname($firstname) + ->setLastname($lastname) + ->setAddress1($address1) + ->setAddress2($address2) + ->setAddress3($address3) + ->setPhone($phone) + ->setCellphone($cellphone) + ->setZipcode($zipcode) + ->setCountryId($countryId) + ->setIsDefault(1) + ; + + $this->addAddress($address); + + } else { + $address = $this->getDefaultAddress(); + + $address + ->setTitleId($titleId) + ->setFirstname($firstname) + ->setLastname($lastname) + ->setAddress1($address1) + ->setAddress2($address2) + ->setAddress3($address3) + ->setPhone($phone) + ->setCellphone($cellphone) + ->setZipcode($zipcode) + ->setCountryId($countryId) + ->save($con) + ; + } $this->save($con); - $address = new Address(); - - $address - ->setTitleId($titleId) - ->setFirstname($firstname) - ->setLastname($lastname) - ->setAddress1($address1) - ->setAddress2($address2) - ->setAddress3($address3) - ->setPhone($phone) - ->setCellphone($cellphone) - ->setZipcode($zipcode) - ->setCountryId($countryId) - ->setIsDefault(1) - ->setCustomer($this) - ->save($con); - $con->commit(); - } catch(Exception $e) { $con->rollback(); throw $e; @@ -107,12 +126,23 @@ class Customer extends BaseCustomer implements UserInterface return uniqid(substr($this->getLastname(), 0, (strlen($this->getLastname()) >= 3) ? 3 : strlen($this->getLastname())), true); } + /** + * @return Address + */ + public function getDefaultAddress() + { + return AddressQuery::create() + ->filterByCustomer($this) + ->filterByIsDefault(1) + ->findOne(); + } + /** * create hash for plain password and set it in Customer object * * @param string $password plain password before hashing + * @throws Exception\InvalidArgumentException * @return $this|Customer - * @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException */ public function setPassword($password) { From fce528c41f718874ec68f05972244139b8f5c0fa Mon Sep 17 00:00:00 2001 From: franck Date: Tue, 3 Sep 2013 15:43:05 +0200 Subject: [PATCH 18/32] Added AdminUtilities Smarty plugin, optimized templates --- core/lib/Thelia/Config/Resources/config.xml | 10 +- .../Controller/Admin/BaseAdminController.php | 27 +-- .../Controller/Admin/CategoryController.php | 2 +- .../Controller/Admin/ConfigController.php | 27 ++- .../Controller/Admin/CurrencyController.php | 4 +- core/lib/Thelia/Core/Template/Loop/Config.php | 52 +++++- .../Thelia/Core/Template/Loop/Currency.php | 10 +- .../Smarty/Plugins/AdminUtilities.php | 144 ++++++++++++++++ templates/admin/default/assets/css/admin.less | 12 ++ templates/admin/default/categories.html | 125 ++++++++------ templates/admin/default/currencies.html | 160 ++++++++---------- templates/admin/default/edit_category.html | 2 +- .../default/includes/inner-form-toolbar.html | 4 +- templates/admin/default/message-edit.html | 4 +- templates/admin/default/messages.html | 4 + templates/admin/default/variable-edit.html | 4 +- templates/admin/default/variables.html | 38 ++++- 17 files changed, 452 insertions(+), 177 deletions(-) create mode 100644 core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 07e0a1d07..ddc17111b 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -166,17 +166,23 @@
- + - + + + + + + + diff --git a/core/lib/Thelia/Controller/Admin/BaseAdminController.php b/core/lib/Thelia/Controller/Admin/BaseAdminController.php index 8160033fe..b4b10e9be 100755 --- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php +++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php @@ -155,7 +155,7 @@ class BaseAdminController extends BaseController */ protected function getCurrentEditionLangId() { return $this->getRequest()->get( - 'edition_language', + 'edit_language_id', $this->getSession()->getAdminEditionLangId() ); } @@ -196,29 +196,32 @@ class BaseAdminController extends BaseController $session = $this->getSession(); - // Find the current edit language ID $edition_language = $this->getCurrentEditionLangId(); // Current back-office (not edition) language - $current_lang = LangQuery::create()->findOneById($session->getLangId()); + $current_lang = LangQuery::create()->findOneById($session->getLangId()); + + // Find the current edit language ID + $edition_language = LangQuery::create()->findOneById($this->getCurrentEditionLangId()); // Prepare common template variables $args = array_merge($args, array( - 'locale' => $session->getLocale(), - 'lang_code' => $session->getLang(), - 'lang_id' => $session->getLangId(), + 'locale' => $session->getLocale(), + 'lang_code' => $session->getLang(), + 'lang_id' => $session->getLangId(), - 'datetime_format' => $current_lang->getDateTimeFormat(), - 'date_format' => $current_lang->getDateFormat(), - 'time_format' => $current_lang->getTimeFormat(), + 'datetime_format' => $current_lang->getDateTimeFormat(), + 'date_format' => $current_lang->getDateFormat(), + 'time_format' => $current_lang->getTimeFormat(), - 'edition_language' => $edition_language, + 'edit_language_id' => $edition_language->getId(), + 'edit_language_locale' => $edition_language->getLocale(), - 'current_url' => htmlspecialchars($this->getRequest()->getUri()) + 'current_url' => htmlspecialchars($this->getRequest()->getUri()) )); // Update the current edition language in session - $this->getSession()->setAdminEditionLangId($edition_language); + $this->getSession()->setAdminEditionLangId($edition_language->getId()); // Render the template. try { diff --git a/core/lib/Thelia/Controller/Admin/CategoryController.php b/core/lib/Thelia/Controller/Admin/CategoryController.php index 9966034f8..6cba34e39 100755 --- a/core/lib/Thelia/Controller/Admin/CategoryController.php +++ b/core/lib/Thelia/Controller/Admin/CategoryController.php @@ -188,7 +188,7 @@ class CategoryController extends BaseAdminController // Find the current order $category_order = $this->getRequest()->get( - 'category_order', + 'order', $this->getSession()->get('admin.category_order', 'manual') ); diff --git a/core/lib/Thelia/Controller/Admin/ConfigController.php b/core/lib/Thelia/Controller/Admin/ConfigController.php index 8f761ed7e..c6fab6b1b 100644 --- a/core/lib/Thelia/Controller/Admin/ConfigController.php +++ b/core/lib/Thelia/Controller/Admin/ConfigController.php @@ -42,6 +42,25 @@ use Thelia\Form\ConfigCreationForm; */ class ConfigController extends BaseAdminController { + /** + * Render the currencies list, ensuring the sort order is set. + * + * @return Symfony\Component\HttpFoundation\Response the response + */ + protected function renderList() { + + // Find the current order + $order = $this->getRequest()->get( + 'order', + $this->getSession()->get('admin.variables_order', 'name') + ); + + // Store the current sort order in session + $this->getSession()->set('admin.variables_order', $order); + + return $this->render('variables', array('order' => $order)); + } + /** * The default action is displaying the variables list. * @@ -51,7 +70,7 @@ class ConfigController extends BaseAdminController if (null !== $response = $this->checkAuth("admin.configuration.variables.view")) return $response; - return $this->render('variables'); + return $this->renderList(); } /** @@ -124,7 +143,7 @@ class ConfigController extends BaseAdminController } // At this point, the form has error, and should be redisplayed. - return $this->render('variables'); + return $this->renderList(); } /** @@ -276,7 +295,7 @@ class ConfigController extends BaseAdminController $this->dispatch(TheliaEvents::CONFIG_SETVALUE, $event); } - $this->redirect(URL::adminViewUrl('variables')); + $this->redirect(URL::absoluteUrl('/admin/configuration/variables')); } /** @@ -294,6 +313,6 @@ class ConfigController extends BaseAdminController $this->dispatch(TheliaEvents::CONFIG_DELETE, $event); - $this->redirect(URL::adminViewUrl('variables')); + $this->redirect(URL::absoluteUrl('/admin/configuration/variables')); } } \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/CurrencyController.php b/core/lib/Thelia/Controller/Admin/CurrencyController.php index 69cc60117..b9ca98083 100644 --- a/core/lib/Thelia/Controller/Admin/CurrencyController.php +++ b/core/lib/Thelia/Controller/Admin/CurrencyController.php @@ -101,7 +101,9 @@ class CurrencyController extends BaseAdminController ->setCurrencyName($data['name']) ->setLocale($data["locale"]) ->setSymbol($data['symbol']) - ; + ->setCode($data['code']) + ->setRate($data['rate']) + ; $this->dispatch(TheliaEvents::CURRENCY_CREATE, $createEvent); diff --git a/core/lib/Thelia/Core/Template/Loop/Config.php b/core/lib/Thelia/Core/Template/Loop/Config.php index 5cc1b2b44..684803385 100644 --- a/core/lib/Thelia/Core/Template/Loop/Config.php +++ b/core/lib/Thelia/Core/Template/Loop/Config.php @@ -34,6 +34,8 @@ use Thelia\Model\LangQuery; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Model\ConfigQuery; use Thelia\Type\BooleanOrBothType; +use Thelia\Type\TypeCollection; +use Thelia\Type\EnumListType; /** * Config loop, to access configuration variables @@ -59,7 +61,21 @@ class Config extends BaseI18nLoop Argument::createIntListTypeArgument('exclude'), Argument::createAnyTypeArgument('variable'), Argument::createBooleanOrBothTypeArgument('hidden'), - Argument::createBooleanOrBothTypeArgument('secured') + Argument::createBooleanOrBothTypeArgument('secured'), + new Argument( + 'order', + new TypeCollection( + new EnumListType( + array( + 'id', 'id_reverse', + 'name', 'name_reverse', + 'title', 'title_reverse', + 'value', 'value_reverse', + ) + ) + ), + 'name' + ) ); } @@ -94,7 +110,39 @@ class Config extends BaseI18nLoop if (! is_null($secured) && $secured != BooleanOrBothType::ANY) $search->filterBySecured($secured ? 1 : 0); - $search->orderByName(Criteria::ASC); + $orders = $this->getOrder(); + + foreach($orders as $order) { + switch ($order) { + case 'id': + $search->orderById(Criteria::ASC); + break; + case 'id_reverse': + $search->orderById(Criteria::DESC); + break; + + case 'name': + $search->orderByName(Criteria::ASC); + break; + case 'name_reverse': + $search->orderByName(Criteria::DESC); + break; + + case 'title': + $search->addAscendingOrderByColumn('i18n_TITLE'); + break; + case 'title_reverse': + $search->addDescendingOrderByColumn('i18n_TITLE'); + break; + + case 'value': + $search->orderByValue(Criteria::ASC); + break; + case 'value_reverse': + $search->orderByValue(Criteria::DESC); + break; + } + } $results = $this->search($search, $pagination); diff --git a/core/lib/Thelia/Core/Template/Loop/Currency.php b/core/lib/Thelia/Core/Template/Loop/Currency.php index 2fb296070..b6756fbe6 100755 --- a/core/lib/Thelia/Core/Template/Loop/Currency.php +++ b/core/lib/Thelia/Core/Template/Loop/Currency.php @@ -66,8 +66,9 @@ class Currency extends BaseI18nLoop 'code', 'code_reverse', 'symbol', 'symbol_reverse', 'rate', 'rate_reverse', + 'is_default', 'is_default_reverse', 'manual', 'manual_reverse') - ) + ) ), 'manual' ) @@ -143,6 +144,13 @@ class Currency extends BaseI18nLoop $search->orderByRate(Criteria::DESC); break; + case 'is_default': + $search->orderByByDefault(Criteria::ASC); + break; + case 'is_default_reverse': + $search->orderByByDefault(Criteria::DESC); + break; + case 'manual': $search->orderByPosition(Criteria::ASC); break; diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php new file mode 100644 index 000000000..aab63177a --- /dev/null +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/AdminUtilities.php @@ -0,0 +1,144 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template\Smarty\Plugins; + +use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; +use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; +use Thelia\Tools\URL; +use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\Security\SecurityContext; + +/** + * This class implements variour admin template utilities + * + * @author Franck Allimant + */ +class AdminUtilities extends AbstractSmartyPlugin +{ + private $securityContext; + + public function __construct(SecurityContext $securityContext) + { + $this->securityContext = $securityContext; + } + + public function generatePositionChangeBlock($params, &$smarty) { + // The required permissions + $permission = $this->getParam($params, 'permission'); + + // The base position change path + $path = $this->getParam($params, 'path'); + + // The URL parameter the object ID is assigned + $url_parameter = $this->getParam($params, 'url_parameter'); + + // The current object position + $position = $this->getParam($params, 'position'); + + // The object ID + $id = $this->getParam($params, 'id'); + + // The in place dition class + $in_place_edit_class = $this->getParam($params, 'in_place_edit_class'); + + /* + + {$POSITION} + + */ + + if ($permissions == null || $this->securityContext->isGranted("ADMIN", array($permission))) { + return sprintf( + '%s', + URL::absoluteUrl("$path/positionUp", array($url_parameter => $id)), + $in_place_edit_class, + $id, + $position, + URL::absoluteUrl("$path/positionDown", array($url_parameter => $id)) + ); + } + else { + return $position; + } + } + + + /** + * Generates the link of a sortable column header + * + * @param array $params + * @param unknown $smarty + * @return string no text is returned. + */ + public function generateSortableColumnHeader($params, &$smarty) + { + // The current order of the table + $current_order = $this->getParam($params, 'current_order'); + + // The column ascending order + $order = $this->getParam($params, 'order'); + + // The column descending order label + $reverse_order = $this->getParam($params, 'reverse_order'); + + // The order change path + $path = $this->getParam($params, 'path'); + + // The column label + $label = $this->getParam($params, 'label'); + + if ($current_order == $order) { + $icon = 'up'; + $order_change = $reverse_order; + } + else if ($current_order == $reverse_order) { + $icon = 'down'; + $order_change = $order; + } + else { + $order_change = $order; + } + + if (! empty($icon)) + $output = sprintf(' ', $icon); + else + $output = ''; + + return sprintf('%s%s', $output, URL::absoluteUrl($path, array('order' => $order_change)), $label); + } + + + /** + * Define the various smarty plugins handled by this class + * + * @return an array of smarty plugin descriptors + */ + public function getPluginDescriptors() + { + return array( + new SmartyPluginDescriptor('function', 'admin_sortable_header', $this, 'generateSortableColumnHeader'), + new SmartyPluginDescriptor('function', 'admin_position_block' , $this, 'generatePositionChangeBlock'), + ); + } +} \ No newline at end of file diff --git a/templates/admin/default/assets/css/admin.less b/templates/admin/default/assets/css/admin.less index 85cef27da..9a01cfb67 100755 --- a/templates/admin/default/assets/css/admin.less +++ b/templates/admin/default/assets/css/admin.less @@ -621,6 +621,7 @@ form .info .input-append .add-on { li.active a { opacity: 1; background-color: #E7E7E7; + border: 1px solid #E9720F; } } } @@ -725,6 +726,17 @@ label { td, th { text-align: center; + + &.text-center { + text-align: center; + } + &.text-left { + text-align: left; + } + &.text-right { + text-align: right; + } + } td.object-title, th.object-title { diff --git a/templates/admin/default/categories.html b/templates/admin/default/categories.html index 1548140bf..65902e5d7 100755 --- a/templates/admin/default/categories.html +++ b/templates/admin/default/categories.html @@ -47,54 +47,40 @@   + - {if $category_order == 'alpha'} - - {$order_change = 'alpha_reverse'} - {elseif $category_order == 'alpha_reverse'} - - {$order_change = 'alpha'} - {else} - {$order_change = 'alpha'} - {/if} - - {intl l="Category title"} - - + {admin_sortable_header + current_order=$category_order + order='alpha' + reverse_order='alpha_reverse' + path={url path='/admin/catalog/category' id="{$current_category_id}"} + label={intl l='Category title'} + } + {module_include location='category_list_header'} - {if $category_order == 'visible'} - - {$order_change = 'visible_reverse'} - {elseif $category_order == 'visible_reverse'} - - {$order_change = 'visible'} - {else} - {$order_change = 'visible'} - {/if} - - - {intl l="Online"} - + {admin_sortable_header + current_order=$category_order + order='visible' + reverse_order='visible_reverse' + path={url path='/admin/catalog/category' id="{$current_category_id}"} + label={intl l='Online'} + } - {if $category_order == 'manual'} - - {$order_change = 'manual_reverse'} - {elseif $category_order == 'manual_reverse'} - - {$order_change = 'manual'} - {else} - {$order_change = 'manual'} - {/if} - - {intl l="Position"} + {admin_sortable_header + current_order=$category_order + order='manual' + reverse_order='manual_reverse' + path={url path='/admin/catalog/category' id="{$current_category_id}"} + label={intl l='Position'} + } - {intl l="Actions"} +   @@ -126,15 +112,14 @@ - {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"} - - {$POSITION} - - {/loop} - - {elseloop rel="can_change"} - {$POSITION} - {/elseloop} + {admin_position_block + permission="admin.category.edit" + path={url path='admin/catalog/category' category_id="{$ID}"} + url_parameter="category_id" + in_place_edit_class="categoryPositionChange" + position="$POSITION" + id="$ID" + } @@ -200,13 +185,38 @@   - {intl l="Product title"} + + {admin_sortable_header + current_order=$product_order + order='alpha' + reverse_order='alpha_reverse' + path={url path='/admin/catalog/product' id="{$current_category_id}"} + label={intl l='Product title'} + } {module_include location='product_list_header'} - {intl l="Online"} - {intl l="Position"} - {intl l="Actions"} + + {admin_sortable_header + current_order=$product_order + order='visible' + reverse_order='visible_reverse' + path={url path='/admin/catalog/product' id="{$current_category_id}"} + label={intl l='Online'} + } + + + + {admin_sortable_header + current_order=$product_order + order='manual' + reverse_order='manual_reverse' + path={url path='/admin/catalog/product' id="{$current_category_id}"} + label={intl l='Position'} + } + + +   @@ -229,13 +239,18 @@ - - {$POSITION} - + {admin_position_block + permission="admin.product.edit" + path={url path='admin/catalog/product' category_id="{$ID}"} + url_parameter="product_id" + in_place_edit_class="productPositionChange" + position="$POSITION" + id="$ID" + } - + diff --git a/templates/admin/default/currencies.html b/templates/admin/default/currencies.html index 762bb47ee..6671c131f 100644 --- a/templates/admin/default/currencies.html +++ b/templates/admin/default/currencies.html @@ -40,94 +40,75 @@ - {if $order == 'id'} - - {$order_change = 'id_reverse'} - {elseif $order == 'id_reverse'} - - {$order_change = 'id'} - {else} - {$order_change = 'id'} - {/if} - - {intl l="ID"} - + {admin_sortable_header + current_order=$order + order='id' + reverse_order='id_reverse' + path='/admin/configuration/currencies' + label="{intl l='ID'}" + } - {if $order == 'alpha'} - - {$order_change = 'alpha_reverse'} - {elseif $order == 'alpha_reverse'} - - {$order_change = 'alpha'} - {else} - {$order_change = 'alpha'} - {/if} - - {intl l="Name"} - + {admin_sortable_header + current_order=$order + order='alpha' + reverse_order='alpha_reverse' + path='/admin/configuration/currencies' + label="{intl l='Name'}" + } - - {if $order == 'code'} - - {$order_change = 'code_reverse'} - {elseif $order == 'code_reverse'} - - {$order_change = 'code'} - {else} - {$order_change = 'code'} - {/if} - {intl l="ISO 4217 Code"} + + {admin_sortable_header + current_order=$order + order='code' + reverse_order='code_reverse' + path='/admin/configuration/currencies' + label="{intl l="ISO 4217 Code"}" + } - - {if $order == 'symbol'} - - {$order_change = 'symbol_reverse'} - {elseif $order == 'symbol_reverse'} - - {$order_change = 'symbol'} - {else} - {$order_change = 'symbol'} - {/if} - - {intl l="Symbol"} - + + {admin_sortable_header + current_order=$order + order='symbol' + reverse_order='symbol_reverse' + path='/admin/configuration/currencies' + label="{intl l="Symbol"}" + } - - {if $order == 'rate'} - - {$order_change = 'rate_reverse'} - {elseif $order == 'rate_reverse'} - - {$order_change = 'rate'} - {else} - {$order_change = 'rate'} - {/if} - - {intl l="Rate in €"} - + + {admin_sortable_header + current_order=$order + order='rate' + reverse_order='rate_reverse' + path='/admin/configuration/currencies' + label="{intl l="Rate in €"}" + } - - {if $order == 'manual'} - - {$order_change = 'manual_reverse'} - {elseif $order == 'manual_reverse'} - - {$order_change = 'manual'} - {else} - {$order_change = 'manual'} - {/if} - - {intl l="Position"} + + {admin_sortable_header + current_order=$order + order='manual' + reverse_order='manual_reverse' + path='/admin/configuration/currencies' + label="{intl l="Position"}" + } - {intl l="Default"} + + {admin_sortable_header + current_order=$order + order='is_default' + reverse_order='is_default_reverse' + path='/admin/configuration/currencies' + label="{intl l="Default"}" + } + {module_include location='currencies_table_header'} @@ -148,25 +129,24 @@ {/elseloop} - {$ISOCODE} + {$ISOCODE} - {$SYMBOL} + {$SYMBOL} - {$RATE|string_format:"%.4f"} + {$RATE|string_format:"%.4f"} - - {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"} - - {$POSITION} - - {/loop} - - {elseloop rel="can_change"} - {$POSITION} - {/elseloop} + + {admin_position_block + permission="admin.currencies.edit" + path="/admin/configuration/currencies" + url_parameter="currency_id" + in_place_edit_class="currencyPositionChange" + position="$POSITION" + id="$ID" + } - + {module_include location='currencies_table_row'} @@ -238,6 +218,10 @@
{loop type="lang" name="default-lang" default_only="1"} + + {* Switch edition to the current locale *} + + {form_field form=$form field='locale'} {/form_field} diff --git a/templates/admin/default/edit_category.html b/templates/admin/default/edit_category.html index 65c5f9c56..3d70e5cdb 100755 --- a/templates/admin/default/edit_category.html +++ b/templates/admin/default/edit_category.html @@ -12,7 +12,7 @@
- {loop name="category_edit" type="category" visible="*" id="{$current_category_id}" backend_context="1" lang="$edition_language"} + {loop name="category_edit" type="category" visible="*" id="{$current_category_id}" backend_context="1" lang="$edit_language_id"}
diff --git a/templates/admin/default/includes/inner-form-toolbar.html b/templates/admin/default/includes/inner-form-toolbar.html index 082ad34e2..3edcbf794 100755 --- a/templates/admin/default/includes/inner-form-toolbar.html +++ b/templates/admin/default/includes/inner-form-toolbar.html @@ -11,8 +11,8 @@