Merge branch 'delivery'
Conflicts: composer.lock install/insert.sql
This commit is contained in:
1
composer.lock
generated
1
composer.lock
generated
@@ -4,6 +4,7 @@
|
|||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
||||||
],
|
],
|
||||||
"hash": "ba2f3e0943f00c7c3bf0c086bc611b0f",
|
"hash": "ba2f3e0943f00c7c3bf0c086bc611b0f",
|
||||||
|
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "imagine/imagine",
|
"name": "imagine/imagine",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace %%NAMESPACE%%;
|
|||||||
|
|
||||||
use Thelia\Module\BaseModule;
|
use Thelia\Module\BaseModule;
|
||||||
|
|
||||||
class Class extends BaseModule
|
class %%CLASSNAME%% extends BaseModule
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
|
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
<loop class="Thelia\Core\Template\Loop\Image" name="image"/>
|
<loop class="Thelia\Core\Template\Loop\Image" name="image"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Config" name="config"/>
|
<loop class="Thelia\Core\Template\Loop\Config" name="config"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Message" name="message"/>
|
<loop class="Thelia\Core\Template\Loop\Message" name="message"/>
|
||||||
|
<loop class="Thelia\Core\Template\Loop\Delivery" name="delivery"/>
|
||||||
</loops>
|
</loops>
|
||||||
|
|
||||||
<forms>
|
<forms>
|
||||||
|
|||||||
@@ -60,4 +60,11 @@
|
|||||||
<default key="_view">cart</default>
|
<default key="_view">cart</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<!-- order management process -->
|
||||||
|
<route id="order.delivery.add" path="/delivery/choose/{delivery_id}">
|
||||||
|
<default key="_controller">Thelia\Controller\Front\DeliveryController::select</default>
|
||||||
|
<requirement key="delivery_id">\d+</requirement>
|
||||||
|
</route>
|
||||||
|
<!-- end order management process -->
|
||||||
|
|
||||||
</routes>
|
</routes>
|
||||||
|
|||||||
56
core/lib/Thelia/Controller/Front/DeliveryController.php
Normal file
56
core/lib/Thelia/Controller/Front/DeliveryController.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?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\Model\ModuleQuery;
|
||||||
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DeliveryController
|
||||||
|
* @package Thelia\Controller\Front
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class DeliveryController extends BaseFrontController
|
||||||
|
{
|
||||||
|
public function select($delivery_id)
|
||||||
|
{
|
||||||
|
if ($this->getSecurityContext()->hasCustomerUser() === false) {
|
||||||
|
$this->redirect(URL::getInstance()->getIndexPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
|
||||||
|
$deliveryModule = ModuleQuery::create()
|
||||||
|
->filterById($delivery_id)
|
||||||
|
->filterByActivate(1)
|
||||||
|
->findOne()
|
||||||
|
;
|
||||||
|
|
||||||
|
if ($deliveryModule) {
|
||||||
|
$request->getSession()->setDelivery($delivery_id);
|
||||||
|
} else {
|
||||||
|
$this->pageNotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -164,10 +164,28 @@ class Session extends BaseSession
|
|||||||
* assign cart id in session
|
* assign cart id in session
|
||||||
*
|
*
|
||||||
* @param $cart_id
|
* @param $cart_id
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setCart($cart_id)
|
public function setCart($cart_id)
|
||||||
{
|
{
|
||||||
$this->set("thelia.cart_id", $cart_id);
|
$this->set("thelia.cart_id", $cart_id);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* assign delivery id in session
|
||||||
|
*
|
||||||
|
* @param $delivery_id
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setDelivery($delivery_id)
|
||||||
|
{
|
||||||
|
$this->set("thelia.delivery_id", $delivery_id);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDelivery()
|
||||||
|
{
|
||||||
|
return $this->get("thelia.delivery_id");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -243,23 +243,9 @@ abstract class BaseLoop
|
|||||||
*
|
*
|
||||||
* this function have to be implement in your own loop class.
|
* this function have to be implement in your own loop class.
|
||||||
*
|
*
|
||||||
* All your parameters are defined in defineArgs() and can be accessible like a class property.
|
* All loops parameters can be accessible via getter.
|
||||||
*
|
*
|
||||||
* example :
|
* for example, ref parameter is accessible through getRef method
|
||||||
*
|
|
||||||
* public function defineArgs()
|
|
||||||
* {
|
|
||||||
* return array (
|
|
||||||
* "ref",
|
|
||||||
* "id" => "optional",
|
|
||||||
* "stock" => array(
|
|
||||||
* "optional",
|
|
||||||
* "default" => 10
|
|
||||||
* )
|
|
||||||
* );
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* you can retrieve ref value using $this->ref
|
|
||||||
*
|
*
|
||||||
* @param $pagination
|
* @param $pagination
|
||||||
*
|
*
|
||||||
@@ -271,18 +257,31 @@ abstract class BaseLoop
|
|||||||
*
|
*
|
||||||
* define all args used in your loop
|
* define all args used in your loop
|
||||||
*
|
*
|
||||||
* array key is your arg name.
|
|
||||||
*
|
*
|
||||||
* example :
|
* example :
|
||||||
*
|
*
|
||||||
* return array (
|
* public function getArgDefinitions()
|
||||||
* "ref",
|
* {
|
||||||
* "id" => "optional",
|
* return new ArgumentCollection(
|
||||||
* "stock" => array(
|
* Argument::createIntListTypeArgument('id'),
|
||||||
* "optional",
|
* new Argument(
|
||||||
* "default" => 10
|
* 'ref',
|
||||||
|
* new TypeCollection(
|
||||||
|
* new Type\AlphaNumStringListType()
|
||||||
* )
|
* )
|
||||||
|
* ),
|
||||||
|
* Argument::createIntListTypeArgument('category'),
|
||||||
|
* Argument::createBooleanTypeArgument('new'),
|
||||||
|
* Argument::createBooleanTypeArgument('promo'),
|
||||||
|
* Argument::createFloatTypeArgument('min_price'),
|
||||||
|
* Argument::createFloatTypeArgument('max_price'),
|
||||||
|
* Argument::createIntTypeArgument('min_stock'),
|
||||||
|
* Argument::createFloatTypeArgument('min_weight'),
|
||||||
|
* Argument::createFloatTypeArgument('max_weight'),
|
||||||
|
* Argument::createBooleanTypeArgument('current'),
|
||||||
|
*
|
||||||
* );
|
* );
|
||||||
|
* }
|
||||||
*
|
*
|
||||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||||
*/
|
*/
|
||||||
|
|||||||
109
core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php
Normal file
109
core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<?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\Template\Loop;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
|
use Thelia\Model\ModuleQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Delivery
|
||||||
|
* @package Thelia\Core\Template\Loop
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class BaseSpecificModule extends BaseI18nLoop {
|
||||||
|
public $timestampable = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* define all args used in your loop
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* example :
|
||||||
|
*
|
||||||
|
* public function getArgDefinitions()
|
||||||
|
* {
|
||||||
|
* return new ArgumentCollection(
|
||||||
|
* Argument::createIntListTypeArgument('id'),
|
||||||
|
* new Argument(
|
||||||
|
* 'ref',
|
||||||
|
* new TypeCollection(
|
||||||
|
* new Type\AlphaNumStringListType()
|
||||||
|
* )
|
||||||
|
* ),
|
||||||
|
* Argument::createIntListTypeArgument('category'),
|
||||||
|
* Argument::createBooleanTypeArgument('new'),
|
||||||
|
* Argument::createBooleanTypeArgument('promo'),
|
||||||
|
* Argument::createFloatTypeArgument('min_price'),
|
||||||
|
* Argument::createFloatTypeArgument('max_price'),
|
||||||
|
* Argument::createIntTypeArgument('min_stock'),
|
||||||
|
* Argument::createFloatTypeArgument('min_weight'),
|
||||||
|
* Argument::createFloatTypeArgument('max_weight'),
|
||||||
|
* Argument::createBooleanTypeArgument('current'),
|
||||||
|
*
|
||||||
|
* );
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||||
|
*/
|
||||||
|
protected function getArgDefinitions()
|
||||||
|
{
|
||||||
|
return new ArgumentCollection(
|
||||||
|
Argument::createIntTypeArgument('id'),
|
||||||
|
Argument::createIntListTypeArgument('exclude')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* this function have to be implement in your own loop class.
|
||||||
|
*
|
||||||
|
* All loops parameters can be accesible via getter.
|
||||||
|
*
|
||||||
|
* for example, ref parameter is accessible through getRef method
|
||||||
|
*
|
||||||
|
* @param $pagination
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\ModuleQuery
|
||||||
|
*/
|
||||||
|
public function exec(&$pagination)
|
||||||
|
{
|
||||||
|
$search = ModuleQuery::create();
|
||||||
|
|
||||||
|
if(null !== $id = $this->getId())
|
||||||
|
{
|
||||||
|
$search->filterById($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (null !== $exclude = $this->getExclude()) {
|
||||||
|
$search->filterById($exclude, Criteria::NOT_IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $search;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
85
core/lib/Thelia/Core/Template/Loop/Delivery.php
Normal file
85
core/lib/Thelia/Core/Template/Loop/Delivery.php
Normal 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\Core\Template\Loop;
|
||||||
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Delivery
|
||||||
|
* @package Thelia\Core\Template\Loop
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class Delivery extends BaseSpecificModule
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getArgDefinitions()
|
||||||
|
{
|
||||||
|
$collection = parent::getArgDefinitions();
|
||||||
|
|
||||||
|
$collection->addArgument(
|
||||||
|
Argument::createIntTypeArgument("country")
|
||||||
|
);
|
||||||
|
|
||||||
|
return $collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exec(&$pagination)
|
||||||
|
{
|
||||||
|
$search = parent::exec($pagination);
|
||||||
|
/* manage translations */
|
||||||
|
$locale = $this->configureI18nProcessing($search);
|
||||||
|
/* perform search */
|
||||||
|
$deliveryModules = $this->search($search, $pagination);
|
||||||
|
|
||||||
|
$loopResult = new LoopResult($deliveryModules);
|
||||||
|
|
||||||
|
foreach ($deliveryModules as $deliveryModule) {
|
||||||
|
$loopResultRow = new LoopResultRow($loopResult, $deliveryModule, $this->versionable, $this->timestampable, $this->countable);
|
||||||
|
|
||||||
|
$moduleReflection = new \ReflectionClass($deliveryModule->getFullNamespace());
|
||||||
|
if($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
|
||||||
|
throw new \RuntimeException(sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $deliveryModule->getCode()));
|
||||||
|
}
|
||||||
|
$moduleInstance = $moduleReflection->newInstance();
|
||||||
|
|
||||||
|
$moduleInstance->setRequest($this->request);
|
||||||
|
$moduleInstance->setDispatcher($this->dispatcher);
|
||||||
|
|
||||||
|
$loopResultRow
|
||||||
|
->set('ID', $deliveryModule->getId())
|
||||||
|
->set('TITLE', $deliveryModule->getVirtualColumn('i18n_TITLE'))
|
||||||
|
->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO'))
|
||||||
|
->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION'))
|
||||||
|
->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||||
|
->set('PRICE', $moduleInstance->calculate($this->getCountry()))
|
||||||
|
;
|
||||||
|
|
||||||
|
$loopResult->addRow($loopResultRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $loopResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,8 +33,10 @@ namespace Thelia\Core;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\HttpKernel\Kernel;
|
use Symfony\Component\HttpKernel\Kernel;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
|
use Symfony\Component\Validator\Tests\Fixtures\Reference;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
|
|
||||||
@@ -118,6 +120,16 @@ class Thelia extends Kernel
|
|||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
$defintion = new Definition();
|
||||||
|
$defintion->setClass($module->getFullNamespace());
|
||||||
|
$defintion->addMethodCall("setContainer", array('service_container'));
|
||||||
|
|
||||||
|
$container->setDefinition(
|
||||||
|
"module.".$module->getCode(),
|
||||||
|
$defintion
|
||||||
|
);
|
||||||
|
|
||||||
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config"));
|
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config"));
|
||||||
$loader->load("config.xml");
|
$loader->load("config.xml");
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
|
|||||||
@@ -89,6 +89,12 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
protected $position;
|
protected $position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the full_namespace field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $full_namespace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the created_at field.
|
* The value for the created_at field.
|
||||||
* @var string
|
* @var string
|
||||||
@@ -456,6 +462,17 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
return $this->position;
|
return $this->position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [full_namespace] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFullNamespace()
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->full_namespace;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [optionally formatted] temporal [created_at] column value.
|
* Get the [optionally formatted] temporal [created_at] column value.
|
||||||
*
|
*
|
||||||
@@ -601,6 +618,27 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
return $this;
|
return $this;
|
||||||
} // setPosition()
|
} // setPosition()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [full_namespace] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return \Thelia\Model\Module The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setFullNamespace($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->full_namespace !== $v) {
|
||||||
|
$this->full_namespace = $v;
|
||||||
|
$this->modifiedColumns[] = ModuleTableMap::FULL_NAMESPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setFullNamespace()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||||
*
|
*
|
||||||
@@ -695,13 +733,16 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ModuleTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ModuleTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
$this->position = (null !== $col) ? (int) $col : null;
|
$this->position = (null !== $col) ? (int) $col : null;
|
||||||
|
|
||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ModuleTableMap::translateFieldName('FullNamespace', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
|
$this->full_namespace = (null !== $col) ? (string) $col : null;
|
||||||
|
|
||||||
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
if ($col === '0000-00-00 00:00:00') {
|
if ($col === '0000-00-00 00:00:00') {
|
||||||
$col = null;
|
$col = null;
|
||||||
}
|
}
|
||||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||||
|
|
||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
if ($col === '0000-00-00 00:00:00') {
|
if ($col === '0000-00-00 00:00:00') {
|
||||||
$col = null;
|
$col = null;
|
||||||
}
|
}
|
||||||
@@ -714,7 +755,7 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 7; // 7 = ModuleTableMap::NUM_HYDRATE_COLUMNS.
|
return $startcol + 8; // 8 = ModuleTableMap::NUM_HYDRATE_COLUMNS.
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating \Thelia\Model\Module object", 0, $e);
|
throw new PropelException("Error populating \Thelia\Model\Module object", 0, $e);
|
||||||
@@ -987,6 +1028,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
if ($this->isColumnModified(ModuleTableMap::POSITION)) {
|
if ($this->isColumnModified(ModuleTableMap::POSITION)) {
|
||||||
$modifiedColumns[':p' . $index++] = 'POSITION';
|
$modifiedColumns[':p' . $index++] = 'POSITION';
|
||||||
}
|
}
|
||||||
|
if ($this->isColumnModified(ModuleTableMap::FULL_NAMESPACE)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = 'FULL_NAMESPACE';
|
||||||
|
}
|
||||||
if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) {
|
if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) {
|
||||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||||
}
|
}
|
||||||
@@ -1019,6 +1063,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
case 'POSITION':
|
case 'POSITION':
|
||||||
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
|
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
|
||||||
break;
|
break;
|
||||||
|
case 'FULL_NAMESPACE':
|
||||||
|
$stmt->bindValue($identifier, $this->full_namespace, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
case 'CREATED_AT':
|
case 'CREATED_AT':
|
||||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||||
break;
|
break;
|
||||||
@@ -1103,9 +1150,12 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
return $this->getPosition();
|
return $this->getPosition();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
return $this->getCreatedAt();
|
return $this->getFullNamespace();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
|
return $this->getCreatedAt();
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
return $this->getUpdatedAt();
|
return $this->getUpdatedAt();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -1142,8 +1192,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$keys[2] => $this->getType(),
|
$keys[2] => $this->getType(),
|
||||||
$keys[3] => $this->getActivate(),
|
$keys[3] => $this->getActivate(),
|
||||||
$keys[4] => $this->getPosition(),
|
$keys[4] => $this->getPosition(),
|
||||||
$keys[5] => $this->getCreatedAt(),
|
$keys[5] => $this->getFullNamespace(),
|
||||||
$keys[6] => $this->getUpdatedAt(),
|
$keys[6] => $this->getCreatedAt(),
|
||||||
|
$keys[7] => $this->getUpdatedAt(),
|
||||||
);
|
);
|
||||||
$virtualColumns = $this->virtualColumns;
|
$virtualColumns = $this->virtualColumns;
|
||||||
foreach($virtualColumns as $key => $virtualColumn)
|
foreach($virtualColumns as $key => $virtualColumn)
|
||||||
@@ -1208,9 +1259,12 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$this->setPosition($value);
|
$this->setPosition($value);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
$this->setCreatedAt($value);
|
$this->setFullNamespace($value);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
|
$this->setCreatedAt($value);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
$this->setUpdatedAt($value);
|
$this->setUpdatedAt($value);
|
||||||
break;
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
@@ -1242,8 +1296,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]);
|
if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]);
|
||||||
if (array_key_exists($keys[3], $arr)) $this->setActivate($arr[$keys[3]]);
|
if (array_key_exists($keys[3], $arr)) $this->setActivate($arr[$keys[3]]);
|
||||||
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
||||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
if (array_key_exists($keys[5], $arr)) $this->setFullNamespace($arr[$keys[5]]);
|
||||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
|
||||||
|
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1260,6 +1315,7 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
if ($this->isColumnModified(ModuleTableMap::TYPE)) $criteria->add(ModuleTableMap::TYPE, $this->type);
|
if ($this->isColumnModified(ModuleTableMap::TYPE)) $criteria->add(ModuleTableMap::TYPE, $this->type);
|
||||||
if ($this->isColumnModified(ModuleTableMap::ACTIVATE)) $criteria->add(ModuleTableMap::ACTIVATE, $this->activate);
|
if ($this->isColumnModified(ModuleTableMap::ACTIVATE)) $criteria->add(ModuleTableMap::ACTIVATE, $this->activate);
|
||||||
if ($this->isColumnModified(ModuleTableMap::POSITION)) $criteria->add(ModuleTableMap::POSITION, $this->position);
|
if ($this->isColumnModified(ModuleTableMap::POSITION)) $criteria->add(ModuleTableMap::POSITION, $this->position);
|
||||||
|
if ($this->isColumnModified(ModuleTableMap::FULL_NAMESPACE)) $criteria->add(ModuleTableMap::FULL_NAMESPACE, $this->full_namespace);
|
||||||
if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) $criteria->add(ModuleTableMap::CREATED_AT, $this->created_at);
|
if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) $criteria->add(ModuleTableMap::CREATED_AT, $this->created_at);
|
||||||
if ($this->isColumnModified(ModuleTableMap::UPDATED_AT)) $criteria->add(ModuleTableMap::UPDATED_AT, $this->updated_at);
|
if ($this->isColumnModified(ModuleTableMap::UPDATED_AT)) $criteria->add(ModuleTableMap::UPDATED_AT, $this->updated_at);
|
||||||
|
|
||||||
@@ -1329,6 +1385,7 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$copyObj->setType($this->getType());
|
$copyObj->setType($this->getType());
|
||||||
$copyObj->setActivate($this->getActivate());
|
$copyObj->setActivate($this->getActivate());
|
||||||
$copyObj->setPosition($this->getPosition());
|
$copyObj->setPosition($this->getPosition());
|
||||||
|
$copyObj->setFullNamespace($this->getFullNamespace());
|
||||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
|
||||||
@@ -1876,6 +1933,7 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$this->type = null;
|
$this->type = null;
|
||||||
$this->activate = null;
|
$this->activate = null;
|
||||||
$this->position = null;
|
$this->position = null;
|
||||||
|
$this->full_namespace = null;
|
||||||
$this->created_at = null;
|
$this->created_at = null;
|
||||||
$this->updated_at = null;
|
$this->updated_at = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
|||||||
* @method ChildModuleQuery orderByType($order = Criteria::ASC) Order by the type column
|
* @method ChildModuleQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||||
* @method ChildModuleQuery orderByActivate($order = Criteria::ASC) Order by the activate column
|
* @method ChildModuleQuery orderByActivate($order = Criteria::ASC) Order by the activate column
|
||||||
* @method ChildModuleQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
* @method ChildModuleQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
|
* @method ChildModuleQuery orderByFullNamespace($order = Criteria::ASC) Order by the full_namespace column
|
||||||
* @method ChildModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
* @method ChildModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
* @method ChildModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
* @method ChildModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
*
|
*
|
||||||
@@ -35,6 +36,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
|||||||
* @method ChildModuleQuery groupByType() Group by the type column
|
* @method ChildModuleQuery groupByType() Group by the type column
|
||||||
* @method ChildModuleQuery groupByActivate() Group by the activate column
|
* @method ChildModuleQuery groupByActivate() Group by the activate column
|
||||||
* @method ChildModuleQuery groupByPosition() Group by the position column
|
* @method ChildModuleQuery groupByPosition() Group by the position column
|
||||||
|
* @method ChildModuleQuery groupByFullNamespace() Group by the full_namespace column
|
||||||
* @method ChildModuleQuery groupByCreatedAt() Group by the created_at column
|
* @method ChildModuleQuery groupByCreatedAt() Group by the created_at column
|
||||||
* @method ChildModuleQuery groupByUpdatedAt() Group by the updated_at column
|
* @method ChildModuleQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
*
|
*
|
||||||
@@ -58,6 +60,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
|||||||
* @method ChildModule findOneByType(int $type) Return the first ChildModule filtered by the type column
|
* @method ChildModule findOneByType(int $type) Return the first ChildModule filtered by the type column
|
||||||
* @method ChildModule findOneByActivate(int $activate) Return the first ChildModule filtered by the activate column
|
* @method ChildModule findOneByActivate(int $activate) Return the first ChildModule filtered by the activate column
|
||||||
* @method ChildModule findOneByPosition(int $position) Return the first ChildModule filtered by the position column
|
* @method ChildModule findOneByPosition(int $position) Return the first ChildModule filtered by the position column
|
||||||
|
* @method ChildModule findOneByFullNamespace(string $full_namespace) Return the first ChildModule filtered by the full_namespace column
|
||||||
* @method ChildModule findOneByCreatedAt(string $created_at) Return the first ChildModule filtered by the created_at column
|
* @method ChildModule findOneByCreatedAt(string $created_at) Return the first ChildModule filtered by the created_at column
|
||||||
* @method ChildModule findOneByUpdatedAt(string $updated_at) Return the first ChildModule filtered by the updated_at column
|
* @method ChildModule findOneByUpdatedAt(string $updated_at) Return the first ChildModule filtered by the updated_at column
|
||||||
*
|
*
|
||||||
@@ -66,6 +69,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
|||||||
* @method array findByType(int $type) Return ChildModule objects filtered by the type column
|
* @method array findByType(int $type) Return ChildModule objects filtered by the type column
|
||||||
* @method array findByActivate(int $activate) Return ChildModule objects filtered by the activate column
|
* @method array findByActivate(int $activate) Return ChildModule objects filtered by the activate column
|
||||||
* @method array findByPosition(int $position) Return ChildModule objects filtered by the position column
|
* @method array findByPosition(int $position) Return ChildModule objects filtered by the position column
|
||||||
|
* @method array findByFullNamespace(string $full_namespace) Return ChildModule objects filtered by the full_namespace column
|
||||||
* @method array findByCreatedAt(string $created_at) Return ChildModule objects filtered by the created_at column
|
* @method array findByCreatedAt(string $created_at) Return ChildModule objects filtered by the created_at column
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return ChildModule objects filtered by the updated_at column
|
* @method array findByUpdatedAt(string $updated_at) Return ChildModule objects filtered by the updated_at column
|
||||||
*
|
*
|
||||||
@@ -156,7 +160,7 @@ abstract class ModuleQuery extends ModelCriteria
|
|||||||
*/
|
*/
|
||||||
protected function findPkSimple($key, $con)
|
protected function findPkSimple($key, $con)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT ID, CODE, TYPE, ACTIVATE, POSITION, CREATED_AT, UPDATED_AT FROM module WHERE ID = :p0';
|
$sql = 'SELECT ID, CODE, TYPE, ACTIVATE, POSITION, FULL_NAMESPACE, CREATED_AT, UPDATED_AT FROM module WHERE ID = :p0';
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||||
@@ -438,6 +442,35 @@ abstract class ModuleQuery extends ModelCriteria
|
|||||||
return $this->addUsingAlias(ModuleTableMap::POSITION, $position, $comparison);
|
return $this->addUsingAlias(ModuleTableMap::POSITION, $position, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the full_namespace column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByFullNamespace('fooValue'); // WHERE full_namespace = 'fooValue'
|
||||||
|
* $query->filterByFullNamespace('%fooValue%'); // WHERE full_namespace LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $fullNamespace The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByFullNamespace($fullNamespace = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($fullNamespace)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $fullNamespace)) {
|
||||||
|
$fullNamespace = str_replace('*', '%', $fullNamespace);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ModuleTableMap::FULL_NAMESPACE, $fullNamespace, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query on the created_at column
|
* Filter the query on the created_at column
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class ModuleTableMap extends TableMap
|
|||||||
/**
|
/**
|
||||||
* The total number of columns
|
* The total number of columns
|
||||||
*/
|
*/
|
||||||
const NUM_COLUMNS = 7;
|
const NUM_COLUMNS = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of lazy-loaded columns
|
* The number of lazy-loaded columns
|
||||||
@@ -67,7 +67,7 @@ class ModuleTableMap extends TableMap
|
|||||||
/**
|
/**
|
||||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||||
*/
|
*/
|
||||||
const NUM_HYDRATE_COLUMNS = 7;
|
const NUM_HYDRATE_COLUMNS = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the column name for the ID field
|
* the column name for the ID field
|
||||||
@@ -94,6 +94,11 @@ class ModuleTableMap extends TableMap
|
|||||||
*/
|
*/
|
||||||
const POSITION = 'module.POSITION';
|
const POSITION = 'module.POSITION';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the FULL_NAMESPACE field
|
||||||
|
*/
|
||||||
|
const FULL_NAMESPACE = 'module.FULL_NAMESPACE';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the column name for the CREATED_AT field
|
* the column name for the CREATED_AT field
|
||||||
*/
|
*/
|
||||||
@@ -125,12 +130,12 @@ class ModuleTableMap extends TableMap
|
|||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
protected static $fieldNames = array (
|
protected static $fieldNames = array (
|
||||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'FullNamespace', 'CreatedAt', 'UpdatedAt', ),
|
||||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'createdAt', 'updatedAt', ),
|
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'fullNamespace', 'createdAt', 'updatedAt', ),
|
||||||
self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ),
|
self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::FULL_NAMESPACE, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ),
|
||||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'FULL_NAMESPACE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'created_at', 'updated_at', ),
|
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'full_namespace', 'created_at', 'updated_at', ),
|
||||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,12 +145,12 @@ class ModuleTableMap extends TableMap
|
|||||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
protected static $fieldKeys = array (
|
protected static $fieldKeys = array (
|
||||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
|
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'FullNamespace' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
|
||||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
|
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'fullNamespace' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
|
||||||
self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::CREATED_AT => 5, ModuleTableMap::UPDATED_AT => 6, ),
|
self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::FULL_NAMESPACE => 5, ModuleTableMap::CREATED_AT => 6, ModuleTableMap::UPDATED_AT => 7, ),
|
||||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
|
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'FULL_NAMESPACE' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
|
||||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
|
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'full_namespace' => 5, 'created_at' => 6, 'updated_at' => 7, ),
|
||||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -169,6 +174,7 @@ class ModuleTableMap extends TableMap
|
|||||||
$this->addColumn('TYPE', 'Type', 'TINYINT', true, null, null);
|
$this->addColumn('TYPE', 'Type', 'TINYINT', true, null, null);
|
||||||
$this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null);
|
$this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null);
|
||||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||||
|
$this->addColumn('FULL_NAMESPACE', 'FullNamespace', 'VARCHAR', false, 255, null);
|
||||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
} // initialize()
|
} // initialize()
|
||||||
@@ -349,6 +355,7 @@ class ModuleTableMap extends TableMap
|
|||||||
$criteria->addSelectColumn(ModuleTableMap::TYPE);
|
$criteria->addSelectColumn(ModuleTableMap::TYPE);
|
||||||
$criteria->addSelectColumn(ModuleTableMap::ACTIVATE);
|
$criteria->addSelectColumn(ModuleTableMap::ACTIVATE);
|
||||||
$criteria->addSelectColumn(ModuleTableMap::POSITION);
|
$criteria->addSelectColumn(ModuleTableMap::POSITION);
|
||||||
|
$criteria->addSelectColumn(ModuleTableMap::FULL_NAMESPACE);
|
||||||
$criteria->addSelectColumn(ModuleTableMap::CREATED_AT);
|
$criteria->addSelectColumn(ModuleTableMap::CREATED_AT);
|
||||||
$criteria->addSelectColumn(ModuleTableMap::UPDATED_AT);
|
$criteria->addSelectColumn(ModuleTableMap::UPDATED_AT);
|
||||||
} else {
|
} else {
|
||||||
@@ -357,6 +364,7 @@ class ModuleTableMap extends TableMap
|
|||||||
$criteria->addSelectColumn($alias . '.TYPE');
|
$criteria->addSelectColumn($alias . '.TYPE');
|
||||||
$criteria->addSelectColumn($alias . '.ACTIVATE');
|
$criteria->addSelectColumn($alias . '.ACTIVATE');
|
||||||
$criteria->addSelectColumn($alias . '.POSITION');
|
$criteria->addSelectColumn($alias . '.POSITION');
|
||||||
|
$criteria->addSelectColumn($alias . '.FULL_NAMESPACE');
|
||||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
|
|
||||||
namespace Thelia\Module;
|
namespace Thelia\Module;
|
||||||
|
|
||||||
abstract class BaseModule
|
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||||
|
|
||||||
|
abstract class BaseModule extends ContainerAware
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -37,6 +39,19 @@ abstract class BaseModule
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasContainer()
|
||||||
|
{
|
||||||
|
return null === $this->container;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContainer()
|
||||||
|
{
|
||||||
|
if($this->hasContainer() === false) {
|
||||||
|
throw new \RuntimeException("Sorry, container his not available in this context");
|
||||||
|
}
|
||||||
|
return $this->container;
|
||||||
|
}
|
||||||
|
|
||||||
abstract public function install();
|
abstract public function install();
|
||||||
abstract public function destroy();
|
abstract public function destroy();
|
||||||
|
|
||||||
|
|||||||
37
core/lib/Thelia/Module/BaseModuleInterface.php
Normal file
37
core/lib/Thelia/Module/BaseModuleInterface.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?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\Module;
|
||||||
|
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
interface BaseModuleInterface {
|
||||||
|
|
||||||
|
public function setRequest(Request $request);
|
||||||
|
public function getRequest();
|
||||||
|
|
||||||
|
public function setDispatcher(EventDispatcherInterface $dispatcher);
|
||||||
|
public function getDispatcher();
|
||||||
|
}
|
||||||
36
core/lib/Thelia/Module/DeliveryModuleInterface.php
Normal file
36
core/lib/Thelia/Module/DeliveryModuleInterface.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?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\Module;
|
||||||
|
|
||||||
|
|
||||||
|
interface DeliveryModuleInterface extends BaseModuleInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* calculate and return delivery price
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function calculate($country = null);
|
||||||
|
}
|
||||||
@@ -803,6 +803,7 @@ CREATE TABLE `module`
|
|||||||
`type` TINYINT NOT NULL,
|
`type` TINYINT NOT NULL,
|
||||||
`activate` TINYINT,
|
`activate` TINYINT,
|
||||||
`position` INTEGER,
|
`position` INTEGER,
|
||||||
|
`full_namespace` VARCHAR(255),
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
|||||||
@@ -605,6 +605,7 @@
|
|||||||
<column name="description" type="CLOB" />
|
<column name="description" type="CLOB" />
|
||||||
<column name="chapo" type="LONGVARCHAR" />
|
<column name="chapo" type="LONGVARCHAR" />
|
||||||
<column name="postscriptum" type="LONGVARCHAR" />
|
<column name="postscriptum" type="LONGVARCHAR" />
|
||||||
|
<column name="full_namespace" size="255" type="VARCHAR" />
|
||||||
<unique name="code_UNIQUE">
|
<unique name="code_UNIQUE">
|
||||||
<unique-column name="code" />
|
<unique-column name="code" />
|
||||||
</unique>
|
</unique>
|
||||||
|
|||||||
83
local/modules/Colissimo/Colissimo.php
Normal file
83
local/modules/Colissimo/Colissimo.php
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?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 Colissimo;
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Thelia\Module\BaseModule;
|
||||||
|
use Thelia\Module\DeliveryModuleInterface;
|
||||||
|
|
||||||
|
class Colissimo extends BaseModule implements DeliveryModuleInterface
|
||||||
|
{
|
||||||
|
protected $request;
|
||||||
|
protected $dispatcher;
|
||||||
|
|
||||||
|
public function setRequest(Request $request)
|
||||||
|
{
|
||||||
|
$this->request = $request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequest()
|
||||||
|
{
|
||||||
|
return $this->request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDispatcher(EventDispatcherInterface $dispatcher)
|
||||||
|
{
|
||||||
|
$this->dispatcher = $dispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDispatcher()
|
||||||
|
{
|
||||||
|
return $this->dispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* calculate and return delivery price
|
||||||
|
*
|
||||||
|
* @param null $country
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function calculate($country = null)
|
||||||
|
{
|
||||||
|
// TODO: Implement calculate() method.
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
|
||||||
|
* Like install and destroy
|
||||||
|
*/
|
||||||
|
public function install()
|
||||||
|
{
|
||||||
|
// TODO: Implement install() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy()
|
||||||
|
{
|
||||||
|
// TODO: Implement destroy() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
36
local/modules/Colissimo/Config/config.xml
Normal file
36
local/modules/Colissimo/Config/config.xml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<config xmlns="http://thelia.net/schema/dic/config"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||||
|
|
||||||
|
<loops>
|
||||||
|
<!-- sample definition
|
||||||
|
<loop name="MySuperLoop" class="MyModule\Loop\MySuperLoop" />
|
||||||
|
-->
|
||||||
|
</loops>
|
||||||
|
|
||||||
|
<forms>
|
||||||
|
<!--
|
||||||
|
<form name="MyFormName" class="MyModule\Form\MySuperForm" />
|
||||||
|
-->
|
||||||
|
</forms>
|
||||||
|
|
||||||
|
<commands>
|
||||||
|
<!--
|
||||||
|
<command class="MyModule\Command\MySuperCommand" />
|
||||||
|
-->
|
||||||
|
</commands>
|
||||||
|
|
||||||
|
<templateDirectives>
|
||||||
|
<!-- Sample definition
|
||||||
|
<templateDirectives class="MyModule\Directive\MyTemplateDirective" name="my_filter"/>
|
||||||
|
-->
|
||||||
|
</templateDirectives>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<services>
|
||||||
|
|
||||||
|
</services>
|
||||||
|
-->
|
||||||
|
</config>
|
||||||
0
local/modules/Colissimo/Config/plugin.xml
Normal file
0
local/modules/Colissimo/Config/plugin.xml
Normal file
7
local/modules/Colissimo/Config/schema.xml
Normal file
7
local/modules/Colissimo/Config/schema.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<database defaultIdMethod="native" name="thelia" namespace="Colissimo\Model">
|
||||||
|
<!--
|
||||||
|
See propel documentation on http://propelorm.org for all information about schema file
|
||||||
|
-->
|
||||||
|
<external-schema filename="/home/manu/dev/www/thelia/local/config/schema.xml" referenceOnly="true" />
|
||||||
|
</database>
|
||||||
15
templates/default/delivery_list.html
Normal file
15
templates/default/delivery_list.html
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{include file="includes/header.html"}
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{loop type="delivery" name="delivery.list"}
|
||||||
|
<li>
|
||||||
|
<ul>
|
||||||
|
<li>id : {#ID}</li>
|
||||||
|
<li>prix : {#PRICE}</li>
|
||||||
|
<li>Choisir : <a href="{url path="/delivery/choose/{#ID}"}">Choisir</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
{/loop}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{include file="includes/footer.html"}
|
||||||
Reference in New Issue
Block a user