diff --git a/core/lib/Thelia/Action/Message.php b/core/lib/Thelia/Action/Message.php index fa9b13db5..4b85c7ca9 100644 --- a/core/lib/Thelia/Action/Message.php +++ b/core/lib/Thelia/Action/Message.php @@ -82,9 +82,15 @@ class Message extends BaseAction implements EventSubscriberInterface ->setTitle($event->getTitle()) ->setSubject($event->getSubject()) + ->setHtmlMessage($event->getHtmlMessage()) ->setTextMessage($event->getTextMessage()) + ->setHtmlLayoutFileName($event->getHtmlLayoutFileName()) + ->setHtmlTemplateFileName($event->getHtmlTemplateFileName()) + ->setTextLayoutFileName($event->getTextLayoutFileName()) + ->setTextTemplateFileName($event->getTextTemplateFileName()) + ->save(); $event->setMessage($message); diff --git a/core/lib/Thelia/Action/Order.php b/core/lib/Thelia/Action/Order.php index 78ebb94d6..0699c14d1 100755 --- a/core/lib/Thelia/Action/Order.php +++ b/core/lib/Thelia/Action/Order.php @@ -288,8 +288,18 @@ class Order extends BaseAction implements EventSubscriberInterface */ public function sendOrderEmail(OrderEvent $event) { - $store_email = ConfigQuery::read('store_email'); - if($store_email) { + $contact_email = ConfigQuery::read('contact_email'); + + if($contact_email) { + + $message = MessageQuery::create() + ->filterByName('order_confirmation') + ->findOne(); + + if (false === $message) { + throw new \Exception("Failed to load message 'order_confirmation'."); + } + $order = $event->getOrder(); $customer = $order->getCustomer(); @@ -298,24 +308,16 @@ class Order extends BaseAction implements EventSubscriberInterface $parser->assign('order_id', $order->getId()); $parser->assign('order_ref', $order->getRef()); - $message = MessageQuery::create() - ->filterByName('order_confirmation') - ->findOne(); - $message ->setLocale($order->getLang()->getLocale()); - $subject = $parser->fetch(sprintf("string:%s", $message->getSubject())); - $htmlMessage = $parser->fetch(sprintf("string:%s", $message->getHtmlMessage())); - $textMessage = $parser->fetch(sprintf("string:%s", $message->getTextMessage())); - - $instance = \Swift_Message::newInstance($subject) + $instance = \Swift_Message::newInstance() ->addTo($customer->getEmail(), $customer->getFirstname()." ".$customer->getLastname()) - ->addFrom($store_email, ConfigQuery::read('store_name')) + ->addFrom(ConfigQuery::read('contact_email'), ConfigQuery::read('company_name')) ; - $instance - ->setBody($htmlMessage, 'text/html') - ->addPart($textMessage, 'text/plain'); + + // Build subject and body + $message->build($parser, $instance); $mail = $this->getMailer()->send($instance); } diff --git a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php index 11ed4fc50..dd6d19bcd 100644 --- a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php +++ b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php @@ -411,9 +411,9 @@ abstract class AbstractCrudController extends BaseAdminController } catch (FormValidationException $ex) { // Form cannot be validated $error_msg = $this->createStandardFormValidationErrorMessage($ex); - } catch (\Exception $ex) { + /*} catch (\Exception $ex) { // Any other error - $error_msg = $ex->getMessage(); + $error_msg = $ex->getMessage();*/ } $this->setupFormErrorContext( diff --git a/core/lib/Thelia/Controller/Admin/MessageController.php b/core/lib/Thelia/Controller/Admin/MessageController.php index 407578a08..fe8b655c7 100644 --- a/core/lib/Thelia/Controller/Admin/MessageController.php +++ b/core/lib/Thelia/Controller/Admin/MessageController.php @@ -30,6 +30,9 @@ use Thelia\Core\Event\Message\MessageCreateEvent; use Thelia\Model\MessageQuery; use Thelia\Form\MessageModificationForm; use Thelia\Form\MessageCreationForm; +use Symfony\Component\Finder\Finder; +use Thelia\Model\ConfigQuery; +use Thelia\Core\Template\TemplateHelper; /** * Manages messages sent by mail @@ -90,6 +93,10 @@ class MessageController extends AbstractCrudController ->setLocale($formData["locale"]) ->setTitle($formData['title']) ->setSubject($formData['subject']) + ->setHtmlLayoutFileName($formData['html_layout_file_name']) + ->setHtmlTemplateFileName($formData['html_template_file_name']) + ->setTextLayoutFileName($formData['text_layout_file_name']) + ->setTextTemplateFileName($formData['text_template_file_name']) ->setHtmlMessage($formData['html_message']) ->setTextMessage($formData['text_message']) ; @@ -111,14 +118,19 @@ class MessageController extends AbstractCrudController { // Prepare the data that will hydrate the form $data = array( - 'id' => $object->getId(), - 'name' => $object->getName(), - 'secured' => $object->getSecured(), - 'locale' => $object->getLocale(), - 'title' => $object->getTitle(), - 'subject' => $object->getSubject(), - 'html_message' => $object->getHtmlMessage(), - 'text_message' => $object->getTextMessage() + 'id' => $object->getId(), + 'name' => $object->getName(), + 'secured' => $object->getSecured(), + 'locale' => $object->getLocale(), + 'title' => $object->getTitle(), + 'subject' => $object->getSubject(), + 'html_message' => $object->getHtmlMessage(), + 'text_message' => $object->getTextMessage(), + + 'html_layout_file_name' => $object->getHtmlLayoutFileName(), + 'html_template_file_name' => $object->getHtmlTemplateFileName(), + 'text_layout_file_name' => $object->getTextLayoutFileName(), + 'text_template_file_name' => $object->getTextTemplateFileName(), ); // Setup the object form @@ -152,17 +164,36 @@ class MessageController extends AbstractCrudController return $this->render('messages'); } + protected function listDirectoryContent($requiredExtension) { + + $list = array(); + + $dir = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath(); + + $finder = Finder::create()->files()->in($dir)->ignoreDotFiles(true)->sortByName()->name("*.$requiredExtension"); + + foreach ($finder as $file) { + $list[] = $file->getBasename(); + } + + return $list; + } + protected function renderEditionTemplate() { - return $this->render('message-edit', array('message_id' => $this->getRequest()->get('message_id'))); + return $this->render('message-edit', array( + 'message_id' => $this->getRequest()->get('message_id'), + 'layout_list' => $this->listDirectoryContent('tpl'), + 'html_template_list' => $this->listDirectoryContent('html'), + 'text_template_list' => $this->listDirectoryContent('txt'), + )); } protected function redirectToEditionTemplate() { - $this->redirectToRoute( - "admin.configuration.messages.update", - array('message_id' => $this->getRequest()->get('message_id')) - ); + $this->redirectToRoute("admin.configuration.messages.update", array( + 'message_id' => $this->getRequest()->get('message_id') + )); } protected function redirectToListTemplate() diff --git a/core/lib/Thelia/Controller/Admin/TranslationsController.php b/core/lib/Thelia/Controller/Admin/TranslationsController.php index 04fc065b5..7bea68e6f 100644 --- a/core/lib/Thelia/Controller/Admin/TranslationsController.php +++ b/core/lib/Thelia/Controller/Admin/TranslationsController.php @@ -71,8 +71,8 @@ class TranslationsController extends BaseAdminController case 'mo' : if (null !== $module = ModuleQuery::create()->findPk($item_id)) { - $directory = THELIA_MODULE_DIR . $module->getBaseDir(); - $i18n_directory = THELIA_TEMPLATE_DIR . $module->getI18nPath(); + $directory = $module->getAbsoluteBaseDir(); + $i18n_directory = $module->getAbsoluteI18nPath(); $walkMode = TemplateHelper::WALK_MODE_PHP; } break; @@ -97,8 +97,8 @@ class TranslationsController extends BaseAdminController } if ($template) { - $directory = THELIA_TEMPLATE_DIR . $template->getPath(); - $i18n_directory = THELIA_TEMPLATE_DIR . $template->getI18nPath(); + $directory = $template->getAbsolutePath(); + $i18n_directory = $template->getAbsoluteI18nPath(); } // Load strings to translate diff --git a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php index f92b7bf3d..845a659d2 100755 --- a/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php +++ b/core/lib/Thelia/Core/DependencyInjection/Compiler/RegisterRouterPass.php @@ -68,12 +68,14 @@ class RegisterRouterPass implements CompilerPassInterface foreach ($modules as $module) { $moduleBaseDir = $module->getBaseDir(); - if (file_exists(THELIA_MODULE_DIR . "/" . $moduleBaseDir . "/Config/routing.xml")) { + $routingConfigFilePath = $module->getAbsoluteBaseDir() . DS . "Config" . DS . "routing.xml"; + + if (file_exists($routingConfigFilePath)) { $definition = new Definition( $container->getParameter("router.class"), array( new Reference("router.module.xmlLoader"), - $moduleBaseDir . "/Config/routing.xml", + $routingConfigFilePath, array( "cache_dir" => $container->getParameter("kernel.cache_dir"), "debug" => $container->getParameter("kernel.debug"), diff --git a/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php b/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php index 858a668b8..6630b7c13 100644 --- a/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Message/MessageUpdateEvent.php @@ -22,13 +22,18 @@ /*************************************************************************************/ namespace Thelia\Core\Event\Message; - use Thelia\Core\Event\Message\MessageCreateEvent; class MessageUpdateEvent extends MessageCreateEvent { protected $message_id; + protected $html_layout_file_name; + protected $html_template_file_name; + + protected $text_layout_file_name; + protected $text_template_file_name; + protected $text_message; protected $html_message; protected $subject; @@ -85,4 +90,52 @@ class MessageUpdateEvent extends MessageCreateEvent return $this; } -} + + public function getHtmlLayoutFileName() + { + return $this->html_layout_file_name; + } + + public function setHtmlLayoutFileName($html_layout_file_name) + { + $this->html_layout_file_name = $html_layout_file_name; + + return $this; + } + + public function getHtmlTemplateFileName() + { + return $this->html_template_file_name; + } + + public function setHtmlTemplateFileName($html_template_file_name) + { + $this->html_template_file_name = $html_template_file_name; + + return $this; + } + + public function getTextLayoutFileName() + { + return $this->text_layout_file_name; + } + + public function setTextLayoutFileName($text_layout_file_name) + { + $this->text_layout_file_name = $text_layout_file_name; + + return $this; + } + + public function getTextTemplateFileName() + { + return $this->text_template_file_name; + } + + public function setTextTemplateFileName($text_template_file_name) + { + $this->text_template_file_name = $text_template_file_name; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Module.php b/core/lib/Thelia/Core/Template/Loop/Module.php index 9815faf7e..0b10517b2 100755 --- a/core/lib/Thelia/Core/Template/Loop/Module.php +++ b/core/lib/Thelia/Core/Template/Loop/Module.php @@ -165,7 +165,7 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface /* if not ; test if it uses admin inclusion : module_configuration.html */ if(false === $hasConfigurationInterface) { - if(file_exists( sprintf("%s/%s/AdminIncludes/%s.html", THELIA_MODULE_DIR, $module->getBaseDir(), "module_configuration"))) { + if(file_exists( sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), "module_configuration"))) { $hasConfigurationInterface = true; } } diff --git a/core/lib/Thelia/Core/Template/Loop/Template.php b/core/lib/Thelia/Core/Template/Loop/Template.php index 7560926d8..c5b6a95f3 100644 --- a/core/lib/Thelia/Core/Template/Loop/Template.php +++ b/core/lib/Thelia/Core/Template/Loop/Template.php @@ -93,7 +93,7 @@ class Template extends BaseLoop implements ArraySearchLoopInterface $loopResultRow ->set("NAME" , $template->getName()) ->set("RELATIVE_PATH" , $template->getPath()) - ->set("ABSOLUTE_PATH" , THELIA_TEMPLATE_DIR . $template->getPath()) + ->set("ABSOLUTE_PATH" , $template->getAbsolutePath()) ; $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php index 2340537db..4d1ed3060 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php @@ -54,7 +54,7 @@ class Module extends AbstractSmartyPlugin continue; } - $file = sprintf("%s/%s/AdminIncludes/%s.html", THELIA_MODULE_DIR, $module->getBaseDir(), $location); + $file = sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), $location); if (file_exists($file)) { $content .= file_get_contents($file); diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php index 53cedbede..2e52e21e0 100755 --- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php +++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php @@ -16,6 +16,7 @@ use Thelia\Core\Template\ParserContext; use Thelia\Core\Template\TemplateDefinition; use Thelia\Model\ConfigQuery; use Thelia\Core\Template\TemplateHelper; +use Thelia\Core\Translation\Translator; /** * @@ -125,10 +126,10 @@ class SmartyParser extends Smarty implements ParserInterface $this->setTemplateDir(array()); /* add main template directory */ - $this->addTemplateDir(THELIA_TEMPLATE_DIR . $this->template, 0); + $this->addTemplateDir($templateDefinition->getAbsolutePath(), 0); /* define config directory */ - $configDirectory = THELIA_TEMPLATE_DIR . $this->template . '/configs'; + $configDirectory = $templateDefinition->getAbsoluteConfigPath(); $this->setConfigDir($configDirectory); /* add modules template directories */ @@ -165,17 +166,16 @@ class SmartyParser extends Smarty implements ParserInterface } /** - * Return a rendered template file + * Return a rendered template, either from file or ftom a string * - * @param string $realTemplateName the template name (from the template directory) + * @param string $resourceType either 'string' (rendering from a string) or 'file' (rendering a file) + * @param string $resourceContent the resource content (a text, or a template file name) * @param array $parameters an associative array of names / value pairs + * * @return string the rendered template text */ - public function render($realTemplateName, array $parameters = array()) + protected function internalRenderer($resourceType, $resourceContent, array $parameters) { - if(false === $this->templateExists($realTemplateName)) { - throw new ResourceNotFoundException(); - } // Assign the parserContext variables foreach ($this->parserContext as $var => $value) { $this->assign($var, $value); @@ -183,7 +183,35 @@ class SmartyParser extends Smarty implements ParserInterface $this->assign($parameters); - return $this->fetch(sprintf("file:%s", $realTemplateName)); + return $this->fetch(sprintf("%s:%s", $resourceType, $resourceContent)); + } + + + /** + * Return a rendered template file + * + * @param string $realTemplateName the template name (from the template directory) + * @param array $parameters an associative array of names / value pairs + * @return string the rendered template text + */ + public function render($realTemplateName, array $parameters = array()) { + + if(false === $this->templateExists($realTemplateName)) { + throw new ResourceNotFoundException(Translator::getInstance()->trans("Template file %file cannot be found.", array('%file', $realTemplateName))); + } + + return $this->internalRenderer('file', $realTemplateName, $parameters); + } + + /** + * Return a rendered template text + * + * @param string $templateText the template text + * @param array $parameters an associative array of names / value pairs + * @return string the rendered template text + */ + public function renderString($templateText, array $parameters = array()) { + return $this->internalRenderer('string', $templateText, $parameters); } /** diff --git a/core/lib/Thelia/Core/Template/TemplateDefinition.php b/core/lib/Thelia/Core/Template/TemplateDefinition.php index 7fa05c7cb..14dcdca93 100644 --- a/core/lib/Thelia/Core/Template/TemplateDefinition.php +++ b/core/lib/Thelia/Core/Template/TemplateDefinition.php @@ -28,10 +28,12 @@ class TemplateDefinition const FRONT_OFFICE = 1; const BACK_OFFICE = 2; const PDF = 3; + const EMAIL = 4; const FRONT_OFFICE_SUBDIR = 'frontOffice/'; const BACK_OFFICE_SUBDIR = 'backOffice/'; const PDF_SUBDIR = 'pdf/'; + const EMAIL_SUBDIR = 'email/'; /** * @var the template directory name (e.g. 'default') @@ -64,6 +66,9 @@ class TemplateDefinition case TemplateDefinition::PDF: $this->path = self::PDF_SUBDIR . $name; break; + case TemplateDefinition::EMAIL: + $this->path = self::EMAIL_SUBDIR . $name; + break; default: $this->path = $name; break; @@ -85,11 +90,28 @@ class TemplateDefinition return $this->getPath() . DS . 'I18n'; } + public function getAbsoluteI18nPath() { + return THELIA_TEMPLATE_DIR . $this->getI18nPath(); + } + public function getPath() { return $this->path; } + public function getAbsolutePath() { + return THELIA_TEMPLATE_DIR . $this->getPath(); + } + + public function getConfigPath() + { + return $this->getPath() . DS . 'configs'; + } + + public function getAbsoluteConfigPath() { + return THELIA_TEMPLATE_DIR . $this->getConfigPath(); + } + public function setPath($path) { $this->path = $path; @@ -106,5 +128,4 @@ class TemplateDefinition $this->type = $type; return $this; } - -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/TemplateHelper.php b/core/lib/Thelia/Core/Template/TemplateHelper.php index 3310b5f04..4f33e1a42 100644 --- a/core/lib/Thelia/Core/Template/TemplateHelper.php +++ b/core/lib/Thelia/Core/Template/TemplateHelper.php @@ -46,6 +46,16 @@ class TemplateHelper return self::$instance; } + /** + * @return TemplateDefinition + */ + public function getActiveMailTemplate() { + return new TemplateDefinition( + ConfigQuery::read('active-mail-template', 'default'), + TemplateDefinition::EMAIL + ); + } + /** * @return TemplateDefinition */ diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index 49647f4c9..e5fc0cd75 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -145,15 +145,15 @@ class Thelia extends Kernel $code = ucfirst($module->getCode()); - $loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . $code . "/Config")); + $loader = new XmlFileLoader($container, new FileLocator($module->getAbsoluteConfigPath())); $loader->load("config.xml"); - if (is_dir($dir = THELIA_MODULE_DIR . "/" . $code . "/I18n")) { + if (is_dir($dir = $module->getAbsoluteI18nPath())) { $translationDirs[] = $dir; } /* is there a front-office template directory ? */ - $frontOfficeModuleTemplateDirectory = sprintf("%s%s%stemplates%s%s", THELIA_MODULE_DIR, $code, DS, DS, TemplateDefinition::FRONT_OFFICE_SUBDIR); + $frontOfficeModuleTemplateDirectory = sprintf("%s%stemplates%s%s", $module->getAbsoluteBaseDir(), DS, DS, TemplateDefinition::FRONT_OFFICE_SUBDIR); if (is_dir($frontOfficeModuleTemplateDirectory)) { try { $moduleFrontOfficeTemplateBrowser = new \DirectoryIterator($frontOfficeModuleTemplateDirectory); @@ -178,7 +178,7 @@ class Thelia extends Kernel } /* is there a back-office template directory ? */ - $backOfficeModuleTemplateDirectory = sprintf("%s%s%stemplates%s%s", THELIA_MODULE_DIR, $code, DS, DS, TemplateDefinition::BACK_OFFICE_SUBDIR); + $backOfficeModuleTemplateDirectory = sprintf("%s%stemplates%s%s", $module->getAbsoluteBaseDir(), DS, DS, TemplateDefinition::BACK_OFFICE_SUBDIR); if (is_dir($backOfficeModuleTemplateDirectory)) { try { $moduleBackOfficeTemplateBrowser = new \DirectoryIterator($backOfficeModuleTemplateDirectory); @@ -210,18 +210,20 @@ class Thelia extends Kernel //core translation $translationDirs[] = THELIA_ROOT . "core/lib/Thelia/Config/I18n"; + $th = TemplateHelper::getInstance(); + // admin template - if (is_dir($dir = THELIA_TEMPLATE_DIR . TemplateHelper::getInstance()->getActiveAdminTemplate()->getI18nPath())) { + if (is_dir($dir = $th->getActiveAdminTemplate()->getAbsoluteI18nPath())) { $translationDirs[] = $dir; } // front template - if (is_dir($dir = THELIA_TEMPLATE_DIR . TemplateHelper::getInstance()->getActiveFrontTemplate()->getI18nPath())) { + if (is_dir($dir = $th->getActiveFrontTemplate()->getAbsoluteI18nPath())) { $translationDirs[] = $dir; } // PDF template - if (is_dir($dir = THELIA_TEMPLATE_DIR . TemplateHelper::getInstance()->getActivePdfTemplate()->getI18nPath())) { + if (is_dir($dir = $th->getActivePdfTemplate()->getAbsoluteI18nPath())) { $translationDirs[] = $dir; } diff --git a/core/lib/Thelia/Form/MessageModificationForm.php b/core/lib/Thelia/Form/MessageModificationForm.php index c22d67bbf..231c605b8 100644 --- a/core/lib/Thelia/Form/MessageModificationForm.php +++ b/core/lib/Thelia/Form/MessageModificationForm.php @@ -34,10 +34,11 @@ class MessageModificationForm extends BaseForm ->add("id" , "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) ->add("name" , "text" , array( "constraints" => array(new NotBlank()), - "label" => Translator::getInstance()->trans('Name *'), + "label" => Translator::getInstance()->trans('Name'), "label_attr" => array( "for" => "name" - ) + ), + "required" => true )) ->add("secured" , "text" , array( "label" => Translator::getInstance()->trans('Prevent mailing template modification or deletion, except for super-admin') @@ -45,29 +46,61 @@ class MessageModificationForm extends BaseForm ->add("locale" , "text" , array()) ->add("title" , "text" , array( "constraints" => array(new NotBlank()), - "label" => Translator::getInstance()->trans('Title *'), + "label" => Translator::getInstance()->trans('Title'), "label_attr" => array( "for" => "title" - ) + ), + "required" => true )) ->add("subject" , "text" , array( "constraints" => array(new NotBlank()), - "label" => Translator::getInstance()->trans('Message subject *'), + "label" => Translator::getInstance()->trans('Message subject'), "label_attr" => array( "for" => "subject" - ) + ), + "required" => true )) ->add("html_message" , "text" , array( "label" => Translator::getInstance()->trans('HTML Message'), "label_attr" => array( "for" => "html_message" - ) + ), + "required" => false )) ->add("text_message" , "text" , array( "label" => Translator::getInstance()->trans('Text Message'), "label_attr" => array( "for" => "text_message" - ) + ), + "required" => false + )) + ->add("html_layout_file_name" , "text" , array( + "label" => Translator::getInstance()->trans('Name of the HTML layout file'), + "label_attr" => array( + "for" => "html_layout_file_name" + ), + "required" => false + )) + ->add("html_template_file_name" , "text" , array( + "label" => Translator::getInstance()->trans('Name of the HTML template file'), + "label_attr" => array( + "for" => "html_template_file_name" + ), + "required" => false + )) + ->add("text_layout_file_name" , "text" , array( + "label" => Translator::getInstance()->trans('Name of the text layout file'), + "label_attr" => array( + "for" => "text_layout_file_name" + ), + "required" => false + )) + ->add("text_template_file_name" , "text" , array( + "label" => Translator::getInstance()->trans('Name of the text template file'), + "label_attr" => array( + "for" => "text_template_file_name" + ), + "required" => false )) ; } diff --git a/core/lib/Thelia/Model/Base/Message.php b/core/lib/Thelia/Model/Base/Message.php index fbea5b241..351aa3818 100644 --- a/core/lib/Thelia/Model/Base/Message.php +++ b/core/lib/Thelia/Model/Base/Message.php @@ -78,6 +78,30 @@ abstract class Message implements ActiveRecordInterface */ protected $secured; + /** + * The value for the text_layout_file_name field. + * @var string + */ + protected $text_layout_file_name; + + /** + * The value for the text_template_file_name field. + * @var string + */ + protected $text_template_file_name; + + /** + * The value for the html_layout_file_name field. + * @var string + */ + protected $html_layout_file_name; + + /** + * The value for the html_template_file_name field. + * @var string + */ + protected $html_template_file_name; + /** * The value for the created_at field. * @var string @@ -467,6 +491,50 @@ abstract class Message implements ActiveRecordInterface return $this->secured; } + /** + * Get the [text_layout_file_name] column value. + * + * @return string + */ + public function getTextLayoutFileName() + { + + return $this->text_layout_file_name; + } + + /** + * Get the [text_template_file_name] column value. + * + * @return string + */ + public function getTextTemplateFileName() + { + + return $this->text_template_file_name; + } + + /** + * Get the [html_layout_file_name] column value. + * + * @return string + */ + public function getHtmlLayoutFileName() + { + + return $this->html_layout_file_name; + } + + /** + * Get the [html_template_file_name] column value. + * + * @return string + */ + public function getHtmlTemplateFileName() + { + + return $this->html_template_file_name; + } + /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -612,6 +680,90 @@ abstract class Message implements ActiveRecordInterface return $this; } // setSecured() + /** + * Set the value of [text_layout_file_name] column. + * + * @param string $v new value + * @return \Thelia\Model\Message The current object (for fluent API support) + */ + public function setTextLayoutFileName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->text_layout_file_name !== $v) { + $this->text_layout_file_name = $v; + $this->modifiedColumns[] = MessageTableMap::TEXT_LAYOUT_FILE_NAME; + } + + + return $this; + } // setTextLayoutFileName() + + /** + * Set the value of [text_template_file_name] column. + * + * @param string $v new value + * @return \Thelia\Model\Message The current object (for fluent API support) + */ + public function setTextTemplateFileName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->text_template_file_name !== $v) { + $this->text_template_file_name = $v; + $this->modifiedColumns[] = MessageTableMap::TEXT_TEMPLATE_FILE_NAME; + } + + + return $this; + } // setTextTemplateFileName() + + /** + * Set the value of [html_layout_file_name] column. + * + * @param string $v new value + * @return \Thelia\Model\Message The current object (for fluent API support) + */ + public function setHtmlLayoutFileName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->html_layout_file_name !== $v) { + $this->html_layout_file_name = $v; + $this->modifiedColumns[] = MessageTableMap::HTML_LAYOUT_FILE_NAME; + } + + + return $this; + } // setHtmlLayoutFileName() + + /** + * Set the value of [html_template_file_name] column. + * + * @param string $v new value + * @return \Thelia\Model\Message The current object (for fluent API support) + */ + public function setHtmlTemplateFileName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->html_template_file_name !== $v) { + $this->html_template_file_name = $v; + $this->modifiedColumns[] = MessageTableMap::HTML_TEMPLATE_FILE_NAME; + } + + + return $this; + } // setHtmlTemplateFileName() + /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -767,28 +919,40 @@ abstract class Message implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MessageTableMap::translateFieldName('Secured', TableMap::TYPE_PHPNAME, $indexType)]; $this->secured = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageTableMap::translateFieldName('TextLayoutFileName', TableMap::TYPE_PHPNAME, $indexType)]; + $this->text_layout_file_name = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageTableMap::translateFieldName('TextTemplateFileName', TableMap::TYPE_PHPNAME, $indexType)]; + $this->text_template_file_name = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageTableMap::translateFieldName('HtmlLayoutFileName', TableMap::TYPE_PHPNAME, $indexType)]; + $this->html_layout_file_name = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageTableMap::translateFieldName('HtmlTemplateFileName', TableMap::TYPE_PHPNAME, $indexType)]; + $this->html_template_file_name = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : MessageTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : MessageTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $this->version = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : MessageTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : MessageTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; $this->version_created_by = (null !== $col) ? (string) $col : null; $this->resetModified(); @@ -798,7 +962,7 @@ abstract class Message implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 8; // 8 = MessageTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 12; // 12 = MessageTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\Message object", 0, $e); @@ -1077,6 +1241,18 @@ abstract class Message implements ActiveRecordInterface if ($this->isColumnModified(MessageTableMap::SECURED)) { $modifiedColumns[':p' . $index++] = 'SECURED'; } + if ($this->isColumnModified(MessageTableMap::TEXT_LAYOUT_FILE_NAME)) { + $modifiedColumns[':p' . $index++] = 'TEXT_LAYOUT_FILE_NAME'; + } + if ($this->isColumnModified(MessageTableMap::TEXT_TEMPLATE_FILE_NAME)) { + $modifiedColumns[':p' . $index++] = 'TEXT_TEMPLATE_FILE_NAME'; + } + if ($this->isColumnModified(MessageTableMap::HTML_LAYOUT_FILE_NAME)) { + $modifiedColumns[':p' . $index++] = 'HTML_LAYOUT_FILE_NAME'; + } + if ($this->isColumnModified(MessageTableMap::HTML_TEMPLATE_FILE_NAME)) { + $modifiedColumns[':p' . $index++] = 'HTML_TEMPLATE_FILE_NAME'; + } if ($this->isColumnModified(MessageTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -1112,6 +1288,18 @@ abstract class Message implements ActiveRecordInterface case 'SECURED': $stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT); break; + case 'TEXT_LAYOUT_FILE_NAME': + $stmt->bindValue($identifier, $this->text_layout_file_name, PDO::PARAM_STR); + break; + case 'TEXT_TEMPLATE_FILE_NAME': + $stmt->bindValue($identifier, $this->text_template_file_name, PDO::PARAM_STR); + break; + case 'HTML_LAYOUT_FILE_NAME': + $stmt->bindValue($identifier, $this->html_layout_file_name, PDO::PARAM_STR); + break; + case 'HTML_TEMPLATE_FILE_NAME': + $stmt->bindValue($identifier, $this->html_template_file_name, PDO::PARAM_STR); + break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -1199,18 +1387,30 @@ abstract class Message implements ActiveRecordInterface return $this->getSecured(); break; case 3: - return $this->getCreatedAt(); + return $this->getTextLayoutFileName(); break; case 4: - return $this->getUpdatedAt(); + return $this->getTextTemplateFileName(); break; case 5: - return $this->getVersion(); + return $this->getHtmlLayoutFileName(); break; case 6: - return $this->getVersionCreatedAt(); + return $this->getHtmlTemplateFileName(); break; case 7: + return $this->getCreatedAt(); + break; + case 8: + return $this->getUpdatedAt(); + break; + case 9: + return $this->getVersion(); + break; + case 10: + return $this->getVersionCreatedAt(); + break; + case 11: return $this->getVersionCreatedBy(); break; default: @@ -1245,11 +1445,15 @@ abstract class Message implements ActiveRecordInterface $keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getSecured(), - $keys[3] => $this->getCreatedAt(), - $keys[4] => $this->getUpdatedAt(), - $keys[5] => $this->getVersion(), - $keys[6] => $this->getVersionCreatedAt(), - $keys[7] => $this->getVersionCreatedBy(), + $keys[3] => $this->getTextLayoutFileName(), + $keys[4] => $this->getTextTemplateFileName(), + $keys[5] => $this->getHtmlLayoutFileName(), + $keys[6] => $this->getHtmlTemplateFileName(), + $keys[7] => $this->getCreatedAt(), + $keys[8] => $this->getUpdatedAt(), + $keys[9] => $this->getVersion(), + $keys[10] => $this->getVersionCreatedAt(), + $keys[11] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1307,18 +1511,30 @@ abstract class Message implements ActiveRecordInterface $this->setSecured($value); break; case 3: - $this->setCreatedAt($value); + $this->setTextLayoutFileName($value); break; case 4: - $this->setUpdatedAt($value); + $this->setTextTemplateFileName($value); break; case 5: - $this->setVersion($value); + $this->setHtmlLayoutFileName($value); break; case 6: - $this->setVersionCreatedAt($value); + $this->setHtmlTemplateFileName($value); break; case 7: + $this->setCreatedAt($value); + break; + case 8: + $this->setUpdatedAt($value); + break; + case 9: + $this->setVersion($value); + break; + case 10: + $this->setVersionCreatedAt($value); + break; + case 11: $this->setVersionCreatedBy($value); break; } // switch() @@ -1348,11 +1564,15 @@ abstract class Message implements ActiveRecordInterface 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[2], $arr)) $this->setSecured($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]]); - if (array_key_exists($keys[5], $arr)) $this->setVersion($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setVersionCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedBy($arr[$keys[7]]); + if (array_key_exists($keys[3], $arr)) $this->setTextLayoutFileName($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setTextTemplateFileName($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setHtmlLayoutFileName($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setHtmlTemplateFileName($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setVersion($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedAt($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setVersionCreatedBy($arr[$keys[11]]); } /** @@ -1367,6 +1587,10 @@ abstract class Message implements ActiveRecordInterface if ($this->isColumnModified(MessageTableMap::ID)) $criteria->add(MessageTableMap::ID, $this->id); if ($this->isColumnModified(MessageTableMap::NAME)) $criteria->add(MessageTableMap::NAME, $this->name); if ($this->isColumnModified(MessageTableMap::SECURED)) $criteria->add(MessageTableMap::SECURED, $this->secured); + if ($this->isColumnModified(MessageTableMap::TEXT_LAYOUT_FILE_NAME)) $criteria->add(MessageTableMap::TEXT_LAYOUT_FILE_NAME, $this->text_layout_file_name); + if ($this->isColumnModified(MessageTableMap::TEXT_TEMPLATE_FILE_NAME)) $criteria->add(MessageTableMap::TEXT_TEMPLATE_FILE_NAME, $this->text_template_file_name); + if ($this->isColumnModified(MessageTableMap::HTML_LAYOUT_FILE_NAME)) $criteria->add(MessageTableMap::HTML_LAYOUT_FILE_NAME, $this->html_layout_file_name); + if ($this->isColumnModified(MessageTableMap::HTML_TEMPLATE_FILE_NAME)) $criteria->add(MessageTableMap::HTML_TEMPLATE_FILE_NAME, $this->html_template_file_name); if ($this->isColumnModified(MessageTableMap::CREATED_AT)) $criteria->add(MessageTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(MessageTableMap::UPDATED_AT)) $criteria->add(MessageTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(MessageTableMap::VERSION)) $criteria->add(MessageTableMap::VERSION, $this->version); @@ -1437,6 +1661,10 @@ abstract class Message implements ActiveRecordInterface { $copyObj->setName($this->getName()); $copyObj->setSecured($this->getSecured()); + $copyObj->setTextLayoutFileName($this->getTextLayoutFileName()); + $copyObj->setTextTemplateFileName($this->getTextTemplateFileName()); + $copyObj->setHtmlLayoutFileName($this->getHtmlLayoutFileName()); + $copyObj->setHtmlTemplateFileName($this->getHtmlTemplateFileName()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setVersion($this->getVersion()); @@ -1963,6 +2191,10 @@ abstract class Message implements ActiveRecordInterface $this->id = null; $this->name = null; $this->secured = null; + $this->text_layout_file_name = null; + $this->text_template_file_name = null; + $this->html_layout_file_name = null; + $this->html_template_file_name = null; $this->created_at = null; $this->updated_at = null; $this->version = null; @@ -2284,6 +2516,10 @@ abstract class Message implements ActiveRecordInterface $version->setId($this->getId()); $version->setName($this->getName()); $version->setSecured($this->getSecured()); + $version->setTextLayoutFileName($this->getTextLayoutFileName()); + $version->setTextTemplateFileName($this->getTextTemplateFileName()); + $version->setHtmlLayoutFileName($this->getHtmlLayoutFileName()); + $version->setHtmlTemplateFileName($this->getHtmlTemplateFileName()); $version->setCreatedAt($this->getCreatedAt()); $version->setUpdatedAt($this->getUpdatedAt()); $version->setVersion($this->getVersion()); @@ -2329,6 +2565,10 @@ abstract class Message implements ActiveRecordInterface $this->setId($version->getId()); $this->setName($version->getName()); $this->setSecured($version->getSecured()); + $this->setTextLayoutFileName($version->getTextLayoutFileName()); + $this->setTextTemplateFileName($version->getTextTemplateFileName()); + $this->setHtmlLayoutFileName($version->getHtmlLayoutFileName()); + $this->setHtmlTemplateFileName($version->getHtmlTemplateFileName()); $this->setCreatedAt($version->getCreatedAt()); $this->setUpdatedAt($version->getUpdatedAt()); $this->setVersion($version->getVersion()); diff --git a/core/lib/Thelia/Model/Base/MessageQuery.php b/core/lib/Thelia/Model/Base/MessageQuery.php index d72dc7bed..3f412191f 100644 --- a/core/lib/Thelia/Model/Base/MessageQuery.php +++ b/core/lib/Thelia/Model/Base/MessageQuery.php @@ -25,6 +25,10 @@ use Thelia\Model\Map\MessageTableMap; * @method ChildMessageQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildMessageQuery orderByName($order = Criteria::ASC) Order by the name column * @method ChildMessageQuery orderBySecured($order = Criteria::ASC) Order by the secured column + * @method ChildMessageQuery orderByTextLayoutFileName($order = Criteria::ASC) Order by the text_layout_file_name column + * @method ChildMessageQuery orderByTextTemplateFileName($order = Criteria::ASC) Order by the text_template_file_name column + * @method ChildMessageQuery orderByHtmlLayoutFileName($order = Criteria::ASC) Order by the html_layout_file_name column + * @method ChildMessageQuery orderByHtmlTemplateFileName($order = Criteria::ASC) Order by the html_template_file_name column * @method ChildMessageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildMessageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildMessageQuery orderByVersion($order = Criteria::ASC) Order by the version column @@ -34,6 +38,10 @@ use Thelia\Model\Map\MessageTableMap; * @method ChildMessageQuery groupById() Group by the id column * @method ChildMessageQuery groupByName() Group by the name column * @method ChildMessageQuery groupBySecured() Group by the secured column + * @method ChildMessageQuery groupByTextLayoutFileName() Group by the text_layout_file_name column + * @method ChildMessageQuery groupByTextTemplateFileName() Group by the text_template_file_name column + * @method ChildMessageQuery groupByHtmlLayoutFileName() Group by the html_layout_file_name column + * @method ChildMessageQuery groupByHtmlTemplateFileName() Group by the html_template_file_name column * @method ChildMessageQuery groupByCreatedAt() Group by the created_at column * @method ChildMessageQuery groupByUpdatedAt() Group by the updated_at column * @method ChildMessageQuery groupByVersion() Group by the version column @@ -58,6 +66,10 @@ use Thelia\Model\Map\MessageTableMap; * @method ChildMessage findOneById(int $id) Return the first ChildMessage filtered by the id column * @method ChildMessage findOneByName(string $name) Return the first ChildMessage filtered by the name column * @method ChildMessage findOneBySecured(int $secured) Return the first ChildMessage filtered by the secured column + * @method ChildMessage findOneByTextLayoutFileName(string $text_layout_file_name) Return the first ChildMessage filtered by the text_layout_file_name column + * @method ChildMessage findOneByTextTemplateFileName(string $text_template_file_name) Return the first ChildMessage filtered by the text_template_file_name column + * @method ChildMessage findOneByHtmlLayoutFileName(string $html_layout_file_name) Return the first ChildMessage filtered by the html_layout_file_name column + * @method ChildMessage findOneByHtmlTemplateFileName(string $html_template_file_name) Return the first ChildMessage filtered by the html_template_file_name column * @method ChildMessage findOneByCreatedAt(string $created_at) Return the first ChildMessage filtered by the created_at column * @method ChildMessage findOneByUpdatedAt(string $updated_at) Return the first ChildMessage filtered by the updated_at column * @method ChildMessage findOneByVersion(int $version) Return the first ChildMessage filtered by the version column @@ -67,6 +79,10 @@ use Thelia\Model\Map\MessageTableMap; * @method array findById(int $id) Return ChildMessage objects filtered by the id column * @method array findByName(string $name) Return ChildMessage objects filtered by the name column * @method array findBySecured(int $secured) Return ChildMessage objects filtered by the secured column + * @method array findByTextLayoutFileName(string $text_layout_file_name) Return ChildMessage objects filtered by the text_layout_file_name column + * @method array findByTextTemplateFileName(string $text_template_file_name) Return ChildMessage objects filtered by the text_template_file_name column + * @method array findByHtmlLayoutFileName(string $html_layout_file_name) Return ChildMessage objects filtered by the html_layout_file_name column + * @method array findByHtmlTemplateFileName(string $html_template_file_name) Return ChildMessage objects filtered by the html_template_file_name column * @method array findByCreatedAt(string $created_at) Return ChildMessage objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildMessage objects filtered by the updated_at column * @method array findByVersion(int $version) Return ChildMessage objects filtered by the version column @@ -167,7 +183,7 @@ abstract class MessageQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, NAME, SECURED, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message WHERE ID = :p0'; + $sql = 'SELECT ID, NAME, SECURED, TEXT_LAYOUT_FILE_NAME, TEXT_TEMPLATE_FILE_NAME, HTML_LAYOUT_FILE_NAME, HTML_TEMPLATE_FILE_NAME, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -367,6 +383,122 @@ abstract class MessageQuery extends ModelCriteria return $this->addUsingAlias(MessageTableMap::SECURED, $secured, $comparison); } + /** + * Filter the query on the text_layout_file_name column + * + * Example usage: + * + * $query->filterByTextLayoutFileName('fooValue'); // WHERE text_layout_file_name = 'fooValue' + * $query->filterByTextLayoutFileName('%fooValue%'); // WHERE text_layout_file_name LIKE '%fooValue%' + * + * + * @param string $textLayoutFileName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildMessageQuery The current query, for fluid interface + */ + public function filterByTextLayoutFileName($textLayoutFileName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($textLayoutFileName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $textLayoutFileName)) { + $textLayoutFileName = str_replace('*', '%', $textLayoutFileName); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(MessageTableMap::TEXT_LAYOUT_FILE_NAME, $textLayoutFileName, $comparison); + } + + /** + * Filter the query on the text_template_file_name column + * + * Example usage: + * + * $query->filterByTextTemplateFileName('fooValue'); // WHERE text_template_file_name = 'fooValue' + * $query->filterByTextTemplateFileName('%fooValue%'); // WHERE text_template_file_name LIKE '%fooValue%' + * + * + * @param string $textTemplateFileName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildMessageQuery The current query, for fluid interface + */ + public function filterByTextTemplateFileName($textTemplateFileName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($textTemplateFileName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $textTemplateFileName)) { + $textTemplateFileName = str_replace('*', '%', $textTemplateFileName); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(MessageTableMap::TEXT_TEMPLATE_FILE_NAME, $textTemplateFileName, $comparison); + } + + /** + * Filter the query on the html_layout_file_name column + * + * Example usage: + * + * $query->filterByHtmlLayoutFileName('fooValue'); // WHERE html_layout_file_name = 'fooValue' + * $query->filterByHtmlLayoutFileName('%fooValue%'); // WHERE html_layout_file_name LIKE '%fooValue%' + * + * + * @param string $htmlLayoutFileName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildMessageQuery The current query, for fluid interface + */ + public function filterByHtmlLayoutFileName($htmlLayoutFileName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($htmlLayoutFileName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $htmlLayoutFileName)) { + $htmlLayoutFileName = str_replace('*', '%', $htmlLayoutFileName); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(MessageTableMap::HTML_LAYOUT_FILE_NAME, $htmlLayoutFileName, $comparison); + } + + /** + * Filter the query on the html_template_file_name column + * + * Example usage: + * + * $query->filterByHtmlTemplateFileName('fooValue'); // WHERE html_template_file_name = 'fooValue' + * $query->filterByHtmlTemplateFileName('%fooValue%'); // WHERE html_template_file_name LIKE '%fooValue%' + * + * + * @param string $htmlTemplateFileName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildMessageQuery The current query, for fluid interface + */ + public function filterByHtmlTemplateFileName($htmlTemplateFileName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($htmlTemplateFileName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $htmlTemplateFileName)) { + $htmlTemplateFileName = str_replace('*', '%', $htmlTemplateFileName); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(MessageTableMap::HTML_TEMPLATE_FILE_NAME, $htmlTemplateFileName, $comparison); + } + /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Base/MessageVersion.php b/core/lib/Thelia/Model/Base/MessageVersion.php index 0c58a5bb2..6fe06658c 100644 --- a/core/lib/Thelia/Model/Base/MessageVersion.php +++ b/core/lib/Thelia/Model/Base/MessageVersion.php @@ -73,6 +73,30 @@ abstract class MessageVersion implements ActiveRecordInterface */ protected $secured; + /** + * The value for the text_layout_file_name field. + * @var string + */ + protected $text_layout_file_name; + + /** + * The value for the text_template_file_name field. + * @var string + */ + protected $text_template_file_name; + + /** + * The value for the html_layout_file_name field. + * @var string + */ + protected $html_layout_file_name; + + /** + * The value for the html_template_file_name field. + * @var string + */ + protected $html_template_file_name; + /** * The value for the created_at field. * @var string @@ -421,6 +445,50 @@ abstract class MessageVersion implements ActiveRecordInterface return $this->secured; } + /** + * Get the [text_layout_file_name] column value. + * + * @return string + */ + public function getTextLayoutFileName() + { + + return $this->text_layout_file_name; + } + + /** + * Get the [text_template_file_name] column value. + * + * @return string + */ + public function getTextTemplateFileName() + { + + return $this->text_template_file_name; + } + + /** + * Get the [html_layout_file_name] column value. + * + * @return string + */ + public function getHtmlLayoutFileName() + { + + return $this->html_layout_file_name; + } + + /** + * Get the [html_template_file_name] column value. + * + * @return string + */ + public function getHtmlTemplateFileName() + { + + return $this->html_template_file_name; + } + /** * Get the [optionally formatted] temporal [created_at] column value. * @@ -570,6 +638,90 @@ abstract class MessageVersion implements ActiveRecordInterface return $this; } // setSecured() + /** + * Set the value of [text_layout_file_name] column. + * + * @param string $v new value + * @return \Thelia\Model\MessageVersion The current object (for fluent API support) + */ + public function setTextLayoutFileName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->text_layout_file_name !== $v) { + $this->text_layout_file_name = $v; + $this->modifiedColumns[] = MessageVersionTableMap::TEXT_LAYOUT_FILE_NAME; + } + + + return $this; + } // setTextLayoutFileName() + + /** + * Set the value of [text_template_file_name] column. + * + * @param string $v new value + * @return \Thelia\Model\MessageVersion The current object (for fluent API support) + */ + public function setTextTemplateFileName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->text_template_file_name !== $v) { + $this->text_template_file_name = $v; + $this->modifiedColumns[] = MessageVersionTableMap::TEXT_TEMPLATE_FILE_NAME; + } + + + return $this; + } // setTextTemplateFileName() + + /** + * Set the value of [html_layout_file_name] column. + * + * @param string $v new value + * @return \Thelia\Model\MessageVersion The current object (for fluent API support) + */ + public function setHtmlLayoutFileName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->html_layout_file_name !== $v) { + $this->html_layout_file_name = $v; + $this->modifiedColumns[] = MessageVersionTableMap::HTML_LAYOUT_FILE_NAME; + } + + + return $this; + } // setHtmlLayoutFileName() + + /** + * Set the value of [html_template_file_name] column. + * + * @param string $v new value + * @return \Thelia\Model\MessageVersion The current object (for fluent API support) + */ + public function setHtmlTemplateFileName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->html_template_file_name !== $v) { + $this->html_template_file_name = $v; + $this->modifiedColumns[] = MessageVersionTableMap::HTML_TEMPLATE_FILE_NAME; + } + + + return $this; + } // setHtmlTemplateFileName() + /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. * @@ -725,28 +877,40 @@ abstract class MessageVersion implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : MessageVersionTableMap::translateFieldName('Secured', TableMap::TYPE_PHPNAME, $indexType)]; $this->secured = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : MessageVersionTableMap::translateFieldName('TextLayoutFileName', TableMap::TYPE_PHPNAME, $indexType)]; + $this->text_layout_file_name = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageVersionTableMap::translateFieldName('TextTemplateFileName', TableMap::TYPE_PHPNAME, $indexType)]; + $this->text_template_file_name = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageVersionTableMap::translateFieldName('HtmlLayoutFileName', TableMap::TYPE_PHPNAME, $indexType)]; + $this->html_layout_file_name = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageVersionTableMap::translateFieldName('HtmlTemplateFileName', TableMap::TYPE_PHPNAME, $indexType)]; + $this->html_template_file_name = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : MessageVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : MessageVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : MessageVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : MessageVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]; $this->version = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : MessageVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)]; $this->version_created_by = (null !== $col) ? (string) $col : null; $this->resetModified(); @@ -756,7 +920,7 @@ abstract class MessageVersion implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 8; // 8 = MessageVersionTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 12; // 12 = MessageVersionTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\MessageVersion object", 0, $e); @@ -986,6 +1150,18 @@ abstract class MessageVersion implements ActiveRecordInterface if ($this->isColumnModified(MessageVersionTableMap::SECURED)) { $modifiedColumns[':p' . $index++] = 'SECURED'; } + if ($this->isColumnModified(MessageVersionTableMap::TEXT_LAYOUT_FILE_NAME)) { + $modifiedColumns[':p' . $index++] = 'TEXT_LAYOUT_FILE_NAME'; + } + if ($this->isColumnModified(MessageVersionTableMap::TEXT_TEMPLATE_FILE_NAME)) { + $modifiedColumns[':p' . $index++] = 'TEXT_TEMPLATE_FILE_NAME'; + } + if ($this->isColumnModified(MessageVersionTableMap::HTML_LAYOUT_FILE_NAME)) { + $modifiedColumns[':p' . $index++] = 'HTML_LAYOUT_FILE_NAME'; + } + if ($this->isColumnModified(MessageVersionTableMap::HTML_TEMPLATE_FILE_NAME)) { + $modifiedColumns[':p' . $index++] = 'HTML_TEMPLATE_FILE_NAME'; + } if ($this->isColumnModified(MessageVersionTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; } @@ -1021,6 +1197,18 @@ abstract class MessageVersion implements ActiveRecordInterface case 'SECURED': $stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT); break; + case 'TEXT_LAYOUT_FILE_NAME': + $stmt->bindValue($identifier, $this->text_layout_file_name, PDO::PARAM_STR); + break; + case 'TEXT_TEMPLATE_FILE_NAME': + $stmt->bindValue($identifier, $this->text_template_file_name, PDO::PARAM_STR); + break; + case 'HTML_LAYOUT_FILE_NAME': + $stmt->bindValue($identifier, $this->html_layout_file_name, PDO::PARAM_STR); + break; + case 'HTML_TEMPLATE_FILE_NAME': + $stmt->bindValue($identifier, $this->html_template_file_name, PDO::PARAM_STR); + break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); break; @@ -1101,18 +1289,30 @@ abstract class MessageVersion implements ActiveRecordInterface return $this->getSecured(); break; case 3: - return $this->getCreatedAt(); + return $this->getTextLayoutFileName(); break; case 4: - return $this->getUpdatedAt(); + return $this->getTextTemplateFileName(); break; case 5: - return $this->getVersion(); + return $this->getHtmlLayoutFileName(); break; case 6: - return $this->getVersionCreatedAt(); + return $this->getHtmlTemplateFileName(); break; case 7: + return $this->getCreatedAt(); + break; + case 8: + return $this->getUpdatedAt(); + break; + case 9: + return $this->getVersion(); + break; + case 10: + return $this->getVersionCreatedAt(); + break; + case 11: return $this->getVersionCreatedBy(); break; default: @@ -1147,11 +1347,15 @@ abstract class MessageVersion implements ActiveRecordInterface $keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getSecured(), - $keys[3] => $this->getCreatedAt(), - $keys[4] => $this->getUpdatedAt(), - $keys[5] => $this->getVersion(), - $keys[6] => $this->getVersionCreatedAt(), - $keys[7] => $this->getVersionCreatedBy(), + $keys[3] => $this->getTextLayoutFileName(), + $keys[4] => $this->getTextTemplateFileName(), + $keys[5] => $this->getHtmlLayoutFileName(), + $keys[6] => $this->getHtmlTemplateFileName(), + $keys[7] => $this->getCreatedAt(), + $keys[8] => $this->getUpdatedAt(), + $keys[9] => $this->getVersion(), + $keys[10] => $this->getVersionCreatedAt(), + $keys[11] => $this->getVersionCreatedBy(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1206,18 +1410,30 @@ abstract class MessageVersion implements ActiveRecordInterface $this->setSecured($value); break; case 3: - $this->setCreatedAt($value); + $this->setTextLayoutFileName($value); break; case 4: - $this->setUpdatedAt($value); + $this->setTextTemplateFileName($value); break; case 5: - $this->setVersion($value); + $this->setHtmlLayoutFileName($value); break; case 6: - $this->setVersionCreatedAt($value); + $this->setHtmlTemplateFileName($value); break; case 7: + $this->setCreatedAt($value); + break; + case 8: + $this->setUpdatedAt($value); + break; + case 9: + $this->setVersion($value); + break; + case 10: + $this->setVersionCreatedAt($value); + break; + case 11: $this->setVersionCreatedBy($value); break; } // switch() @@ -1247,11 +1463,15 @@ abstract class MessageVersion implements ActiveRecordInterface 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[2], $arr)) $this->setSecured($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]]); - if (array_key_exists($keys[5], $arr)) $this->setVersion($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setVersionCreatedAt($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedBy($arr[$keys[7]]); + if (array_key_exists($keys[3], $arr)) $this->setTextLayoutFileName($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setTextTemplateFileName($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setHtmlLayoutFileName($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setHtmlTemplateFileName($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setVersion($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedAt($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setVersionCreatedBy($arr[$keys[11]]); } /** @@ -1266,6 +1486,10 @@ abstract class MessageVersion implements ActiveRecordInterface if ($this->isColumnModified(MessageVersionTableMap::ID)) $criteria->add(MessageVersionTableMap::ID, $this->id); if ($this->isColumnModified(MessageVersionTableMap::NAME)) $criteria->add(MessageVersionTableMap::NAME, $this->name); if ($this->isColumnModified(MessageVersionTableMap::SECURED)) $criteria->add(MessageVersionTableMap::SECURED, $this->secured); + if ($this->isColumnModified(MessageVersionTableMap::TEXT_LAYOUT_FILE_NAME)) $criteria->add(MessageVersionTableMap::TEXT_LAYOUT_FILE_NAME, $this->text_layout_file_name); + if ($this->isColumnModified(MessageVersionTableMap::TEXT_TEMPLATE_FILE_NAME)) $criteria->add(MessageVersionTableMap::TEXT_TEMPLATE_FILE_NAME, $this->text_template_file_name); + if ($this->isColumnModified(MessageVersionTableMap::HTML_LAYOUT_FILE_NAME)) $criteria->add(MessageVersionTableMap::HTML_LAYOUT_FILE_NAME, $this->html_layout_file_name); + if ($this->isColumnModified(MessageVersionTableMap::HTML_TEMPLATE_FILE_NAME)) $criteria->add(MessageVersionTableMap::HTML_TEMPLATE_FILE_NAME, $this->html_template_file_name); if ($this->isColumnModified(MessageVersionTableMap::CREATED_AT)) $criteria->add(MessageVersionTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(MessageVersionTableMap::UPDATED_AT)) $criteria->add(MessageVersionTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(MessageVersionTableMap::VERSION)) $criteria->add(MessageVersionTableMap::VERSION, $this->version); @@ -1344,6 +1568,10 @@ abstract class MessageVersion implements ActiveRecordInterface $copyObj->setId($this->getId()); $copyObj->setName($this->getName()); $copyObj->setSecured($this->getSecured()); + $copyObj->setTextLayoutFileName($this->getTextLayoutFileName()); + $copyObj->setTextTemplateFileName($this->getTextTemplateFileName()); + $copyObj->setHtmlLayoutFileName($this->getHtmlLayoutFileName()); + $copyObj->setHtmlTemplateFileName($this->getHtmlTemplateFileName()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setVersion($this->getVersion()); @@ -1435,6 +1663,10 @@ abstract class MessageVersion implements ActiveRecordInterface $this->id = null; $this->name = null; $this->secured = null; + $this->text_layout_file_name = null; + $this->text_template_file_name = null; + $this->html_layout_file_name = null; + $this->html_template_file_name = null; $this->created_at = null; $this->updated_at = null; $this->version = null; diff --git a/core/lib/Thelia/Model/Base/MessageVersionQuery.php b/core/lib/Thelia/Model/Base/MessageVersionQuery.php index 088234eb5..638ed5e5c 100644 --- a/core/lib/Thelia/Model/Base/MessageVersionQuery.php +++ b/core/lib/Thelia/Model/Base/MessageVersionQuery.php @@ -24,6 +24,10 @@ use Thelia\Model\Map\MessageVersionTableMap; * @method ChildMessageVersionQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildMessageVersionQuery orderByName($order = Criteria::ASC) Order by the name column * @method ChildMessageVersionQuery orderBySecured($order = Criteria::ASC) Order by the secured column + * @method ChildMessageVersionQuery orderByTextLayoutFileName($order = Criteria::ASC) Order by the text_layout_file_name column + * @method ChildMessageVersionQuery orderByTextTemplateFileName($order = Criteria::ASC) Order by the text_template_file_name column + * @method ChildMessageVersionQuery orderByHtmlLayoutFileName($order = Criteria::ASC) Order by the html_layout_file_name column + * @method ChildMessageVersionQuery orderByHtmlTemplateFileName($order = Criteria::ASC) Order by the html_template_file_name column * @method ChildMessageVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildMessageVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildMessageVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column @@ -33,6 +37,10 @@ use Thelia\Model\Map\MessageVersionTableMap; * @method ChildMessageVersionQuery groupById() Group by the id column * @method ChildMessageVersionQuery groupByName() Group by the name column * @method ChildMessageVersionQuery groupBySecured() Group by the secured column + * @method ChildMessageVersionQuery groupByTextLayoutFileName() Group by the text_layout_file_name column + * @method ChildMessageVersionQuery groupByTextTemplateFileName() Group by the text_template_file_name column + * @method ChildMessageVersionQuery groupByHtmlLayoutFileName() Group by the html_layout_file_name column + * @method ChildMessageVersionQuery groupByHtmlTemplateFileName() Group by the html_template_file_name column * @method ChildMessageVersionQuery groupByCreatedAt() Group by the created_at column * @method ChildMessageVersionQuery groupByUpdatedAt() Group by the updated_at column * @method ChildMessageVersionQuery groupByVersion() Group by the version column @@ -53,6 +61,10 @@ use Thelia\Model\Map\MessageVersionTableMap; * @method ChildMessageVersion findOneById(int $id) Return the first ChildMessageVersion filtered by the id column * @method ChildMessageVersion findOneByName(string $name) Return the first ChildMessageVersion filtered by the name column * @method ChildMessageVersion findOneBySecured(int $secured) Return the first ChildMessageVersion filtered by the secured column + * @method ChildMessageVersion findOneByTextLayoutFileName(string $text_layout_file_name) Return the first ChildMessageVersion filtered by the text_layout_file_name column + * @method ChildMessageVersion findOneByTextTemplateFileName(string $text_template_file_name) Return the first ChildMessageVersion filtered by the text_template_file_name column + * @method ChildMessageVersion findOneByHtmlLayoutFileName(string $html_layout_file_name) Return the first ChildMessageVersion filtered by the html_layout_file_name column + * @method ChildMessageVersion findOneByHtmlTemplateFileName(string $html_template_file_name) Return the first ChildMessageVersion filtered by the html_template_file_name column * @method ChildMessageVersion findOneByCreatedAt(string $created_at) Return the first ChildMessageVersion filtered by the created_at column * @method ChildMessageVersion findOneByUpdatedAt(string $updated_at) Return the first ChildMessageVersion filtered by the updated_at column * @method ChildMessageVersion findOneByVersion(int $version) Return the first ChildMessageVersion filtered by the version column @@ -62,6 +74,10 @@ use Thelia\Model\Map\MessageVersionTableMap; * @method array findById(int $id) Return ChildMessageVersion objects filtered by the id column * @method array findByName(string $name) Return ChildMessageVersion objects filtered by the name column * @method array findBySecured(int $secured) Return ChildMessageVersion objects filtered by the secured column + * @method array findByTextLayoutFileName(string $text_layout_file_name) Return ChildMessageVersion objects filtered by the text_layout_file_name column + * @method array findByTextTemplateFileName(string $text_template_file_name) Return ChildMessageVersion objects filtered by the text_template_file_name column + * @method array findByHtmlLayoutFileName(string $html_layout_file_name) Return ChildMessageVersion objects filtered by the html_layout_file_name column + * @method array findByHtmlTemplateFileName(string $html_template_file_name) Return ChildMessageVersion objects filtered by the html_template_file_name column * @method array findByCreatedAt(string $created_at) Return ChildMessageVersion objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildMessageVersion objects filtered by the updated_at column * @method array findByVersion(int $version) Return ChildMessageVersion objects filtered by the version column @@ -155,7 +171,7 @@ abstract class MessageVersionQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, NAME, SECURED, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message_version WHERE ID = :p0 AND VERSION = :p1'; + $sql = 'SELECT ID, NAME, SECURED, TEXT_LAYOUT_FILE_NAME, TEXT_TEMPLATE_FILE_NAME, HTML_LAYOUT_FILE_NAME, HTML_TEMPLATE_FILE_NAME, CREATED_AT, UPDATED_AT, VERSION, VERSION_CREATED_AT, VERSION_CREATED_BY FROM message_version WHERE ID = :p0 AND VERSION = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -369,6 +385,122 @@ abstract class MessageVersionQuery extends ModelCriteria return $this->addUsingAlias(MessageVersionTableMap::SECURED, $secured, $comparison); } + /** + * Filter the query on the text_layout_file_name column + * + * Example usage: + * + * $query->filterByTextLayoutFileName('fooValue'); // WHERE text_layout_file_name = 'fooValue' + * $query->filterByTextLayoutFileName('%fooValue%'); // WHERE text_layout_file_name LIKE '%fooValue%' + * + * + * @param string $textLayoutFileName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildMessageVersionQuery The current query, for fluid interface + */ + public function filterByTextLayoutFileName($textLayoutFileName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($textLayoutFileName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $textLayoutFileName)) { + $textLayoutFileName = str_replace('*', '%', $textLayoutFileName); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(MessageVersionTableMap::TEXT_LAYOUT_FILE_NAME, $textLayoutFileName, $comparison); + } + + /** + * Filter the query on the text_template_file_name column + * + * Example usage: + * + * $query->filterByTextTemplateFileName('fooValue'); // WHERE text_template_file_name = 'fooValue' + * $query->filterByTextTemplateFileName('%fooValue%'); // WHERE text_template_file_name LIKE '%fooValue%' + * + * + * @param string $textTemplateFileName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildMessageVersionQuery The current query, for fluid interface + */ + public function filterByTextTemplateFileName($textTemplateFileName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($textTemplateFileName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $textTemplateFileName)) { + $textTemplateFileName = str_replace('*', '%', $textTemplateFileName); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(MessageVersionTableMap::TEXT_TEMPLATE_FILE_NAME, $textTemplateFileName, $comparison); + } + + /** + * Filter the query on the html_layout_file_name column + * + * Example usage: + * + * $query->filterByHtmlLayoutFileName('fooValue'); // WHERE html_layout_file_name = 'fooValue' + * $query->filterByHtmlLayoutFileName('%fooValue%'); // WHERE html_layout_file_name LIKE '%fooValue%' + * + * + * @param string $htmlLayoutFileName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildMessageVersionQuery The current query, for fluid interface + */ + public function filterByHtmlLayoutFileName($htmlLayoutFileName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($htmlLayoutFileName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $htmlLayoutFileName)) { + $htmlLayoutFileName = str_replace('*', '%', $htmlLayoutFileName); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(MessageVersionTableMap::HTML_LAYOUT_FILE_NAME, $htmlLayoutFileName, $comparison); + } + + /** + * Filter the query on the html_template_file_name column + * + * Example usage: + * + * $query->filterByHtmlTemplateFileName('fooValue'); // WHERE html_template_file_name = 'fooValue' + * $query->filterByHtmlTemplateFileName('%fooValue%'); // WHERE html_template_file_name LIKE '%fooValue%' + * + * + * @param string $htmlTemplateFileName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildMessageVersionQuery The current query, for fluid interface + */ + public function filterByHtmlTemplateFileName($htmlTemplateFileName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($htmlTemplateFileName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $htmlTemplateFileName)) { + $htmlTemplateFileName = str_replace('*', '%', $htmlTemplateFileName); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(MessageVersionTableMap::HTML_TEMPLATE_FILE_NAME, $htmlTemplateFileName, $comparison); + } + /** * Filter the query on the created_at column * diff --git a/core/lib/Thelia/Model/Base/Product.php b/core/lib/Thelia/Model/Base/Product.php index 77824575c..e850d2acf 100644 --- a/core/lib/Thelia/Model/Base/Product.php +++ b/core/lib/Thelia/Model/Base/Product.php @@ -5866,6 +5866,78 @@ abstract class Product implements ActiveRecordInterface return $this; } + + /** + * Get the [meta_title] column value. + * + * @return string + */ + public function getMetaTitle() + { + return $this->getCurrentTranslation()->getMetaTitle(); + } + + + /** + * Set the value of [meta_title] column. + * + * @param string $v new value + * @return \Thelia\Model\ProductI18n The current object (for fluent API support) + */ + public function setMetaTitle($v) + { $this->getCurrentTranslation()->setMetaTitle($v); + + return $this; + } + + + /** + * Get the [meta_description] column value. + * + * @return string + */ + public function getMetaDescription() + { + return $this->getCurrentTranslation()->getMetaDescription(); + } + + + /** + * Set the value of [meta_description] column. + * + * @param string $v new value + * @return \Thelia\Model\ProductI18n The current object (for fluent API support) + */ + public function setMetaDescription($v) + { $this->getCurrentTranslation()->setMetaDescription($v); + + return $this; + } + + + /** + * Get the [meta_keyword] column value. + * + * @return string + */ + public function getMetaKeyword() + { + return $this->getCurrentTranslation()->getMetaKeyword(); + } + + + /** + * Set the value of [meta_keyword] column. + * + * @param string $v new value + * @return \Thelia\Model\ProductI18n The current object (for fluent API support) + */ + public function setMetaKeyword($v) + { $this->getCurrentTranslation()->setMetaKeyword($v); + + return $this; + } + // versionable behavior /** diff --git a/core/lib/Thelia/Model/Base/ProductI18n.php b/core/lib/Thelia/Model/Base/ProductI18n.php index cdab7349d..a72f07c83 100644 --- a/core/lib/Thelia/Model/Base/ProductI18n.php +++ b/core/lib/Thelia/Model/Base/ProductI18n.php @@ -90,6 +90,24 @@ abstract class ProductI18n implements ActiveRecordInterface */ protected $postscriptum; + /** + * The value for the meta_title field. + * @var string + */ + protected $meta_title; + + /** + * The value for the meta_description field. + * @var string + */ + protected $meta_description; + + /** + * The value for the meta_keyword field. + * @var string + */ + protected $meta_keyword; + /** * @var Product */ @@ -440,6 +458,39 @@ abstract class ProductI18n implements ActiveRecordInterface return $this->postscriptum; } + /** + * Get the [meta_title] column value. + * + * @return string + */ + public function getMetaTitle() + { + + return $this->meta_title; + } + + /** + * Get the [meta_description] column value. + * + * @return string + */ + public function getMetaDescription() + { + + return $this->meta_description; + } + + /** + * Get the [meta_keyword] column value. + * + * @return string + */ + public function getMetaKeyword() + { + + return $this->meta_keyword; + } + /** * Set the value of [id] column. * @@ -570,6 +621,69 @@ abstract class ProductI18n implements ActiveRecordInterface return $this; } // setPostscriptum() + /** + * Set the value of [meta_title] column. + * + * @param string $v new value + * @return \Thelia\Model\ProductI18n The current object (for fluent API support) + */ + public function setMetaTitle($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->meta_title !== $v) { + $this->meta_title = $v; + $this->modifiedColumns[] = ProductI18nTableMap::META_TITLE; + } + + + return $this; + } // setMetaTitle() + + /** + * Set the value of [meta_description] column. + * + * @param string $v new value + * @return \Thelia\Model\ProductI18n The current object (for fluent API support) + */ + public function setMetaDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->meta_description !== $v) { + $this->meta_description = $v; + $this->modifiedColumns[] = ProductI18nTableMap::META_DESCRIPTION; + } + + + return $this; + } // setMetaDescription() + + /** + * Set the value of [meta_keyword] column. + * + * @param string $v new value + * @return \Thelia\Model\ProductI18n The current object (for fluent API support) + */ + public function setMetaKeyword($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->meta_keyword !== $v) { + $this->meta_keyword = $v; + $this->modifiedColumns[] = ProductI18nTableMap::META_KEYWORD; + } + + + return $this; + } // setMetaKeyword() + /** * Indicates whether the columns in this object are only set to default values. * @@ -628,6 +742,15 @@ abstract class ProductI18n implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)]; $this->postscriptum = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductI18nTableMap::translateFieldName('MetaTitle', TableMap::TYPE_PHPNAME, $indexType)]; + $this->meta_title = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductI18nTableMap::translateFieldName('MetaDescription', TableMap::TYPE_PHPNAME, $indexType)]; + $this->meta_description = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductI18nTableMap::translateFieldName('MetaKeyword', TableMap::TYPE_PHPNAME, $indexType)]; + $this->meta_keyword = (null !== $col) ? (string) $col : null; $this->resetModified(); $this->setNew(false); @@ -636,7 +759,7 @@ abstract class ProductI18n implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 6; // 6 = ProductI18nTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 9; // 9 = ProductI18nTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Thelia\Model\ProductI18n object", 0, $e); @@ -875,6 +998,15 @@ abstract class ProductI18n implements ActiveRecordInterface if ($this->isColumnModified(ProductI18nTableMap::POSTSCRIPTUM)) { $modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM'; } + if ($this->isColumnModified(ProductI18nTableMap::META_TITLE)) { + $modifiedColumns[':p' . $index++] = 'META_TITLE'; + } + if ($this->isColumnModified(ProductI18nTableMap::META_DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = 'META_DESCRIPTION'; + } + if ($this->isColumnModified(ProductI18nTableMap::META_KEYWORD)) { + $modifiedColumns[':p' . $index++] = 'META_KEYWORD'; + } $sql = sprintf( 'INSERT INTO product_i18n (%s) VALUES (%s)', @@ -904,6 +1036,15 @@ abstract class ProductI18n implements ActiveRecordInterface case 'POSTSCRIPTUM': $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR); break; + case 'META_TITLE': + $stmt->bindValue($identifier, $this->meta_title, PDO::PARAM_STR); + break; + case 'META_DESCRIPTION': + $stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR); + break; + case 'META_KEYWORD': + $stmt->bindValue($identifier, $this->meta_keyword, PDO::PARAM_STR); + break; } } $stmt->execute(); @@ -977,6 +1118,15 @@ abstract class ProductI18n implements ActiveRecordInterface case 5: return $this->getPostscriptum(); break; + case 6: + return $this->getMetaTitle(); + break; + case 7: + return $this->getMetaDescription(); + break; + case 8: + return $this->getMetaKeyword(); + break; default: return null; break; @@ -1012,6 +1162,9 @@ abstract class ProductI18n implements ActiveRecordInterface $keys[3] => $this->getDescription(), $keys[4] => $this->getChapo(), $keys[5] => $this->getPostscriptum(), + $keys[6] => $this->getMetaTitle(), + $keys[7] => $this->getMetaDescription(), + $keys[8] => $this->getMetaKeyword(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1074,6 +1227,15 @@ abstract class ProductI18n implements ActiveRecordInterface case 5: $this->setPostscriptum($value); break; + case 6: + $this->setMetaTitle($value); + break; + case 7: + $this->setMetaDescription($value); + break; + case 8: + $this->setMetaKeyword($value); + break; } // switch() } @@ -1104,6 +1266,9 @@ abstract class ProductI18n implements ActiveRecordInterface if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setMetaTitle($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setMetaDescription($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setMetaKeyword($arr[$keys[8]]); } /** @@ -1121,6 +1286,9 @@ abstract class ProductI18n implements ActiveRecordInterface if ($this->isColumnModified(ProductI18nTableMap::DESCRIPTION)) $criteria->add(ProductI18nTableMap::DESCRIPTION, $this->description); if ($this->isColumnModified(ProductI18nTableMap::CHAPO)) $criteria->add(ProductI18nTableMap::CHAPO, $this->chapo); if ($this->isColumnModified(ProductI18nTableMap::POSTSCRIPTUM)) $criteria->add(ProductI18nTableMap::POSTSCRIPTUM, $this->postscriptum); + if ($this->isColumnModified(ProductI18nTableMap::META_TITLE)) $criteria->add(ProductI18nTableMap::META_TITLE, $this->meta_title); + if ($this->isColumnModified(ProductI18nTableMap::META_DESCRIPTION)) $criteria->add(ProductI18nTableMap::META_DESCRIPTION, $this->meta_description); + if ($this->isColumnModified(ProductI18nTableMap::META_KEYWORD)) $criteria->add(ProductI18nTableMap::META_KEYWORD, $this->meta_keyword); return $criteria; } @@ -1197,6 +1365,9 @@ abstract class ProductI18n implements ActiveRecordInterface $copyObj->setDescription($this->getDescription()); $copyObj->setChapo($this->getChapo()); $copyObj->setPostscriptum($this->getPostscriptum()); + $copyObj->setMetaTitle($this->getMetaTitle()); + $copyObj->setMetaDescription($this->getMetaDescription()); + $copyObj->setMetaKeyword($this->getMetaKeyword()); if ($makeNew) { $copyObj->setNew(true); } @@ -1286,6 +1457,9 @@ abstract class ProductI18n implements ActiveRecordInterface $this->description = null; $this->chapo = null; $this->postscriptum = null; + $this->meta_title = null; + $this->meta_description = null; + $this->meta_keyword = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->applyDefaultValues(); diff --git a/core/lib/Thelia/Model/Base/ProductI18nQuery.php b/core/lib/Thelia/Model/Base/ProductI18nQuery.php index d64c95892..01d3af9d4 100644 --- a/core/lib/Thelia/Model/Base/ProductI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ProductI18nQuery.php @@ -27,6 +27,9 @@ use Thelia\Model\Map\ProductI18nTableMap; * @method ChildProductI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column * @method ChildProductI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column * @method ChildProductI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column + * @method ChildProductI18nQuery orderByMetaTitle($order = Criteria::ASC) Order by the meta_title column + * @method ChildProductI18nQuery orderByMetaDescription($order = Criteria::ASC) Order by the meta_description column + * @method ChildProductI18nQuery orderByMetaKeyword($order = Criteria::ASC) Order by the meta_keyword column * * @method ChildProductI18nQuery groupById() Group by the id column * @method ChildProductI18nQuery groupByLocale() Group by the locale column @@ -34,6 +37,9 @@ use Thelia\Model\Map\ProductI18nTableMap; * @method ChildProductI18nQuery groupByDescription() Group by the description column * @method ChildProductI18nQuery groupByChapo() Group by the chapo column * @method ChildProductI18nQuery groupByPostscriptum() Group by the postscriptum column + * @method ChildProductI18nQuery groupByMetaTitle() Group by the meta_title column + * @method ChildProductI18nQuery groupByMetaDescription() Group by the meta_description column + * @method ChildProductI18nQuery groupByMetaKeyword() Group by the meta_keyword column * * @method ChildProductI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildProductI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -52,6 +58,9 @@ use Thelia\Model\Map\ProductI18nTableMap; * @method ChildProductI18n findOneByDescription(string $description) Return the first ChildProductI18n filtered by the description column * @method ChildProductI18n findOneByChapo(string $chapo) Return the first ChildProductI18n filtered by the chapo column * @method ChildProductI18n findOneByPostscriptum(string $postscriptum) Return the first ChildProductI18n filtered by the postscriptum column + * @method ChildProductI18n findOneByMetaTitle(string $meta_title) Return the first ChildProductI18n filtered by the meta_title column + * @method ChildProductI18n findOneByMetaDescription(string $meta_description) Return the first ChildProductI18n filtered by the meta_description column + * @method ChildProductI18n findOneByMetaKeyword(string $meta_keyword) Return the first ChildProductI18n filtered by the meta_keyword column * * @method array findById(int $id) Return ChildProductI18n objects filtered by the id column * @method array findByLocale(string $locale) Return ChildProductI18n objects filtered by the locale column @@ -59,6 +68,9 @@ use Thelia\Model\Map\ProductI18nTableMap; * @method array findByDescription(string $description) Return ChildProductI18n objects filtered by the description column * @method array findByChapo(string $chapo) Return ChildProductI18n objects filtered by the chapo column * @method array findByPostscriptum(string $postscriptum) Return ChildProductI18n objects filtered by the postscriptum column + * @method array findByMetaTitle(string $meta_title) Return ChildProductI18n objects filtered by the meta_title column + * @method array findByMetaDescription(string $meta_description) Return ChildProductI18n objects filtered by the meta_description column + * @method array findByMetaKeyword(string $meta_keyword) Return ChildProductI18n objects filtered by the meta_keyword column * */ abstract class ProductI18nQuery extends ModelCriteria @@ -147,7 +159,7 @@ abstract class ProductI18nQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM product_i18n WHERE ID = :p0 AND LOCALE = :p1'; + $sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORD FROM product_i18n WHERE ID = :p0 AND LOCALE = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -436,6 +448,93 @@ abstract class ProductI18nQuery extends ModelCriteria return $this->addUsingAlias(ProductI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison); } + /** + * Filter the query on the meta_title column + * + * Example usage: + * + * $query->filterByMetaTitle('fooValue'); // WHERE meta_title = 'fooValue' + * $query->filterByMetaTitle('%fooValue%'); // WHERE meta_title LIKE '%fooValue%' + * + * + * @param string $metaTitle 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 ChildProductI18nQuery The current query, for fluid interface + */ + public function filterByMetaTitle($metaTitle = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($metaTitle)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $metaTitle)) { + $metaTitle = str_replace('*', '%', $metaTitle); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(ProductI18nTableMap::META_TITLE, $metaTitle, $comparison); + } + + /** + * Filter the query on the meta_description column + * + * Example usage: + * + * $query->filterByMetaDescription('fooValue'); // WHERE meta_description = 'fooValue' + * $query->filterByMetaDescription('%fooValue%'); // WHERE meta_description LIKE '%fooValue%' + * + * + * @param string $metaDescription 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 ChildProductI18nQuery The current query, for fluid interface + */ + public function filterByMetaDescription($metaDescription = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($metaDescription)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $metaDescription)) { + $metaDescription = str_replace('*', '%', $metaDescription); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(ProductI18nTableMap::META_DESCRIPTION, $metaDescription, $comparison); + } + + /** + * Filter the query on the meta_keyword column + * + * Example usage: + * + * $query->filterByMetaKeyword('fooValue'); // WHERE meta_keyword = 'fooValue' + * $query->filterByMetaKeyword('%fooValue%'); // WHERE meta_keyword LIKE '%fooValue%' + * + * + * @param string $metaKeyword 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 ChildProductI18nQuery The current query, for fluid interface + */ + public function filterByMetaKeyword($metaKeyword = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($metaKeyword)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $metaKeyword)) { + $metaKeyword = str_replace('*', '%', $metaKeyword); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(ProductI18nTableMap::META_KEYWORD, $metaKeyword, $comparison); + } + /** * Filter the query by a related \Thelia\Model\Product object * diff --git a/core/lib/Thelia/Model/Map/MessageTableMap.php b/core/lib/Thelia/Model/Map/MessageTableMap.php index d56b1210c..a81f022a0 100644 --- a/core/lib/Thelia/Model/Map/MessageTableMap.php +++ b/core/lib/Thelia/Model/Map/MessageTableMap.php @@ -57,7 +57,7 @@ class MessageTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 8; + const NUM_COLUMNS = 12; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class MessageTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 8; + const NUM_HYDRATE_COLUMNS = 12; /** * the column name for the ID field @@ -84,6 +84,26 @@ class MessageTableMap extends TableMap */ const SECURED = 'message.SECURED'; + /** + * the column name for the TEXT_LAYOUT_FILE_NAME field + */ + const TEXT_LAYOUT_FILE_NAME = 'message.TEXT_LAYOUT_FILE_NAME'; + + /** + * the column name for the TEXT_TEMPLATE_FILE_NAME field + */ + const TEXT_TEMPLATE_FILE_NAME = 'message.TEXT_TEMPLATE_FILE_NAME'; + + /** + * the column name for the HTML_LAYOUT_FILE_NAME field + */ + const HTML_LAYOUT_FILE_NAME = 'message.HTML_LAYOUT_FILE_NAME'; + + /** + * the column name for the HTML_TEMPLATE_FILE_NAME field + */ + const HTML_TEMPLATE_FILE_NAME = 'message.HTML_TEMPLATE_FILE_NAME'; + /** * the column name for the CREATED_AT field */ @@ -130,12 +150,12 @@ class MessageTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Name', 'Secured', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), - self::TYPE_STUDLYPHPNAME => array('id', 'name', 'secured', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), - self::TYPE_COLNAME => array(MessageTableMap::ID, MessageTableMap::NAME, MessageTableMap::SECURED, MessageTableMap::CREATED_AT, MessageTableMap::UPDATED_AT, MessageTableMap::VERSION, MessageTableMap::VERSION_CREATED_AT, MessageTableMap::VERSION_CREATED_BY, ), - self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'SECURED', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), - self::TYPE_FIELDNAME => array('id', 'name', 'secured', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) + self::TYPE_PHPNAME => array('Id', 'Name', 'Secured', 'TextLayoutFileName', 'TextTemplateFileName', 'HtmlLayoutFileName', 'HtmlTemplateFileName', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), + self::TYPE_STUDLYPHPNAME => array('id', 'name', 'secured', 'textLayoutFileName', 'textTemplateFileName', 'htmlLayoutFileName', 'htmlTemplateFileName', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), + self::TYPE_COLNAME => array(MessageTableMap::ID, MessageTableMap::NAME, MessageTableMap::SECURED, MessageTableMap::TEXT_LAYOUT_FILE_NAME, MessageTableMap::TEXT_TEMPLATE_FILE_NAME, MessageTableMap::HTML_LAYOUT_FILE_NAME, MessageTableMap::HTML_TEMPLATE_FILE_NAME, MessageTableMap::CREATED_AT, MessageTableMap::UPDATED_AT, MessageTableMap::VERSION, MessageTableMap::VERSION_CREATED_AT, MessageTableMap::VERSION_CREATED_BY, ), + self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'SECURED', 'TEXT_LAYOUT_FILE_NAME', 'TEXT_TEMPLATE_FILE_NAME', 'HTML_LAYOUT_FILE_NAME', 'HTML_TEMPLATE_FILE_NAME', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), + self::TYPE_FIELDNAME => array('id', 'name', 'secured', 'text_layout_file_name', 'text_template_file_name', 'html_layout_file_name', 'html_template_file_name', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); /** @@ -145,12 +165,12 @@ class MessageTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Secured' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, 'Version' => 5, 'VersionCreatedAt' => 6, 'VersionCreatedBy' => 7, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'createdAt' => 3, 'updatedAt' => 4, 'version' => 5, 'versionCreatedAt' => 6, 'versionCreatedBy' => 7, ), - self::TYPE_COLNAME => array(MessageTableMap::ID => 0, MessageTableMap::NAME => 1, MessageTableMap::SECURED => 2, MessageTableMap::CREATED_AT => 3, MessageTableMap::UPDATED_AT => 4, MessageTableMap::VERSION => 5, MessageTableMap::VERSION_CREATED_AT => 6, MessageTableMap::VERSION_CREATED_BY => 7, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'SECURED' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, 'VERSION' => 5, 'VERSION_CREATED_AT' => 6, 'VERSION_CREATED_BY' => 7, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'created_at' => 3, 'updated_at' => 4, 'version' => 5, 'version_created_at' => 6, 'version_created_by' => 7, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Secured' => 2, 'TextLayoutFileName' => 3, 'TextTemplateFileName' => 4, 'HtmlLayoutFileName' => 5, 'HtmlTemplateFileName' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, 'Version' => 9, 'VersionCreatedAt' => 10, 'VersionCreatedBy' => 11, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'textLayoutFileName' => 3, 'textTemplateFileName' => 4, 'htmlLayoutFileName' => 5, 'htmlTemplateFileName' => 6, 'createdAt' => 7, 'updatedAt' => 8, 'version' => 9, 'versionCreatedAt' => 10, 'versionCreatedBy' => 11, ), + self::TYPE_COLNAME => array(MessageTableMap::ID => 0, MessageTableMap::NAME => 1, MessageTableMap::SECURED => 2, MessageTableMap::TEXT_LAYOUT_FILE_NAME => 3, MessageTableMap::TEXT_TEMPLATE_FILE_NAME => 4, MessageTableMap::HTML_LAYOUT_FILE_NAME => 5, MessageTableMap::HTML_TEMPLATE_FILE_NAME => 6, MessageTableMap::CREATED_AT => 7, MessageTableMap::UPDATED_AT => 8, MessageTableMap::VERSION => 9, MessageTableMap::VERSION_CREATED_AT => 10, MessageTableMap::VERSION_CREATED_BY => 11, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'SECURED' => 2, 'TEXT_LAYOUT_FILE_NAME' => 3, 'TEXT_TEMPLATE_FILE_NAME' => 4, 'HTML_LAYOUT_FILE_NAME' => 5, 'HTML_TEMPLATE_FILE_NAME' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, 'VERSION' => 9, 'VERSION_CREATED_AT' => 10, 'VERSION_CREATED_BY' => 11, ), + self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'text_layout_file_name' => 3, 'text_template_file_name' => 4, 'html_layout_file_name' => 5, 'html_template_file_name' => 6, 'created_at' => 7, 'updated_at' => 8, 'version' => 9, 'version_created_at' => 10, 'version_created_by' => 11, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); /** @@ -172,6 +192,10 @@ class MessageTableMap extends TableMap $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addColumn('NAME', 'Name', 'VARCHAR', true, 255, null); $this->addColumn('SECURED', 'Secured', 'TINYINT', false, null, null); + $this->addColumn('TEXT_LAYOUT_FILE_NAME', 'TextLayoutFileName', 'VARCHAR', false, 255, null); + $this->addColumn('TEXT_TEMPLATE_FILE_NAME', 'TextTemplateFileName', 'VARCHAR', false, 255, null); + $this->addColumn('HTML_LAYOUT_FILE_NAME', 'HtmlLayoutFileName', 'VARCHAR', false, 255, null); + $this->addColumn('HTML_TEMPLATE_FILE_NAME', 'HtmlTemplateFileName', 'VARCHAR', false, 255, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0); @@ -354,6 +378,10 @@ class MessageTableMap extends TableMap $criteria->addSelectColumn(MessageTableMap::ID); $criteria->addSelectColumn(MessageTableMap::NAME); $criteria->addSelectColumn(MessageTableMap::SECURED); + $criteria->addSelectColumn(MessageTableMap::TEXT_LAYOUT_FILE_NAME); + $criteria->addSelectColumn(MessageTableMap::TEXT_TEMPLATE_FILE_NAME); + $criteria->addSelectColumn(MessageTableMap::HTML_LAYOUT_FILE_NAME); + $criteria->addSelectColumn(MessageTableMap::HTML_TEMPLATE_FILE_NAME); $criteria->addSelectColumn(MessageTableMap::CREATED_AT); $criteria->addSelectColumn(MessageTableMap::UPDATED_AT); $criteria->addSelectColumn(MessageTableMap::VERSION); @@ -363,6 +391,10 @@ class MessageTableMap extends TableMap $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.NAME'); $criteria->addSelectColumn($alias . '.SECURED'); + $criteria->addSelectColumn($alias . '.TEXT_LAYOUT_FILE_NAME'); + $criteria->addSelectColumn($alias . '.TEXT_TEMPLATE_FILE_NAME'); + $criteria->addSelectColumn($alias . '.HTML_LAYOUT_FILE_NAME'); + $criteria->addSelectColumn($alias . '.HTML_TEMPLATE_FILE_NAME'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.VERSION'); diff --git a/core/lib/Thelia/Model/Map/MessageVersionTableMap.php b/core/lib/Thelia/Model/Map/MessageVersionTableMap.php index db043cdc5..c4b72d126 100644 --- a/core/lib/Thelia/Model/Map/MessageVersionTableMap.php +++ b/core/lib/Thelia/Model/Map/MessageVersionTableMap.php @@ -57,7 +57,7 @@ class MessageVersionTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 8; + const NUM_COLUMNS = 12; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class MessageVersionTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 8; + const NUM_HYDRATE_COLUMNS = 12; /** * the column name for the ID field @@ -84,6 +84,26 @@ class MessageVersionTableMap extends TableMap */ const SECURED = 'message_version.SECURED'; + /** + * the column name for the TEXT_LAYOUT_FILE_NAME field + */ + const TEXT_LAYOUT_FILE_NAME = 'message_version.TEXT_LAYOUT_FILE_NAME'; + + /** + * the column name for the TEXT_TEMPLATE_FILE_NAME field + */ + const TEXT_TEMPLATE_FILE_NAME = 'message_version.TEXT_TEMPLATE_FILE_NAME'; + + /** + * the column name for the HTML_LAYOUT_FILE_NAME field + */ + const HTML_LAYOUT_FILE_NAME = 'message_version.HTML_LAYOUT_FILE_NAME'; + + /** + * the column name for the HTML_TEMPLATE_FILE_NAME field + */ + const HTML_TEMPLATE_FILE_NAME = 'message_version.HTML_TEMPLATE_FILE_NAME'; + /** * the column name for the CREATED_AT field */ @@ -121,12 +141,12 @@ class MessageVersionTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Name', 'Secured', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), - self::TYPE_STUDLYPHPNAME => array('id', 'name', 'secured', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), - self::TYPE_COLNAME => array(MessageVersionTableMap::ID, MessageVersionTableMap::NAME, MessageVersionTableMap::SECURED, MessageVersionTableMap::CREATED_AT, MessageVersionTableMap::UPDATED_AT, MessageVersionTableMap::VERSION, MessageVersionTableMap::VERSION_CREATED_AT, MessageVersionTableMap::VERSION_CREATED_BY, ), - self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'SECURED', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), - self::TYPE_FIELDNAME => array('id', 'name', 'secured', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) + self::TYPE_PHPNAME => array('Id', 'Name', 'Secured', 'TextLayoutFileName', 'TextTemplateFileName', 'HtmlLayoutFileName', 'HtmlTemplateFileName', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ), + self::TYPE_STUDLYPHPNAME => array('id', 'name', 'secured', 'textLayoutFileName', 'textTemplateFileName', 'htmlLayoutFileName', 'htmlTemplateFileName', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ), + self::TYPE_COLNAME => array(MessageVersionTableMap::ID, MessageVersionTableMap::NAME, MessageVersionTableMap::SECURED, MessageVersionTableMap::TEXT_LAYOUT_FILE_NAME, MessageVersionTableMap::TEXT_TEMPLATE_FILE_NAME, MessageVersionTableMap::HTML_LAYOUT_FILE_NAME, MessageVersionTableMap::HTML_TEMPLATE_FILE_NAME, MessageVersionTableMap::CREATED_AT, MessageVersionTableMap::UPDATED_AT, MessageVersionTableMap::VERSION, MessageVersionTableMap::VERSION_CREATED_AT, MessageVersionTableMap::VERSION_CREATED_BY, ), + self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'SECURED', 'TEXT_LAYOUT_FILE_NAME', 'TEXT_TEMPLATE_FILE_NAME', 'HTML_LAYOUT_FILE_NAME', 'HTML_TEMPLATE_FILE_NAME', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ), + self::TYPE_FIELDNAME => array('id', 'name', 'secured', 'text_layout_file_name', 'text_template_file_name', 'html_layout_file_name', 'html_template_file_name', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); /** @@ -136,12 +156,12 @@ class MessageVersionTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Secured' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, 'Version' => 5, 'VersionCreatedAt' => 6, 'VersionCreatedBy' => 7, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'createdAt' => 3, 'updatedAt' => 4, 'version' => 5, 'versionCreatedAt' => 6, 'versionCreatedBy' => 7, ), - self::TYPE_COLNAME => array(MessageVersionTableMap::ID => 0, MessageVersionTableMap::NAME => 1, MessageVersionTableMap::SECURED => 2, MessageVersionTableMap::CREATED_AT => 3, MessageVersionTableMap::UPDATED_AT => 4, MessageVersionTableMap::VERSION => 5, MessageVersionTableMap::VERSION_CREATED_AT => 6, MessageVersionTableMap::VERSION_CREATED_BY => 7, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'SECURED' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, 'VERSION' => 5, 'VERSION_CREATED_AT' => 6, 'VERSION_CREATED_BY' => 7, ), - self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'created_at' => 3, 'updated_at' => 4, 'version' => 5, 'version_created_at' => 6, 'version_created_by' => 7, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Secured' => 2, 'TextLayoutFileName' => 3, 'TextTemplateFileName' => 4, 'HtmlLayoutFileName' => 5, 'HtmlTemplateFileName' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, 'Version' => 9, 'VersionCreatedAt' => 10, 'VersionCreatedBy' => 11, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'textLayoutFileName' => 3, 'textTemplateFileName' => 4, 'htmlLayoutFileName' => 5, 'htmlTemplateFileName' => 6, 'createdAt' => 7, 'updatedAt' => 8, 'version' => 9, 'versionCreatedAt' => 10, 'versionCreatedBy' => 11, ), + self::TYPE_COLNAME => array(MessageVersionTableMap::ID => 0, MessageVersionTableMap::NAME => 1, MessageVersionTableMap::SECURED => 2, MessageVersionTableMap::TEXT_LAYOUT_FILE_NAME => 3, MessageVersionTableMap::TEXT_TEMPLATE_FILE_NAME => 4, MessageVersionTableMap::HTML_LAYOUT_FILE_NAME => 5, MessageVersionTableMap::HTML_TEMPLATE_FILE_NAME => 6, MessageVersionTableMap::CREATED_AT => 7, MessageVersionTableMap::UPDATED_AT => 8, MessageVersionTableMap::VERSION => 9, MessageVersionTableMap::VERSION_CREATED_AT => 10, MessageVersionTableMap::VERSION_CREATED_BY => 11, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'SECURED' => 2, 'TEXT_LAYOUT_FILE_NAME' => 3, 'TEXT_TEMPLATE_FILE_NAME' => 4, 'HTML_LAYOUT_FILE_NAME' => 5, 'HTML_TEMPLATE_FILE_NAME' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, 'VERSION' => 9, 'VERSION_CREATED_AT' => 10, 'VERSION_CREATED_BY' => 11, ), + self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'secured' => 2, 'text_layout_file_name' => 3, 'text_template_file_name' => 4, 'html_layout_file_name' => 5, 'html_template_file_name' => 6, 'created_at' => 7, 'updated_at' => 8, 'version' => 9, 'version_created_at' => 10, 'version_created_by' => 11, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); /** @@ -163,6 +183,10 @@ class MessageVersionTableMap extends TableMap $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'message', 'ID', true, null, null); $this->addColumn('NAME', 'Name', 'VARCHAR', true, 255, null); $this->addColumn('SECURED', 'Secured', 'TINYINT', false, null, null); + $this->addColumn('TEXT_LAYOUT_FILE_NAME', 'TextLayoutFileName', 'VARCHAR', false, 255, null); + $this->addColumn('TEXT_TEMPLATE_FILE_NAME', 'TextTemplateFileName', 'VARCHAR', false, 255, null); + $this->addColumn('HTML_LAYOUT_FILE_NAME', 'HtmlLayoutFileName', 'VARCHAR', false, 255, null); + $this->addColumn('HTML_TEMPLATE_FILE_NAME', 'HtmlTemplateFileName', 'VARCHAR', false, 255, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); $this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0); @@ -245,11 +269,11 @@ class MessageVersionTableMap extends TableMap public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { // If the PK cannot be derived from the row, return NULL. - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 5 + $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 ? 9 + $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 ? 5 + $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 ? 9 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)])); } /** @@ -368,6 +392,10 @@ class MessageVersionTableMap extends TableMap $criteria->addSelectColumn(MessageVersionTableMap::ID); $criteria->addSelectColumn(MessageVersionTableMap::NAME); $criteria->addSelectColumn(MessageVersionTableMap::SECURED); + $criteria->addSelectColumn(MessageVersionTableMap::TEXT_LAYOUT_FILE_NAME); + $criteria->addSelectColumn(MessageVersionTableMap::TEXT_TEMPLATE_FILE_NAME); + $criteria->addSelectColumn(MessageVersionTableMap::HTML_LAYOUT_FILE_NAME); + $criteria->addSelectColumn(MessageVersionTableMap::HTML_TEMPLATE_FILE_NAME); $criteria->addSelectColumn(MessageVersionTableMap::CREATED_AT); $criteria->addSelectColumn(MessageVersionTableMap::UPDATED_AT); $criteria->addSelectColumn(MessageVersionTableMap::VERSION); @@ -377,6 +405,10 @@ class MessageVersionTableMap extends TableMap $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.NAME'); $criteria->addSelectColumn($alias . '.SECURED'); + $criteria->addSelectColumn($alias . '.TEXT_LAYOUT_FILE_NAME'); + $criteria->addSelectColumn($alias . '.TEXT_TEMPLATE_FILE_NAME'); + $criteria->addSelectColumn($alias . '.HTML_LAYOUT_FILE_NAME'); + $criteria->addSelectColumn($alias . '.HTML_TEMPLATE_FILE_NAME'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.VERSION'); diff --git a/core/lib/Thelia/Model/Map/ProductI18nTableMap.php b/core/lib/Thelia/Model/Map/ProductI18nTableMap.php index 79a01514a..e082ebccb 100644 --- a/core/lib/Thelia/Model/Map/ProductI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductI18nTableMap.php @@ -57,7 +57,7 @@ class ProductI18nTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 6; + const NUM_COLUMNS = 9; /** * The number of lazy-loaded columns @@ -67,7 +67,7 @@ class ProductI18nTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 6; + const NUM_HYDRATE_COLUMNS = 9; /** * the column name for the ID field @@ -99,6 +99,21 @@ class ProductI18nTableMap extends TableMap */ const POSTSCRIPTUM = 'product_i18n.POSTSCRIPTUM'; + /** + * the column name for the META_TITLE field + */ + const META_TITLE = 'product_i18n.META_TITLE'; + + /** + * the column name for the META_DESCRIPTION field + */ + const META_DESCRIPTION = 'product_i18n.META_DESCRIPTION'; + + /** + * the column name for the META_KEYWORD field + */ + const META_KEYWORD = 'product_i18n.META_KEYWORD'; + /** * The default string format for model objects of the related table */ @@ -111,12 +126,12 @@ class ProductI18nTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ), - self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ), - self::TYPE_COLNAME => array(ProductI18nTableMap::ID, ProductI18nTableMap::LOCALE, ProductI18nTableMap::TITLE, ProductI18nTableMap::DESCRIPTION, ProductI18nTableMap::CHAPO, ProductI18nTableMap::POSTSCRIPTUM, ), - self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ), - self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', 'MetaTitle', 'MetaDescription', 'MetaKeyword', ), + self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'metaTitle', 'metaDescription', 'metaKeyword', ), + self::TYPE_COLNAME => array(ProductI18nTableMap::ID, ProductI18nTableMap::LOCALE, ProductI18nTableMap::TITLE, ProductI18nTableMap::DESCRIPTION, ProductI18nTableMap::CHAPO, ProductI18nTableMap::POSTSCRIPTUM, ProductI18nTableMap::META_TITLE, ProductI18nTableMap::META_DESCRIPTION, ProductI18nTableMap::META_KEYWORD, ), + self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORD', ), + self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'meta_title', 'meta_description', 'meta_keyword', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) ); /** @@ -126,12 +141,12 @@ class ProductI18nTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ), - self::TYPE_COLNAME => array(ProductI18nTableMap::ID => 0, ProductI18nTableMap::LOCALE => 1, ProductI18nTableMap::TITLE => 2, ProductI18nTableMap::DESCRIPTION => 3, ProductI18nTableMap::CHAPO => 4, ProductI18nTableMap::POSTSCRIPTUM => 5, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ), - self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, 'MetaTitle' => 6, 'MetaDescription' => 7, 'MetaKeyword' => 8, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'metaTitle' => 6, 'metaDescription' => 7, 'metaKeyword' => 8, ), + self::TYPE_COLNAME => array(ProductI18nTableMap::ID => 0, ProductI18nTableMap::LOCALE => 1, ProductI18nTableMap::TITLE => 2, ProductI18nTableMap::DESCRIPTION => 3, ProductI18nTableMap::CHAPO => 4, ProductI18nTableMap::POSTSCRIPTUM => 5, ProductI18nTableMap::META_TITLE => 6, ProductI18nTableMap::META_DESCRIPTION => 7, ProductI18nTableMap::META_KEYWORD => 8, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, 'META_TITLE' => 6, 'META_DESCRIPTION' => 7, 'META_KEYWORD' => 8, ), + self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'meta_title' => 6, 'meta_description' => 7, 'meta_keyword' => 8, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, ) ); /** @@ -156,6 +171,9 @@ class ProductI18nTableMap extends TableMap $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null); $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null); + $this->addColumn('META_TITLE', 'MetaTitle', 'VARCHAR', false, 255, null); + $this->addColumn('META_DESCRIPTION', 'MetaDescription', 'LONGVARCHAR', false, null, null); + $this->addColumn('META_KEYWORD', 'MetaKeyword', 'LONGVARCHAR', false, null, null); } // initialize() /** @@ -359,6 +377,9 @@ class ProductI18nTableMap extends TableMap $criteria->addSelectColumn(ProductI18nTableMap::DESCRIPTION); $criteria->addSelectColumn(ProductI18nTableMap::CHAPO); $criteria->addSelectColumn(ProductI18nTableMap::POSTSCRIPTUM); + $criteria->addSelectColumn(ProductI18nTableMap::META_TITLE); + $criteria->addSelectColumn(ProductI18nTableMap::META_DESCRIPTION); + $criteria->addSelectColumn(ProductI18nTableMap::META_KEYWORD); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.LOCALE'); @@ -366,6 +387,9 @@ class ProductI18nTableMap extends TableMap $criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.CHAPO'); $criteria->addSelectColumn($alias . '.POSTSCRIPTUM'); + $criteria->addSelectColumn($alias . '.META_TITLE'); + $criteria->addSelectColumn($alias . '.META_DESCRIPTION'); + $criteria->addSelectColumn($alias . '.META_KEYWORD'); } } diff --git a/core/lib/Thelia/Model/Map/ProductTableMap.php b/core/lib/Thelia/Model/Map/ProductTableMap.php index 68a34a393..3cf8d3925 100644 --- a/core/lib/Thelia/Model/Map/ProductTableMap.php +++ b/core/lib/Thelia/Model/Map/ProductTableMap.php @@ -230,7 +230,7 @@ class ProductTableMap extends TableMap { return array( 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), - 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), + 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum, meta_title, meta_description, meta_keyword', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ), ); } // getBehaviors() diff --git a/core/lib/Thelia/Model/Message.php b/core/lib/Thelia/Model/Message.php index 4163e6d6b..190ceff03 100755 --- a/core/lib/Thelia/Model/Message.php +++ b/core/lib/Thelia/Model/Message.php @@ -6,6 +6,8 @@ use Thelia\Model\Base\Message as BaseMessage; use Propel\Runtime\Connection\ConnectionInterface; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\Message\MessageEvent; +use Thelia\Core\Template\ParserInterface; +use Thelia\Core\Template\TemplateHelper; class Message extends BaseMessage { @@ -64,4 +66,97 @@ class Message extends BaseMessage { { $this->dispatchEvent(TheliaEvents::AFTER_DELETEMESSAGE, new MessageEvent($this)); } -} + + /** + * Calculate the message body, given the HTML entered in the back-office, the message layout, and the message template + */ + protected function getMessageBody($parser, $message, $layout, $template) { + + $body = false; + + $mail_template_path = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath() . DS; + + // Try to get the body from template file, if a file is defined + if (! empty($template)) { + try { + + $body = $parser->render($mail_template_path . $template); + } catch (ResourceNotFoundException $ex) { + // Ignore this. + } + } + + // We did not get it ? Use the message entered in the back-office + if ($body === false) { + $body = $parser->renderString($message); + } + + // Do we have a layout ? + if (! empty($layout)) { + + // Populate the message body variable + $parser->assign('message_body', $body); + + // Render the layout file + $body = $parser->render($mail_template_path . $layout); + } + + return $body; + } + + /** + * Get the HTML message body + */ + public function getHtmlMessageBody(ParserInterface $parser) { + + return $this->getMessageBody( + $parser, + $this->getHtmlMessage(), + $this->getHtmlLayoutFileName(), + $this->getHtmlTemplateFileName() + ); + } + + /** + * Get the TEXT message body + */ + public function getTextMessageBody(ParserInterface $parser) { + + return $this->getMessageBody( + $parser, + $this->getTextMessage(), + $this->getTextLayoutFileName(), + $this->getTextTemplateFileName() + ); + } + + /** + * Add a subject and a body (TEXT, HTML or both, depending on the message + * configuration. + */ + public function buildMessage($parser, \Swift_Message $messageInstance) { + + $subject = $parser->fetch(sprintf("string:%s", $this->getSubject())); + $htmlMessage = $this->getHtmlMessageBody($parser); + $textMessage = $this->getTextMessageBody($parser); + + $messageInstance->setSubject($subject); + + // If we do not have an HTML message + if (empty($htmlMessage)) { + // Message body is the text message + $messageInstance->setBody($textMessage, 'text/plain'); + } + else { + // The main body is the HTML messahe + $messageInstance->setBody($htmlMessage, 'text/html'); + + // Use the text as a message part, if we have one. + if (! empty($textMessage)) { + $messageInstance->addPart($textMessage, 'text/plain'); + } + } + + return $messageInstance; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/Module.php b/core/lib/Thelia/Model/Module.php index b2518169d..3d45746cc 100755 --- a/core/lib/Thelia/Model/Module.php +++ b/core/lib/Thelia/Model/Module.php @@ -22,6 +22,13 @@ class Module extends BaseModule return ucfirst($this->getCode()); } + /** + * @return the module's base directory path, relative to THELIA_MODULE_DIR + */ + public function getAbsoluteBaseDir() { + return THELIA_MODULE_DIR . $this->getBaseDir(); + } + /** * @return the module's config directory path, relative to THELIA_MODULE_DIR */ @@ -29,10 +36,24 @@ class Module extends BaseModule return $this->getBaseDir() . DS . "Config"; } + /** + * @return the module's config absolute directory path + */ + public function getAbsoluteConfigPath() { + return THELIA_MODULE_DIR . $this->getConfigPath(); + } + /** * @return the module's i18N directory path, relative to THELIA_MODULE_DIR */ public function getI18nPath() { return $this->getBaseDir() . DS . "I18n"; } -} + + /** + * @return the module's i18N absolute directory path + */ + public function getAbsoluteI18nPath() { + return THELIA_MODULE_DIR . $this->getI18nPath(); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Tests/Model/Message.php b/core/lib/Thelia/Tests/Model/Message.php new file mode 100644 index 000000000..1b7cd5716 --- /dev/null +++ b/core/lib/Thelia/Tests/Model/Message.php @@ -0,0 +1,337 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Model; + + +use Thelia\Model\ConfigQuery; +use Symfony\Component\Filesystem\Filesystem; +use Thelia\Model\Message; +use Thelia\Core\Template\Smarty\SmartyParser; +use Thelia\Core\Template\ParserContext; +use Thelia\Core\Template\TemplateHelper; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; +use Thelia\Core\HttpFoundation\Request; +use Thelia\Core\HttpFoundation\Session\Session; + +/** + * Class CustomerTest + * @package Thelia\Tests\Action + * @author Etienne Roudeix + */ +class MessageTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ContainerBuilder $container + */ + protected $container, $parser; + + private $backup_mail_template = 'undefined'; + + public function setUp() + { + $this->backup_mail_template = ConfigQuery::read('active-mail-template', 'default'); + + ConfigQuery::write('active-mail-template', 'test'); + + @mkdir(TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath(), 0777, true); + + $container = new ContainerBuilder(); + + $session = new Session(new MockArraySessionStorage()); + $request = new Request(); + $dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface"); + + $request->setSession($session); + + /* + * public function __construct( + Request $request, EventDispatcherInterface $dispatcher, ParserContext $parserContext, + $env = "prod", $debug = false) + + */ + $container->set("event_dispatcher", $dispatcher); + $container->set('request', $request); + + $this->parser = new SmartyParser($request, $dispatcher, new ParserContext($request), 'dev', true); + $this->parser->setTemplate(TemplateHelper::getInstance()->getActiveMailTemplate()); + + $container->set('thelia.parser', $this->parser); + + $this->container = $container; + } + + /** + * Create message with HTML and TEXT body from message HTMl and TEXT fields + */ + public function testMessageWithTextAndHtmlBody() + { + $message = new Message(); + + $message->setLocale('fr_FR'); + + $message->setSubject("The subject"); + $message->setHtmlMessage("The HTML content"); + $message->setTextMessage("The TEXT content"); + + $instance = \Swift_Message::newInstance(); + + $message->buildMessage($this->parser, $instance); + + $this->assertEquals("The subject", $instance->getSubject()); + $this->assertEquals("The HTML content", $instance->getBody()); + $this->assertEquals("The TEXT content", $instance->getChildren()[0]->getBody()); + } + + /** + * Create message with TEXT body only from message HTMl and TEXT fields + */ + public function testMessageWithTextOnlyBody() + { + $message = new Message(); + + $message->setLocale('fr_FR'); + + $message->setSubject("The subject"); + $message->setTextMessage("The TEXT content"); + + $instance = \Swift_Message::newInstance(); + + $message->buildMessage($this->parser, $instance); + + $this->assertEquals("The subject", $instance->getSubject()); + $this->assertEquals("The TEXT content", $instance->getBody()); + $this->assertEquals(0, count($instance->getChildren())); + } + + /** + * Create message with HTML and TEXT body from message HTMl and TEXT fields + * using a text and a html layout + */ + public function testMessageWithTextAndHtmlBodyAndTextAndHtmlLayout() + { + $message = new Message(); + + $message->setLocale('fr_FR'); + + $message->setSubject("The subject"); + $message->setTextMessage("The TEXT content"); + $message->setHtmlMessage("The HTML content"); + + $message->setHtmlLayoutFileName('layout.html.tpl'); + $message->setTextLayoutFileName('layout.text.tpl'); + + $path = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath(); + + file_put_contents($path.DS.'layout.html.tpl', 'HTML Layout: {$message_body nofilter}'); + file_put_contents($path.DS.'layout.text.tpl', 'TEXT Layout: {$message_body nofilter}'); + + $instance = \Swift_Message::newInstance(); + + $message->buildMessage($this->parser, $instance); + + $this->assertEquals("The subject", $instance->getSubject()); + $this->assertEquals("HTML Layout: The HTML content", $instance->getBody()); + $this->assertEquals("TEXT Layout: The TEXT content", $instance->getChildren()[0]->getBody()); + } + + /** + * Create message with TEXT only body from message HTMl and TEXT fields + * using a text only layout + */ + public function testMessageWithTextOnlyBodyAndTextOnlyLayout() + { + $message = new Message(); + + $message->setLocale('fr_FR'); + + $message->setSubject("The subject"); + $message->setTextMessage("The & content"); + + $message->setTextLayoutFileName('layout3.text.tpl'); + + $path = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath(); + + file_put_contents($path.DS.'layout3.text.tpl', 'TEXT Layout 3: {$message_body nofilter} :-) <>'); + + $instance = \Swift_Message::newInstance(); + + $message->buildMessage($this->parser, $instance); + + $this->assertEquals("The subject", $instance->getSubject()); + $this->assertEquals("TEXT Layout 3: The & content :-) <>", $instance->getBody()); + $this->assertEquals(0, count($instance->getChildren())); + } + + /** + * Create message with TEXT and HTML body from message HTMl and TEXT fields + * using a text only layout + */ + public function testMessageWithTextAndHtmlBodyAndTextOnlyLayout() + { + $message = new Message(); + + $message->setLocale('fr_FR'); + + $message->setSubject("The subject"); + $message->setTextMessage("The & content"); + $message->setHtmlMessage("The & content"); + + $message->setTextLayoutFileName('layout3.text.tpl'); + + $path = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath(); + + file_put_contents($path.DS.'layout3.text.tpl', 'TEXT Layout 3: {$message_body nofilter} :-) <>'); + + $instance = \Swift_Message::newInstance(); + + $message->buildMessage($this->parser, $instance); + + $this->assertEquals("The subject", $instance->getSubject()); + $this->assertEquals("The & content", $instance->getBody()); + $this->assertEquals("TEXT Layout 3: The & content :-) <>", $instance->getChildren()[0]->getBody()); + } + + /** + * Create message with HTML and TEXT body from template HTMl and TEXT fields + * using a text and a html layout + */ + public function testMessageWithTextAndHtmlBodyAndTextAndHtmlLayoutAndTextAndHtmlTemplate() + { + $message = new Message(); + + $message->setLocale('fr_FR'); + + $message->setSubject("The subject"); + $message->setTextMessage("The TEXT content"); + $message->setHtmlMessage("The HTML content"); + + $message->setTextTemplateFileName('template4-text.txt'); + $message->setHtmlTemplateFileName('template4-html.html'); + + $message->setHtmlLayoutFileName('layout4.html.tpl'); + $message->setTextLayoutFileName('layout4.text.tpl'); + + $path = TemplateHelper::getInstance()->getActiveMailTemplate()->getAbsolutePath(); + + $this->parser->assign('myvar', 'my-value'); + + file_put_contents($path.DS.'layout4.html.tpl', 'HTML Layout 4: {$message_body nofilter}'); + file_put_contents($path.DS.'layout4.text.tpl', 'TEXT Layout 4: {$message_body nofilter}'); + + file_put_contents($path.DS.'template4-html.html', 'HTML