Merge branch 'master' of https://github.com/thelia/thelia
Conflicts: core/lib/Thelia/Config/Resources/routing/front.xml reset_install.sh
This commit is contained in:
@@ -12,3 +12,4 @@ before_script:
|
||||
- composer install --prefer-dist --dev
|
||||
- sh -c "mysql -u$DB_USER -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS thelia;SET FOREIGN_KEY_CHECKS = 1;'; fi"
|
||||
- php Thelia thelia:install --db_host=localhost --db_username=$DB_USER --db_name=thelia
|
||||
- php install/faker.php
|
||||
|
||||
108
core/lib/Thelia/Action/Address.php
Normal file
108
core/lib/Thelia/Action/Address.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Action;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Address as AddressModel;
|
||||
|
||||
|
||||
/**
|
||||
* Class Address
|
||||
* @package Thelia\Action
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class Address extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
|
||||
public function create(AddressCreateOrUpdateEvent $event)
|
||||
{
|
||||
$address = new AddressModel();
|
||||
$address->setCustomer($event->getCustomer());
|
||||
$this->createOrUpdate($address, $event);
|
||||
}
|
||||
|
||||
public function update(AddressCreateOrUpdateEvent $event)
|
||||
{
|
||||
$addressModel = $event->getAddress();
|
||||
|
||||
$this->createOrUpdate($addressModel, $event);
|
||||
}
|
||||
|
||||
|
||||
protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event)
|
||||
{
|
||||
$addressModel->setDispatcher($this->getDispatcher());
|
||||
|
||||
if ($addressModel->isNew()) {
|
||||
$addressModel->setLabel($event->getLabel());
|
||||
}
|
||||
|
||||
$addressModel
|
||||
->setTitleId($event->getTitle())
|
||||
->setFirstname($event->getFirstname())
|
||||
->setLastname($event->getLastname())
|
||||
->setAddress1($event->getAddress1())
|
||||
->setAddress2($event->getAddress2())
|
||||
->setAddress3($event->getAddress3())
|
||||
->setZipcode($event->getZipcode())
|
||||
->setCity($event->getCity())
|
||||
->setCountryId($event->getCountry())
|
||||
->setCellphone($event->getCellphone())
|
||||
->setPhone($event->getPhone())
|
||||
->setCompany($event->getCompany())
|
||||
->save()
|
||||
;
|
||||
|
||||
$event->setAddress($addressModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of event names this subscriber wants to listen to.
|
||||
*
|
||||
* The array keys are event names and the value can be:
|
||||
*
|
||||
* * The method name to call (priority defaults to 0)
|
||||
* * An array composed of the method name to call and the priority
|
||||
* * An array of arrays composed of the method names to call and respective
|
||||
* priorities, or 0 if unset
|
||||
*
|
||||
* For instance:
|
||||
*
|
||||
* * array('eventName' => 'methodName')
|
||||
* * array('eventName' => array('methodName', $priority))
|
||||
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
|
||||
*
|
||||
* @return array The event names to listen to
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::ADDRESS_CREATE => array("create", 128),
|
||||
TheliaEvents::ADDRESS_UPDATE => array("update", 128)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
);
|
||||
}
|
||||
|
||||
public function modify(CategoryChangeEvent $event)
|
||||
public function update(CategoryChangeEvent $event)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::CATEGORY_CREATE => array("create", 128),
|
||||
TheliaEvents::CATEGORY_MODIFY => array("modify", 128),
|
||||
TheliaEvents::CATEGORY_UPDATE => array("update", 128),
|
||||
TheliaEvents::CATEGORY_DELETE => array("delete", 128),
|
||||
|
||||
TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
|
||||
|
||||
@@ -148,7 +148,7 @@ class Config extends BaseAction implements EventSubscriberInterface
|
||||
return array(
|
||||
TheliaEvents::CONFIG_CREATE => array("create", 128),
|
||||
TheliaEvents::CONFIG_SETVALUE => array("setValue", 128),
|
||||
TheliaEvents::CONFIG_MODIFY => array("modify", 128),
|
||||
TheliaEvents::CONFIG_UPDATE => array("modify", 128),
|
||||
TheliaEvents::CONFIG_DELETE => array("delete", 128),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
||||
*
|
||||
* @param CurrencyChangeEvent $event
|
||||
*/
|
||||
public function modify(CurrencyChangeEvent $event)
|
||||
public function update(CurrencyChangeEvent $event)
|
||||
{
|
||||
$search = CurrencyQuery::create();
|
||||
|
||||
@@ -165,7 +165,7 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::CURRENCY_CREATE => array("create", 128),
|
||||
TheliaEvents::CURRENCY_MODIFY => array("modify", 128),
|
||||
TheliaEvents::CURRENCY_UPDATE => array("update", 128),
|
||||
TheliaEvents::CURRENCY_DELETE => array("delete", 128),
|
||||
TheliaEvents::CURRENCY_SET_DEFAULT => array("setDefault", 128),
|
||||
TheliaEvents::CURRENCY_UPDATE_RATES => array("updateRates", 128),
|
||||
|
||||
@@ -118,7 +118,7 @@ class Message extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::MESSAGE_CREATE => array("create", 128),
|
||||
TheliaEvents::MESSAGE_MODIFY => array("modify", 128),
|
||||
TheliaEvents::MESSAGE_UPDATE => array("modify", 128),
|
||||
TheliaEvents::MESSAGE_DELETE => array("delete", 128),
|
||||
);
|
||||
}
|
||||
|
||||
85
core/lib/Thelia/Action/PageNotFound.php
Executable file
85
core/lib/Thelia/Action/PageNotFound.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class PageNotFound
|
||||
* @package Thelia\Action
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class PageNotFound extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
public function display404(GetResponseForExceptionEvent $event)
|
||||
{
|
||||
if($event->getException() instanceof NotFoundHttpException) {
|
||||
|
||||
$parser = $this->container->get("thelia.parser");
|
||||
|
||||
// Define the template thant shoud be used
|
||||
$parser->setTemplate(ConfigQuery::getActiveTemplate());
|
||||
|
||||
//$event->getRequest()->attributes->set('_view', ConfigQuery::getPageNotFoundView());
|
||||
|
||||
$response = new Response($parser->render(ConfigQuery::getPageNotFoundView()), 404);
|
||||
|
||||
$event->setResponse($response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of event names this subscriber wants to listen to.
|
||||
*
|
||||
* The array keys are event names and the value can be:
|
||||
*
|
||||
* * The method name to call (priority defaults to 0)
|
||||
* * An array composed of the method name to call and the priority
|
||||
* * An array of arrays composed of the method names to call and respective
|
||||
* priorities, or 0 if unset
|
||||
*
|
||||
* For instance:
|
||||
*
|
||||
* * array('eventName' => 'methodName')
|
||||
* * array('eventName' => array('methodName', $priority))
|
||||
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
|
||||
*
|
||||
* @return array The event names to listen to
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
KernelEvents::EXCEPTION => array("display404", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Thelia\Command\ContainerAwareCommand;
|
||||
use Thelia\Install\Database;
|
||||
|
||||
/**
|
||||
* try to install a new instance of Thelia
|
||||
@@ -97,14 +98,16 @@ class Install extends ContainerAwareCommand
|
||||
$connectionInfo = $this->getConnectionInfo($input, $output);
|
||||
}
|
||||
|
||||
$this->createDatabase($connection, $connectionInfo["dbName"]);
|
||||
$database = new Database($connection);
|
||||
|
||||
$database->createDatabase($connectionInfo["dbName"]);
|
||||
|
||||
$output->writeln(array(
|
||||
"",
|
||||
"<info>Creating Thelia database, please wait</info>",
|
||||
""
|
||||
));
|
||||
$this->insertSql($connection, $connectionInfo["dbName"]);
|
||||
$database->insertSql($connectionInfo["dbName"]);
|
||||
|
||||
$output->writeln(array(
|
||||
"",
|
||||
@@ -203,65 +206,6 @@ class Install extends ContainerAwareCommand
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert all sql needed in database
|
||||
*
|
||||
* @param \PDO $connection
|
||||
* @param $dbName
|
||||
*/
|
||||
protected function insertSql(\PDO $connection, $dbName)
|
||||
{
|
||||
$connection->query(sprintf("use %s", $dbName));
|
||||
$sql = array();
|
||||
$sql = array_merge(
|
||||
$sql,
|
||||
$this->prepareSql(file_get_contents(THELIA_ROOT . "/install/thelia.sql")),
|
||||
$this->prepareSql(file_get_contents(THELIA_ROOT . "/install/insert.sql"))
|
||||
);
|
||||
|
||||
for ($i = 0; $i < count($sql); $i ++) {
|
||||
$connection->query($sql[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Separate each sql instruction in an array
|
||||
*
|
||||
* @param $sql
|
||||
* @return array
|
||||
*/
|
||||
protected function prepareSql($sql)
|
||||
{
|
||||
$sql = str_replace(";',", "-CODE-", $sql);
|
||||
$query = array();
|
||||
|
||||
$tab = explode(";", $sql);
|
||||
|
||||
for ($i=0; $i<count($tab); $i++) {
|
||||
$queryTemp = str_replace("-CODE-", ";',", $tab[$i]);
|
||||
$queryTemp = str_replace("|", ";", $queryTemp);
|
||||
$query[] = $queryTemp;
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* create database if not exists
|
||||
*
|
||||
* @param \PDO $connection
|
||||
* @param $dbName
|
||||
*/
|
||||
protected function createDatabase(\PDO $connection, $dbName)
|
||||
{
|
||||
$connection->query(
|
||||
sprintf(
|
||||
"CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8",
|
||||
$dbName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* test database access
|
||||
*
|
||||
|
||||
70
core/lib/Thelia/Command/ReloadDatabaseCommand.php
Normal file
70
core/lib/Thelia/Command/ReloadDatabaseCommand.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Command;
|
||||
use Propel\Runtime\Propel;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Thelia\Install\Database;
|
||||
|
||||
|
||||
/**
|
||||
* Class ReloadDatabasesCommand
|
||||
* @package Thelia\Command
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class ReloadDatabaseCommand extends BaseModuleGenerate
|
||||
{
|
||||
public function configure()
|
||||
{
|
||||
$this
|
||||
->setName("thelia:dev:reloadDB")
|
||||
->setDescription("erase current database and create new one")
|
||||
/* ->addOption(
|
||||
"load-fixtures",
|
||||
null,
|
||||
InputOption::VALUE_NONE,
|
||||
"load fixtures in databases"
|
||||
)*/
|
||||
;
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$connection = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
||||
$connection = $connection->getWrappedConnection();
|
||||
|
||||
$database = new Database($connection);
|
||||
$output->writeln(array(
|
||||
'',
|
||||
'<info>starting reloaded database, please wait</info>'
|
||||
));
|
||||
$database->insertSql();
|
||||
$output->writeln(array(
|
||||
'',
|
||||
'<info>Database reloaded with success</info>',
|
||||
''
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,11 @@
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.pageNotFound" class="Thelia\Action\PageNotFound">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
|
||||
</config>
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
<command class="Thelia\Command\ModuleGenerateModelCommand"/>
|
||||
<command class="Thelia\Command\ModuleGenerateSqlCommand"/>
|
||||
<command class="Thelia\Command\CreateAdminUser"/>
|
||||
<command class="Thelia\Command\ReloadDatabaseCommand"/>
|
||||
</commands>
|
||||
|
||||
<services>
|
||||
|
||||
@@ -56,6 +56,17 @@
|
||||
<tag name="router.register" priority="0"/>
|
||||
</service>
|
||||
|
||||
<service id="router.install" class="%router.class%">
|
||||
<argument type="service" id="router.xmlLoader"/>
|
||||
<argument>install.xml</argument>
|
||||
<argument type="collection">
|
||||
<argument key="cache_dir">%kernel.cache_dir%</argument>
|
||||
<argument key="debug">%kernel.debug%</argument>
|
||||
</argument>
|
||||
<argument type="service" id="request.context"/>
|
||||
<tag name="router.register" priority="-1"/>
|
||||
</service>
|
||||
|
||||
<service id="router.front" class="%router.class%">
|
||||
<argument type="service" id="router.xmlLoader"/>
|
||||
<argument>front.xml</argument>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<default key="_view">index</default>
|
||||
</route>
|
||||
|
||||
<!-- Customer routes -->
|
||||
<route id="customer.create.process" path="/customer/create" methods="post">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::createAction</default>
|
||||
<default key="_view">connexion</default>
|
||||
@@ -25,7 +26,15 @@
|
||||
<route id="customer.logout.process" path="/customer/logout">
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerController::logoutAction</default>
|
||||
</route>
|
||||
<!-- end customer routes -->
|
||||
|
||||
<!-- customer address routes -->
|
||||
<route id="customer.adress.create" path="/customer/address/create" >
|
||||
<default key="_controller">Thelia\Controller\Front\CustomerAddressController::createAction</default>
|
||||
</route>
|
||||
<!-- end customer address routes -->
|
||||
|
||||
<!-- cart routes -->
|
||||
<route id="cart.add.process" path="/cart/add">
|
||||
<default key="_controller">Thelia\Controller\Front\CartController::addItem</default>
|
||||
<default key="_view">cart</default>
|
||||
@@ -41,7 +50,9 @@
|
||||
<default key="_view">cart</default>
|
||||
</route>
|
||||
|
||||
<!-- <route id="url-rewriting.check" path="/{rewritten_url}" methods="GET">
|
||||
<route id="url-rewriting.check" path="/{rewritten_url}" methods="GET">
|
||||
<default key="_controller">Thelia\Controller\Front\UrlRewritingController::check</default>
|
||||
</route> -->
|
||||
<requirement key="rewritten_url">.*</requirement>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
|
||||
15
core/lib/Thelia/Config/Resources/routing/install.xml
Normal file
15
core/lib/Thelia/Config/Resources/routing/install.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="home" path="/install" >
|
||||
<default key="_controller">Thelia\Controller\Install\InstallController::index</default>
|
||||
</route>
|
||||
|
||||
<route id="home" path="/install/step/2" >
|
||||
<default key="_controller">Thelia\Controller\Install\InstallController::checkPermission</default>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
@@ -229,7 +229,7 @@ class ConfigController extends BaseAdminController
|
||||
->setPostscriptum($data['postscriptum'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::CONFIG_MODIFY, $changeEvent);
|
||||
$this->dispatch(TheliaEvents::CONFIG_UPDATE, $changeEvent);
|
||||
|
||||
// Log config modification
|
||||
$changedObject = $changeEvent->getConfig();
|
||||
|
||||
@@ -220,7 +220,7 @@ class CurrencyController extends BaseAdminController
|
||||
->setRate($data['rate'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::CURRENCY_MODIFY, $changeEvent);
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE, $changeEvent);
|
||||
|
||||
// Log currency modification
|
||||
$changedObject = $changeEvent->getCurrency();
|
||||
|
||||
@@ -204,7 +204,7 @@ class MessageController extends BaseAdminController
|
||||
->setTextMessage($data['text_message'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::MESSAGE_MODIFY, $changeEvent);
|
||||
$this->dispatch(TheliaEvents::MESSAGE_UPDATE, $changeEvent);
|
||||
|
||||
// Log message modification
|
||||
$changedObject = $changeEvent->getMessage();
|
||||
|
||||
@@ -31,7 +31,6 @@ use Thelia\Tools\Redirect;
|
||||
use Thelia\Core\Template\ParserContext;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Thelia\Core\Factory\ActionEventFactory;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
@@ -206,8 +205,11 @@ class BaseController extends ContainerAware
|
||||
/**
|
||||
* Get a route path from the route id.
|
||||
*
|
||||
* @param unknown $routerName either admin.router or front.router
|
||||
* @param unknown $routeName the route ID
|
||||
* @param $routerName
|
||||
* @param $routeId
|
||||
*
|
||||
* @return mixed
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function getRouteFromRouter($routerName, $routeId) {
|
||||
$route = $this->container->get($routerName)->getRouteCollection()->get($routeId);
|
||||
@@ -221,10 +223,10 @@ class BaseController extends ContainerAware
|
||||
|
||||
/**
|
||||
* Return a 404 error
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
protected function pageNotFound()
|
||||
{
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ class CartController extends BaseFrontController
|
||||
$cartEvent->setQuantity($this->getRequest()->get("quantity"));
|
||||
|
||||
try {
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent);
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent);
|
||||
|
||||
$this->redirectSuccess();
|
||||
} catch(PropelException $e) {
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Front;
|
||||
use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Form\AddressForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\Customer;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
|
||||
/**
|
||||
* Class CustomerAddressController
|
||||
* @package Thelia\Controller\Front
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class CustomerAddressController extends BaseFrontController
|
||||
{
|
||||
|
||||
public function createAction()
|
||||
{
|
||||
if ($this->getSecurityContext()->hasCustomerUser() === false) {
|
||||
$this->redirect(URL::getIndexPage());
|
||||
}
|
||||
|
||||
$addressCreate = new AddressForm($this->getRequest());
|
||||
|
||||
try {
|
||||
$customer = $this->getSecurityContext()->getCustomerUser();
|
||||
|
||||
$form = $this->validateForm($addressCreate, "post");
|
||||
$event = $this->createAddressEvent($form->getData(), $customer);
|
||||
|
||||
$this->dispatch(TheliaEvents::ADDRESS_CREATE, $event);
|
||||
$this->redirectSuccess($addressCreate);
|
||||
|
||||
}catch (FormValidationException $e) {
|
||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during address creation process : %s", $message));
|
||||
|
||||
$addressCreate->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($addressCreate)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
protected function createAddressEvent($data, Customer $customer)
|
||||
{
|
||||
return new AddressCreateOrUpdateEvent(
|
||||
$data["label"],
|
||||
$data["title"],
|
||||
$data["firstname"],
|
||||
$data["lastname"],
|
||||
$data["address1"],
|
||||
$data["address2"],
|
||||
$data["address3"],
|
||||
$data["zipcode"],
|
||||
$data["city"],
|
||||
$data["country"],
|
||||
$data["cellpone"],
|
||||
$data["phone"],
|
||||
$data["company"],
|
||||
$customer
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,11 @@ use Thelia\Tools\URL;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Core\Security\Exception\WrongPasswordException;
|
||||
|
||||
/**
|
||||
* Class CustomerController
|
||||
* @package Thelia\Controller\Front
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class CustomerController extends BaseFrontController
|
||||
{
|
||||
/**
|
||||
@@ -66,10 +71,10 @@ class CustomerController extends BaseFrontController
|
||||
$this->redirectSuccess($customerCreation);
|
||||
}
|
||||
catch (FormValidationException $e) {
|
||||
$message = sprintf("Please check your input: %s", $ex->getMessage());
|
||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $ex->getMessage());
|
||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
@@ -114,14 +119,14 @@ class CustomerController extends BaseFrontController
|
||||
|
||||
}
|
||||
catch (FormValidationException $e) {
|
||||
$message = sprintf("Please check your input: %s", $ex->getMessage());
|
||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $ex->getMessage());
|
||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
Tlog::getInstance()->error(sprintf("Error during customer modification process : %s. Exception was %s", $message, $e->getMessage()));
|
||||
Tlog::getInstance()->error(sprintf("Error during customer modification process : %s.", $message));
|
||||
|
||||
$customerModification->setErrorMessage($message);
|
||||
|
||||
@@ -146,11 +151,10 @@ class CustomerController extends BaseFrontController
|
||||
$message = false;
|
||||
|
||||
$request = $this->getRequest();
|
||||
$customerLoginForm = new CustomerLogin($request);
|
||||
|
||||
try {
|
||||
|
||||
$customerLoginForm = new CustomerLogin($request);
|
||||
|
||||
$form = $this->validateForm($customerLoginForm, "post");
|
||||
|
||||
$authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm);
|
||||
@@ -163,7 +167,7 @@ class CustomerController extends BaseFrontController
|
||||
|
||||
}
|
||||
catch (FormValidationException $e) {
|
||||
$message = sprintf("Please check your input: %s", $ex->getMessage());
|
||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||
}
|
||||
catch(UsernameNotFoundException $e) {
|
||||
$message = "This customer email was not found.";
|
||||
@@ -175,7 +179,7 @@ class CustomerController extends BaseFrontController
|
||||
$message = "Sorry, we failed to authentify you. Please try again.";
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $ex->getMessage());
|
||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
@@ -190,8 +194,6 @@ class CustomerController extends BaseFrontController
|
||||
|
||||
/**
|
||||
* Perform customer logout.
|
||||
*
|
||||
* @param Customer $customer
|
||||
*/
|
||||
public function logoutAction()
|
||||
{
|
||||
@@ -203,6 +205,11 @@ class CustomerController extends BaseFrontController
|
||||
$this->redirect(URL::getIndexPage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch event for customer login action
|
||||
*
|
||||
* @param Customer $customer
|
||||
*/
|
||||
protected function processLogin(Customer $customer)
|
||||
{
|
||||
$this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer));
|
||||
|
||||
60
core/lib/Thelia/Controller/Install/BaseInstallController.php
Normal file
60
core/lib/Thelia/Controller/Install/BaseInstallController.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Install;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Controller\BaseController;
|
||||
|
||||
|
||||
/**
|
||||
* Class BaseInstallController
|
||||
* @package Thelia\Controller\Install
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class BaseInstallController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @return a ParserInterface instance parser
|
||||
*/
|
||||
protected function getParser()
|
||||
{
|
||||
$parser = $this->container->get("thelia.parser");
|
||||
|
||||
// Define the template thant shoud be used
|
||||
$parser->setTemplate("install");
|
||||
|
||||
return $parser;
|
||||
}
|
||||
|
||||
public function render($templateName, $args = array())
|
||||
{
|
||||
return new Response($this->renderRaw($templateName, $args));
|
||||
}
|
||||
|
||||
public function renderRaw($templateName, $args = array())
|
||||
{
|
||||
$data = $this->getParser()->render($templateName, $args);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
69
core/lib/Thelia/Controller/Install/InstallController.php
Normal file
69
core/lib/Thelia/Controller/Install/InstallController.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Install;
|
||||
use Thelia\Install\BaseInstall;
|
||||
use Thelia\Install\CheckPermission;
|
||||
|
||||
/**
|
||||
* Class InstallController
|
||||
* @package Thelia\Controller\Install
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class InstallController extends BaseInstallController {
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->verifyStep(1);
|
||||
|
||||
$this->getSession()->set("step", 1);
|
||||
|
||||
$this->render("index.html");
|
||||
}
|
||||
|
||||
public function checkPermission()
|
||||
{
|
||||
$this->verifyStep(2);
|
||||
|
||||
$permission = new CheckPermission();
|
||||
}
|
||||
|
||||
protected function verifyStep($step)
|
||||
{
|
||||
$session = $this->getSession();
|
||||
|
||||
if ($session->has("step")) {
|
||||
$sessionStep = $session->get("step");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch($step) {
|
||||
case "1" :
|
||||
if ($sessionStep > 1) {
|
||||
$this->redirect("/install/step/2");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ class RegisterRouterPass implements CompilerPassInterface
|
||||
|
||||
$container->setDefinition("router.".$moduleCode, $definition);
|
||||
|
||||
$chainRouter->addMethodCall("add", array(new Reference("router.".$moduleCode), -1));
|
||||
$chainRouter->addMethodCall("add", array(new Reference("router.".$moduleCode), 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
267
core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php
Normal file
267
core/lib/Thelia/Core/Event/AddressCreateOrUpdateEvent.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Thelia\Model\Address;
|
||||
use Thelia\Model\Customer;
|
||||
|
||||
|
||||
/**
|
||||
* Class AddressCreateOrUpdateEvent
|
||||
* @package Thelia\Core\Event
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AddressCreateOrUpdateEvent extends Event
|
||||
{
|
||||
/**
|
||||
* @var string address label
|
||||
*/
|
||||
protected $label;
|
||||
|
||||
/**
|
||||
* @var int title id
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @var string|null company name
|
||||
*/
|
||||
protected $company;
|
||||
|
||||
/**
|
||||
* @var string first name
|
||||
*/
|
||||
protected $firstname;
|
||||
|
||||
/**
|
||||
* @var string last name
|
||||
*/
|
||||
protected $lastname;
|
||||
|
||||
/**
|
||||
* @var string address
|
||||
*/
|
||||
protected $address1;
|
||||
|
||||
/**
|
||||
* @var string address line 2
|
||||
*/
|
||||
protected $address2;
|
||||
|
||||
/**
|
||||
* @var string address line 3
|
||||
*/
|
||||
protected $address3;
|
||||
|
||||
/**
|
||||
* @var string zipcode
|
||||
*/
|
||||
protected $zipcode;
|
||||
|
||||
/**
|
||||
* @var string city
|
||||
*/
|
||||
protected $city;
|
||||
|
||||
/**
|
||||
* @var int country id
|
||||
*/
|
||||
protected $country;
|
||||
|
||||
/**
|
||||
* @var string cell phone
|
||||
*/
|
||||
protected $cellphone;
|
||||
|
||||
/**
|
||||
* @var string phone
|
||||
*/
|
||||
protected $phone;
|
||||
|
||||
/**
|
||||
* @var \Thelia\Model\Customer
|
||||
*/
|
||||
protected $customer;
|
||||
|
||||
/**
|
||||
* @var \Thelia\Model\Address
|
||||
*/
|
||||
protected $address;
|
||||
|
||||
function __construct($label, $title, $firstname, $lastname, $address1, $address2, $address3, $zipcode, $city, $country, $cellphone, $phone, $company)
|
||||
{
|
||||
$this->address1 = $address1;
|
||||
$this->address2 = $address2;
|
||||
$this->address3 = $address3;
|
||||
$this->cellphone = $cellphone;
|
||||
$this->city = $city;
|
||||
$this->company = $company;
|
||||
$this->country = $country;
|
||||
$this->firstname = $firstname;
|
||||
$this->label = $label;
|
||||
$this->lastname = $lastname;
|
||||
$this->phone = $phone;
|
||||
$this->title = $title;
|
||||
$this->zipcode = $zipcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress1()
|
||||
{
|
||||
return $this->address1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress2()
|
||||
{
|
||||
return $this->address2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress3()
|
||||
{
|
||||
return $this->address3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCellphone()
|
||||
{
|
||||
return $this->cellphone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCity()
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCompany()
|
||||
{
|
||||
return $this->company;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCountry()
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstname()
|
||||
{
|
||||
return $this->firstname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLastname()
|
||||
{
|
||||
return $this->lastname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPhone()
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getZipcode()
|
||||
{
|
||||
return $this->zipcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Thelia\Model\Customer $customer
|
||||
*/
|
||||
public function setCustomer(Customer $customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Model\Customer
|
||||
*/
|
||||
public function getCustomer()
|
||||
{
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Thelia\Model\Address $address
|
||||
*/
|
||||
public function setAddress(Address $address)
|
||||
{
|
||||
$this->address = $address;
|
||||
$this->setCustomer($address->getCustomer());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Model\Address
|
||||
*/
|
||||
public function getAddress()
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -64,7 +64,7 @@ final class TheliaEvents
|
||||
/**
|
||||
* sent on customer account update
|
||||
*/
|
||||
const CUSTOMER_UPDATEACCOUNT = "action.modifyCustomer";
|
||||
const CUSTOMER_UPDATEACCOUNT = "action.updateCustomer";
|
||||
|
||||
/**
|
||||
* Sent before the logout of the administrator.
|
||||
@@ -88,12 +88,21 @@ final class TheliaEvents
|
||||
/**
|
||||
* Sent once the customer change form has been successfully validated, and before customer update in the database.
|
||||
*/
|
||||
const BEFORE_CHANGECUSTOMER = "action.before_changecustomer";
|
||||
const BEFORE_CHANGECUSTOMER = "action.before_updateCustomer";
|
||||
/**
|
||||
* Sent just after a successful update of a customer in the database.
|
||||
*/
|
||||
const AFTER_CHANGECUSTOMER = "action.after_changecustomer";
|
||||
const AFTER_CHANGECUSTOMER = "action.after_updateCustomer";
|
||||
|
||||
/**
|
||||
* sent for address creation
|
||||
*/
|
||||
const ADDRESS_CREATE = "action.createAddress";
|
||||
|
||||
/**
|
||||
* sent for address creation
|
||||
*/
|
||||
const ADDRESS_UPDATE = "action.updateAddress";
|
||||
|
||||
/**
|
||||
* Sent once the category creation form has been successfully validated, and before category insertion in the database.
|
||||
@@ -104,7 +113,7 @@ final class TheliaEvents
|
||||
* Create, change or delete a category
|
||||
*/
|
||||
const CATEGORY_CREATE = "action.createCategory";
|
||||
const CATEGORY_MODIFY = "action.modifyCategory";
|
||||
const CATEGORY_UPDATE = "action.updateCategory";
|
||||
const CATEGORY_DELETE = "action.deleteCategory";
|
||||
|
||||
/**
|
||||
@@ -134,12 +143,12 @@ final class TheliaEvents
|
||||
/**
|
||||
* Sent just before a successful change of a category in the database.
|
||||
*/
|
||||
const BEFORE_CHANGECATEGORY = "action.before_changecategory";
|
||||
const BEFORE_UPDATECATEGORY = "action.before_updateCategory";
|
||||
|
||||
/**
|
||||
* Sent just after a successful change of a category in the database.
|
||||
*/
|
||||
const AFTER_CHANGECATEGORY = "action.after_changecategory";
|
||||
const AFTER_UPDATECATEGORY = "action.after_updateCategory";
|
||||
|
||||
/**
|
||||
* sent when a new existing cat id duplicated. This append when current customer is different from current cart
|
||||
@@ -154,7 +163,7 @@ final class TheliaEvents
|
||||
/**
|
||||
* sent when a cart item is modify
|
||||
*/
|
||||
const AFTER_CARTCHANGEITEM = "cart.modifyItem";
|
||||
const AFTER_CARTUPDATEITEM = "cart.updateItem";
|
||||
|
||||
/**
|
||||
* sent for addArticle action
|
||||
@@ -164,7 +173,7 @@ final class TheliaEvents
|
||||
/**
|
||||
* sent on modify article action
|
||||
*/
|
||||
const CART_CHANGEITEM = "action.changeArticle";
|
||||
const CART_UPDATEITEM = "action.updateArticle";
|
||||
|
||||
const CART_DELETEITEM = "action.deleteArticle";
|
||||
|
||||
@@ -182,14 +191,14 @@ final class TheliaEvents
|
||||
|
||||
const CONFIG_CREATE = "action.createConfig";
|
||||
const CONFIG_SETVALUE = "action.setConfigValue";
|
||||
const CONFIG_MODIFY = "action.changeConfig";
|
||||
const CONFIG_UPDATE = "action.updateConfig";
|
||||
const CONFIG_DELETE = "action.deleteConfig";
|
||||
|
||||
const BEFORE_CREATECONFIG = "action.before_createConfig";
|
||||
const AFTER_CREATECONFIG = "action.after_createConfig";
|
||||
|
||||
const BEFORE_CHANGECONFIG = "action.before_changeConfig";
|
||||
const AFTER_CHANGECONFIG = "action.after_changeConfig";
|
||||
const BEFORE_UPDATECONFIG = "action.before_updateConfig";
|
||||
const AFTER_UPDATECONFIG = "action.after_updateConfig";
|
||||
|
||||
const BEFORE_DELETECONFIG = "action.before_deleteConfig";
|
||||
const AFTER_DELETECONFIG = "action.after_deleteConfig";
|
||||
@@ -197,14 +206,14 @@ final class TheliaEvents
|
||||
// -- Messages management ---------------------------------------------
|
||||
|
||||
const MESSAGE_CREATE = "action.createMessage";
|
||||
const MESSAGE_MODIFY = "action.changeMessage";
|
||||
const MESSAGE_UPDATE = "action.updateMessage";
|
||||
const MESSAGE_DELETE = "action.deleteMessage";
|
||||
|
||||
const BEFORE_CREATEMESSAGE = "action.before_createMessage";
|
||||
const AFTER_CREATEMESSAGE = "action.after_createMessage";
|
||||
|
||||
const BEFORE_CHANGEMESSAGE = "action.before_changeMessage";
|
||||
const AFTER_CHANGEMESSAGE = "action.after_changeMessage";
|
||||
const BEFORE_UPDATEMESSAGE = "action.before_updateMessage";
|
||||
const AFTER_UPDATEMESSAGE = "action.after_updateMessage";
|
||||
|
||||
const BEFORE_DELETEMESSAGE = "action.before_deleteMessage";
|
||||
const AFTER_DELETEMESSAGE = "action.after_deleteMessage";
|
||||
@@ -212,17 +221,20 @@ final class TheliaEvents
|
||||
// -- Currencies management ---------------------------------------------
|
||||
|
||||
const CURRENCY_CREATE = "action.createCurrency";
|
||||
const CURRENCY_MODIFY = "action.changeCurrency";
|
||||
const CURRENCY_UPDATE = "action.updateCurrency";
|
||||
const CURRENCY_DELETE = "action.deleteCurrency";
|
||||
const CURRENCY_SET_DEFAULT = "action.setDefaultCurrency";
|
||||
const CURRENCY_UPDATE_RATES = "action.updateCurrencyRates";
|
||||
|
||||
|
||||
const BEFORE_CREATECURRENCY = "action.before_createCurrency";
|
||||
const AFTER_CREATECURRENCY = "action.after_createCurrency";
|
||||
|
||||
const BEFORE_CHANGECURRENCY = "action.before_changeCurrency";
|
||||
const AFTER_CHANGECURRENCY = "action.after_changeCurrency";
|
||||
const BEFORE_UPDATECURRENCY = "action.before_updateCurrency";
|
||||
const AFTER_UPDATECURRENCY = "action.after_updateCurrency";
|
||||
|
||||
const BEFORE_DELETECURRENCY = "action.before_deleteCurrency";
|
||||
const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class ViewListener implements EventSubscriberInterface
|
||||
} catch (AuthenticationException $ex) {
|
||||
|
||||
// Redirect to the login template
|
||||
$event->setResponse(Redirect::exec(URL::viewUrl($ex->getLoginTemplate())));
|
||||
Redirect::exec(URL::viewUrl($ex->getLoginTemplate()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class SecurityContext
|
||||
*/
|
||||
public function hasAdminUser()
|
||||
{
|
||||
return $this->getSession()->getAdminUser() != null;
|
||||
return $this->getSession()->getAdminUser() !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ class SecurityContext
|
||||
*/
|
||||
public function hasCustomerUser()
|
||||
{
|
||||
return $this->getSession()->getCustomerUser() != null;
|
||||
return $this->getSession()->getCustomerUser() !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,6 +54,10 @@ abstract class BaseLoop
|
||||
|
||||
protected $args;
|
||||
|
||||
public $countable = true;
|
||||
public $timestampable = false;
|
||||
public $versionable = false;
|
||||
|
||||
/**
|
||||
* Create a new Loop
|
||||
*
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
namespace Thelia\Core\Template\Element;
|
||||
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Util\PropelModelPager;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
class LoopResult implements \Iterator
|
||||
@@ -30,9 +32,14 @@ class LoopResult implements \Iterator
|
||||
private $position;
|
||||
protected $collection = array();
|
||||
|
||||
public function __construct()
|
||||
public $modelCollection = null;
|
||||
|
||||
public function __construct($modelCollection = null)
|
||||
{
|
||||
$this->position = 0;
|
||||
if($modelCollection instanceof ObjectCollection || $modelCollection instanceof PropelModelPager) {
|
||||
$this->modelCollection = $modelCollection;
|
||||
}
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
|
||||
@@ -23,10 +23,37 @@
|
||||
|
||||
namespace Thelia\Core\Template\Element;
|
||||
|
||||
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
|
||||
|
||||
class LoopResultRow
|
||||
{
|
||||
protected $substitution = array();
|
||||
|
||||
public $model = null;
|
||||
public $loopResult;
|
||||
|
||||
public $versionable = false;
|
||||
public $timestampable = false;
|
||||
public $countable = false;
|
||||
|
||||
public function __construct($loopResult = null, $model = null, $versionable = false, $timestampable = false, $countable = true)
|
||||
{
|
||||
if($model instanceof ActiveRecordInterface) {
|
||||
$this->model = $model;
|
||||
|
||||
$this->versionable = $versionable;
|
||||
$this->timestampable = $timestampable;
|
||||
}
|
||||
|
||||
if($loopResult instanceof LoopResult) {
|
||||
$this->loopResult = $loopResult;
|
||||
|
||||
$this->countable = $countable;
|
||||
}
|
||||
|
||||
$this->assignDefaultOutputs();
|
||||
}
|
||||
|
||||
public function set($key, $value)
|
||||
{
|
||||
$this->substitution[$key] = $value === null ? '' : $value;
|
||||
@@ -49,4 +76,38 @@ class LoopResultRow
|
||||
return array_keys($this->substitution);
|
||||
}
|
||||
|
||||
protected function getTimestampOutputs()
|
||||
{
|
||||
return array(
|
||||
array('CREATE_DATE', 'getCreatedAt'),
|
||||
array('UPDATE_DATE', 'getUpdatedAt'),
|
||||
);
|
||||
}
|
||||
|
||||
protected function getVersionOutputs()
|
||||
{
|
||||
return array(
|
||||
array('VERSION', 'getVersion'),
|
||||
array('VERSION_DATE', 'getVersionCreatedAt'),
|
||||
array('VERSION_AUTHOR', 'getVersionCreatedBy'),
|
||||
);
|
||||
}
|
||||
|
||||
protected function assignDefaultOutputs()
|
||||
{
|
||||
if(true === $this->versionable) {
|
||||
foreach($this->getVersionOutputs() as $output) {
|
||||
$this->set($output[0], $this->model->$output[1]());
|
||||
}
|
||||
}
|
||||
if(true === $this->timestampable) {
|
||||
foreach($this->getTimestampOutputs() as $output) {
|
||||
$this->set($output[0], $this->model->$output[1]());
|
||||
}
|
||||
}
|
||||
if(true === $this->countable) {
|
||||
$this->set('LOOP_COUNT', 1 + $this->loopResult->getCount());
|
||||
$this->set('LOOP_TOTAL', $this->loopResult->modelCollection->count());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
@@ -46,6 +47,8 @@ use Thelia\Type;
|
||||
*/
|
||||
class Address extends BaseLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -110,10 +113,10 @@ class Address extends BaseLoop
|
||||
|
||||
$addresses = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($addresses);
|
||||
|
||||
foreach ($addresses as $address) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $address, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow
|
||||
->set("ID", $address->getId())
|
||||
->set("NAME", $address->getName())
|
||||
|
||||
@@ -55,6 +55,8 @@ use Thelia\Type\BooleanOrBothType;
|
||||
*/
|
||||
class Attribute extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -150,10 +152,10 @@ class Attribute extends BaseI18nLoop
|
||||
/* perform search */
|
||||
$attributes = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($attributes);
|
||||
|
||||
foreach ($attributes as $attribute) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $attribute, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $attribute->getId())
|
||||
->set("IS_TRANSLATED",$attribute->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
|
||||
@@ -48,6 +48,8 @@ use Thelia\Type;
|
||||
*/
|
||||
class AttributeAvailability extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -119,10 +121,10 @@ class AttributeAvailability extends BaseI18nLoop
|
||||
/* perform search */
|
||||
$attributesAv = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($attributesAv);
|
||||
|
||||
foreach ($attributesAv as $attributeAv) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $attributeAv, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $attributeAv->getId())
|
||||
->set("IS_TRANSLATED",$attributeAv->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
|
||||
@@ -50,6 +50,8 @@ use Thelia\Type;
|
||||
*/
|
||||
class AttributeCombination extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -111,10 +113,10 @@ class AttributeCombination extends BaseI18nLoop
|
||||
|
||||
$attributeCombinations = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($attributeCombinations);
|
||||
|
||||
foreach ($attributeCombinations as $attributeCombination) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $attributeCombination, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("LOCALE",$locale)
|
||||
|
||||
@@ -71,20 +71,20 @@ class Cart extends BaseLoop
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$result = new LoopResult();
|
||||
$cartItems = $cart->getCartItems();
|
||||
|
||||
$result = new LoopResult($cartItems);
|
||||
$cart = $this->getCart($this->request);
|
||||
|
||||
if ($cart === null) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$cartItems = $cart->getCartItems();
|
||||
|
||||
foreach ($cartItems as $cartItem) {
|
||||
$product = $cartItem->getProduct();
|
||||
//$product->setLocale($this->request->getSession()->getLocale());
|
||||
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($result, $cartItem, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow->set("ITEM_ID", $cartItem->getId());
|
||||
$loopResultRow->set("TITLE", $product->getTitle());
|
||||
|
||||
@@ -64,6 +64,9 @@ use Thelia\Type\BooleanOrBothType;
|
||||
*/
|
||||
class Category extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
public $versionable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -165,7 +168,7 @@ class Category extends BaseI18nLoop
|
||||
/* @todo */
|
||||
$notEmpty = $this->getNot_empty();
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($categories);
|
||||
|
||||
foreach ($categories as $category) {
|
||||
/*
|
||||
@@ -173,7 +176,7 @@ class Category extends BaseI18nLoop
|
||||
* if ($this->getNotEmpty() && $category->countAllProducts() == 0) continue;
|
||||
*/
|
||||
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $category, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $category->getId())
|
||||
@@ -188,12 +191,6 @@ class Category extends BaseI18nLoop
|
||||
->set("PRODUCT_COUNT", $category->countChild())
|
||||
->set("VISIBLE", $category->getVisible() ? "1" : "0")
|
||||
->set("POSITION", $category->getPosition())
|
||||
|
||||
->set("CREATE_DATE", $category->getCreatedAt())
|
||||
->set("UPDATE_DATE", $category->getUpdatedAt())
|
||||
->set("VERSION", $category->getVersion())
|
||||
->set("VERSION_DATE", $category->getVersionCreatedAt())
|
||||
->set("VERSION_AUTHOR", $category->getVersionCreatedBy())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -51,6 +51,8 @@ use Thelia\Type\EnumListType;
|
||||
*/
|
||||
class Config extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -146,11 +148,11 @@ class Config extends BaseI18nLoop
|
||||
|
||||
$results = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($results);
|
||||
|
||||
foreach ($results as $result) {
|
||||
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $result, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID" , $result->getId())
|
||||
@@ -164,12 +166,6 @@ class Config extends BaseI18nLoop
|
||||
->set("POSTSCRIPTUM" , $result->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("HIDDEN" , $result->getHidden())
|
||||
->set("SECURED" , $result->getSecured())
|
||||
|
||||
->set("CREATE_DATE" , $result->getCreatedAt())
|
||||
->set("UPDATE_DATE" , $result->getUpdatedAt())
|
||||
->set("VERSION" , $result->getVersion())
|
||||
->set("VERSION_DATE" , $result->getVersionCreatedAt())
|
||||
->set("VERSION_AUTHOR" , $result->getVersionCreatedBy())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -51,6 +51,9 @@ use Thelia\Type\BooleanOrBothType;
|
||||
*/
|
||||
class Content extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
public $versionable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -207,10 +210,10 @@ class Content extends BaseI18nLoop
|
||||
|
||||
$contents = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($contents);
|
||||
|
||||
foreach ($contents as $content) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $content, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow->set("ID", $content->getId())
|
||||
->set("IS_TRANSLATED",$content->getVirtualColumn('IS_TRANSLATED'))
|
||||
|
||||
@@ -45,6 +45,8 @@ use Thelia\Model\ConfigQuery;
|
||||
*/
|
||||
class Country extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -101,10 +103,10 @@ class Country extends BaseI18nLoop
|
||||
/* perform search */
|
||||
$countries = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($countries);
|
||||
|
||||
foreach ($countries as $country) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $country, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $country->getId())
|
||||
->set("IS_TRANSLATED",$country->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
|
||||
@@ -47,6 +47,8 @@ use Thelia\Type\EnumListType;
|
||||
*/
|
||||
class Currency extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -163,11 +165,11 @@ class Currency extends BaseI18nLoop
|
||||
/* perform search */
|
||||
$currencies = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($currencies);
|
||||
|
||||
foreach ($currencies as $currency) {
|
||||
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $currency, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow
|
||||
->set("ID" , $currency->getId())
|
||||
->set("IS_TRANSLATED" , $currency->getVirtualColumn('IS_TRANSLATED'))
|
||||
@@ -178,9 +180,6 @@ class Currency extends BaseI18nLoop
|
||||
->set("RATE" , $currency->getRate())
|
||||
->set("POSITION" , $currency->getPosition())
|
||||
->set("IS_DEFAULT" , $currency->getByDefault())
|
||||
|
||||
->set("CREATE_DATE" , $currency->getCreatedAt())
|
||||
->set("UPDATE_DATE" , $currency->getUpdatedAt())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
@@ -46,6 +47,8 @@ use Thelia\Type;
|
||||
*/
|
||||
class Customer extends BaseLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -113,10 +116,10 @@ class Customer extends BaseLoop
|
||||
|
||||
$customers = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($customers);
|
||||
|
||||
foreach ($customers as $customer) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $customer, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $customer->getId());
|
||||
$loopResultRow->set("REF", $customer->getRef());
|
||||
$loopResultRow->set("TITLE", $customer->getTitleId());
|
||||
|
||||
@@ -51,6 +51,8 @@ use Thelia\Type\BooleanOrBothType;
|
||||
*/
|
||||
class Feature extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -142,10 +144,10 @@ class Feature extends BaseI18nLoop
|
||||
/* perform search */
|
||||
$features = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($features);
|
||||
|
||||
foreach ($features as $feature) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $feature, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $feature->getId())
|
||||
->set("IS_TRANSLATED",$feature->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
|
||||
@@ -46,6 +46,8 @@ use Thelia\Type;
|
||||
*/
|
||||
class FeatureAvailability extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -117,10 +119,10 @@ class FeatureAvailability extends BaseI18nLoop
|
||||
/* perform search */
|
||||
$featuresAv = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($featuresAv);
|
||||
|
||||
foreach ($featuresAv as $featureAv) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $featureAv, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $featureAv->getId())
|
||||
->set("IS_TRANSLATED",$featureAv->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
|
||||
@@ -51,6 +51,8 @@ use Thelia\Type;
|
||||
*/
|
||||
class FeatureValue extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -135,10 +137,10 @@ class FeatureValue extends BaseI18nLoop
|
||||
|
||||
$featureValues = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($featureValues);
|
||||
|
||||
foreach ($featureValues as $featureValue) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $featureValue, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $featureValue->getId());
|
||||
|
||||
$loopResultRow
|
||||
|
||||
@@ -46,6 +46,9 @@ use Thelia\Type\BooleanOrBothType;
|
||||
*/
|
||||
class Folder extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
public $versionable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -142,7 +145,7 @@ class Folder extends BaseI18nLoop
|
||||
/* @todo */
|
||||
$notEmpty = $this->getNot_empty();
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($folders);
|
||||
|
||||
foreach ($folders as $folder) {
|
||||
|
||||
@@ -151,7 +154,7 @@ class Folder extends BaseI18nLoop
|
||||
* if ($notEmpty && $folder->countAllProducts() == 0) continue;
|
||||
*/
|
||||
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $folder, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $folder->getId())
|
||||
@@ -166,12 +169,6 @@ class Folder extends BaseI18nLoop
|
||||
->set("CONTENT_COUNT", $folder->countChild())
|
||||
->set("VISIBLE", $folder->getVisible() ? "1" : "0")
|
||||
->set("POSITION", $folder->getPosition())
|
||||
|
||||
->set("CREATE_DATE", $folder->getCreatedAt())
|
||||
->set("UPDATE_DATE", $folder->getUpdatedAt())
|
||||
->set("VERSION", $folder->getVersion())
|
||||
->set("VERSION_DATE", $folder->getVersionCreatedAt())
|
||||
->set("VERSION_AUTHOR", $folder->getVersionCreatedBy())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -45,6 +45,8 @@ use Thelia\Log\Tlog;
|
||||
*/
|
||||
class Image extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @var array Possible image sources
|
||||
*/
|
||||
@@ -264,7 +266,7 @@ class Image extends BaseI18nLoop
|
||||
|
||||
$results = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($results);
|
||||
|
||||
foreach ($results as $result) {
|
||||
|
||||
@@ -295,7 +297,7 @@ class Image extends BaseI18nLoop
|
||||
// Dispatch image processing event
|
||||
$this->dispatcher->dispatch(TheliaEvents::IMAGE_PROCESS, $event);
|
||||
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $result, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID" , $result->getId())
|
||||
|
||||
@@ -45,6 +45,8 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
*/
|
||||
class Lang extends BaseLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -84,11 +86,11 @@ class Lang extends BaseLoop
|
||||
|
||||
$results = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($results);
|
||||
|
||||
foreach ($results as $result) {
|
||||
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $result, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $result->getId())
|
||||
@@ -99,9 +101,6 @@ class Lang extends BaseLoop
|
||||
->set("IS_DEFAULT", $result->getByDefault())
|
||||
->set("URL", $result->getUrl())
|
||||
->set("POSITION", $result->getPosition())
|
||||
|
||||
->set("CREATE_DATE", $result->getCreatedAt())
|
||||
->set("UPDATE_DATE", $result->getUpdatedAt())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -49,6 +49,8 @@ use Thelia\Type\BooleanOrBothType;
|
||||
*/
|
||||
class Message extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -101,11 +103,11 @@ class Message extends BaseI18nLoop
|
||||
|
||||
$results = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($results);
|
||||
|
||||
foreach ($results as $result) {
|
||||
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $result, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID" , $result->getId())
|
||||
@@ -117,8 +119,6 @@ class Message extends BaseI18nLoop
|
||||
->set("TEXT_MESSAGE" , $result->getVirtualColumn('i18n_TEXT_MESSAGE'))
|
||||
->set("HTML_MESSAGE" , $result->getVirtualColumn('i18n_HTML_MESSAGE'))
|
||||
->set("SECURED" , $result->getSecured())
|
||||
->set("CREATE_DATE" , $result->getCreatedAt())
|
||||
->set("UPDATE_DATE" , $result->getUpdatedAt())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -58,6 +58,9 @@ use Thelia\Type\BooleanOrBothType;
|
||||
*/
|
||||
class Product extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
public $versionable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -501,10 +504,10 @@ class Product extends BaseI18nLoop
|
||||
/* perform search */
|
||||
$products = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($products);
|
||||
|
||||
foreach ($products as $product) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $product, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow->set("ID", $product->getId())
|
||||
->set("REF",$product->getRef())
|
||||
@@ -519,12 +522,6 @@ class Product extends BaseI18nLoop
|
||||
->set("IS_PROMO", $product->getVirtualColumn('main_product_is_promo'))
|
||||
->set("IS_NEW", $product->getVirtualColumn('main_product_is_new'))
|
||||
->set("POSITION", $product->getPosition())
|
||||
|
||||
->set("CREATE_DATE", $category->getCreatedAt())
|
||||
->set("UPDATE_DATE", $category->getUpdatedAt())
|
||||
->set("VERSION", $category->getVersion())
|
||||
->set("VERSION_DATE", $category->getVersionCreatedAt())
|
||||
->set("VERSION_AUTHOR", $category->getVersionCreatedBy())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -50,6 +50,8 @@ use Thelia\Type;
|
||||
*/
|
||||
class ProductSaleElements extends BaseLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -117,10 +119,10 @@ class ProductSaleElements extends BaseLoop
|
||||
|
||||
$PSEValues = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($PSEValues);
|
||||
|
||||
foreach ($PSEValues as $PSEValue) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $PSEValue, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow->set("ID", $PSEValue->getId())
|
||||
->set("QUANTITY", $PSEValue->getQuantity())
|
||||
|
||||
@@ -45,6 +45,8 @@ use Thelia\Model\ConfigQuery;
|
||||
*/
|
||||
class Title extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
@@ -78,10 +80,10 @@ class Title extends BaseI18nLoop
|
||||
/* perform search */
|
||||
$titles = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult();
|
||||
$loopResult = new LoopResult($titles);
|
||||
|
||||
foreach ($titles as $title) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow = new LoopResultRow($loopResult, $title, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $title->getId())
|
||||
->set("IS_TRANSLATED",$title->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
|
||||
@@ -138,22 +138,6 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
if ($loopResults->valid()) {
|
||||
$loopResultRow = $loopResults->current();
|
||||
|
||||
// On first iteration, save variables that may be overwritten by this loop
|
||||
if (! isset($this->varstack[$name])) {
|
||||
|
||||
$saved_vars = array();
|
||||
|
||||
$varlist = $loopResultRow->getVars();
|
||||
$varlist[] = 'LOOP_COUNT';
|
||||
$varlist[] = 'LOOP_TOTAL';
|
||||
|
||||
foreach ($varlist as $var) {
|
||||
$saved_vars[$var] = $template->getTemplateVars($var);
|
||||
}
|
||||
|
||||
$this->varstack[$name] = $saved_vars;
|
||||
}
|
||||
|
||||
foreach ($loopResultRow->getVarVal() as $var => $val) {
|
||||
$template->assign($var, $val);
|
||||
}
|
||||
@@ -161,10 +145,6 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
$repeat = true;
|
||||
}
|
||||
|
||||
// Assign meta information
|
||||
$template->assign('LOOP_COUNT', 1 + $loopResults->key());
|
||||
$template->assign('LOOP_TOTAL', $loopResults->getCount());
|
||||
|
||||
// Loop is terminated. Cleanup.
|
||||
if (! $repeat) {
|
||||
// Restore previous variables values before terminating
|
||||
|
||||
@@ -169,9 +169,7 @@ class UrlGenerator extends AbstractSmartyPlugin
|
||||
|
||||
protected function getCurrentUrl()
|
||||
{
|
||||
$retriever = URL::init()->retrieveCurrent($this->request);
|
||||
|
||||
return $retriever->rewrittenUrl === null ? $retriever->url : $retriever->rewrittenUrl ;
|
||||
return URL::init()->retrieveCurrent($this->request)->toString();
|
||||
}
|
||||
|
||||
protected function getReturnToUrl()
|
||||
|
||||
@@ -36,6 +36,7 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
* @param ParserContext $parserContext
|
||||
* @param bool $template
|
||||
* @param string $env
|
||||
* @param bool $debug
|
||||
|
||||
132
core/lib/Thelia/Form/AddressForm.php
Normal file
132
core/lib/Thelia/Form/AddressForm.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Form;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
|
||||
/**
|
||||
* Class AddressForm
|
||||
* @package Thelia\Form
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AddressForm extends BaseForm
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* in this function you add all the fields you need for your Form.
|
||||
* Form this you have to call add method on $this->formBuilder attribute :
|
||||
*
|
||||
* $this->formBuilder->add("name", "text")
|
||||
* ->add("email", "email", array(
|
||||
* "attr" => array(
|
||||
* "class" => "field"
|
||||
* ),
|
||||
* "label" => "email",
|
||||
* "constraints" => array(
|
||||
* new \Symfony\Component\Validator\Constraints\NotBlank()
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ->add('age', 'integer');
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("label", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "address name"
|
||||
))
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "title"
|
||||
))
|
||||
->add("firstname", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "first name"
|
||||
))
|
||||
->add("lastname", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "last name"
|
||||
))
|
||||
->add("address1", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "address"
|
||||
))
|
||||
->add("address2", "text", array(
|
||||
"label" => "address (line 2)"
|
||||
))
|
||||
->add("address3", "text", array(
|
||||
"label" => "address (line 3)"
|
||||
))
|
||||
->add("zipcode", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "zipcode"
|
||||
))
|
||||
->add("city", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "city"
|
||||
))
|
||||
->add("country", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "country"
|
||||
))
|
||||
->add("phone", "text", array(
|
||||
"label" => "phone"
|
||||
))
|
||||
->add("cellphone", "text", array(
|
||||
"label" => "cellphone"
|
||||
))
|
||||
->add("company", "text", array(
|
||||
"label" => "company"
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of you form. This name must be unique
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_address_creation";
|
||||
}
|
||||
}
|
||||
46
core/lib/Thelia/Install/BaseInstall.php
Normal file
46
core/lib/Thelia/Install/BaseInstall.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Install;
|
||||
use Thelia\Install\Exception\AlreadyInstallException;
|
||||
|
||||
/**
|
||||
* Class BaseInstall
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
abstract class BaseInstall
|
||||
{
|
||||
/**
|
||||
* Verify if an installation already exists
|
||||
*/
|
||||
public function __construct($verifyInstall = true)
|
||||
{
|
||||
if (file_exists(THELIA_ROOT . '/local/config/database.yml') && $verifyInstall) {
|
||||
throw new AlreadyInstallException("Thelia is already installed");
|
||||
}
|
||||
|
||||
|
||||
$this->exec();
|
||||
}
|
||||
|
||||
abstract public function exec();
|
||||
}
|
||||
78
core/lib/Thelia/Install/CheckPermission.php
Normal file
78
core/lib/Thelia/Install/CheckPermission.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Install;
|
||||
|
||||
|
||||
/**
|
||||
* Class CheckPermission
|
||||
* @package Thelia\Install
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class CheckPermission extends BaseInstall
|
||||
{
|
||||
const CONF = "const";
|
||||
const LOG = "log";
|
||||
const CACHE = "cache";
|
||||
|
||||
private $directories = array();
|
||||
private $validation = array();
|
||||
private $valid = true;
|
||||
|
||||
public function __construct($verifyInstall = true)
|
||||
{
|
||||
|
||||
|
||||
$this->directories = array(
|
||||
self::CONF => THELIA_ROOT . "local/config",
|
||||
self::LOG => THELIA_ROOT . "log",
|
||||
self::CACHE => THELIA_ROOT . "cache"
|
||||
);
|
||||
|
||||
$this->validation = array(
|
||||
self::CONF => array(
|
||||
"text" => sprintf("config directory(%s)...", $this->directories[self::CONF]),
|
||||
"status" => true
|
||||
),
|
||||
self::LOG => array(
|
||||
"text" => sprintf("cache directory(%s)...", $this->directories[self::LOG]),
|
||||
"status" => true
|
||||
),
|
||||
self::CACHE => array(
|
||||
"text" => sprintf("log directory(%s)...", $this->directories[self::CACHE]),
|
||||
"status" => true
|
||||
)
|
||||
);
|
||||
parent::__construct($verifyInstall);
|
||||
}
|
||||
|
||||
public function exec()
|
||||
{
|
||||
foreach ($this->directories as $key => $directory) {
|
||||
if(is_writable($directory) === false) {
|
||||
$this->valid = false;
|
||||
$this->validation[$key]["status"] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
103
core/lib/Thelia/Install/Database.php
Normal file
103
core/lib/Thelia/Install/Database.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Install;
|
||||
|
||||
|
||||
/**
|
||||
* Class Database
|
||||
* @package Thelia\Install
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class Database
|
||||
{
|
||||
public $connection;
|
||||
|
||||
public function __construct(\PDO $connection)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert all sql needed in database
|
||||
*
|
||||
* @param $dbName
|
||||
*/
|
||||
public function insertSql($dbName = null)
|
||||
{
|
||||
if($dbName) {
|
||||
$this->connection->query(sprintf("use %s", $dbName));
|
||||
}
|
||||
|
||||
$sql = array();
|
||||
$sql = array_merge(
|
||||
$sql,
|
||||
$this->prepareSql(file_get_contents(THELIA_ROOT . "/install/thelia.sql")),
|
||||
$this->prepareSql(file_get_contents(THELIA_ROOT . "/install/insert.sql"))
|
||||
);
|
||||
|
||||
for ($i = 0; $i < count($sql); $i ++) {
|
||||
if (!empty($sql[$i])) {
|
||||
$this->connection->query($sql[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Separate each sql instruction in an array
|
||||
*
|
||||
* @param $sql
|
||||
* @return array
|
||||
*/
|
||||
protected function prepareSql($sql)
|
||||
{
|
||||
$sql = str_replace(";',", "-CODE-", $sql);
|
||||
$sql = trim($sql);
|
||||
$query = array();
|
||||
|
||||
$tab = explode(";", $sql);
|
||||
|
||||
for ($i=0; $i<count($tab); $i++) {
|
||||
$queryTemp = str_replace("-CODE-", ";',", $tab[$i]);
|
||||
$queryTemp = str_replace("|", ";", $queryTemp);
|
||||
$query[] = $queryTemp;
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* create database if not exists
|
||||
*
|
||||
* @param $dbName
|
||||
*/
|
||||
public function createDatabase($dbName)
|
||||
{
|
||||
$this->connection->query(
|
||||
sprintf(
|
||||
"CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8",
|
||||
$dbName
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Install\Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Class AlreadyInstallException
|
||||
* @package Thelia\Install\Exception
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AlreadyInstallException extends InstallException
|
||||
{
|
||||
|
||||
}
|
||||
32
core/lib/Thelia/Install/Exception/InstallException.php
Normal file
32
core/lib/Thelia/Install/Exception/InstallException.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Install\Exception;
|
||||
|
||||
/**
|
||||
* Class InstallException
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class InstallException extends \RuntimeException
|
||||
{
|
||||
|
||||
}
|
||||
@@ -2,8 +2,21 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Thelia\Model\Base\Address as BaseAddress;
|
||||
|
||||
class Address extends BaseAddress {
|
||||
|
||||
protected $dispatcher;
|
||||
|
||||
public function setDispatcher(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
public function getDispatcher()
|
||||
{
|
||||
return $this->dispatcher;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ abstract class Address implements ActiveRecordInterface
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* The value for the name field.
|
||||
* The value for the label field.
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
protected $label;
|
||||
|
||||
/**
|
||||
* The value for the customer_id field.
|
||||
@@ -498,14 +498,14 @@ abstract class Address implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [name] column value.
|
||||
* Get the [label] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
public function getLabel()
|
||||
{
|
||||
|
||||
return $this->name;
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -724,25 +724,25 @@ abstract class Address implements ActiveRecordInterface
|
||||
} // setId()
|
||||
|
||||
/**
|
||||
* Set the value of [name] column.
|
||||
* Set the value of [label] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Address The current object (for fluent API support)
|
||||
*/
|
||||
public function setName($v)
|
||||
public function setLabel($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->name !== $v) {
|
||||
$this->name = $v;
|
||||
$this->modifiedColumns[] = AddressTableMap::NAME;
|
||||
if ($this->label !== $v) {
|
||||
$this->label = $v;
|
||||
$this->modifiedColumns[] = AddressTableMap::LABEL;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setName()
|
||||
} // setLabel()
|
||||
|
||||
/**
|
||||
* Set the value of [customer_id] column.
|
||||
@@ -1136,8 +1136,8 @@ abstract class Address implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AddressTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AddressTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->name = (null !== $col) ? (string) $col : null;
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AddressTableMap::translateFieldName('Label', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->label = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AddressTableMap::translateFieldName('CustomerId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->customer_id = (null !== $col) ? (int) $col : null;
|
||||
@@ -1501,8 +1501,8 @@ abstract class Address implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(AddressTableMap::ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'ID';
|
||||
}
|
||||
if ($this->isColumnModified(AddressTableMap::NAME)) {
|
||||
$modifiedColumns[':p' . $index++] = 'NAME';
|
||||
if ($this->isColumnModified(AddressTableMap::LABEL)) {
|
||||
$modifiedColumns[':p' . $index++] = 'LABEL';
|
||||
}
|
||||
if ($this->isColumnModified(AddressTableMap::CUSTOMER_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CUSTOMER_ID';
|
||||
@@ -1566,8 +1566,8 @@ abstract class Address implements ActiveRecordInterface
|
||||
case 'ID':
|
||||
$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'NAME':
|
||||
$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
|
||||
case 'LABEL':
|
||||
$stmt->bindValue($identifier, $this->label, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CUSTOMER_ID':
|
||||
$stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT);
|
||||
@@ -1683,7 +1683,7 @@ abstract class Address implements ActiveRecordInterface
|
||||
return $this->getId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getName();
|
||||
return $this->getLabel();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getCustomerId();
|
||||
@@ -1763,7 +1763,7 @@ abstract class Address implements ActiveRecordInterface
|
||||
$keys = AddressTableMap::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getName(),
|
||||
$keys[1] => $this->getLabel(),
|
||||
$keys[2] => $this->getCustomerId(),
|
||||
$keys[3] => $this->getTitleId(),
|
||||
$keys[4] => $this->getCompany(),
|
||||
@@ -1841,7 +1841,7 @@ abstract class Address implements ActiveRecordInterface
|
||||
$this->setId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setName($value);
|
||||
$this->setLabel($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setCustomerId($value);
|
||||
@@ -1916,7 +1916,7 @@ abstract class Address implements ActiveRecordInterface
|
||||
$keys = AddressTableMap::getFieldNames($keyType);
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setLabel($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setCustomerId($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setTitleId($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setCompany($arr[$keys[4]]);
|
||||
@@ -1945,7 +1945,7 @@ abstract class Address implements ActiveRecordInterface
|
||||
$criteria = new Criteria(AddressTableMap::DATABASE_NAME);
|
||||
|
||||
if ($this->isColumnModified(AddressTableMap::ID)) $criteria->add(AddressTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(AddressTableMap::NAME)) $criteria->add(AddressTableMap::NAME, $this->name);
|
||||
if ($this->isColumnModified(AddressTableMap::LABEL)) $criteria->add(AddressTableMap::LABEL, $this->label);
|
||||
if ($this->isColumnModified(AddressTableMap::CUSTOMER_ID)) $criteria->add(AddressTableMap::CUSTOMER_ID, $this->customer_id);
|
||||
if ($this->isColumnModified(AddressTableMap::TITLE_ID)) $criteria->add(AddressTableMap::TITLE_ID, $this->title_id);
|
||||
if ($this->isColumnModified(AddressTableMap::COMPANY)) $criteria->add(AddressTableMap::COMPANY, $this->company);
|
||||
@@ -2025,7 +2025,7 @@ abstract class Address implements ActiveRecordInterface
|
||||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
||||
{
|
||||
$copyObj->setName($this->getName());
|
||||
$copyObj->setLabel($this->getLabel());
|
||||
$copyObj->setCustomerId($this->getCustomerId());
|
||||
$copyObj->setTitleId($this->getTitleId());
|
||||
$copyObj->setCompany($this->getCompany());
|
||||
@@ -2804,7 +2804,7 @@ abstract class Address implements ActiveRecordInterface
|
||||
public function clear()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->name = null;
|
||||
$this->label = null;
|
||||
$this->customer_id = null;
|
||||
$this->title_id = null;
|
||||
$this->company = null;
|
||||
|
||||
@@ -22,7 +22,7 @@ use Thelia\Model\Map\AddressTableMap;
|
||||
*
|
||||
*
|
||||
* @method ChildAddressQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildAddressQuery orderByName($order = Criteria::ASC) Order by the name column
|
||||
* @method ChildAddressQuery orderByLabel($order = Criteria::ASC) Order by the label column
|
||||
* @method ChildAddressQuery orderByCustomerId($order = Criteria::ASC) Order by the customer_id column
|
||||
* @method ChildAddressQuery orderByTitleId($order = Criteria::ASC) Order by the title_id column
|
||||
* @method ChildAddressQuery orderByCompany($order = Criteria::ASC) Order by the company column
|
||||
@@ -41,7 +41,7 @@ use Thelia\Model\Map\AddressTableMap;
|
||||
* @method ChildAddressQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildAddressQuery groupById() Group by the id column
|
||||
* @method ChildAddressQuery groupByName() Group by the name column
|
||||
* @method ChildAddressQuery groupByLabel() Group by the label column
|
||||
* @method ChildAddressQuery groupByCustomerId() Group by the customer_id column
|
||||
* @method ChildAddressQuery groupByTitleId() Group by the title_id column
|
||||
* @method ChildAddressQuery groupByCompany() Group by the company column
|
||||
@@ -87,7 +87,7 @@ use Thelia\Model\Map\AddressTableMap;
|
||||
* @method ChildAddress findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAddress matching the query, or a new ChildAddress object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildAddress findOneById(int $id) Return the first ChildAddress filtered by the id column
|
||||
* @method ChildAddress findOneByName(string $name) Return the first ChildAddress filtered by the name column
|
||||
* @method ChildAddress findOneByLabel(string $label) Return the first ChildAddress filtered by the label column
|
||||
* @method ChildAddress findOneByCustomerId(int $customer_id) Return the first ChildAddress filtered by the customer_id column
|
||||
* @method ChildAddress findOneByTitleId(int $title_id) Return the first ChildAddress filtered by the title_id column
|
||||
* @method ChildAddress findOneByCompany(string $company) Return the first ChildAddress filtered by the company column
|
||||
@@ -106,7 +106,7 @@ use Thelia\Model\Map\AddressTableMap;
|
||||
* @method ChildAddress findOneByUpdatedAt(string $updated_at) Return the first ChildAddress filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildAddress objects filtered by the id column
|
||||
* @method array findByName(string $name) Return ChildAddress objects filtered by the name column
|
||||
* @method array findByLabel(string $label) Return ChildAddress objects filtered by the label column
|
||||
* @method array findByCustomerId(int $customer_id) Return ChildAddress objects filtered by the customer_id column
|
||||
* @method array findByTitleId(int $title_id) Return ChildAddress objects filtered by the title_id column
|
||||
* @method array findByCompany(string $company) Return ChildAddress objects filtered by the company column
|
||||
@@ -211,7 +211,7 @@ abstract class AddressQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, NAME, CUSTOMER_ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, LABEL, CUSTOMER_ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -342,32 +342,32 @@ abstract class AddressQuery extends ModelCriteria
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the name column
|
||||
* Filter the query on the label column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByName('fooValue'); // WHERE name = 'fooValue'
|
||||
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
|
||||
* $query->filterByLabel('fooValue'); // WHERE label = 'fooValue'
|
||||
* $query->filterByLabel('%fooValue%'); // WHERE label LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $name The value to use as filter.
|
||||
* @param string $label The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByName($name = null, $comparison = null)
|
||||
public function filterByLabel($label = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($name)) {
|
||||
if (is_array($label)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $name)) {
|
||||
$name = str_replace('*', '%', $name);
|
||||
} elseif (preg_match('/[\%\*]/', $label)) {
|
||||
$label = str_replace('*', '%', $label);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressTableMap::NAME, $name, $comparison);
|
||||
return $this->addUsingAlias(AddressTableMap::LABEL, $label, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,8 +20,6 @@ use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\Coupon as ChildCoupon;
|
||||
use Thelia\Model\CouponI18n as ChildCouponI18n;
|
||||
use Thelia\Model\CouponI18nQuery as ChildCouponI18nQuery;
|
||||
use Thelia\Model\CouponOrder as ChildCouponOrder;
|
||||
use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery;
|
||||
use Thelia\Model\CouponQuery as ChildCouponQuery;
|
||||
use Thelia\Model\CouponVersion as ChildCouponVersion;
|
||||
use Thelia\Model\CouponVersionQuery as ChildCouponVersionQuery;
|
||||
@@ -80,24 +78,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* The value for the title field.
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* The value for the short_description field.
|
||||
* @var string
|
||||
*/
|
||||
protected $short_description;
|
||||
|
||||
/**
|
||||
* The value for the description field.
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* The value for the amount field.
|
||||
* @var double
|
||||
@@ -171,12 +151,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
*/
|
||||
protected $version;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildCouponOrder[] Collection to store aggregation of ChildCouponOrder objects.
|
||||
*/
|
||||
protected $collCouponOrders;
|
||||
protected $collCouponOrdersPartial;
|
||||
|
||||
/**
|
||||
* @var ObjectCollection|ChildCouponI18n[] Collection to store aggregation of ChildCouponI18n objects.
|
||||
*/
|
||||
@@ -219,12 +193,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
*/
|
||||
protected $enforceVersion = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
*/
|
||||
protected $couponOrdersScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var ObjectCollection
|
||||
@@ -537,39 +505,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [title] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [short_description] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShortDescription()
|
||||
{
|
||||
|
||||
return $this->short_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [description] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [amount] column value.
|
||||
*
|
||||
@@ -792,69 +727,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setType()
|
||||
|
||||
/**
|
||||
* Set the value of [title] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||
*/
|
||||
public function setTitle($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->title !== $v) {
|
||||
$this->title = $v;
|
||||
$this->modifiedColumns[] = CouponTableMap::TITLE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setTitle()
|
||||
|
||||
/**
|
||||
* Set the value of [short_description] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||
*/
|
||||
public function setShortDescription($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->short_description !== $v) {
|
||||
$this->short_description = $v;
|
||||
$this->modifiedColumns[] = CouponTableMap::SHORT_DESCRIPTION;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setShortDescription()
|
||||
|
||||
/**
|
||||
* Set the value of [description] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||
*/
|
||||
public function setDescription($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->description !== $v) {
|
||||
$this->description = $v;
|
||||
$this->modifiedColumns[] = CouponTableMap::DESCRIPTION;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setDescription()
|
||||
|
||||
/**
|
||||
* Set the value of [amount] column.
|
||||
*
|
||||
@@ -1165,58 +1037,49 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->type = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->title = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->short_description = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->description = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->amount = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_used = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_enabled = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->serialized_rules = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_cumulative = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_removing_postage = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->max_usage = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_available_on_special_offers = (null !== $col) ? (boolean) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version = (null !== $col) ? (int) $col : null;
|
||||
$this->resetModified();
|
||||
|
||||
@@ -1226,7 +1089,7 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 18; // 18 = CouponTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 15; // 15 = CouponTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Coupon object", 0, $e);
|
||||
@@ -1287,8 +1150,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->collCouponOrders = null;
|
||||
|
||||
$this->collCouponI18ns = null;
|
||||
|
||||
$this->collCouponVersions = null;
|
||||
@@ -1435,23 +1296,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->couponOrdersScheduledForDeletion !== null) {
|
||||
if (!$this->couponOrdersScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\CouponOrderQuery::create()
|
||||
->filterByPrimaryKeys($this->couponOrdersScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->couponOrdersScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collCouponOrders !== null) {
|
||||
foreach ($this->collCouponOrders as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->couponI18nsScheduledForDeletion !== null) {
|
||||
if (!$this->couponI18nsScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\CouponI18nQuery::create()
|
||||
@@ -1521,15 +1365,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponTableMap::TYPE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TYPE';
|
||||
}
|
||||
if ($this->isColumnModified(CouponTableMap::TITLE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TITLE';
|
||||
}
|
||||
if ($this->isColumnModified(CouponTableMap::SHORT_DESCRIPTION)) {
|
||||
$modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION';
|
||||
}
|
||||
if ($this->isColumnModified(CouponTableMap::DESCRIPTION)) {
|
||||
$modifiedColumns[':p' . $index++] = 'DESCRIPTION';
|
||||
}
|
||||
if ($this->isColumnModified(CouponTableMap::AMOUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'AMOUNT';
|
||||
}
|
||||
@@ -1586,15 +1421,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
case 'TYPE':
|
||||
$stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'TITLE':
|
||||
$stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'SHORT_DESCRIPTION':
|
||||
$stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'DESCRIPTION':
|
||||
$stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'AMOUNT':
|
||||
$stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1703,48 +1529,39 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
return $this->getType();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getTitle();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getShortDescription();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getDescription();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getAmount();
|
||||
break;
|
||||
case 7:
|
||||
case 4:
|
||||
return $this->getIsUsed();
|
||||
break;
|
||||
case 8:
|
||||
case 5:
|
||||
return $this->getIsEnabled();
|
||||
break;
|
||||
case 9:
|
||||
case 6:
|
||||
return $this->getExpirationDate();
|
||||
break;
|
||||
case 10:
|
||||
case 7:
|
||||
return $this->getSerializedRules();
|
||||
break;
|
||||
case 11:
|
||||
case 8:
|
||||
return $this->getIsCumulative();
|
||||
break;
|
||||
case 12:
|
||||
case 9:
|
||||
return $this->getIsRemovingPostage();
|
||||
break;
|
||||
case 13:
|
||||
case 10:
|
||||
return $this->getMaxUsage();
|
||||
break;
|
||||
case 14:
|
||||
case 11:
|
||||
return $this->getIsAvailableOnSpecialOffers();
|
||||
break;
|
||||
case 15:
|
||||
case 12:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 16:
|
||||
case 13:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
case 17:
|
||||
case 14:
|
||||
return $this->getVersion();
|
||||
break;
|
||||
default:
|
||||
@@ -1779,21 +1596,18 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getCode(),
|
||||
$keys[2] => $this->getType(),
|
||||
$keys[3] => $this->getTitle(),
|
||||
$keys[4] => $this->getShortDescription(),
|
||||
$keys[5] => $this->getDescription(),
|
||||
$keys[6] => $this->getAmount(),
|
||||
$keys[7] => $this->getIsUsed(),
|
||||
$keys[8] => $this->getIsEnabled(),
|
||||
$keys[9] => $this->getExpirationDate(),
|
||||
$keys[10] => $this->getSerializedRules(),
|
||||
$keys[11] => $this->getIsCumulative(),
|
||||
$keys[12] => $this->getIsRemovingPostage(),
|
||||
$keys[13] => $this->getMaxUsage(),
|
||||
$keys[14] => $this->getIsAvailableOnSpecialOffers(),
|
||||
$keys[15] => $this->getCreatedAt(),
|
||||
$keys[16] => $this->getUpdatedAt(),
|
||||
$keys[17] => $this->getVersion(),
|
||||
$keys[3] => $this->getAmount(),
|
||||
$keys[4] => $this->getIsUsed(),
|
||||
$keys[5] => $this->getIsEnabled(),
|
||||
$keys[6] => $this->getExpirationDate(),
|
||||
$keys[7] => $this->getSerializedRules(),
|
||||
$keys[8] => $this->getIsCumulative(),
|
||||
$keys[9] => $this->getIsRemovingPostage(),
|
||||
$keys[10] => $this->getMaxUsage(),
|
||||
$keys[11] => $this->getIsAvailableOnSpecialOffers(),
|
||||
$keys[12] => $this->getCreatedAt(),
|
||||
$keys[13] => $this->getUpdatedAt(),
|
||||
$keys[14] => $this->getVersion(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1802,9 +1616,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
}
|
||||
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->collCouponOrders) {
|
||||
$result['CouponOrders'] = $this->collCouponOrders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->collCouponI18ns) {
|
||||
$result['CouponI18ns'] = $this->collCouponI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
@@ -1855,48 +1666,39 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->setType($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setTitle($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setShortDescription($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setDescription($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setAmount($value);
|
||||
break;
|
||||
case 7:
|
||||
case 4:
|
||||
$this->setIsUsed($value);
|
||||
break;
|
||||
case 8:
|
||||
case 5:
|
||||
$this->setIsEnabled($value);
|
||||
break;
|
||||
case 9:
|
||||
case 6:
|
||||
$this->setExpirationDate($value);
|
||||
break;
|
||||
case 10:
|
||||
case 7:
|
||||
$this->setSerializedRules($value);
|
||||
break;
|
||||
case 11:
|
||||
case 8:
|
||||
$this->setIsCumulative($value);
|
||||
break;
|
||||
case 12:
|
||||
case 9:
|
||||
$this->setIsRemovingPostage($value);
|
||||
break;
|
||||
case 13:
|
||||
case 10:
|
||||
$this->setMaxUsage($value);
|
||||
break;
|
||||
case 14:
|
||||
case 11:
|
||||
$this->setIsAvailableOnSpecialOffers($value);
|
||||
break;
|
||||
case 15:
|
||||
case 12:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 16:
|
||||
case 13:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
case 17:
|
||||
case 14:
|
||||
$this->setVersion($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1926,21 +1728,18 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setShortDescription($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setDescription($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setAmount($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setIsUsed($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setIsEnabled($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setExpirationDate($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setSerializedRules($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setIsCumulative($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setIsRemovingPostage($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setMaxUsage($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setCreatedAt($arr[$keys[15]]);
|
||||
if (array_key_exists($keys[16], $arr)) $this->setUpdatedAt($arr[$keys[16]]);
|
||||
if (array_key_exists($keys[17], $arr)) $this->setVersion($arr[$keys[17]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setIsUsed($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setIsEnabled($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setExpirationDate($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setSerializedRules($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setIsCumulative($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setIsRemovingPostage($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setMaxUsage($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1955,9 +1754,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponTableMap::ID)) $criteria->add(CouponTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(CouponTableMap::CODE)) $criteria->add(CouponTableMap::CODE, $this->code);
|
||||
if ($this->isColumnModified(CouponTableMap::TYPE)) $criteria->add(CouponTableMap::TYPE, $this->type);
|
||||
if ($this->isColumnModified(CouponTableMap::TITLE)) $criteria->add(CouponTableMap::TITLE, $this->title);
|
||||
if ($this->isColumnModified(CouponTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponTableMap::SHORT_DESCRIPTION, $this->short_description);
|
||||
if ($this->isColumnModified(CouponTableMap::DESCRIPTION)) $criteria->add(CouponTableMap::DESCRIPTION, $this->description);
|
||||
if ($this->isColumnModified(CouponTableMap::AMOUNT)) $criteria->add(CouponTableMap::AMOUNT, $this->amount);
|
||||
if ($this->isColumnModified(CouponTableMap::IS_USED)) $criteria->add(CouponTableMap::IS_USED, $this->is_used);
|
||||
if ($this->isColumnModified(CouponTableMap::IS_ENABLED)) $criteria->add(CouponTableMap::IS_ENABLED, $this->is_enabled);
|
||||
@@ -2035,9 +1831,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
{
|
||||
$copyObj->setCode($this->getCode());
|
||||
$copyObj->setType($this->getType());
|
||||
$copyObj->setTitle($this->getTitle());
|
||||
$copyObj->setShortDescription($this->getShortDescription());
|
||||
$copyObj->setDescription($this->getDescription());
|
||||
$copyObj->setAmount($this->getAmount());
|
||||
$copyObj->setIsUsed($this->getIsUsed());
|
||||
$copyObj->setIsEnabled($this->getIsEnabled());
|
||||
@@ -2056,12 +1849,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
// the getter/setter methods for fkey referrer objects.
|
||||
$copyObj->setNew(false);
|
||||
|
||||
foreach ($this->getCouponOrders() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addCouponOrder($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getCouponI18ns() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addCouponI18n($relObj->copy($deepCopy));
|
||||
@@ -2115,9 +1902,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
if ('CouponOrder' == $relationName) {
|
||||
return $this->initCouponOrders();
|
||||
}
|
||||
if ('CouponI18n' == $relationName) {
|
||||
return $this->initCouponI18ns();
|
||||
}
|
||||
@@ -2126,249 +1910,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCouponOrders collection
|
||||
*
|
||||
* This does not modify the database; however, it will remove any associated objects, causing
|
||||
* them to be refetched by subsequent calls to accessor method.
|
||||
*
|
||||
* @return void
|
||||
* @see addCouponOrders()
|
||||
*/
|
||||
public function clearCouponOrders()
|
||||
{
|
||||
$this->collCouponOrders = null; // important to set this to NULL since that means it is uninitialized
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset is the collCouponOrders collection loaded partially.
|
||||
*/
|
||||
public function resetPartialCouponOrders($v = true)
|
||||
{
|
||||
$this->collCouponOrdersPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCouponOrders collection.
|
||||
*
|
||||
* By default this just sets the collCouponOrders collection to an empty array (like clearcollCouponOrders());
|
||||
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||
* to your application -- for example, setting the initial array to the values stored in database.
|
||||
*
|
||||
* @param boolean $overrideExisting If set to true, the method call initializes
|
||||
* the collection even if it is not empty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initCouponOrders($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collCouponOrders && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collCouponOrders = new ObjectCollection();
|
||||
$this->collCouponOrders->setModel('\Thelia\Model\CouponOrder');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of ChildCouponOrder objects which contain a foreign key that references this object.
|
||||
*
|
||||
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||
* Otherwise the results are fetched from the database the first time, then cached.
|
||||
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||
* If this ChildCoupon is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCouponOrders($criteria = null, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collCouponOrdersPartial && !$this->isNew();
|
||||
if (null === $this->collCouponOrders || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collCouponOrders) {
|
||||
// return empty collection
|
||||
$this->initCouponOrders();
|
||||
} else {
|
||||
$collCouponOrders = ChildCouponOrderQuery::create(null, $criteria)
|
||||
->filterByCoupon($this)
|
||||
->find($con);
|
||||
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collCouponOrdersPartial && count($collCouponOrders)) {
|
||||
$this->initCouponOrders(false);
|
||||
|
||||
foreach ($collCouponOrders as $obj) {
|
||||
if (false == $this->collCouponOrders->contains($obj)) {
|
||||
$this->collCouponOrders->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCouponOrdersPartial = true;
|
||||
}
|
||||
|
||||
$collCouponOrders->getInternalIterator()->rewind();
|
||||
|
||||
return $collCouponOrders;
|
||||
}
|
||||
|
||||
if ($partial && $this->collCouponOrders) {
|
||||
foreach ($this->collCouponOrders as $obj) {
|
||||
if ($obj->isNew()) {
|
||||
$collCouponOrders[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCouponOrders = $collCouponOrders;
|
||||
$this->collCouponOrdersPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collCouponOrders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of CouponOrder objects related by a one-to-many relationship
|
||||
* to the current object.
|
||||
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
|
||||
* and new objects from the given Propel collection.
|
||||
*
|
||||
* @param Collection $couponOrders A Propel collection.
|
||||
* @param ConnectionInterface $con Optional connection object
|
||||
* @return ChildCoupon The current object (for fluent API support)
|
||||
*/
|
||||
public function setCouponOrders(Collection $couponOrders, ConnectionInterface $con = null)
|
||||
{
|
||||
$couponOrdersToDelete = $this->getCouponOrders(new Criteria(), $con)->diff($couponOrders);
|
||||
|
||||
|
||||
$this->couponOrdersScheduledForDeletion = $couponOrdersToDelete;
|
||||
|
||||
foreach ($couponOrdersToDelete as $couponOrderRemoved) {
|
||||
$couponOrderRemoved->setCoupon(null);
|
||||
}
|
||||
|
||||
$this->collCouponOrders = null;
|
||||
foreach ($couponOrders as $couponOrder) {
|
||||
$this->addCouponOrder($couponOrder);
|
||||
}
|
||||
|
||||
$this->collCouponOrders = $couponOrders;
|
||||
$this->collCouponOrdersPartial = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related CouponOrder objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param ConnectionInterface $con
|
||||
* @return int Count of related CouponOrder objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countCouponOrders(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
|
||||
{
|
||||
$partial = $this->collCouponOrdersPartial && !$this->isNew();
|
||||
if (null === $this->collCouponOrders || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collCouponOrders) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($partial && !$criteria) {
|
||||
return count($this->getCouponOrders());
|
||||
}
|
||||
|
||||
$query = ChildCouponOrderQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByCoupon($this)
|
||||
->count($con);
|
||||
}
|
||||
|
||||
return count($this->collCouponOrders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a ChildCouponOrder object to this object
|
||||
* through the ChildCouponOrder foreign key attribute.
|
||||
*
|
||||
* @param ChildCouponOrder $l ChildCouponOrder
|
||||
* @return \Thelia\Model\Coupon The current object (for fluent API support)
|
||||
*/
|
||||
public function addCouponOrder(ChildCouponOrder $l)
|
||||
{
|
||||
if ($this->collCouponOrders === null) {
|
||||
$this->initCouponOrders();
|
||||
$this->collCouponOrdersPartial = true;
|
||||
}
|
||||
|
||||
if (!in_array($l, $this->collCouponOrders->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddCouponOrder($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CouponOrder $couponOrder The couponOrder object to add.
|
||||
*/
|
||||
protected function doAddCouponOrder($couponOrder)
|
||||
{
|
||||
$this->collCouponOrders[]= $couponOrder;
|
||||
$couponOrder->setCoupon($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CouponOrder $couponOrder The couponOrder object to remove.
|
||||
* @return ChildCoupon The current object (for fluent API support)
|
||||
*/
|
||||
public function removeCouponOrder($couponOrder)
|
||||
{
|
||||
if ($this->getCouponOrders()->contains($couponOrder)) {
|
||||
$this->collCouponOrders->remove($this->collCouponOrders->search($couponOrder));
|
||||
if (null === $this->couponOrdersScheduledForDeletion) {
|
||||
$this->couponOrdersScheduledForDeletion = clone $this->collCouponOrders;
|
||||
$this->couponOrdersScheduledForDeletion->clear();
|
||||
}
|
||||
$this->couponOrdersScheduledForDeletion[]= clone $couponOrder;
|
||||
$couponOrder->setCoupon(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Coupon is new, it will return
|
||||
* an empty collection; or if this Coupon has previously
|
||||
* been saved, it will retrieve related CouponOrders from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Coupon.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects
|
||||
*/
|
||||
public function getCouponOrdersJoinOrder($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildCouponOrderQuery::create(null, $criteria);
|
||||
$query->joinWith('Order', $joinBehavior);
|
||||
|
||||
return $this->getCouponOrders($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCouponI18ns collection
|
||||
*
|
||||
@@ -2823,9 +2364,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->id = null;
|
||||
$this->code = null;
|
||||
$this->type = null;
|
||||
$this->title = null;
|
||||
$this->short_description = null;
|
||||
$this->description = null;
|
||||
$this->amount = null;
|
||||
$this->is_used = null;
|
||||
$this->is_enabled = null;
|
||||
@@ -2858,11 +2396,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->collCouponOrders) {
|
||||
foreach ($this->collCouponOrders as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collCouponI18ns) {
|
||||
foreach ($this->collCouponI18ns as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
@@ -2879,10 +2412,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->currentLocale = 'en_US';
|
||||
$this->currentTranslations = null;
|
||||
|
||||
if ($this->collCouponOrders instanceof Collection) {
|
||||
$this->collCouponOrders->clearIterator();
|
||||
}
|
||||
$this->collCouponOrders = null;
|
||||
if ($this->collCouponI18ns instanceof Collection) {
|
||||
$this->collCouponI18ns->clearIterator();
|
||||
}
|
||||
@@ -3016,6 +2545,78 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
return $this->getTranslation($this->getLocale(), $con);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the [title] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->getCurrentTranslation()->getTitle();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the value of [title] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponI18n The current object (for fluent API support)
|
||||
*/
|
||||
public function setTitle($v)
|
||||
{ $this->getCurrentTranslation()->setTitle($v);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the [short_description] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShortDescription()
|
||||
{
|
||||
return $this->getCurrentTranslation()->getShortDescription();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the value of [short_description] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponI18n The current object (for fluent API support)
|
||||
*/
|
||||
public function setShortDescription($v)
|
||||
{ $this->getCurrentTranslation()->setShortDescription($v);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the [description] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->getCurrentTranslation()->getDescription();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the value of [description] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponI18n The current object (for fluent API support)
|
||||
*/
|
||||
public function setDescription($v)
|
||||
{ $this->getCurrentTranslation()->setDescription($v);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
// versionable behavior
|
||||
|
||||
/**
|
||||
@@ -3067,9 +2668,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$version->setId($this->getId());
|
||||
$version->setCode($this->getCode());
|
||||
$version->setType($this->getType());
|
||||
$version->setTitle($this->getTitle());
|
||||
$version->setShortDescription($this->getShortDescription());
|
||||
$version->setDescription($this->getDescription());
|
||||
$version->setAmount($this->getAmount());
|
||||
$version->setIsUsed($this->getIsUsed());
|
||||
$version->setIsEnabled($this->getIsEnabled());
|
||||
@@ -3122,9 +2720,6 @@ abstract class Coupon implements ActiveRecordInterface
|
||||
$this->setId($version->getId());
|
||||
$this->setCode($version->getCode());
|
||||
$this->setType($version->getType());
|
||||
$this->setTitle($version->getTitle());
|
||||
$this->setShortDescription($version->getShortDescription());
|
||||
$this->setDescription($version->getDescription());
|
||||
$this->setAmount($version->getAmount());
|
||||
$this->setIsUsed($version->getIsUsed());
|
||||
$this->setIsEnabled($version->getIsEnabled());
|
||||
|
||||
@@ -66,6 +66,24 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
*/
|
||||
protected $locale;
|
||||
|
||||
/**
|
||||
* The value for the title field.
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* The value for the short_description field.
|
||||
* @var string
|
||||
*/
|
||||
protected $short_description;
|
||||
|
||||
/**
|
||||
* The value for the description field.
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var Coupon
|
||||
*/
|
||||
@@ -368,6 +386,39 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [title] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [short_description] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShortDescription()
|
||||
{
|
||||
|
||||
return $this->short_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [description] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
@@ -414,6 +465,69 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setLocale()
|
||||
|
||||
/**
|
||||
* Set the value of [title] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponI18n The current object (for fluent API support)
|
||||
*/
|
||||
public function setTitle($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->title !== $v) {
|
||||
$this->title = $v;
|
||||
$this->modifiedColumns[] = CouponI18nTableMap::TITLE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setTitle()
|
||||
|
||||
/**
|
||||
* Set the value of [short_description] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponI18n The current object (for fluent API support)
|
||||
*/
|
||||
public function setShortDescription($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->short_description !== $v) {
|
||||
$this->short_description = $v;
|
||||
$this->modifiedColumns[] = CouponI18nTableMap::SHORT_DESCRIPTION;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setShortDescription()
|
||||
|
||||
/**
|
||||
* Set the value of [description] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponI18n The current object (for fluent API support)
|
||||
*/
|
||||
public function setDescription($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->description !== $v) {
|
||||
$this->description = $v;
|
||||
$this->modifiedColumns[] = CouponI18nTableMap::DESCRIPTION;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setDescription()
|
||||
|
||||
/**
|
||||
* Indicates whether the columns in this object are only set to default values.
|
||||
*
|
||||
@@ -460,6 +574,15 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->locale = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->title = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponI18nTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->short_description = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->description = (null !== $col) ? (string) $col : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
@@ -468,7 +591,7 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 2; // 2 = CouponI18nTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 5; // 5 = CouponI18nTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\CouponI18n object", 0, $e);
|
||||
@@ -695,6 +818,15 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponI18nTableMap::LOCALE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'LOCALE';
|
||||
}
|
||||
if ($this->isColumnModified(CouponI18nTableMap::TITLE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TITLE';
|
||||
}
|
||||
if ($this->isColumnModified(CouponI18nTableMap::SHORT_DESCRIPTION)) {
|
||||
$modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION';
|
||||
}
|
||||
if ($this->isColumnModified(CouponI18nTableMap::DESCRIPTION)) {
|
||||
$modifiedColumns[':p' . $index++] = 'DESCRIPTION';
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'INSERT INTO coupon_i18n (%s) VALUES (%s)',
|
||||
@@ -712,6 +844,15 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
case 'LOCALE':
|
||||
$stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'TITLE':
|
||||
$stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'SHORT_DESCRIPTION':
|
||||
$stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'DESCRIPTION':
|
||||
$stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
@@ -773,6 +914,15 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
case 1:
|
||||
return $this->getLocale();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getTitle();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getShortDescription();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getDescription();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
@@ -804,6 +954,9 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getLocale(),
|
||||
$keys[2] => $this->getTitle(),
|
||||
$keys[3] => $this->getShortDescription(),
|
||||
$keys[4] => $this->getDescription(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -855,6 +1008,15 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
case 1:
|
||||
$this->setLocale($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setTitle($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setShortDescription($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setDescription($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
@@ -881,6 +1043,9 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setShortDescription($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -894,6 +1059,9 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
|
||||
if ($this->isColumnModified(CouponI18nTableMap::ID)) $criteria->add(CouponI18nTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(CouponI18nTableMap::LOCALE)) $criteria->add(CouponI18nTableMap::LOCALE, $this->locale);
|
||||
if ($this->isColumnModified(CouponI18nTableMap::TITLE)) $criteria->add(CouponI18nTableMap::TITLE, $this->title);
|
||||
if ($this->isColumnModified(CouponI18nTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponI18nTableMap::SHORT_DESCRIPTION, $this->short_description);
|
||||
if ($this->isColumnModified(CouponI18nTableMap::DESCRIPTION)) $criteria->add(CouponI18nTableMap::DESCRIPTION, $this->description);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
@@ -966,6 +1134,9 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
{
|
||||
$copyObj->setId($this->getId());
|
||||
$copyObj->setLocale($this->getLocale());
|
||||
$copyObj->setTitle($this->getTitle());
|
||||
$copyObj->setShortDescription($this->getShortDescription());
|
||||
$copyObj->setDescription($this->getDescription());
|
||||
if ($makeNew) {
|
||||
$copyObj->setNew(true);
|
||||
}
|
||||
@@ -1051,6 +1222,9 @@ abstract class CouponI18n implements ActiveRecordInterface
|
||||
{
|
||||
$this->id = null;
|
||||
$this->locale = null;
|
||||
$this->title = null;
|
||||
$this->short_description = null;
|
||||
$this->description = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->clearAllReferences();
|
||||
$this->applyDefaultValues();
|
||||
|
||||
@@ -23,9 +23,15 @@ use Thelia\Model\Map\CouponI18nTableMap;
|
||||
*
|
||||
* @method ChildCouponI18nQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildCouponI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column
|
||||
* @method ChildCouponI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column
|
||||
* @method ChildCouponI18nQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column
|
||||
* @method ChildCouponI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
|
||||
*
|
||||
* @method ChildCouponI18nQuery groupById() Group by the id column
|
||||
* @method ChildCouponI18nQuery groupByLocale() Group by the locale column
|
||||
* @method ChildCouponI18nQuery groupByTitle() Group by the title column
|
||||
* @method ChildCouponI18nQuery groupByShortDescription() Group by the short_description column
|
||||
* @method ChildCouponI18nQuery groupByDescription() Group by the description column
|
||||
*
|
||||
* @method ChildCouponI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildCouponI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
@@ -40,9 +46,15 @@ use Thelia\Model\Map\CouponI18nTableMap;
|
||||
*
|
||||
* @method ChildCouponI18n findOneById(int $id) Return the first ChildCouponI18n filtered by the id column
|
||||
* @method ChildCouponI18n findOneByLocale(string $locale) Return the first ChildCouponI18n filtered by the locale column
|
||||
* @method ChildCouponI18n findOneByTitle(string $title) Return the first ChildCouponI18n filtered by the title column
|
||||
* @method ChildCouponI18n findOneByShortDescription(string $short_description) Return the first ChildCouponI18n filtered by the short_description column
|
||||
* @method ChildCouponI18n findOneByDescription(string $description) Return the first ChildCouponI18n filtered by the description column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildCouponI18n objects filtered by the id column
|
||||
* @method array findByLocale(string $locale) Return ChildCouponI18n objects filtered by the locale column
|
||||
* @method array findByTitle(string $title) Return ChildCouponI18n objects filtered by the title column
|
||||
* @method array findByShortDescription(string $short_description) Return ChildCouponI18n objects filtered by the short_description column
|
||||
* @method array findByDescription(string $description) Return ChildCouponI18n objects filtered by the description column
|
||||
*
|
||||
*/
|
||||
abstract class CouponI18nQuery extends ModelCriteria
|
||||
@@ -131,7 +143,7 @@ abstract class CouponI18nQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, LOCALE FROM coupon_i18n WHERE ID = :p0 AND LOCALE = :p1';
|
||||
$sql = 'SELECT ID, LOCALE, TITLE, SHORT_DESCRIPTION, DESCRIPTION FROM coupon_i18n WHERE ID = :p0 AND LOCALE = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||
@@ -304,6 +316,93 @@ abstract class CouponI18nQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CouponI18nTableMap::LOCALE, $locale, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the title column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
|
||||
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $title The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTitle($title = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($title)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $title)) {
|
||||
$title = str_replace('*', '%', $title);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponI18nTableMap::TITLE, $title, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the short_description column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue'
|
||||
* $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $shortDescription The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByShortDescription($shortDescription = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($shortDescription)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $shortDescription)) {
|
||||
$shortDescription = str_replace('*', '%', $shortDescription);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponI18nTableMap::SHORT_DESCRIPTION, $shortDescription, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the description column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
|
||||
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $description The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponI18nQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDescription($description = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($description)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $description)) {
|
||||
$description = str_replace('*', '%', $description);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponI18nTableMap::DESCRIPTION, $description, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Coupon object
|
||||
*
|
||||
|
||||
@@ -16,10 +16,8 @@ use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Parser\AbstractParser;
|
||||
use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\Coupon as ChildCoupon;
|
||||
use Thelia\Model\CouponOrder as ChildCouponOrder;
|
||||
use Thelia\Model\CouponOrderQuery as ChildCouponOrderQuery;
|
||||
use Thelia\Model\CouponQuery as ChildCouponQuery;
|
||||
use Thelia\Model\Order as ChildOrder;
|
||||
use Thelia\Model\OrderQuery as ChildOrderQuery;
|
||||
use Thelia\Model\Map\CouponOrderTableMap;
|
||||
@@ -70,12 +68,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
*/
|
||||
protected $order_id;
|
||||
|
||||
/**
|
||||
* The value for the code field.
|
||||
* @var string
|
||||
*/
|
||||
protected $code;
|
||||
|
||||
/**
|
||||
* The value for the value field.
|
||||
* @var double
|
||||
@@ -99,11 +91,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
*/
|
||||
protected $aOrder;
|
||||
|
||||
/**
|
||||
* @var Coupon
|
||||
*/
|
||||
protected $aCoupon;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
@@ -388,17 +375,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
return $this->order_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [code] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCode()
|
||||
{
|
||||
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [value] column value.
|
||||
*
|
||||
@@ -496,31 +472,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setOrderId()
|
||||
|
||||
/**
|
||||
* Set the value of [code] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponOrder The current object (for fluent API support)
|
||||
*/
|
||||
public function setCode($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->code !== $v) {
|
||||
$this->code = $v;
|
||||
$this->modifiedColumns[] = CouponOrderTableMap::CODE;
|
||||
}
|
||||
|
||||
if ($this->aCoupon !== null && $this->aCoupon->getCode() !== $v) {
|
||||
$this->aCoupon = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setCode()
|
||||
|
||||
/**
|
||||
* Set the value of [value] column.
|
||||
*
|
||||
@@ -627,19 +578,16 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : CouponOrderTableMap::translateFieldName('OrderId', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->order_id = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponOrderTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->code = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponOrderTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponOrderTableMap::translateFieldName('Value', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->value = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponOrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponOrderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponOrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponOrderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
@@ -652,7 +600,7 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 6; // 6 = CouponOrderTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 5; // 5 = CouponOrderTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\CouponOrder object", 0, $e);
|
||||
@@ -677,9 +625,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
if ($this->aOrder !== null && $this->order_id !== $this->aOrder->getId()) {
|
||||
$this->aOrder = null;
|
||||
}
|
||||
if ($this->aCoupon !== null && $this->code !== $this->aCoupon->getCode()) {
|
||||
$this->aCoupon = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -720,7 +665,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->aOrder = null;
|
||||
$this->aCoupon = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -855,13 +799,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
$this->setOrder($this->aOrder);
|
||||
}
|
||||
|
||||
if ($this->aCoupon !== null) {
|
||||
if ($this->aCoupon->isModified() || $this->aCoupon->isNew()) {
|
||||
$affectedRows += $this->aCoupon->save($con);
|
||||
}
|
||||
$this->setCoupon($this->aCoupon);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
// persist changes
|
||||
if ($this->isNew()) {
|
||||
@@ -905,9 +842,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponOrderTableMap::ORDER_ID)) {
|
||||
$modifiedColumns[':p' . $index++] = 'ORDER_ID';
|
||||
}
|
||||
if ($this->isColumnModified(CouponOrderTableMap::CODE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CODE';
|
||||
}
|
||||
if ($this->isColumnModified(CouponOrderTableMap::VALUE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'VALUE';
|
||||
}
|
||||
@@ -934,9 +868,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
case 'ORDER_ID':
|
||||
$stmt->bindValue($identifier, $this->order_id, PDO::PARAM_INT);
|
||||
break;
|
||||
case 'CODE':
|
||||
$stmt->bindValue($identifier, $this->code, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'VALUE':
|
||||
$stmt->bindValue($identifier, $this->value, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1015,15 +946,12 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
return $this->getOrderId();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getCode();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getValue();
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
@@ -1057,10 +985,9 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
$result = array(
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getOrderId(),
|
||||
$keys[2] => $this->getCode(),
|
||||
$keys[3] => $this->getValue(),
|
||||
$keys[4] => $this->getCreatedAt(),
|
||||
$keys[5] => $this->getUpdatedAt(),
|
||||
$keys[2] => $this->getValue(),
|
||||
$keys[3] => $this->getCreatedAt(),
|
||||
$keys[4] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1072,9 +999,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
if (null !== $this->aOrder) {
|
||||
$result['Order'] = $this->aOrder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->aCoupon) {
|
||||
$result['Coupon'] = $this->aCoupon->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -1116,15 +1040,12 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
$this->setOrderId($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setCode($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setValue($value);
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1153,10 +1074,9 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setOrderId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setValue($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setValue($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1170,7 +1090,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
|
||||
if ($this->isColumnModified(CouponOrderTableMap::ID)) $criteria->add(CouponOrderTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(CouponOrderTableMap::ORDER_ID)) $criteria->add(CouponOrderTableMap::ORDER_ID, $this->order_id);
|
||||
if ($this->isColumnModified(CouponOrderTableMap::CODE)) $criteria->add(CouponOrderTableMap::CODE, $this->code);
|
||||
if ($this->isColumnModified(CouponOrderTableMap::VALUE)) $criteria->add(CouponOrderTableMap::VALUE, $this->value);
|
||||
if ($this->isColumnModified(CouponOrderTableMap::CREATED_AT)) $criteria->add(CouponOrderTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(CouponOrderTableMap::UPDATED_AT)) $criteria->add(CouponOrderTableMap::UPDATED_AT, $this->updated_at);
|
||||
@@ -1238,7 +1157,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
||||
{
|
||||
$copyObj->setOrderId($this->getOrderId());
|
||||
$copyObj->setCode($this->getCode());
|
||||
$copyObj->setValue($this->getValue());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
@@ -1321,59 +1239,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
return $this->aOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a ChildCoupon object.
|
||||
*
|
||||
* @param ChildCoupon $v
|
||||
* @return \Thelia\Model\CouponOrder The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setCoupon(ChildCoupon $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setCode(NULL);
|
||||
} else {
|
||||
$this->setCode($v->getCode());
|
||||
}
|
||||
|
||||
$this->aCoupon = $v;
|
||||
|
||||
// Add binding for other direction of this n:n relationship.
|
||||
// If this object has already been added to the ChildCoupon object, it will not be re-added.
|
||||
if ($v !== null) {
|
||||
$v->addCouponOrder($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated ChildCoupon object
|
||||
*
|
||||
* @param ConnectionInterface $con Optional Connection object.
|
||||
* @return ChildCoupon The associated ChildCoupon object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCoupon(ConnectionInterface $con = null)
|
||||
{
|
||||
if ($this->aCoupon === null && (($this->code !== "" && $this->code !== null))) {
|
||||
$this->aCoupon = ChildCouponQuery::create()
|
||||
->filterByCouponOrder($this) // here
|
||||
->findOne($con);
|
||||
/* The following can be used additionally to
|
||||
guarantee the related object contains a reference
|
||||
to this object. This level of coupling may, however, be
|
||||
undesirable since it could result in an only partially populated collection
|
||||
in the referenced object.
|
||||
$this->aCoupon->addCouponOrders($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aCoupon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -1381,7 +1246,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
{
|
||||
$this->id = null;
|
||||
$this->order_id = null;
|
||||
$this->code = null;
|
||||
$this->value = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
@@ -1407,7 +1271,6 @@ abstract class CouponOrder implements ActiveRecordInterface
|
||||
} // if ($deep)
|
||||
|
||||
$this->aOrder = null;
|
||||
$this->aCoupon = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,14 +23,12 @@ use Thelia\Model\Map\CouponOrderTableMap;
|
||||
*
|
||||
* @method ChildCouponOrderQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildCouponOrderQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
|
||||
* @method ChildCouponOrderQuery orderByCode($order = Criteria::ASC) Order by the code column
|
||||
* @method ChildCouponOrderQuery orderByValue($order = Criteria::ASC) Order by the value column
|
||||
* @method ChildCouponOrderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildCouponOrderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildCouponOrderQuery groupById() Group by the id column
|
||||
* @method ChildCouponOrderQuery groupByOrderId() Group by the order_id column
|
||||
* @method ChildCouponOrderQuery groupByCode() Group by the code column
|
||||
* @method ChildCouponOrderQuery groupByValue() Group by the value column
|
||||
* @method ChildCouponOrderQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildCouponOrderQuery groupByUpdatedAt() Group by the updated_at column
|
||||
@@ -43,23 +41,17 @@ use Thelia\Model\Map\CouponOrderTableMap;
|
||||
* @method ChildCouponOrderQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
|
||||
* @method ChildCouponOrderQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
|
||||
*
|
||||
* @method ChildCouponOrderQuery leftJoinCoupon($relationAlias = null) Adds a LEFT JOIN clause to the query using the Coupon relation
|
||||
* @method ChildCouponOrderQuery rightJoinCoupon($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Coupon relation
|
||||
* @method ChildCouponOrderQuery innerJoinCoupon($relationAlias = null) Adds a INNER JOIN clause to the query using the Coupon relation
|
||||
*
|
||||
* @method ChildCouponOrder findOne(ConnectionInterface $con = null) Return the first ChildCouponOrder matching the query
|
||||
* @method ChildCouponOrder findOneOrCreate(ConnectionInterface $con = null) Return the first ChildCouponOrder matching the query, or a new ChildCouponOrder object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildCouponOrder findOneById(int $id) Return the first ChildCouponOrder filtered by the id column
|
||||
* @method ChildCouponOrder findOneByOrderId(int $order_id) Return the first ChildCouponOrder filtered by the order_id column
|
||||
* @method ChildCouponOrder findOneByCode(string $code) Return the first ChildCouponOrder filtered by the code column
|
||||
* @method ChildCouponOrder findOneByValue(double $value) Return the first ChildCouponOrder filtered by the value column
|
||||
* @method ChildCouponOrder findOneByCreatedAt(string $created_at) Return the first ChildCouponOrder filtered by the created_at column
|
||||
* @method ChildCouponOrder findOneByUpdatedAt(string $updated_at) Return the first ChildCouponOrder filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildCouponOrder objects filtered by the id column
|
||||
* @method array findByOrderId(int $order_id) Return ChildCouponOrder objects filtered by the order_id column
|
||||
* @method array findByCode(string $code) Return ChildCouponOrder objects filtered by the code column
|
||||
* @method array findByValue(double $value) Return ChildCouponOrder objects filtered by the value column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildCouponOrder objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildCouponOrder objects filtered by the updated_at column
|
||||
@@ -151,7 +143,7 @@ abstract class CouponOrderQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, ORDER_ID, CODE, VALUE, CREATED_AT, UPDATED_AT FROM coupon_order WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, ORDER_ID, VALUE, CREATED_AT, UPDATED_AT FROM coupon_order WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -324,35 +316,6 @@ abstract class CouponOrderQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CouponOrderTableMap::ORDER_ID, $orderId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the code column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
|
||||
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $code The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCode($code = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($code)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $code)) {
|
||||
$code = str_replace('*', '%', $code);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponOrderTableMap::CODE, $code, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the value column
|
||||
*
|
||||
@@ -555,81 +518,6 @@ abstract class CouponOrderQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Coupon object
|
||||
*
|
||||
* @param \Thelia\Model\Coupon|ObjectCollection $coupon The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCoupon($coupon, $comparison = null)
|
||||
{
|
||||
if ($coupon instanceof \Thelia\Model\Coupon) {
|
||||
return $this
|
||||
->addUsingAlias(CouponOrderTableMap::CODE, $coupon->getCode(), $comparison);
|
||||
} elseif ($coupon instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(CouponOrderTableMap::CODE, $coupon->toKeyValue('PrimaryKey', 'Code'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCoupon() only accepts arguments of type \Thelia\Model\Coupon or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Coupon relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponOrderQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCoupon($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Coupon');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Coupon');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Coupon relation Coupon object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCoupon($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Coupon', '\Thelia\Model\CouponQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
@@ -25,9 +25,6 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildCouponQuery orderByCode($order = Criteria::ASC) Order by the code column
|
||||
* @method ChildCouponQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||
* @method ChildCouponQuery orderByTitle($order = Criteria::ASC) Order by the title column
|
||||
* @method ChildCouponQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column
|
||||
* @method ChildCouponQuery orderByDescription($order = Criteria::ASC) Order by the description column
|
||||
* @method ChildCouponQuery orderByAmount($order = Criteria::ASC) Order by the amount column
|
||||
* @method ChildCouponQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column
|
||||
* @method ChildCouponQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column
|
||||
@@ -44,9 +41,6 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery groupById() Group by the id column
|
||||
* @method ChildCouponQuery groupByCode() Group by the code column
|
||||
* @method ChildCouponQuery groupByType() Group by the type column
|
||||
* @method ChildCouponQuery groupByTitle() Group by the title column
|
||||
* @method ChildCouponQuery groupByShortDescription() Group by the short_description column
|
||||
* @method ChildCouponQuery groupByDescription() Group by the description column
|
||||
* @method ChildCouponQuery groupByAmount() Group by the amount column
|
||||
* @method ChildCouponQuery groupByIsUsed() Group by the is_used column
|
||||
* @method ChildCouponQuery groupByIsEnabled() Group by the is_enabled column
|
||||
@@ -64,10 +58,6 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildCouponQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildCouponQuery leftJoinCouponOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponOrder relation
|
||||
* @method ChildCouponQuery rightJoinCouponOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponOrder relation
|
||||
* @method ChildCouponQuery innerJoinCouponOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponOrder relation
|
||||
*
|
||||
* @method ChildCouponQuery leftJoinCouponI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CouponI18n relation
|
||||
* @method ChildCouponQuery rightJoinCouponI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CouponI18n relation
|
||||
* @method ChildCouponQuery innerJoinCouponI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CouponI18n relation
|
||||
@@ -82,9 +72,6 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method ChildCoupon findOneById(int $id) Return the first ChildCoupon filtered by the id column
|
||||
* @method ChildCoupon findOneByCode(string $code) Return the first ChildCoupon filtered by the code column
|
||||
* @method ChildCoupon findOneByType(string $type) Return the first ChildCoupon filtered by the type column
|
||||
* @method ChildCoupon findOneByTitle(string $title) Return the first ChildCoupon filtered by the title column
|
||||
* @method ChildCoupon findOneByShortDescription(string $short_description) Return the first ChildCoupon filtered by the short_description column
|
||||
* @method ChildCoupon findOneByDescription(string $description) Return the first ChildCoupon filtered by the description column
|
||||
* @method ChildCoupon findOneByAmount(double $amount) Return the first ChildCoupon filtered by the amount column
|
||||
* @method ChildCoupon findOneByIsUsed(int $is_used) Return the first ChildCoupon filtered by the is_used column
|
||||
* @method ChildCoupon findOneByIsEnabled(int $is_enabled) Return the first ChildCoupon filtered by the is_enabled column
|
||||
@@ -101,9 +88,6 @@ use Thelia\Model\Map\CouponTableMap;
|
||||
* @method array findById(int $id) Return ChildCoupon objects filtered by the id column
|
||||
* @method array findByCode(string $code) Return ChildCoupon objects filtered by the code column
|
||||
* @method array findByType(string $type) Return ChildCoupon objects filtered by the type column
|
||||
* @method array findByTitle(string $title) Return ChildCoupon objects filtered by the title column
|
||||
* @method array findByShortDescription(string $short_description) Return ChildCoupon objects filtered by the short_description column
|
||||
* @method array findByDescription(string $description) Return ChildCoupon objects filtered by the description column
|
||||
* @method array findByAmount(double $amount) Return ChildCoupon objects filtered by the amount column
|
||||
* @method array findByIsUsed(int $is_used) Return ChildCoupon objects filtered by the is_used column
|
||||
* @method array findByIsEnabled(int $is_enabled) Return ChildCoupon objects filtered by the is_enabled column
|
||||
@@ -211,7 +195,7 @@ abstract class CouponQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, CODE, TYPE, TITLE, SHORT_DESCRIPTION, DESCRIPTION, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -399,93 +383,6 @@ abstract class CouponQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CouponTableMap::TYPE, $type, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the title column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
|
||||
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $title The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTitle($title = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($title)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $title)) {
|
||||
$title = str_replace('*', '%', $title);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponTableMap::TITLE, $title, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the short_description column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue'
|
||||
* $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $shortDescription The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByShortDescription($shortDescription = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($shortDescription)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $shortDescription)) {
|
||||
$shortDescription = str_replace('*', '%', $shortDescription);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponTableMap::SHORT_DESCRIPTION, $shortDescription, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the description column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
|
||||
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $description The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDescription($description = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($description)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $description)) {
|
||||
$description = str_replace('*', '%', $description);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponTableMap::DESCRIPTION, $description, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the amount column
|
||||
*
|
||||
@@ -958,79 +855,6 @@ abstract class CouponQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CouponTableMap::VERSION, $version, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponOrder object
|
||||
*
|
||||
* @param \Thelia\Model\CouponOrder|ObjectCollection $couponOrder the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCouponOrder($couponOrder, $comparison = null)
|
||||
{
|
||||
if ($couponOrder instanceof \Thelia\Model\CouponOrder) {
|
||||
return $this
|
||||
->addUsingAlias(CouponTableMap::CODE, $couponOrder->getCode(), $comparison);
|
||||
} elseif ($couponOrder instanceof ObjectCollection) {
|
||||
return $this
|
||||
->useCouponOrderQuery()
|
||||
->filterByPrimaryKeys($couponOrder->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByCouponOrder() only accepts arguments of type \Thelia\Model\CouponOrder or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CouponOrder relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildCouponQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCouponOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CouponOrder');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'CouponOrder');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CouponOrder relation CouponOrder object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\CouponOrderQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCouponOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCouponOrder($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CouponOrder', '\Thelia\Model\CouponOrderQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\CouponI18n object
|
||||
*
|
||||
|
||||
@@ -73,24 +73,6 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* The value for the title field.
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* The value for the short_description field.
|
||||
* @var string
|
||||
*/
|
||||
protected $short_description;
|
||||
|
||||
/**
|
||||
* The value for the description field.
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* The value for the amount field.
|
||||
* @var double
|
||||
@@ -477,39 +459,6 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [title] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [short_description] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShortDescription()
|
||||
{
|
||||
|
||||
return $this->short_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [description] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [amount] column value.
|
||||
*
|
||||
@@ -736,69 +685,6 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setType()
|
||||
|
||||
/**
|
||||
* Set the value of [title] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponVersion The current object (for fluent API support)
|
||||
*/
|
||||
public function setTitle($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->title !== $v) {
|
||||
$this->title = $v;
|
||||
$this->modifiedColumns[] = CouponVersionTableMap::TITLE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setTitle()
|
||||
|
||||
/**
|
||||
* Set the value of [short_description] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponVersion The current object (for fluent API support)
|
||||
*/
|
||||
public function setShortDescription($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->short_description !== $v) {
|
||||
$this->short_description = $v;
|
||||
$this->modifiedColumns[] = CouponVersionTableMap::SHORT_DESCRIPTION;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setShortDescription()
|
||||
|
||||
/**
|
||||
* Set the value of [description] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\CouponVersion The current object (for fluent API support)
|
||||
*/
|
||||
public function setDescription($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->description !== $v) {
|
||||
$this->description = $v;
|
||||
$this->modifiedColumns[] = CouponVersionTableMap::DESCRIPTION;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setDescription()
|
||||
|
||||
/**
|
||||
* Set the value of [amount] column.
|
||||
*
|
||||
@@ -1109,58 +995,49 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : CouponVersionTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->type = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponVersionTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->title = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponVersionTableMap::translateFieldName('ShortDescription', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->short_description = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponVersionTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->description = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponVersionTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : CouponVersionTableMap::translateFieldName('Amount', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->amount = (null !== $col) ? (double) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponVersionTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : CouponVersionTableMap::translateFieldName('IsUsed', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_used = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponVersionTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : CouponVersionTableMap::translateFieldName('IsEnabled', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_enabled = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponVersionTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : CouponVersionTableMap::translateFieldName('ExpirationDate', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->expiration_date = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponVersionTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : CouponVersionTableMap::translateFieldName('SerializedRules', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->serialized_rules = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponVersionTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : CouponVersionTableMap::translateFieldName('IsCumulative', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_cumulative = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : CouponVersionTableMap::translateFieldName('IsRemovingPostage', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_removing_postage = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponVersionTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : CouponVersionTableMap::translateFieldName('MaxUsage', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->max_usage = (null !== $col) ? (int) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : CouponVersionTableMap::translateFieldName('IsAvailableOnSpecialOffers', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->is_available_on_special_offers = (null !== $col) ? (boolean) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : CouponVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 13 + $startcol : CouponVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->version = (null !== $col) ? (int) $col : null;
|
||||
$this->resetModified();
|
||||
|
||||
@@ -1170,7 +1047,7 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 18; // 18 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 15; // 15 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\CouponVersion object", 0, $e);
|
||||
@@ -1400,15 +1277,6 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponVersionTableMap::TYPE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TYPE';
|
||||
}
|
||||
if ($this->isColumnModified(CouponVersionTableMap::TITLE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'TITLE';
|
||||
}
|
||||
if ($this->isColumnModified(CouponVersionTableMap::SHORT_DESCRIPTION)) {
|
||||
$modifiedColumns[':p' . $index++] = 'SHORT_DESCRIPTION';
|
||||
}
|
||||
if ($this->isColumnModified(CouponVersionTableMap::DESCRIPTION)) {
|
||||
$modifiedColumns[':p' . $index++] = 'DESCRIPTION';
|
||||
}
|
||||
if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'AMOUNT';
|
||||
}
|
||||
@@ -1465,15 +1333,6 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
case 'TYPE':
|
||||
$stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'TITLE':
|
||||
$stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'SHORT_DESCRIPTION':
|
||||
$stmt->bindValue($identifier, $this->short_description, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'DESCRIPTION':
|
||||
$stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'AMOUNT':
|
||||
$stmt->bindValue($identifier, $this->amount, PDO::PARAM_STR);
|
||||
break;
|
||||
@@ -1575,48 +1434,39 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
return $this->getType();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getTitle();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getShortDescription();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getDescription();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getAmount();
|
||||
break;
|
||||
case 7:
|
||||
case 4:
|
||||
return $this->getIsUsed();
|
||||
break;
|
||||
case 8:
|
||||
case 5:
|
||||
return $this->getIsEnabled();
|
||||
break;
|
||||
case 9:
|
||||
case 6:
|
||||
return $this->getExpirationDate();
|
||||
break;
|
||||
case 10:
|
||||
case 7:
|
||||
return $this->getSerializedRules();
|
||||
break;
|
||||
case 11:
|
||||
case 8:
|
||||
return $this->getIsCumulative();
|
||||
break;
|
||||
case 12:
|
||||
case 9:
|
||||
return $this->getIsRemovingPostage();
|
||||
break;
|
||||
case 13:
|
||||
case 10:
|
||||
return $this->getMaxUsage();
|
||||
break;
|
||||
case 14:
|
||||
case 11:
|
||||
return $this->getIsAvailableOnSpecialOffers();
|
||||
break;
|
||||
case 15:
|
||||
case 12:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 16:
|
||||
case 13:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
case 17:
|
||||
case 14:
|
||||
return $this->getVersion();
|
||||
break;
|
||||
default:
|
||||
@@ -1651,21 +1501,18 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$keys[0] => $this->getId(),
|
||||
$keys[1] => $this->getCode(),
|
||||
$keys[2] => $this->getType(),
|
||||
$keys[3] => $this->getTitle(),
|
||||
$keys[4] => $this->getShortDescription(),
|
||||
$keys[5] => $this->getDescription(),
|
||||
$keys[6] => $this->getAmount(),
|
||||
$keys[7] => $this->getIsUsed(),
|
||||
$keys[8] => $this->getIsEnabled(),
|
||||
$keys[9] => $this->getExpirationDate(),
|
||||
$keys[10] => $this->getSerializedRules(),
|
||||
$keys[11] => $this->getIsCumulative(),
|
||||
$keys[12] => $this->getIsRemovingPostage(),
|
||||
$keys[13] => $this->getMaxUsage(),
|
||||
$keys[14] => $this->getIsAvailableOnSpecialOffers(),
|
||||
$keys[15] => $this->getCreatedAt(),
|
||||
$keys[16] => $this->getUpdatedAt(),
|
||||
$keys[17] => $this->getVersion(),
|
||||
$keys[3] => $this->getAmount(),
|
||||
$keys[4] => $this->getIsUsed(),
|
||||
$keys[5] => $this->getIsEnabled(),
|
||||
$keys[6] => $this->getExpirationDate(),
|
||||
$keys[7] => $this->getSerializedRules(),
|
||||
$keys[8] => $this->getIsCumulative(),
|
||||
$keys[9] => $this->getIsRemovingPostage(),
|
||||
$keys[10] => $this->getMaxUsage(),
|
||||
$keys[11] => $this->getIsAvailableOnSpecialOffers(),
|
||||
$keys[12] => $this->getCreatedAt(),
|
||||
$keys[13] => $this->getUpdatedAt(),
|
||||
$keys[14] => $this->getVersion(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach($virtualColumns as $key => $virtualColumn)
|
||||
@@ -1721,48 +1568,39 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->setType($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setTitle($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setShortDescription($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setDescription($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setAmount($value);
|
||||
break;
|
||||
case 7:
|
||||
case 4:
|
||||
$this->setIsUsed($value);
|
||||
break;
|
||||
case 8:
|
||||
case 5:
|
||||
$this->setIsEnabled($value);
|
||||
break;
|
||||
case 9:
|
||||
case 6:
|
||||
$this->setExpirationDate($value);
|
||||
break;
|
||||
case 10:
|
||||
case 7:
|
||||
$this->setSerializedRules($value);
|
||||
break;
|
||||
case 11:
|
||||
case 8:
|
||||
$this->setIsCumulative($value);
|
||||
break;
|
||||
case 12:
|
||||
case 9:
|
||||
$this->setIsRemovingPostage($value);
|
||||
break;
|
||||
case 13:
|
||||
case 10:
|
||||
$this->setMaxUsage($value);
|
||||
break;
|
||||
case 14:
|
||||
case 11:
|
||||
$this->setIsAvailableOnSpecialOffers($value);
|
||||
break;
|
||||
case 15:
|
||||
case 12:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 16:
|
||||
case 13:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
case 17:
|
||||
case 14:
|
||||
$this->setVersion($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -1792,21 +1630,18 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setTitle($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setShortDescription($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setDescription($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setAmount($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setIsUsed($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setIsEnabled($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setExpirationDate($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setSerializedRules($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setIsCumulative($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setIsRemovingPostage($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setMaxUsage($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setCreatedAt($arr[$keys[15]]);
|
||||
if (array_key_exists($keys[16], $arr)) $this->setUpdatedAt($arr[$keys[16]]);
|
||||
if (array_key_exists($keys[17], $arr)) $this->setVersion($arr[$keys[17]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setIsUsed($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setIsEnabled($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setExpirationDate($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setSerializedRules($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setIsCumulative($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setIsRemovingPostage($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setMaxUsage($arr[$keys[10]]);
|
||||
if (array_key_exists($keys[11], $arr)) $this->setIsAvailableOnSpecialOffers($arr[$keys[11]]);
|
||||
if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1821,9 +1656,6 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(CouponVersionTableMap::ID)) $criteria->add(CouponVersionTableMap::ID, $this->id);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::CODE)) $criteria->add(CouponVersionTableMap::CODE, $this->code);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::TYPE)) $criteria->add(CouponVersionTableMap::TYPE, $this->type);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::TITLE)) $criteria->add(CouponVersionTableMap::TITLE, $this->title);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::SHORT_DESCRIPTION)) $criteria->add(CouponVersionTableMap::SHORT_DESCRIPTION, $this->short_description);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::DESCRIPTION)) $criteria->add(CouponVersionTableMap::DESCRIPTION, $this->description);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::AMOUNT)) $criteria->add(CouponVersionTableMap::AMOUNT, $this->amount);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::IS_USED)) $criteria->add(CouponVersionTableMap::IS_USED, $this->is_used);
|
||||
if ($this->isColumnModified(CouponVersionTableMap::IS_ENABLED)) $criteria->add(CouponVersionTableMap::IS_ENABLED, $this->is_enabled);
|
||||
@@ -1909,9 +1741,6 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$copyObj->setId($this->getId());
|
||||
$copyObj->setCode($this->getCode());
|
||||
$copyObj->setType($this->getType());
|
||||
$copyObj->setTitle($this->getTitle());
|
||||
$copyObj->setShortDescription($this->getShortDescription());
|
||||
$copyObj->setDescription($this->getDescription());
|
||||
$copyObj->setAmount($this->getAmount());
|
||||
$copyObj->setIsUsed($this->getIsUsed());
|
||||
$copyObj->setIsEnabled($this->getIsEnabled());
|
||||
@@ -2010,9 +1839,6 @@ abstract class CouponVersion implements ActiveRecordInterface
|
||||
$this->id = null;
|
||||
$this->code = null;
|
||||
$this->type = null;
|
||||
$this->title = null;
|
||||
$this->short_description = null;
|
||||
$this->description = null;
|
||||
$this->amount = null;
|
||||
$this->is_used = null;
|
||||
$this->is_enabled = null;
|
||||
|
||||
@@ -24,9 +24,6 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersionQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildCouponVersionQuery orderByCode($order = Criteria::ASC) Order by the code column
|
||||
* @method ChildCouponVersionQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||
* @method ChildCouponVersionQuery orderByTitle($order = Criteria::ASC) Order by the title column
|
||||
* @method ChildCouponVersionQuery orderByShortDescription($order = Criteria::ASC) Order by the short_description column
|
||||
* @method ChildCouponVersionQuery orderByDescription($order = Criteria::ASC) Order by the description column
|
||||
* @method ChildCouponVersionQuery orderByAmount($order = Criteria::ASC) Order by the amount column
|
||||
* @method ChildCouponVersionQuery orderByIsUsed($order = Criteria::ASC) Order by the is_used column
|
||||
* @method ChildCouponVersionQuery orderByIsEnabled($order = Criteria::ASC) Order by the is_enabled column
|
||||
@@ -43,9 +40,6 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersionQuery groupById() Group by the id column
|
||||
* @method ChildCouponVersionQuery groupByCode() Group by the code column
|
||||
* @method ChildCouponVersionQuery groupByType() Group by the type column
|
||||
* @method ChildCouponVersionQuery groupByTitle() Group by the title column
|
||||
* @method ChildCouponVersionQuery groupByShortDescription() Group by the short_description column
|
||||
* @method ChildCouponVersionQuery groupByDescription() Group by the description column
|
||||
* @method ChildCouponVersionQuery groupByAmount() Group by the amount column
|
||||
* @method ChildCouponVersionQuery groupByIsUsed() Group by the is_used column
|
||||
* @method ChildCouponVersionQuery groupByIsEnabled() Group by the is_enabled column
|
||||
@@ -73,9 +67,6 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method ChildCouponVersion findOneById(int $id) Return the first ChildCouponVersion filtered by the id column
|
||||
* @method ChildCouponVersion findOneByCode(string $code) Return the first ChildCouponVersion filtered by the code column
|
||||
* @method ChildCouponVersion findOneByType(string $type) Return the first ChildCouponVersion filtered by the type column
|
||||
* @method ChildCouponVersion findOneByTitle(string $title) Return the first ChildCouponVersion filtered by the title column
|
||||
* @method ChildCouponVersion findOneByShortDescription(string $short_description) Return the first ChildCouponVersion filtered by the short_description column
|
||||
* @method ChildCouponVersion findOneByDescription(string $description) Return the first ChildCouponVersion filtered by the description column
|
||||
* @method ChildCouponVersion findOneByAmount(double $amount) Return the first ChildCouponVersion filtered by the amount column
|
||||
* @method ChildCouponVersion findOneByIsUsed(int $is_used) Return the first ChildCouponVersion filtered by the is_used column
|
||||
* @method ChildCouponVersion findOneByIsEnabled(int $is_enabled) Return the first ChildCouponVersion filtered by the is_enabled column
|
||||
@@ -92,9 +83,6 @@ use Thelia\Model\Map\CouponVersionTableMap;
|
||||
* @method array findById(int $id) Return ChildCouponVersion objects filtered by the id column
|
||||
* @method array findByCode(string $code) Return ChildCouponVersion objects filtered by the code column
|
||||
* @method array findByType(string $type) Return ChildCouponVersion objects filtered by the type column
|
||||
* @method array findByTitle(string $title) Return ChildCouponVersion objects filtered by the title column
|
||||
* @method array findByShortDescription(string $short_description) Return ChildCouponVersion objects filtered by the short_description column
|
||||
* @method array findByDescription(string $description) Return ChildCouponVersion objects filtered by the description column
|
||||
* @method array findByAmount(double $amount) Return ChildCouponVersion objects filtered by the amount column
|
||||
* @method array findByIsUsed(int $is_used) Return ChildCouponVersion objects filtered by the is_used column
|
||||
* @method array findByIsEnabled(int $is_enabled) Return ChildCouponVersion objects filtered by the is_enabled column
|
||||
@@ -195,7 +183,7 @@ abstract class CouponVersionQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, CODE, TYPE, TITLE, SHORT_DESCRIPTION, DESCRIPTION, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon_version WHERE ID = :p0 AND VERSION = :p1';
|
||||
$sql = 'SELECT ID, CODE, TYPE, AMOUNT, IS_USED, IS_ENABLED, EXPIRATION_DATE, SERIALIZED_RULES, IS_CUMULATIVE, IS_REMOVING_POSTAGE, MAX_USAGE, IS_AVAILABLE_ON_SPECIAL_OFFERS, CREATED_AT, UPDATED_AT, VERSION FROM coupon_version WHERE ID = :p0 AND VERSION = :p1';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||
@@ -397,93 +385,6 @@ abstract class CouponVersionQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(CouponVersionTableMap::TYPE, $type, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the title column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
|
||||
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $title The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponVersionQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTitle($title = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($title)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $title)) {
|
||||
$title = str_replace('*', '%', $title);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponVersionTableMap::TITLE, $title, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the short_description column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByShortDescription('fooValue'); // WHERE short_description = 'fooValue'
|
||||
* $query->filterByShortDescription('%fooValue%'); // WHERE short_description LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $shortDescription The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponVersionQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByShortDescription($shortDescription = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($shortDescription)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $shortDescription)) {
|
||||
$shortDescription = str_replace('*', '%', $shortDescription);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponVersionTableMap::SHORT_DESCRIPTION, $shortDescription, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the description column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
|
||||
* $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $description The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildCouponVersionQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDescription($description = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($description)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $description)) {
|
||||
$description = str_replace('*', '%', $description);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(CouponVersionTableMap::DESCRIPTION, $description, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the amount column
|
||||
*
|
||||
|
||||
@@ -2842,31 +2842,6 @@ abstract class Order implements ActiveRecordInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Order is new, it will return
|
||||
* an empty collection; or if this Order has previously
|
||||
* been saved, it will retrieve related CouponOrders from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Order.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param ConnectionInterface $con optional connection object
|
||||
* @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return Collection|ChildCouponOrder[] List of ChildCouponOrder objects
|
||||
*/
|
||||
public function getCouponOrdersJoinCoupon($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = ChildCouponOrderQuery::create(null, $criteria);
|
||||
$query->joinWith('Coupon', $joinBehavior);
|
||||
|
||||
return $this->getCouponOrders($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ class CartItem extends BaseCartItem
|
||||
if ($this->dispatcher) {
|
||||
$cartEvent = new CartEvent($this->getCart());
|
||||
|
||||
$this->dispatcher->dispatch(TheliaEvents::AFTER_CARTCHANGEITEM, $cartEvent);
|
||||
$this->dispatcher->dispatch(TheliaEvents::AFTER_CARTUPDATEITEM, $cartEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class Category extends BaseCategory
|
||||
|
||||
public function getUrl($locale)
|
||||
{
|
||||
return URL::init()->retrieve('category', $this->getId(), $locale);
|
||||
return URL::init()->retrieve('category', $this->getId(), $locale)->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,14 +95,14 @@ class Category extends BaseCategory
|
||||
|
||||
public function preUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGECATEGORY, new CategoryEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATECATEGORY, new CategoryEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CHANGECATEGORY, new CategoryEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATECATEGORY, new CategoryEvent($this));
|
||||
}
|
||||
|
||||
public function preDelete(ConnectionInterface $con = null)
|
||||
|
||||
@@ -55,7 +55,7 @@ class Config extends BaseConfig {
|
||||
*/
|
||||
public function preUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGECONFIG, new ConfigEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATECONFIG, new ConfigEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class Config extends BaseConfig {
|
||||
*/
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CHANGECONFIG, new ConfigEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATECONFIG, new ConfigEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,4 +32,14 @@ class ConfigQuery extends BaseConfigQuery {
|
||||
{
|
||||
return self::read("rewriting_enable") == 1;
|
||||
}
|
||||
|
||||
public static function getPageNotFoundView()
|
||||
{
|
||||
return self::read("page_not_found_view", '404.html');
|
||||
}
|
||||
|
||||
public static function getActiveTemplate()
|
||||
{
|
||||
return self::read('active-template', 'default');
|
||||
}
|
||||
} // ConfigQuery
|
||||
|
||||
@@ -9,6 +9,6 @@ class Content extends BaseContent
|
||||
{
|
||||
public function getUrl($locale)
|
||||
{
|
||||
return URL::init()->retrieve('content', $this->getId(), $locale);
|
||||
return URL::init()->retrieve('content', $this->getId(), $locale)->toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Currency extends BaseCurrency {
|
||||
*/
|
||||
public function preUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGECURRENCY, new CurrencyEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATECURRENCY, new CurrencyEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class Currency extends BaseCurrency {
|
||||
*/
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CHANGECURRENCY, new CurrencyEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATECURRENCY, new CurrencyEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\Base\Customer as BaseCustomer;
|
||||
|
||||
use Thelia\Model\Exception\InvalidArgumentException;
|
||||
@@ -74,28 +75,46 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
$con = Propel::getWriteConnection(CustomerTableMap::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
try {
|
||||
if ($this->isNew()) {
|
||||
$address = new Address();
|
||||
|
||||
$address
|
||||
->setTitleId($titleId)
|
||||
->setFirstname($firstname)
|
||||
->setLastname($lastname)
|
||||
->setAddress1($address1)
|
||||
->setAddress2($address2)
|
||||
->setAddress3($address3)
|
||||
->setPhone($phone)
|
||||
->setCellphone($cellphone)
|
||||
->setZipcode($zipcode)
|
||||
->setCountryId($countryId)
|
||||
->setIsDefault(1)
|
||||
;
|
||||
|
||||
$this->addAddress($address);
|
||||
|
||||
} else {
|
||||
$address = $this->getDefaultAddress();
|
||||
|
||||
$address
|
||||
->setTitleId($titleId)
|
||||
->setFirstname($firstname)
|
||||
->setLastname($lastname)
|
||||
->setAddress1($address1)
|
||||
->setAddress2($address2)
|
||||
->setAddress3($address3)
|
||||
->setPhone($phone)
|
||||
->setCellphone($cellphone)
|
||||
->setZipcode($zipcode)
|
||||
->setCountryId($countryId)
|
||||
->save($con)
|
||||
;
|
||||
}
|
||||
$this->save($con);
|
||||
|
||||
$address = new Address();
|
||||
|
||||
$address
|
||||
->setTitleId($titleId)
|
||||
->setFirstname($firstname)
|
||||
->setLastname($lastname)
|
||||
->setAddress1($address1)
|
||||
->setAddress2($address2)
|
||||
->setAddress3($address3)
|
||||
->setPhone($phone)
|
||||
->setCellphone($cellphone)
|
||||
->setZipcode($zipcode)
|
||||
->setCountryId($countryId)
|
||||
->setIsDefault(1)
|
||||
->setCustomer($this)
|
||||
->save($con);
|
||||
|
||||
$con->commit();
|
||||
|
||||
|
||||
} catch(Exception $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
@@ -107,12 +126,23 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
return uniqid(substr($this->getLastname(), 0, (strlen($this->getLastname()) >= 3) ? 3 : strlen($this->getLastname())), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Address
|
||||
*/
|
||||
public function getDefaultAddress()
|
||||
{
|
||||
return AddressQuery::create()
|
||||
->filterByCustomer($this)
|
||||
->filterByIsDefault(1)
|
||||
->findOne();
|
||||
}
|
||||
|
||||
/**
|
||||
* create hash for plain password and set it in Customer object
|
||||
*
|
||||
* @param string $password plain password before hashing
|
||||
* @throws Exception\InvalidArgumentException
|
||||
* @return $this|Customer
|
||||
* @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ class Folder extends BaseFolder
|
||||
|
||||
public function getUrl($locale)
|
||||
{
|
||||
return URL::init()->retrieve('folder', $this->getId(), $locale);
|
||||
return URL::init()->retrieve('folder', $this->getId(), $locale)->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,9 +75,9 @@ class AddressTableMap extends TableMap
|
||||
const ID = 'address.ID';
|
||||
|
||||
/**
|
||||
* the column name for the NAME field
|
||||
* the column name for the LABEL field
|
||||
*/
|
||||
const NAME = 'address.NAME';
|
||||
const LABEL = 'address.LABEL';
|
||||
|
||||
/**
|
||||
* the column name for the CUSTOMER_ID field
|
||||
@@ -171,11 +171,11 @@ class AddressTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Name', 'CustomerId', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'name', 'customerId', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::NAME, AddressTableMap::CUSTOMER_ID, AddressTableMap::TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'CUSTOMER_ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'name', 'customer_id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ),
|
||||
self::TYPE_PHPNAME => array('Id', 'Label', 'CustomerId', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'label', 'customerId', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::LABEL, AddressTableMap::CUSTOMER_ID, AddressTableMap::TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'LABEL', 'CUSTOMER_ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'label', 'customer_id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
|
||||
);
|
||||
|
||||
@@ -186,11 +186,11 @@ class AddressTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'CustomerId' => 2, 'TitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'customerId' => 2, 'titleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
|
||||
self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::NAME => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'CUSTOMER_ID' => 2, 'TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'customer_id' => 2, 'title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ),
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Label' => 1, 'CustomerId' => 2, 'TitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'label' => 1, 'customerId' => 2, 'titleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ),
|
||||
self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::LABEL => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LABEL' => 1, 'CUSTOMER_ID' => 2, 'TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'label' => 1, 'customer_id' => 2, 'title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
|
||||
);
|
||||
|
||||
@@ -211,7 +211,7 @@ class AddressTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('NAME', 'Name', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('LABEL', 'Label', 'VARCHAR', false, 255, null);
|
||||
$this->addForeignKey('CUSTOMER_ID', 'CustomerId', 'INTEGER', 'customer', 'ID', true, null, null);
|
||||
$this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null);
|
||||
$this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null);
|
||||
@@ -394,7 +394,7 @@ class AddressTableMap extends TableMap
|
||||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(AddressTableMap::ID);
|
||||
$criteria->addSelectColumn(AddressTableMap::NAME);
|
||||
$criteria->addSelectColumn(AddressTableMap::LABEL);
|
||||
$criteria->addSelectColumn(AddressTableMap::CUSTOMER_ID);
|
||||
$criteria->addSelectColumn(AddressTableMap::TITLE_ID);
|
||||
$criteria->addSelectColumn(AddressTableMap::COMPANY);
|
||||
@@ -413,7 +413,7 @@ class AddressTableMap extends TableMap
|
||||
$criteria->addSelectColumn(AddressTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.NAME');
|
||||
$criteria->addSelectColumn($alias . '.LABEL');
|
||||
$criteria->addSelectColumn($alias . '.CUSTOMER_ID');
|
||||
$criteria->addSelectColumn($alias . '.TITLE_ID');
|
||||
$criteria->addSelectColumn($alias . '.COMPANY');
|
||||
|
||||
@@ -57,7 +57,7 @@ class CouponI18nTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 2;
|
||||
const NUM_COLUMNS = 5;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class CouponI18nTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 2;
|
||||
const NUM_HYDRATE_COLUMNS = 5;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -79,6 +79,21 @@ class CouponI18nTableMap extends TableMap
|
||||
*/
|
||||
const LOCALE = 'coupon_i18n.LOCALE';
|
||||
|
||||
/**
|
||||
* the column name for the TITLE field
|
||||
*/
|
||||
const TITLE = 'coupon_i18n.TITLE';
|
||||
|
||||
/**
|
||||
* the column name for the SHORT_DESCRIPTION field
|
||||
*/
|
||||
const SHORT_DESCRIPTION = 'coupon_i18n.SHORT_DESCRIPTION';
|
||||
|
||||
/**
|
||||
* the column name for the DESCRIPTION field
|
||||
*/
|
||||
const DESCRIPTION = 'coupon_i18n.DESCRIPTION';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
@@ -91,12 +106,12 @@ class CouponI18nTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Locale', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'locale', ),
|
||||
self::TYPE_COLNAME => array(CouponI18nTableMap::ID, CouponI18nTableMap::LOCALE, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'locale', ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'ShortDescription', 'Description', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'shortDescription', 'description', ),
|
||||
self::TYPE_COLNAME => array(CouponI18nTableMap::ID, CouponI18nTableMap::LOCALE, CouponI18nTableMap::TITLE, CouponI18nTableMap::SHORT_DESCRIPTION, CouponI18nTableMap::DESCRIPTION, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'short_description', 'description', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -106,12 +121,12 @@ class CouponI18nTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, ),
|
||||
self::TYPE_COLNAME => array(CouponI18nTableMap::ID => 0, CouponI18nTableMap::LOCALE => 1, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'ShortDescription' => 3, 'Description' => 4, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'shortDescription' => 3, 'description' => 4, ),
|
||||
self::TYPE_COLNAME => array(CouponI18nTableMap::ID => 0, CouponI18nTableMap::LOCALE => 1, CouponI18nTableMap::TITLE => 2, CouponI18nTableMap::SHORT_DESCRIPTION => 3, CouponI18nTableMap::DESCRIPTION => 4, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'SHORT_DESCRIPTION' => 3, 'DESCRIPTION' => 4, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'short_description' => 3, 'description' => 4, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -132,6 +147,9 @@ class CouponI18nTableMap extends TableMap
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||
$this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
@@ -331,9 +349,15 @@ class CouponI18nTableMap extends TableMap
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CouponI18nTableMap::ID);
|
||||
$criteria->addSelectColumn(CouponI18nTableMap::LOCALE);
|
||||
$criteria->addSelectColumn(CouponI18nTableMap::TITLE);
|
||||
$criteria->addSelectColumn(CouponI18nTableMap::SHORT_DESCRIPTION);
|
||||
$criteria->addSelectColumn(CouponI18nTableMap::DESCRIPTION);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.LOCALE');
|
||||
$criteria->addSelectColumn($alias . '.TITLE');
|
||||
$criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class CouponOrderTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 6;
|
||||
const NUM_COLUMNS = 5;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class CouponOrderTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 6;
|
||||
const NUM_HYDRATE_COLUMNS = 5;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -79,11 +79,6 @@ class CouponOrderTableMap extends TableMap
|
||||
*/
|
||||
const ORDER_ID = 'coupon_order.ORDER_ID';
|
||||
|
||||
/**
|
||||
* the column name for the CODE field
|
||||
*/
|
||||
const CODE = 'coupon_order.CODE';
|
||||
|
||||
/**
|
||||
* the column name for the VALUE field
|
||||
*/
|
||||
@@ -111,12 +106,12 @@ class CouponOrderTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'OrderId', 'Code', 'Value', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'code', 'value', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CouponOrderTableMap::ID, CouponOrderTableMap::ORDER_ID, CouponOrderTableMap::CODE, CouponOrderTableMap::VALUE, CouponOrderTableMap::CREATED_AT, CouponOrderTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'CODE', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'order_id', 'code', 'value', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
self::TYPE_PHPNAME => array('Id', 'OrderId', 'Value', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'value', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(CouponOrderTableMap::ID, CouponOrderTableMap::ORDER_ID, CouponOrderTableMap::VALUE, CouponOrderTableMap::CREATED_AT, CouponOrderTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'VALUE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'order_id', 'value', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -126,12 +121,12 @@ class CouponOrderTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Code' => 2, 'Value' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'code' => 2, 'value' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
|
||||
self::TYPE_COLNAME => array(CouponOrderTableMap::ID => 0, CouponOrderTableMap::ORDER_ID => 1, CouponOrderTableMap::CODE => 2, CouponOrderTableMap::VALUE => 3, CouponOrderTableMap::CREATED_AT => 4, CouponOrderTableMap::UPDATED_AT => 5, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'CODE' => 2, 'VALUE' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'code' => 2, 'value' => 3, 'created_at' => 4, 'updated_at' => 5, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'Value' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'value' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
|
||||
self::TYPE_COLNAME => array(CouponOrderTableMap::ID => 0, CouponOrderTableMap::ORDER_ID => 1, CouponOrderTableMap::VALUE => 2, CouponOrderTableMap::CREATED_AT => 3, CouponOrderTableMap::UPDATED_AT => 4, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'VALUE' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'value' => 2, 'created_at' => 3, 'updated_at' => 4, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -152,7 +147,6 @@ class CouponOrderTableMap extends TableMap
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null);
|
||||
$this->addForeignKey('CODE', 'Code', 'VARCHAR', 'coupon', 'CODE', true, 45, null);
|
||||
$this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
@@ -164,7 +158,6 @@ class CouponOrderTableMap extends TableMap
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('code' => 'code', ), null, null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
@@ -320,14 +313,12 @@ class CouponOrderTableMap extends TableMap
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CouponOrderTableMap::ID);
|
||||
$criteria->addSelectColumn(CouponOrderTableMap::ORDER_ID);
|
||||
$criteria->addSelectColumn(CouponOrderTableMap::CODE);
|
||||
$criteria->addSelectColumn(CouponOrderTableMap::VALUE);
|
||||
$criteria->addSelectColumn(CouponOrderTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(CouponOrderTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.ORDER_ID');
|
||||
$criteria->addSelectColumn($alias . '.CODE');
|
||||
$criteria->addSelectColumn($alias . '.VALUE');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
|
||||
@@ -57,7 +57,7 @@ class CouponTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 18;
|
||||
const NUM_COLUMNS = 15;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class CouponTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 18;
|
||||
const NUM_HYDRATE_COLUMNS = 15;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -84,21 +84,6 @@ class CouponTableMap extends TableMap
|
||||
*/
|
||||
const TYPE = 'coupon.TYPE';
|
||||
|
||||
/**
|
||||
* the column name for the TITLE field
|
||||
*/
|
||||
const TITLE = 'coupon.TITLE';
|
||||
|
||||
/**
|
||||
* the column name for the SHORT_DESCRIPTION field
|
||||
*/
|
||||
const SHORT_DESCRIPTION = 'coupon.SHORT_DESCRIPTION';
|
||||
|
||||
/**
|
||||
* the column name for the DESCRIPTION field
|
||||
*/
|
||||
const DESCRIPTION = 'coupon.DESCRIPTION';
|
||||
|
||||
/**
|
||||
* the column name for the AMOUNT field
|
||||
*/
|
||||
@@ -180,12 +165,12 @@ class CouponTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ),
|
||||
self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::TITLE, CouponTableMap::SHORT_DESCRIPTION, CouponTableMap::DESCRIPTION, CouponTableMap::AMOUNT, CouponTableMap::IS_USED, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::SERIALIZED_RULES, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ),
|
||||
self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::AMOUNT, CouponTableMap::IS_USED, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::SERIALIZED_RULES, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -195,12 +180,12 @@ class CouponTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Amount' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRules' => 10, 'IsCumulative' => 11, 'IsRemovingPostage' => 12, 'MaxUsage' => 13, 'IsAvailableOnSpecialOffers' => 14, 'CreatedAt' => 15, 'UpdatedAt' => 16, 'Version' => 17, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'amount' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRules' => 10, 'isCumulative' => 11, 'isRemovingPostage' => 12, 'maxUsage' => 13, 'isAvailableOnSpecialOffers' => 14, 'createdAt' => 15, 'updatedAt' => 16, 'version' => 17, ),
|
||||
self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::TITLE => 3, CouponTableMap::SHORT_DESCRIPTION => 4, CouponTableMap::DESCRIPTION => 5, CouponTableMap::AMOUNT => 6, CouponTableMap::IS_USED => 7, CouponTableMap::IS_ENABLED => 8, CouponTableMap::EXPIRATION_DATE => 9, CouponTableMap::SERIALIZED_RULES => 10, CouponTableMap::IS_CUMULATIVE => 11, CouponTableMap::IS_REMOVING_POSTAGE => 12, CouponTableMap::MAX_USAGE => 13, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 14, CouponTableMap::CREATED_AT => 15, CouponTableMap::UPDATED_AT => 16, CouponTableMap::VERSION => 17, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'AMOUNT' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES' => 10, 'IS_CUMULATIVE' => 11, 'IS_REMOVING_POSTAGE' => 12, 'MAX_USAGE' => 13, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 14, 'CREATED_AT' => 15, 'UPDATED_AT' => 16, 'VERSION' => 17, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'amount' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules' => 10, 'is_cumulative' => 11, 'is_removing_postage' => 12, 'max_usage' => 13, 'is_available_on_special_offers' => 14, 'created_at' => 15, 'updated_at' => 16, 'version' => 17, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Amount' => 3, 'IsUsed' => 4, 'IsEnabled' => 5, 'ExpirationDate' => 6, 'SerializedRules' => 7, 'IsCumulative' => 8, 'IsRemovingPostage' => 9, 'MaxUsage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'isUsed' => 4, 'isEnabled' => 5, 'expirationDate' => 6, 'serializedRules' => 7, 'isCumulative' => 8, 'isRemovingPostage' => 9, 'maxUsage' => 10, 'isAvailableOnSpecialOffers' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, ),
|
||||
self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::AMOUNT => 3, CouponTableMap::IS_USED => 4, CouponTableMap::IS_ENABLED => 5, CouponTableMap::EXPIRATION_DATE => 6, CouponTableMap::SERIALIZED_RULES => 7, CouponTableMap::IS_CUMULATIVE => 8, CouponTableMap::IS_REMOVING_POSTAGE => 9, CouponTableMap::MAX_USAGE => 10, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, CouponTableMap::CREATED_AT => 12, CouponTableMap::UPDATED_AT => 13, CouponTableMap::VERSION => 14, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'AMOUNT' => 3, 'IS_USED' => 4, 'IS_ENABLED' => 5, 'EXPIRATION_DATE' => 6, 'SERIALIZED_RULES' => 7, 'IS_CUMULATIVE' => 8, 'IS_REMOVING_POSTAGE' => 9, 'MAX_USAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'is_used' => 4, 'is_enabled' => 5, 'expiration_date' => 6, 'serialized_rules' => 7, 'is_cumulative' => 8, 'is_removing_postage' => 9, 'max_usage' => 10, 'is_available_on_special_offers' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -222,9 +207,6 @@ class CouponTableMap extends TableMap
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null);
|
||||
$this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null);
|
||||
$this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null);
|
||||
$this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null);
|
||||
@@ -244,7 +226,6 @@ class CouponTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CouponOrder', '\\Thelia\\Model\\CouponOrder', RelationMap::ONE_TO_MANY, array('code' => 'code', ), null, null, 'CouponOrders');
|
||||
$this->addRelation('CouponI18n', '\\Thelia\\Model\\CouponI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponI18ns');
|
||||
$this->addRelation('CouponVersion', '\\Thelia\\Model\\CouponVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponVersions');
|
||||
} // buildRelations()
|
||||
@@ -259,7 +240,7 @@ class CouponTableMap extends TableMap
|
||||
{
|
||||
return array(
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => '', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
|
||||
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, short_description, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
|
||||
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'false', 'log_created_by' => 'false', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
@@ -415,9 +396,6 @@ class CouponTableMap extends TableMap
|
||||
$criteria->addSelectColumn(CouponTableMap::ID);
|
||||
$criteria->addSelectColumn(CouponTableMap::CODE);
|
||||
$criteria->addSelectColumn(CouponTableMap::TYPE);
|
||||
$criteria->addSelectColumn(CouponTableMap::TITLE);
|
||||
$criteria->addSelectColumn(CouponTableMap::SHORT_DESCRIPTION);
|
||||
$criteria->addSelectColumn(CouponTableMap::DESCRIPTION);
|
||||
$criteria->addSelectColumn(CouponTableMap::AMOUNT);
|
||||
$criteria->addSelectColumn(CouponTableMap::IS_USED);
|
||||
$criteria->addSelectColumn(CouponTableMap::IS_ENABLED);
|
||||
@@ -434,9 +412,6 @@ class CouponTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.CODE');
|
||||
$criteria->addSelectColumn($alias . '.TYPE');
|
||||
$criteria->addSelectColumn($alias . '.TITLE');
|
||||
$criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.AMOUNT');
|
||||
$criteria->addSelectColumn($alias . '.IS_USED');
|
||||
$criteria->addSelectColumn($alias . '.IS_ENABLED');
|
||||
|
||||
@@ -57,7 +57,7 @@ class CouponVersionTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 18;
|
||||
const NUM_COLUMNS = 15;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class CouponVersionTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 18;
|
||||
const NUM_HYDRATE_COLUMNS = 15;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -84,21 +84,6 @@ class CouponVersionTableMap extends TableMap
|
||||
*/
|
||||
const TYPE = 'coupon_version.TYPE';
|
||||
|
||||
/**
|
||||
* the column name for the TITLE field
|
||||
*/
|
||||
const TITLE = 'coupon_version.TITLE';
|
||||
|
||||
/**
|
||||
* the column name for the SHORT_DESCRIPTION field
|
||||
*/
|
||||
const SHORT_DESCRIPTION = 'coupon_version.SHORT_DESCRIPTION';
|
||||
|
||||
/**
|
||||
* the column name for the DESCRIPTION field
|
||||
*/
|
||||
const DESCRIPTION = 'coupon_version.DESCRIPTION';
|
||||
|
||||
/**
|
||||
* the column name for the AMOUNT field
|
||||
*/
|
||||
@@ -171,12 +156,12 @@ class CouponVersionTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Title', 'ShortDescription', 'Description', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'title', 'shortDescription', 'description', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ),
|
||||
self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::TITLE, CouponVersionTableMap::SHORT_DESCRIPTION, CouponVersionTableMap::DESCRIPTION, CouponVersionTableMap::AMOUNT, CouponVersionTableMap::IS_USED, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::SERIALIZED_RULES, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'TITLE', 'SHORT_DESCRIPTION', 'DESCRIPTION', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'title', 'short_description', 'description', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Amount', 'IsUsed', 'IsEnabled', 'ExpirationDate', 'SerializedRules', 'IsCumulative', 'IsRemovingPostage', 'MaxUsage', 'IsAvailableOnSpecialOffers', 'CreatedAt', 'UpdatedAt', 'Version', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'amount', 'isUsed', 'isEnabled', 'expirationDate', 'serializedRules', 'isCumulative', 'isRemovingPostage', 'maxUsage', 'isAvailableOnSpecialOffers', 'createdAt', 'updatedAt', 'version', ),
|
||||
self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::AMOUNT, CouponVersionTableMap::IS_USED, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::SERIALIZED_RULES, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'AMOUNT', 'IS_USED', 'IS_ENABLED', 'EXPIRATION_DATE', 'SERIALIZED_RULES', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'MAX_USAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'amount', 'is_used', 'is_enabled', 'expiration_date', 'serialized_rules', 'is_cumulative', 'is_removing_postage', 'max_usage', 'is_available_on_special_offers', 'created_at', 'updated_at', 'version', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -186,12 +171,12 @@ class CouponVersionTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Title' => 3, 'ShortDescription' => 4, 'Description' => 5, 'Amount' => 6, 'IsUsed' => 7, 'IsEnabled' => 8, 'ExpirationDate' => 9, 'SerializedRules' => 10, 'IsCumulative' => 11, 'IsRemovingPostage' => 12, 'MaxUsage' => 13, 'IsAvailableOnSpecialOffers' => 14, 'CreatedAt' => 15, 'UpdatedAt' => 16, 'Version' => 17, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'shortDescription' => 4, 'description' => 5, 'amount' => 6, 'isUsed' => 7, 'isEnabled' => 8, 'expirationDate' => 9, 'serializedRules' => 10, 'isCumulative' => 11, 'isRemovingPostage' => 12, 'maxUsage' => 13, 'isAvailableOnSpecialOffers' => 14, 'createdAt' => 15, 'updatedAt' => 16, 'version' => 17, ),
|
||||
self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::TITLE => 3, CouponVersionTableMap::SHORT_DESCRIPTION => 4, CouponVersionTableMap::DESCRIPTION => 5, CouponVersionTableMap::AMOUNT => 6, CouponVersionTableMap::IS_USED => 7, CouponVersionTableMap::IS_ENABLED => 8, CouponVersionTableMap::EXPIRATION_DATE => 9, CouponVersionTableMap::SERIALIZED_RULES => 10, CouponVersionTableMap::IS_CUMULATIVE => 11, CouponVersionTableMap::IS_REMOVING_POSTAGE => 12, CouponVersionTableMap::MAX_USAGE => 13, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 14, CouponVersionTableMap::CREATED_AT => 15, CouponVersionTableMap::UPDATED_AT => 16, CouponVersionTableMap::VERSION => 17, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'TITLE' => 3, 'SHORT_DESCRIPTION' => 4, 'DESCRIPTION' => 5, 'AMOUNT' => 6, 'IS_USED' => 7, 'IS_ENABLED' => 8, 'EXPIRATION_DATE' => 9, 'SERIALIZED_RULES' => 10, 'IS_CUMULATIVE' => 11, 'IS_REMOVING_POSTAGE' => 12, 'MAX_USAGE' => 13, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 14, 'CREATED_AT' => 15, 'UPDATED_AT' => 16, 'VERSION' => 17, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'title' => 3, 'short_description' => 4, 'description' => 5, 'amount' => 6, 'is_used' => 7, 'is_enabled' => 8, 'expiration_date' => 9, 'serialized_rules' => 10, 'is_cumulative' => 11, 'is_removing_postage' => 12, 'max_usage' => 13, 'is_available_on_special_offers' => 14, 'created_at' => 15, 'updated_at' => 16, 'version' => 17, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Amount' => 3, 'IsUsed' => 4, 'IsEnabled' => 5, 'ExpirationDate' => 6, 'SerializedRules' => 7, 'IsCumulative' => 8, 'IsRemovingPostage' => 9, 'MaxUsage' => 10, 'IsAvailableOnSpecialOffers' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'isUsed' => 4, 'isEnabled' => 5, 'expirationDate' => 6, 'serializedRules' => 7, 'isCumulative' => 8, 'isRemovingPostage' => 9, 'maxUsage' => 10, 'isAvailableOnSpecialOffers' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, ),
|
||||
self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::AMOUNT => 3, CouponVersionTableMap::IS_USED => 4, CouponVersionTableMap::IS_ENABLED => 5, CouponVersionTableMap::EXPIRATION_DATE => 6, CouponVersionTableMap::SERIALIZED_RULES => 7, CouponVersionTableMap::IS_CUMULATIVE => 8, CouponVersionTableMap::IS_REMOVING_POSTAGE => 9, CouponVersionTableMap::MAX_USAGE => 10, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 11, CouponVersionTableMap::CREATED_AT => 12, CouponVersionTableMap::UPDATED_AT => 13, CouponVersionTableMap::VERSION => 14, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'AMOUNT' => 3, 'IS_USED' => 4, 'IS_ENABLED' => 5, 'EXPIRATION_DATE' => 6, 'SERIALIZED_RULES' => 7, 'IS_CUMULATIVE' => 8, 'IS_REMOVING_POSTAGE' => 9, 'MAX_USAGE' => 10, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'amount' => 3, 'is_used' => 4, 'is_enabled' => 5, 'expiration_date' => 6, 'serialized_rules' => 7, 'is_cumulative' => 8, 'is_removing_postage' => 9, 'max_usage' => 10, 'is_available_on_special_offers' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -213,9 +198,6 @@ class CouponVersionTableMap extends TableMap
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon', 'ID', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('SHORT_DESCRIPTION', 'ShortDescription', 'LONGVARCHAR', true, null, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', true, null, null);
|
||||
$this->addColumn('AMOUNT', 'Amount', 'FLOAT', true, null, null);
|
||||
$this->addColumn('IS_USED', 'IsUsed', 'TINYINT', true, null, null);
|
||||
$this->addColumn('IS_ENABLED', 'IsEnabled', 'TINYINT', true, null, null);
|
||||
@@ -305,11 +287,11 @@ class CouponVersionTableMap extends TableMap
|
||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
// If the PK cannot be derived from the row, return NULL.
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 17 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 14 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 17 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 14 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -428,9 +410,6 @@ class CouponVersionTableMap extends TableMap
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::ID);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::CODE);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::TYPE);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::TITLE);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::SHORT_DESCRIPTION);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::DESCRIPTION);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::AMOUNT);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::IS_USED);
|
||||
$criteria->addSelectColumn(CouponVersionTableMap::IS_ENABLED);
|
||||
@@ -447,9 +426,6 @@ class CouponVersionTableMap extends TableMap
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.CODE');
|
||||
$criteria->addSelectColumn($alias . '.TYPE');
|
||||
$criteria->addSelectColumn($alias . '.TITLE');
|
||||
$criteria->addSelectColumn($alias . '.SHORT_DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.AMOUNT');
|
||||
$criteria->addSelectColumn($alias . '.IS_USED');
|
||||
$criteria->addSelectColumn($alias . '.IS_ENABLED');
|
||||
|
||||
@@ -34,7 +34,7 @@ class Message extends BaseMessage {
|
||||
*/
|
||||
public function preUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGEMESSAGE, new MessageEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATEMESSAGE, new MessageEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class Message extends BaseMessage {
|
||||
*/
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CHANGEMESSAGE, new MessageEvent($this));
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATEMESSAGE, new MessageEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,6 @@ class Product extends BaseProduct
|
||||
{
|
||||
public function getUrl($locale)
|
||||
{
|
||||
return URL::init()->retrieve('product', $this->getId(), $locale);
|
||||
return URL::init()->retrieve('product', $this->getId(), $locale)->toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,4 +98,12 @@ class RewritingRetriever
|
||||
$this->rewrittenUrl = $this->search->getUrl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return $this->rewrittenUrl === null ? $this->url : $this->rewrittenUrl;
|
||||
}
|
||||
}
|
||||
|
||||
145
core/lib/Thelia/Tests/Action/AddressTest.php
Normal file
145
core/lib/Thelia/Tests/Action/AddressTest.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests\Action;
|
||||
use Thelia\Action\Address;
|
||||
use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
||||
use Thelia\Model\Base\CustomerQuery;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* test address eventListener
|
||||
*
|
||||
* Class AddressTest
|
||||
* @package Thelia\Tests\Action
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AddressTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function getContainer()
|
||||
{
|
||||
$container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
|
||||
|
||||
$dispatcher = $this->getMock("Symfony\Component\EventDispatcher\EventDispatcherInterface");
|
||||
|
||||
$container->set("event_dispatcher", $dispatcher);
|
||||
|
||||
return $container;
|
||||
}
|
||||
|
||||
public function testCreatedAddress()
|
||||
{
|
||||
$customer = CustomerQuery::create()->findOne();
|
||||
|
||||
$AddressCreateOrUpdateEvent = new AddressCreateOrUpdateEvent(
|
||||
"test address",
|
||||
1,
|
||||
"Thelia",
|
||||
"Thelia",
|
||||
"5 rue rochon",
|
||||
"",
|
||||
"",
|
||||
"63000",
|
||||
"clermont-ferrand",
|
||||
64,
|
||||
"0102030405",
|
||||
"",
|
||||
""
|
||||
);
|
||||
$AddressCreateOrUpdateEvent->setCustomer($customer);
|
||||
|
||||
$actionAddress = new Address($this->getContainer());
|
||||
$actionAddress->create($AddressCreateOrUpdateEvent);
|
||||
|
||||
$createdAddress = $AddressCreateOrUpdateEvent->getAddress();
|
||||
|
||||
$this->assertInstanceOf("Thelia\Model\Address", $createdAddress);
|
||||
$this->assertFalse($createdAddress->isNew());
|
||||
$this->assertSame($customer, $createdAddress->getCustomer());
|
||||
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getLabel(), $createdAddress->getLabel());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getTitle(), $createdAddress->getTitleId());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getFirstname(), $createdAddress->getFirstname());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getLastname(), $createdAddress->getLastname());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getAddress1(), $createdAddress->getAddress1());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getAddress2(), $createdAddress->getAddress2());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getAddress3(), $createdAddress->getAddress3());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getZipcode(), $createdAddress->getZipcode());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getCity(), $createdAddress->getCity());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getCountry(), $createdAddress->getCountryId());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getPhone(), $createdAddress->getPhone());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getCellphone(), $createdAddress->getCellphone());
|
||||
$this->assertEquals($AddressCreateOrUpdateEvent->getCompany(), $createdAddress->getCompany());
|
||||
}
|
||||
|
||||
public function testUpdatedAddress()
|
||||
{
|
||||
|
||||
$customer = CustomerQuery::create()->findOne();
|
||||
$address = $customer->getAddresses()->getFirst();
|
||||
|
||||
$addressEvent = new AddressCreateOrUpdateEvent(
|
||||
"",
|
||||
1,
|
||||
"Thelia modif",
|
||||
"Thelia modif",
|
||||
"cour des étoiles",
|
||||
"rue des miracles",
|
||||
"",
|
||||
"63000",
|
||||
"clermont-ferrand",
|
||||
64,
|
||||
"0102030405",
|
||||
"",
|
||||
""
|
||||
);
|
||||
$addressEvent->setAddress($address);
|
||||
|
||||
$actionAddress = new Address($this->getContainer());
|
||||
$actionAddress->update($addressEvent);
|
||||
|
||||
|
||||
$updatedAddress = $addressEvent->getAddress();
|
||||
$this->assertInstanceOf("Thelia\Model\Address", $updatedAddress);
|
||||
$this->assertFalse($updatedAddress->isNew());
|
||||
$this->assertSame($customer, $updatedAddress->getCustomer());
|
||||
|
||||
$this->assertEquals($address->getLabel(), $updatedAddress->getLabel());
|
||||
$this->assertEquals($addressEvent->getTitle(), $updatedAddress->getTitleId());
|
||||
$this->assertEquals($addressEvent->getFirstname(), $updatedAddress->getFirstname());
|
||||
$this->assertEquals($addressEvent->getLastname(), $updatedAddress->getLastname());
|
||||
$this->assertEquals($addressEvent->getAddress1(), $updatedAddress->getAddress1());
|
||||
$this->assertEquals($addressEvent->getAddress2(), $updatedAddress->getAddress2());
|
||||
$this->assertEquals($addressEvent->getAddress3(), $updatedAddress->getAddress3());
|
||||
$this->assertEquals($addressEvent->getZipcode(), $updatedAddress->getZipcode());
|
||||
$this->assertEquals($addressEvent->getCity(), $updatedAddress->getCity());
|
||||
$this->assertEquals($addressEvent->getCountry(), $updatedAddress->getCountryId());
|
||||
$this->assertEquals($addressEvent->getPhone(), $updatedAddress->getPhone());
|
||||
$this->assertEquals($addressEvent->getCellphone(), $updatedAddress->getCellphone());
|
||||
$this->assertEquals($addressEvent->getCompany(), $updatedAddress->getCompany());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,6 +52,18 @@ class RewritingResolverTest extends \PHPUnit_Framework_TestCase
|
||||
return $property;
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Thelia\Exception\UrlRewritingException
|
||||
* @expectedExceptionCode 800
|
||||
*/
|
||||
public function testGetOtherParametersException()
|
||||
{
|
||||
$resolver = new RewritingResolver();
|
||||
|
||||
$method = $this->getMethod('getOtherParameters');
|
||||
$actual = $method->invoke($resolver);
|
||||
}
|
||||
|
||||
public function testGetOtherParameters()
|
||||
{
|
||||
$rewritingArguments = array(
|
||||
@@ -80,6 +92,29 @@ class RewritingResolverTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Thelia\Exception\UrlRewritingException
|
||||
* @expectedExceptionCode 404
|
||||
*/
|
||||
public function testLoadException()
|
||||
{
|
||||
$collection = new ObjectCollection();
|
||||
$collection->setModel('\Thelia\Model\RewritingArgument');
|
||||
|
||||
$resolverQuery = $this->getMock('\Thelia\Model\RewritingUrlQuery', array('getResolverSearch'));
|
||||
$resolverQuery->expects($this->any())
|
||||
->method('getResolverSearch')
|
||||
->with('foo.html')
|
||||
->will($this->returnValue($collection));
|
||||
|
||||
$resolver = new RewritingResolver();
|
||||
|
||||
$rewritingUrlQuery = $this->getProperty('rewritingUrlQuery');
|
||||
$rewritingUrlQuery->setValue($resolver, $resolverQuery);
|
||||
|
||||
$resolver->load('foo.html');
|
||||
}
|
||||
|
||||
public function testLoad()
|
||||
{
|
||||
$collection = new ObjectCollection();
|
||||
|
||||
@@ -124,25 +124,32 @@ class URL
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a rewritten URL from a view, a view id and a locale
|
||||
*
|
||||
* @param $view
|
||||
* @param $viewId
|
||||
* @param $viewLocale
|
||||
*
|
||||
* @return null|string
|
||||
* @return RewritingRetriever You can access $url and $rewrittenUrl properties
|
||||
*/
|
||||
public function retrieve($view, $viewId, $viewLocale)
|
||||
{
|
||||
$rewrittenUrl = null;
|
||||
if(ConfigQuery::isRewritingEnable()) {
|
||||
$rewrittenUrl = $this->retriever->loadViewUrl($view, $viewLocale, $viewId);
|
||||
$this->retriever->loadViewUrl($view, $viewLocale, $viewId);
|
||||
}
|
||||
|
||||
return $rewrittenUrl === null ? self::viewUrl($view, array($view . '_id' => $viewId, 'locale' => $viewLocale)) : $rewrittenUrl;
|
||||
return $this->retriever;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a rewritten URL from the current GET parameters
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return RewritingRetriever You can access $url and $rewrittenUrl properties or use toString method
|
||||
*/
|
||||
public function retrieveCurrent(Request $request)
|
||||
{
|
||||
$rewrittenUrl = null;
|
||||
if(ConfigQuery::isRewritingEnable()) {
|
||||
$view = $request->query->get('view', null);
|
||||
$viewLocale = $request->query->get('locale', null);
|
||||
@@ -165,6 +172,13 @@ class URL
|
||||
return $this->retriever;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a rewritten URL from the current GET parameters or use toString method
|
||||
*
|
||||
* @param $url
|
||||
*
|
||||
* @return RewritingResolver
|
||||
*/
|
||||
public function resolve($url)
|
||||
{
|
||||
$this->resolver->load($url);
|
||||
|
||||
@@ -1637,12 +1637,12 @@
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CREATECATEGORY" class="">AFTER_CREATECATEGORY</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_BEFORE_DELETECATEGORY" class="">BEFORE_DELETECATEGORY</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_DELETECATEGORY" class="">AFTER_DELETECATEGORY</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CHANGECATEGORY" class="">AFTER_CHANGECATEGORY</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CHANGECATEGORY" class="">AFTER_UPDATECATEGORY</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_DUPLICATE" class="">CART_DUPLICATE</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CARTADDITEM" class="">AFTER_CARTADDITEM</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CARTCHANGEITEM" class="">AFTER_CARTCHANGEITEM</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_AFTER_CARTCHANGEITEM" class="">AFTER_CARTUPDATEITEM</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_ADDITEM" class="">CART_ADDITEM</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_CHANGEITEM" class="">CART_CHANGEITEM</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_CHANGEITEM" class="">CART_UPDATEITEM</a><br />
|
||||
<a href="../classes/Thelia.Core.Event.TheliaEvents.html#constant_CART_DELETEITEM" class="">CART_DELETEITEM</a><br />
|
||||
</section>
|
||||
</section>
|
||||
@@ -2023,8 +2023,8 @@
|
||||
<div class="span8 content class">
|
||||
<a id="constant_AFTER_CHANGECATEGORY" name="constant_AFTER_CHANGECATEGORY" class="anchor"></a>
|
||||
<article id="constant_AFTER_CHANGECATEGORY" class="constant">
|
||||
<h3 class="">AFTER_CHANGECATEGORY</h3>
|
||||
<pre class="signature">AFTER_CHANGECATEGORY</pre>
|
||||
<h3 class="">AFTER_UPDATECATEGORY</h3>
|
||||
<pre class="signature">AFTER_UPDATECATEGORY</pre>
|
||||
<p><em>Sent just after a successful change of a category in the database.</em></p>
|
||||
|
||||
|
||||
@@ -2089,8 +2089,8 @@
|
||||
<div class="span8 content class">
|
||||
<a id="constant_AFTER_CARTCHANGEITEM" name="constant_AFTER_CARTCHANGEITEM" class="anchor"></a>
|
||||
<article id="constant_AFTER_CARTCHANGEITEM" class="constant">
|
||||
<h3 class="">AFTER_CARTCHANGEITEM</h3>
|
||||
<pre class="signature">AFTER_CARTCHANGEITEM</pre>
|
||||
<h3 class="">AFTER_CARTUPDATEITEM</h3>
|
||||
<pre class="signature">AFTER_CARTUPDATEITEM</pre>
|
||||
<p><em>sent when a cart item is modify</em></p>
|
||||
|
||||
|
||||
@@ -2133,8 +2133,8 @@
|
||||
<div class="span8 content class">
|
||||
<a id="constant_CART_CHANGEITEM" name="constant_CART_CHANGEITEM" class="anchor"></a>
|
||||
<article id="constant_CART_CHANGEITEM" class="constant">
|
||||
<h3 class="">CART_CHANGEITEM</h3>
|
||||
<pre class="signature">CART_CHANGEITEM</pre>
|
||||
<h3 class="">CART_UPDATEITEM</h3>
|
||||
<pre class="signature">CART_UPDATEITEM</pre>
|
||||
<p><em>sent on modify article action</em></p>
|
||||
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
$categoryEvent = new CategoryEvent($category);
|
||||
|
||||
$event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECATEGORY, $categoryEvent);
|
||||
$event->getDispatcher()->dispatch(TheliaEvents::AFTER_UPDATECATEGORY, $categoryEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class CartController extends BaseFrontController
|
||||
$cartEvent->setQuantity($this->getRequest()->get("quantity"));
|
||||
|
||||
try {
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::CART_CHANGEITEM, $cartEvent);
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::CART_UPDATEITEM, $cartEvent);
|
||||
|
||||
$this->redirectSuccess();
|
||||
} catch(PropelException $e) {
|
||||
|
||||
@@ -106,7 +106,7 @@ final class TheliaEvents
|
||||
/**
|
||||
* Sent just after a successful change of a category in the database.
|
||||
*/
|
||||
const AFTER_CHANGECATEGORY = "action.after_changecategory";
|
||||
const AFTER_UPDATECATEGORY = "action.after_changecategory";
|
||||
|
||||
/**
|
||||
* sent when a new existing cat id duplicated. This append when current customer is different from current cart
|
||||
@@ -121,7 +121,7 @@ final class TheliaEvents
|
||||
/**
|
||||
* sent when a cart item is modify
|
||||
*/
|
||||
const AFTER_CARTCHANGEITEM = "cart.modifyItem";
|
||||
const AFTER_CARTUPDATEITEM = "cart.modifyItem";
|
||||
|
||||
/**
|
||||
* sent for addArticle action
|
||||
@@ -131,7 +131,7 @@ final class TheliaEvents
|
||||
/**
|
||||
* sent on modify article action
|
||||
*/
|
||||
const CART_CHANGEITEM = "action.changeArticle";
|
||||
const CART_UPDATEITEM = "action.changeArticle";
|
||||
|
||||
const CART_DELETEITEM = "action.deleteArticle";
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class CartItem extends BaseCartItem
|
||||
if ($this->dispatcher) {
|
||||
$cartEvent = new CartEvent($this->getCart());
|
||||
|
||||
$this->dispatcher->dispatch(TheliaEvents::AFTER_CARTCHANGEITEM, $cartEvent);
|
||||
$this->dispatcher->dispatch(TheliaEvents::AFTER_CARTUPDATEITEM, $cartEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
|
||||
('original_image_delivery_mode', 'symlink', 0, 0, NOW(), NOW()),
|
||||
('images_library_path', 'local/media/images', 0, 0, NOW(), NOW()),
|
||||
('image_cache_dir_from_web_root', 'cache/images', 0, 0, NOW(), NOW()),
|
||||
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW());
|
||||
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()),
|
||||
('page_not_found_view', '404.html', 0, 0, NOW(), NOW());
|
||||
|
||||
INSERT INTO `module` (`code`, `type`, `activate`, `position`, `created_at`, `updated_at`) VALUES ('test', '1', '1', '1', NOW(), NOW());
|
||||
|
||||
|
||||
@@ -455,7 +455,7 @@ DROP TABLE IF EXISTS `address`;
|
||||
CREATE TABLE `address`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(255),
|
||||
`label` VARCHAR(255),
|
||||
`customer_id` INTEGER NOT NULL,
|
||||
`title_id` INTEGER NOT NULL,
|
||||
`company` VARCHAR(255),
|
||||
@@ -1040,9 +1040,6 @@ CREATE TABLE `coupon`
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`code` VARCHAR(45) NOT NULL,
|
||||
`type` VARCHAR(255) NOT NULL,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`short_description` TEXT NOT NULL,
|
||||
`description` LONGTEXT NOT NULL,
|
||||
`amount` FLOAT NOT NULL,
|
||||
`is_used` TINYINT NOT NULL,
|
||||
`is_enabled` TINYINT NOT NULL,
|
||||
@@ -1078,21 +1075,16 @@ CREATE TABLE `coupon_order`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`order_id` INTEGER NOT NULL,
|
||||
`code` VARCHAR(45) NOT NULL,
|
||||
`value` FLOAT NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_coupon_order_order_id` (`order_id`),
|
||||
INDEX `fk_coupon_order_coupon_idx` (`code`),
|
||||
CONSTRAINT `fk_coupon_order_order_id`
|
||||
FOREIGN KEY (`order_id`)
|
||||
REFERENCES `order` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_coupon_order_coupon`
|
||||
FOREIGN KEY (`code`)
|
||||
REFERENCES `coupon` (`code`)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
@@ -1923,6 +1915,9 @@ CREATE TABLE `coupon_i18n`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`short_description` TEXT NOT NULL,
|
||||
`description` LONGTEXT NOT NULL,
|
||||
PRIMARY KEY (`id`,`locale`),
|
||||
CONSTRAINT `coupon_i18n_FK_1`
|
||||
FOREIGN KEY (`id`)
|
||||
@@ -2186,9 +2181,6 @@ CREATE TABLE `coupon_version`
|
||||
`id` INTEGER NOT NULL,
|
||||
`code` VARCHAR(45) NOT NULL,
|
||||
`type` VARCHAR(255) NOT NULL,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`short_description` TEXT NOT NULL,
|
||||
`description` LONGTEXT NOT NULL,
|
||||
`amount` FLOAT NOT NULL,
|
||||
`is_used` TINYINT NOT NULL,
|
||||
`is_enabled` TINYINT NOT NULL,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user