delivery process

This commit is contained in:
Etienne Roudeix
2013-09-17 12:38:23 +02:00
parent 692badb06b
commit c4fd65e6ea
28 changed files with 1594 additions and 557 deletions

View File

@@ -114,17 +114,17 @@
<route id="order.delivery" path="/order/delivery" methods="post"> <route id="order.delivery" path="/order/delivery" methods="post">
<default key="_controller">Thelia\Controller\Front\OrderController::deliver</default> <default key="_controller">Thelia\Controller\Front\OrderController::deliver</default>
<default key="_view">cart_delivery</default> <default key="_view">order_delivery</default>
</route> </route>
<route id="order.delivery.process" path="/order/delivery"> <route id="order.delivery.process" path="/order/delivery">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default> <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">cart_delivery</default> <default key="_view">order_delivery</default>
</route> </route>
<route id="order.billing" path="/order/billing"> <route id="order.invoice" path="/order/invoice">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default> <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">cart_billing</default> <default key="_view">order_invoice</default>
</route> </route>
<!-- end cart routes --> <!-- end cart routes -->

View File

@@ -57,4 +57,11 @@ class BaseFrontController extends BaseController
$this->redirectToRoute("customer.login.view"); $this->redirectToRoute("customer.login.view");
} }
} }
protected function checkCartNotEmpty()
{
if($this->getSession()->getCart()->countCartItems() == 0) {
$this->redirectToRoute("cart.view");
}
}
} }

View File

@@ -29,6 +29,7 @@ use Thelia\Core\Event\TheliaEvents;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Thelia\Form\OrderDelivery; use Thelia\Form\OrderDelivery;
use Thelia\Log\Tlog; use Thelia\Log\Tlog;
use Thelia\Model\Base\AddressQuery;
use Thelia\Model\Order; use Thelia\Model\Order;
/** /**
@@ -45,6 +46,9 @@ class OrderController extends BaseFrontController
*/ */
public function deliver() public function deliver()
{ {
$this->checkAuth();
$this->checkCartNotEmpty();
$message = false; $message = false;
$orderDelivery = new OrderDelivery($this->getRequest()); $orderDelivery = new OrderDelivery($this->getRequest());
@@ -55,15 +59,27 @@ class OrderController extends BaseFrontController
try { try {
$form = $this->validateForm($orderDelivery, "post"); $form = $this->validateForm($orderDelivery, "post");
$orderEvent = $this->getOrderEvent(); $deliveryAddressId = $form->get("delivery-address")->getData();
$orderEvent->setDeliveryAddress($form->get("delivery-address")->getData()); $deliveryModuleId = $form->get("delivery-module")->getData();
$orderEvent->setDeliveryModule($form->get("delivery-module")->getData());
/* check that the delivery address belong to the current customer */
$deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId);
if($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) {
throw new \Exception("Address does not belong to the current customer");
}
/* check that the delivery module fetch the delivery address area */
$orderEvent = $this->getOrderEvent();
$orderEvent->setDeliveryAddress($deliveryAddressId);
$orderEvent->setDeliveryModule($deliveryModuleId);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_ADDRESS, $orderEvent); $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_ADDRESS, $orderEvent);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent); $this->getDispatcher()->dispatch(TheliaEvents::ORDER_SET_DELIVERY_MODULE, $orderEvent);
$this->redirectToRoute("order.billing"); $this->redirectToRoute("order.invoice");
} catch (FormValidationException $e) { } catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage()); $message = sprintf("Please check your input: %s", $e->getMessage());
@@ -74,7 +90,7 @@ class OrderController extends BaseFrontController
} }
if ($message !== false) { if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during customer creation process : %s. Exception was %s", $message, $e->getMessage())); Tlog::getInstance()->error(sprintf("Error during order delivery process : %s. Exception was %s", $message, $e->getMessage()));
$orderDelivery->setErrorMessage($message); $orderDelivery->setErrorMessage($message);

View File

@@ -186,6 +186,11 @@ class DataAccessFunctions extends AbstractSmartyPlugin
return $result; return $result;
} }
public function orderDataAccess($params, &$smarty)
{
return $this->dataAccess("Order", $params, $this->request->getSession()->getOrder());
}
/** /**
* Lang global data * Lang global data
* *
@@ -300,6 +305,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
new SmartyPluginDescriptor('function', 'country', $this, 'countryDataAccess'), new SmartyPluginDescriptor('function', 'country', $this, 'countryDataAccess'),
new SmartyPluginDescriptor('function', 'lang', $this, 'langDataAccess'), new SmartyPluginDescriptor('function', 'lang', $this, 'langDataAccess'),
new SmartyPluginDescriptor('function', 'cart', $this, 'cartDataAccess'), new SmartyPluginDescriptor('function', 'cart', $this, 'cartDataAccess'),
new SmartyPluginDescriptor('function', 'order', $this, 'orderDataAccess'),
); );
} }
} }

View File

@@ -71,8 +71,6 @@ class OrderDelivery extends BaseForm
if(null === $address) { if(null === $address) {
$context->addViolation("Address ID not found"); $context->addViolation("Address ID not found");
} elseif($address->getCustomerId() !== $this->request->getSession()->getCustomerUser()->getId()) {
$context->addViolation("Address does not belong to you");
} }
} }

View File

@@ -0,0 +1,10 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\AreaDeliveryModule as BaseAreaDeliveryModule;
class AreaDeliveryModule extends BaseAreaDeliveryModule
{
}

View File

@@ -2,11 +2,11 @@
namespace Thelia\Model; namespace Thelia\Model;
use Thelia\Model\Base\DelivzoneQuery as BaseDelivzoneQuery; use Thelia\Model\Base\AreaDeliveryModuleQuery as BaseAreaDeliveryModuleQuery;
/** /**
* Skeleton subclass for performing query and update operations on the 'delivzone' table. * Skeleton subclass for performing query and update operations on the 'area_delivery_module' table.
* *
* *
* *
@@ -15,6 +15,7 @@ use Thelia\Model\Base\DelivzoneQuery as BaseDelivzoneQuery;
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
*/ */
class DelivzoneQuery extends BaseDelivzoneQuery { class AreaDeliveryModuleQuery extends BaseAreaDeliveryModuleQuery
{
} // DelivzoneQuery } // AreaDeliveryModuleQuery

View File

@@ -18,11 +18,11 @@ use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime; use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Area as ChildArea; use Thelia\Model\Area as ChildArea;
use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
use Thelia\Model\AreaQuery as ChildAreaQuery; use Thelia\Model\AreaQuery as ChildAreaQuery;
use Thelia\Model\Country as ChildCountry; use Thelia\Model\Country as ChildCountry;
use Thelia\Model\CountryQuery as ChildCountryQuery; use Thelia\Model\CountryQuery as ChildCountryQuery;
use Thelia\Model\Delivzone as ChildDelivzone;
use Thelia\Model\DelivzoneQuery as ChildDelivzoneQuery;
use Thelia\Model\Map\AreaTableMap; use Thelia\Model\Map\AreaTableMap;
abstract class Area implements ActiveRecordInterface abstract class Area implements ActiveRecordInterface
@@ -72,10 +72,10 @@ abstract class Area implements ActiveRecordInterface
protected $name; protected $name;
/** /**
* The value for the unit field. * The value for the postage field.
* @var double * @var double
*/ */
protected $unit; protected $postage;
/** /**
* The value for the created_at field. * The value for the created_at field.
@@ -96,10 +96,10 @@ abstract class Area implements ActiveRecordInterface
protected $collCountriesPartial; protected $collCountriesPartial;
/** /**
* @var ObjectCollection|ChildDelivzone[] Collection to store aggregation of ChildDelivzone objects. * @var ObjectCollection|ChildAreaDeliveryModule[] Collection to store aggregation of ChildAreaDeliveryModule objects.
*/ */
protected $collDelivzones; protected $collAreaDeliveryModules;
protected $collDelivzonesPartial; protected $collAreaDeliveryModulesPartial;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
@@ -119,7 +119,7 @@ abstract class Area implements ActiveRecordInterface
* An array of objects scheduled for deletion. * An array of objects scheduled for deletion.
* @var ObjectCollection * @var ObjectCollection
*/ */
protected $delivzonesScheduledForDeletion = null; protected $areaDeliveryModulesScheduledForDeletion = null;
/** /**
* Initializes internal state of Thelia\Model\Base\Area object. * Initializes internal state of Thelia\Model\Base\Area object.
@@ -398,14 +398,14 @@ abstract class Area implements ActiveRecordInterface
} }
/** /**
* Get the [unit] column value. * Get the [postage] column value.
* *
* @return double * @return double
*/ */
public function getUnit() public function getPostage()
{ {
return $this->unit; return $this->postage;
} }
/** /**
@@ -491,25 +491,25 @@ abstract class Area implements ActiveRecordInterface
} // setName() } // setName()
/** /**
* Set the value of [unit] column. * Set the value of [postage] column.
* *
* @param double $v new value * @param double $v new value
* @return \Thelia\Model\Area The current object (for fluent API support) * @return \Thelia\Model\Area The current object (for fluent API support)
*/ */
public function setUnit($v) public function setPostage($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (double) $v; $v = (double) $v;
} }
if ($this->unit !== $v) { if ($this->postage !== $v) {
$this->unit = $v; $this->postage = $v;
$this->modifiedColumns[] = AreaTableMap::UNIT; $this->modifiedColumns[] = AreaTableMap::POSTAGE;
} }
return $this; return $this;
} // setUnit() } // setPostage()
/** /**
* 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.
@@ -596,8 +596,8 @@ abstract class Area implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AreaTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AreaTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
$this->name = (null !== $col) ? (string) $col : null; $this->name = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AreaTableMap::translateFieldName('Unit', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AreaTableMap::translateFieldName('Postage', TableMap::TYPE_PHPNAME, $indexType)];
$this->unit = (null !== $col) ? (double) $col : null; $this->postage = (null !== $col) ? (double) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AreaTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AreaTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') { if ($col === '0000-00-00 00:00:00') {
@@ -681,7 +681,7 @@ abstract class Area implements ActiveRecordInterface
$this->collCountries = null; $this->collCountries = null;
$this->collDelivzones = null; $this->collAreaDeliveryModules = null;
} // if (deep) } // if (deep)
} }
@@ -834,18 +834,17 @@ abstract class Area implements ActiveRecordInterface
} }
} }
if ($this->delivzonesScheduledForDeletion !== null) { if ($this->areaDeliveryModulesScheduledForDeletion !== null) {
if (!$this->delivzonesScheduledForDeletion->isEmpty()) { if (!$this->areaDeliveryModulesScheduledForDeletion->isEmpty()) {
foreach ($this->delivzonesScheduledForDeletion as $delivzone) { \Thelia\Model\AreaDeliveryModuleQuery::create()
// need to save related object because we set the relation to null ->filterByPrimaryKeys($this->areaDeliveryModulesScheduledForDeletion->getPrimaryKeys(false))
$delivzone->save($con); ->delete($con);
} $this->areaDeliveryModulesScheduledForDeletion = null;
$this->delivzonesScheduledForDeletion = null;
} }
} }
if ($this->collDelivzones !== null) { if ($this->collAreaDeliveryModules !== null) {
foreach ($this->collDelivzones as $referrerFK) { foreach ($this->collAreaDeliveryModules as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con); $affectedRows += $referrerFK->save($con);
} }
@@ -884,8 +883,8 @@ abstract class Area implements ActiveRecordInterface
if ($this->isColumnModified(AreaTableMap::NAME)) { if ($this->isColumnModified(AreaTableMap::NAME)) {
$modifiedColumns[':p' . $index++] = 'NAME'; $modifiedColumns[':p' . $index++] = 'NAME';
} }
if ($this->isColumnModified(AreaTableMap::UNIT)) { if ($this->isColumnModified(AreaTableMap::POSTAGE)) {
$modifiedColumns[':p' . $index++] = 'UNIT'; $modifiedColumns[':p' . $index++] = 'POSTAGE';
} }
if ($this->isColumnModified(AreaTableMap::CREATED_AT)) { if ($this->isColumnModified(AreaTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
@@ -910,8 +909,8 @@ abstract class Area implements ActiveRecordInterface
case 'NAME': case 'NAME':
$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
break; break;
case 'UNIT': case 'POSTAGE':
$stmt->bindValue($identifier, $this->unit, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->postage, PDO::PARAM_STR);
break; 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);
@@ -988,7 +987,7 @@ abstract class Area implements ActiveRecordInterface
return $this->getName(); return $this->getName();
break; break;
case 2: case 2:
return $this->getUnit(); return $this->getPostage();
break; break;
case 3: case 3:
return $this->getCreatedAt(); return $this->getCreatedAt();
@@ -1027,7 +1026,7 @@ abstract class Area implements ActiveRecordInterface
$result = array( $result = array(
$keys[0] => $this->getId(), $keys[0] => $this->getId(),
$keys[1] => $this->getName(), $keys[1] => $this->getName(),
$keys[2] => $this->getUnit(), $keys[2] => $this->getPostage(),
$keys[3] => $this->getCreatedAt(), $keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(), $keys[4] => $this->getUpdatedAt(),
); );
@@ -1041,8 +1040,8 @@ abstract class Area implements ActiveRecordInterface
if (null !== $this->collCountries) { if (null !== $this->collCountries) {
$result['Countries'] = $this->collCountries->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['Countries'] = $this->collCountries->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
if (null !== $this->collDelivzones) { if (null !== $this->collAreaDeliveryModules) {
$result['Delivzones'] = $this->collDelivzones->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['AreaDeliveryModules'] = $this->collAreaDeliveryModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
} }
@@ -1085,7 +1084,7 @@ abstract class Area implements ActiveRecordInterface
$this->setName($value); $this->setName($value);
break; break;
case 2: case 2:
$this->setUnit($value); $this->setPostage($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value); $this->setCreatedAt($value);
@@ -1119,7 +1118,7 @@ abstract class Area implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); 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->setName($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setUnit($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setPostage($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
} }
@@ -1135,7 +1134,7 @@ abstract class Area implements ActiveRecordInterface
if ($this->isColumnModified(AreaTableMap::ID)) $criteria->add(AreaTableMap::ID, $this->id); if ($this->isColumnModified(AreaTableMap::ID)) $criteria->add(AreaTableMap::ID, $this->id);
if ($this->isColumnModified(AreaTableMap::NAME)) $criteria->add(AreaTableMap::NAME, $this->name); if ($this->isColumnModified(AreaTableMap::NAME)) $criteria->add(AreaTableMap::NAME, $this->name);
if ($this->isColumnModified(AreaTableMap::UNIT)) $criteria->add(AreaTableMap::UNIT, $this->unit); if ($this->isColumnModified(AreaTableMap::POSTAGE)) $criteria->add(AreaTableMap::POSTAGE, $this->postage);
if ($this->isColumnModified(AreaTableMap::CREATED_AT)) $criteria->add(AreaTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(AreaTableMap::CREATED_AT)) $criteria->add(AreaTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(AreaTableMap::UPDATED_AT)) $criteria->add(AreaTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(AreaTableMap::UPDATED_AT)) $criteria->add(AreaTableMap::UPDATED_AT, $this->updated_at);
@@ -1202,7 +1201,7 @@ abstract class Area implements ActiveRecordInterface
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{ {
$copyObj->setName($this->getName()); $copyObj->setName($this->getName());
$copyObj->setUnit($this->getUnit()); $copyObj->setPostage($this->getPostage());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1217,9 +1216,9 @@ abstract class Area implements ActiveRecordInterface
} }
} }
foreach ($this->getDelivzones() as $relObj) { foreach ($this->getAreaDeliveryModules() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addDelivzone($relObj->copy($deepCopy)); $copyObj->addAreaDeliveryModule($relObj->copy($deepCopy));
} }
} }
@@ -1267,8 +1266,8 @@ abstract class Area implements ActiveRecordInterface
if ('Country' == $relationName) { if ('Country' == $relationName) {
return $this->initCountries(); return $this->initCountries();
} }
if ('Delivzone' == $relationName) { if ('AreaDeliveryModule' == $relationName) {
return $this->initDelivzones(); return $this->initAreaDeliveryModules();
} }
} }
@@ -1491,31 +1490,31 @@ abstract class Area implements ActiveRecordInterface
} }
/** /**
* Clears out the collDelivzones collection * Clears out the collAreaDeliveryModules collection
* *
* This does not modify the database; however, it will remove any associated objects, causing * This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method. * them to be refetched by subsequent calls to accessor method.
* *
* @return void * @return void
* @see addDelivzones() * @see addAreaDeliveryModules()
*/ */
public function clearDelivzones() public function clearAreaDeliveryModules()
{ {
$this->collDelivzones = null; // important to set this to NULL since that means it is uninitialized $this->collAreaDeliveryModules = null; // important to set this to NULL since that means it is uninitialized
} }
/** /**
* Reset is the collDelivzones collection loaded partially. * Reset is the collAreaDeliveryModules collection loaded partially.
*/ */
public function resetPartialDelivzones($v = true) public function resetPartialAreaDeliveryModules($v = true)
{ {
$this->collDelivzonesPartial = $v; $this->collAreaDeliveryModulesPartial = $v;
} }
/** /**
* Initializes the collDelivzones collection. * Initializes the collAreaDeliveryModules collection.
* *
* By default this just sets the collDelivzones collection to an empty array (like clearcollDelivzones()); * By default this just sets the collAreaDeliveryModules collection to an empty array (like clearcollAreaDeliveryModules());
* however, you may wish to override this method in your stub class to provide setting appropriate * 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. * to your application -- for example, setting the initial array to the values stored in database.
* *
@@ -1524,17 +1523,17 @@ abstract class Area implements ActiveRecordInterface
* *
* @return void * @return void
*/ */
public function initDelivzones($overrideExisting = true) public function initAreaDeliveryModules($overrideExisting = true)
{ {
if (null !== $this->collDelivzones && !$overrideExisting) { if (null !== $this->collAreaDeliveryModules && !$overrideExisting) {
return; return;
} }
$this->collDelivzones = new ObjectCollection(); $this->collAreaDeliveryModules = new ObjectCollection();
$this->collDelivzones->setModel('\Thelia\Model\Delivzone'); $this->collAreaDeliveryModules->setModel('\Thelia\Model\AreaDeliveryModule');
} }
/** /**
* Gets an array of ChildDelivzone objects which contain a foreign key that references this object. * Gets an array of ChildAreaDeliveryModule 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. * 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. * Otherwise the results are fetched from the database the first time, then cached.
@@ -1544,109 +1543,109 @@ abstract class Area implements ActiveRecordInterface
* *
* @param Criteria $criteria optional Criteria object to narrow the query * @param Criteria $criteria optional Criteria object to narrow the query
* @param ConnectionInterface $con optional connection object * @param ConnectionInterface $con optional connection object
* @return Collection|ChildDelivzone[] List of ChildDelivzone objects * @return Collection|ChildAreaDeliveryModule[] List of ChildAreaDeliveryModule objects
* @throws PropelException * @throws PropelException
*/ */
public function getDelivzones($criteria = null, ConnectionInterface $con = null) public function getAreaDeliveryModules($criteria = null, ConnectionInterface $con = null)
{ {
$partial = $this->collDelivzonesPartial && !$this->isNew(); $partial = $this->collAreaDeliveryModulesPartial && !$this->isNew();
if (null === $this->collDelivzones || null !== $criteria || $partial) { if (null === $this->collAreaDeliveryModules || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collDelivzones) { if ($this->isNew() && null === $this->collAreaDeliveryModules) {
// return empty collection // return empty collection
$this->initDelivzones(); $this->initAreaDeliveryModules();
} else { } else {
$collDelivzones = ChildDelivzoneQuery::create(null, $criteria) $collAreaDeliveryModules = ChildAreaDeliveryModuleQuery::create(null, $criteria)
->filterByArea($this) ->filterByArea($this)
->find($con); ->find($con);
if (null !== $criteria) { if (null !== $criteria) {
if (false !== $this->collDelivzonesPartial && count($collDelivzones)) { if (false !== $this->collAreaDeliveryModulesPartial && count($collAreaDeliveryModules)) {
$this->initDelivzones(false); $this->initAreaDeliveryModules(false);
foreach ($collDelivzones as $obj) { foreach ($collAreaDeliveryModules as $obj) {
if (false == $this->collDelivzones->contains($obj)) { if (false == $this->collAreaDeliveryModules->contains($obj)) {
$this->collDelivzones->append($obj); $this->collAreaDeliveryModules->append($obj);
} }
} }
$this->collDelivzonesPartial = true; $this->collAreaDeliveryModulesPartial = true;
} }
$collDelivzones->getInternalIterator()->rewind(); $collAreaDeliveryModules->getInternalIterator()->rewind();
return $collDelivzones; return $collAreaDeliveryModules;
} }
if ($partial && $this->collDelivzones) { if ($partial && $this->collAreaDeliveryModules) {
foreach ($this->collDelivzones as $obj) { foreach ($this->collAreaDeliveryModules as $obj) {
if ($obj->isNew()) { if ($obj->isNew()) {
$collDelivzones[] = $obj; $collAreaDeliveryModules[] = $obj;
} }
} }
} }
$this->collDelivzones = $collDelivzones; $this->collAreaDeliveryModules = $collAreaDeliveryModules;
$this->collDelivzonesPartial = false; $this->collAreaDeliveryModulesPartial = false;
} }
} }
return $this->collDelivzones; return $this->collAreaDeliveryModules;
} }
/** /**
* Sets a collection of Delivzone objects related by a one-to-many relationship * Sets a collection of AreaDeliveryModule objects related by a one-to-many relationship
* to the current object. * to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted) * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection. * and new objects from the given Propel collection.
* *
* @param Collection $delivzones A Propel collection. * @param Collection $areaDeliveryModules A Propel collection.
* @param ConnectionInterface $con Optional connection object * @param ConnectionInterface $con Optional connection object
* @return ChildArea The current object (for fluent API support) * @return ChildArea The current object (for fluent API support)
*/ */
public function setDelivzones(Collection $delivzones, ConnectionInterface $con = null) public function setAreaDeliveryModules(Collection $areaDeliveryModules, ConnectionInterface $con = null)
{ {
$delivzonesToDelete = $this->getDelivzones(new Criteria(), $con)->diff($delivzones); $areaDeliveryModulesToDelete = $this->getAreaDeliveryModules(new Criteria(), $con)->diff($areaDeliveryModules);
$this->delivzonesScheduledForDeletion = $delivzonesToDelete; $this->areaDeliveryModulesScheduledForDeletion = $areaDeliveryModulesToDelete;
foreach ($delivzonesToDelete as $delivzoneRemoved) { foreach ($areaDeliveryModulesToDelete as $areaDeliveryModuleRemoved) {
$delivzoneRemoved->setArea(null); $areaDeliveryModuleRemoved->setArea(null);
} }
$this->collDelivzones = null; $this->collAreaDeliveryModules = null;
foreach ($delivzones as $delivzone) { foreach ($areaDeliveryModules as $areaDeliveryModule) {
$this->addDelivzone($delivzone); $this->addAreaDeliveryModule($areaDeliveryModule);
} }
$this->collDelivzones = $delivzones; $this->collAreaDeliveryModules = $areaDeliveryModules;
$this->collDelivzonesPartial = false; $this->collAreaDeliveryModulesPartial = false;
return $this; return $this;
} }
/** /**
* Returns the number of related Delivzone objects. * Returns the number of related AreaDeliveryModule objects.
* *
* @param Criteria $criteria * @param Criteria $criteria
* @param boolean $distinct * @param boolean $distinct
* @param ConnectionInterface $con * @param ConnectionInterface $con
* @return int Count of related Delivzone objects. * @return int Count of related AreaDeliveryModule objects.
* @throws PropelException * @throws PropelException
*/ */
public function countDelivzones(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) public function countAreaDeliveryModules(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{ {
$partial = $this->collDelivzonesPartial && !$this->isNew(); $partial = $this->collAreaDeliveryModulesPartial && !$this->isNew();
if (null === $this->collDelivzones || null !== $criteria || $partial) { if (null === $this->collAreaDeliveryModules || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collDelivzones) { if ($this->isNew() && null === $this->collAreaDeliveryModules) {
return 0; return 0;
} }
if ($partial && !$criteria) { if ($partial && !$criteria) {
return count($this->getDelivzones()); return count($this->getAreaDeliveryModules());
} }
$query = ChildDelivzoneQuery::create(null, $criteria); $query = ChildAreaDeliveryModuleQuery::create(null, $criteria);
if ($distinct) { if ($distinct) {
$query->distinct(); $query->distinct();
} }
@@ -1656,58 +1655,83 @@ abstract class Area implements ActiveRecordInterface
->count($con); ->count($con);
} }
return count($this->collDelivzones); return count($this->collAreaDeliveryModules);
} }
/** /**
* Method called to associate a ChildDelivzone object to this object * Method called to associate a ChildAreaDeliveryModule object to this object
* through the ChildDelivzone foreign key attribute. * through the ChildAreaDeliveryModule foreign key attribute.
* *
* @param ChildDelivzone $l ChildDelivzone * @param ChildAreaDeliveryModule $l ChildAreaDeliveryModule
* @return \Thelia\Model\Area The current object (for fluent API support) * @return \Thelia\Model\Area The current object (for fluent API support)
*/ */
public function addDelivzone(ChildDelivzone $l) public function addAreaDeliveryModule(ChildAreaDeliveryModule $l)
{ {
if ($this->collDelivzones === null) { if ($this->collAreaDeliveryModules === null) {
$this->initDelivzones(); $this->initAreaDeliveryModules();
$this->collDelivzonesPartial = true; $this->collAreaDeliveryModulesPartial = true;
} }
if (!in_array($l, $this->collDelivzones->getArrayCopy(), true)) { // only add it if the **same** object is not already associated if (!in_array($l, $this->collAreaDeliveryModules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddDelivzone($l); $this->doAddAreaDeliveryModule($l);
} }
return $this; return $this;
} }
/** /**
* @param Delivzone $delivzone The delivzone object to add. * @param AreaDeliveryModule $areaDeliveryModule The areaDeliveryModule object to add.
*/ */
protected function doAddDelivzone($delivzone) protected function doAddAreaDeliveryModule($areaDeliveryModule)
{ {
$this->collDelivzones[]= $delivzone; $this->collAreaDeliveryModules[]= $areaDeliveryModule;
$delivzone->setArea($this); $areaDeliveryModule->setArea($this);
} }
/** /**
* @param Delivzone $delivzone The delivzone object to remove. * @param AreaDeliveryModule $areaDeliveryModule The areaDeliveryModule object to remove.
* @return ChildArea The current object (for fluent API support) * @return ChildArea The current object (for fluent API support)
*/ */
public function removeDelivzone($delivzone) public function removeAreaDeliveryModule($areaDeliveryModule)
{ {
if ($this->getDelivzones()->contains($delivzone)) { if ($this->getAreaDeliveryModules()->contains($areaDeliveryModule)) {
$this->collDelivzones->remove($this->collDelivzones->search($delivzone)); $this->collAreaDeliveryModules->remove($this->collAreaDeliveryModules->search($areaDeliveryModule));
if (null === $this->delivzonesScheduledForDeletion) { if (null === $this->areaDeliveryModulesScheduledForDeletion) {
$this->delivzonesScheduledForDeletion = clone $this->collDelivzones; $this->areaDeliveryModulesScheduledForDeletion = clone $this->collAreaDeliveryModules;
$this->delivzonesScheduledForDeletion->clear(); $this->areaDeliveryModulesScheduledForDeletion->clear();
} }
$this->delivzonesScheduledForDeletion[]= $delivzone; $this->areaDeliveryModulesScheduledForDeletion[]= clone $areaDeliveryModule;
$delivzone->setArea(null); $areaDeliveryModule->setArea(null);
} }
return $this; return $this;
} }
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Area is new, it will return
* an empty collection; or if this Area has previously
* been saved, it will retrieve related AreaDeliveryModules 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 Area.
*
* @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|ChildAreaDeliveryModule[] List of ChildAreaDeliveryModule objects
*/
public function getAreaDeliveryModulesJoinModule($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildAreaDeliveryModuleQuery::create(null, $criteria);
$query->joinWith('Module', $joinBehavior);
return $this->getAreaDeliveryModules($query, $con);
}
/** /**
* Clears the current object and sets all attributes to their default values * Clears the current object and sets all attributes to their default values
*/ */
@@ -1715,7 +1739,7 @@ abstract class Area implements ActiveRecordInterface
{ {
$this->id = null; $this->id = null;
$this->name = null; $this->name = null;
$this->unit = null; $this->postage = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
@@ -1742,8 +1766,8 @@ abstract class Area implements ActiveRecordInterface
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
if ($this->collDelivzones) { if ($this->collAreaDeliveryModules) {
foreach ($this->collDelivzones as $o) { foreach ($this->collAreaDeliveryModules as $o) {
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
@@ -1753,10 +1777,10 @@ abstract class Area implements ActiveRecordInterface
$this->collCountries->clearIterator(); $this->collCountries->clearIterator();
} }
$this->collCountries = null; $this->collCountries = null;
if ($this->collDelivzones instanceof Collection) { if ($this->collAreaDeliveryModules instanceof Collection) {
$this->collDelivzones->clearIterator(); $this->collAreaDeliveryModules->clearIterator();
} }
$this->collDelivzones = null; $this->collAreaDeliveryModules = null;
} }
/** /**

View File

@@ -17,17 +17,19 @@ use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime; use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Area as ChildArea; use Thelia\Model\Area as ChildArea;
use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
use Thelia\Model\AreaQuery as ChildAreaQuery; use Thelia\Model\AreaQuery as ChildAreaQuery;
use Thelia\Model\Delivzone as ChildDelivzone; use Thelia\Model\Module as ChildModule;
use Thelia\Model\DelivzoneQuery as ChildDelivzoneQuery; use Thelia\Model\ModuleQuery as ChildModuleQuery;
use Thelia\Model\Map\DelivzoneTableMap; use Thelia\Model\Map\AreaDeliveryModuleTableMap;
abstract class Delivzone implements ActiveRecordInterface abstract class AreaDeliveryModule implements ActiveRecordInterface
{ {
/** /**
* TableMap class name * TableMap class name
*/ */
const TABLE_MAP = '\\Thelia\\Model\\Map\\DelivzoneTableMap'; const TABLE_MAP = '\\Thelia\\Model\\Map\\AreaDeliveryModuleTableMap';
/** /**
@@ -69,10 +71,10 @@ abstract class Delivzone implements ActiveRecordInterface
protected $area_id; protected $area_id;
/** /**
* The value for the delivery field. * The value for the delivery_module_id field.
* @var string * @var int
*/ */
protected $delivery; protected $delivery_module_id;
/** /**
* The value for the created_at field. * The value for the created_at field.
@@ -91,6 +93,11 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
protected $aArea; protected $aArea;
/**
* @var Module
*/
protected $aModule;
/** /**
* Flag to prevent endless save loop, if this object is referenced * Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction. * by another object which falls in this transaction.
@@ -100,7 +107,7 @@ abstract class Delivzone implements ActiveRecordInterface
protected $alreadyInSave = false; protected $alreadyInSave = false;
/** /**
* Initializes internal state of Thelia\Model\Base\Delivzone object. * Initializes internal state of Thelia\Model\Base\AreaDeliveryModule object.
*/ */
public function __construct() public function __construct()
{ {
@@ -195,9 +202,9 @@ abstract class Delivzone implements ActiveRecordInterface
} }
/** /**
* Compares this with another <code>Delivzone</code> instance. If * Compares this with another <code>AreaDeliveryModule</code> instance. If
* <code>obj</code> is an instance of <code>Delivzone</code>, delegates to * <code>obj</code> is an instance of <code>AreaDeliveryModule</code>, delegates to
* <code>equals(Delivzone)</code>. Otherwise, returns <code>false</code>. * <code>equals(AreaDeliveryModule)</code>. Otherwise, returns <code>false</code>.
* *
* @param obj The object to compare to. * @param obj The object to compare to.
* @return Whether equal to the object specified. * @return Whether equal to the object specified.
@@ -278,7 +285,7 @@ abstract class Delivzone implements ActiveRecordInterface
* @param string $name The virtual column name * @param string $name The virtual column name
* @param mixed $value The value to give to the virtual column * @param mixed $value The value to give to the virtual column
* *
* @return Delivzone The current object, for fluid interface * @return AreaDeliveryModule The current object, for fluid interface
*/ */
public function setVirtualColumn($name, $value) public function setVirtualColumn($name, $value)
{ {
@@ -310,7 +317,7 @@ abstract class Delivzone implements ActiveRecordInterface
* or a format name ('XML', 'YAML', 'JSON', 'CSV') * or a format name ('XML', 'YAML', 'JSON', 'CSV')
* @param string $data The source data to import from * @param string $data The source data to import from
* *
* @return Delivzone The current object, for fluid interface * @return AreaDeliveryModule The current object, for fluid interface
*/ */
public function importFrom($parser, $data) public function importFrom($parser, $data)
{ {
@@ -376,14 +383,14 @@ abstract class Delivzone implements ActiveRecordInterface
} }
/** /**
* Get the [delivery] column value. * Get the [delivery_module_id] column value.
* *
* @return string * @return int
*/ */
public function getDelivery() public function getDeliveryModuleId()
{ {
return $this->delivery; return $this->delivery_module_id;
} }
/** /**
@@ -430,7 +437,7 @@ abstract class Delivzone implements ActiveRecordInterface
* Set the value of [id] column. * Set the value of [id] column.
* *
* @param int $v new value * @param int $v new value
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/ */
public function setId($v) public function setId($v)
{ {
@@ -440,7 +447,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->id !== $v) { if ($this->id !== $v) {
$this->id = $v; $this->id = $v;
$this->modifiedColumns[] = DelivzoneTableMap::ID; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::ID;
} }
@@ -451,7 +458,7 @@ abstract class Delivzone implements ActiveRecordInterface
* Set the value of [area_id] column. * Set the value of [area_id] column.
* *
* @param int $v new value * @param int $v new value
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/ */
public function setAreaId($v) public function setAreaId($v)
{ {
@@ -461,7 +468,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->area_id !== $v) { if ($this->area_id !== $v) {
$this->area_id = $v; $this->area_id = $v;
$this->modifiedColumns[] = DelivzoneTableMap::AREA_ID; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::AREA_ID;
} }
if ($this->aArea !== null && $this->aArea->getId() !== $v) { if ($this->aArea !== null && $this->aArea->getId() !== $v) {
@@ -473,32 +480,36 @@ abstract class Delivzone implements ActiveRecordInterface
} // setAreaId() } // setAreaId()
/** /**
* Set the value of [delivery] column. * Set the value of [delivery_module_id] column.
* *
* @param string $v new value * @param int $v new value
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/ */
public function setDelivery($v) public function setDeliveryModuleId($v)
{ {
if ($v !== null) { if ($v !== null) {
$v = (string) $v; $v = (int) $v;
} }
if ($this->delivery !== $v) { if ($this->delivery_module_id !== $v) {
$this->delivery = $v; $this->delivery_module_id = $v;
$this->modifiedColumns[] = DelivzoneTableMap::DELIVERY; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID;
}
if ($this->aModule !== null && $this->aModule->getId() !== $v) {
$this->aModule = null;
} }
return $this; return $this;
} // setDelivery() } // setDeliveryModuleId()
/** /**
* 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.
* *
* @param mixed $v string, integer (timestamp), or \DateTime value. * @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL. * Empty strings are treated as NULL.
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/ */
public function setCreatedAt($v) public function setCreatedAt($v)
{ {
@@ -506,7 +517,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->created_at !== null || $dt !== null) { if ($this->created_at !== null || $dt !== null) {
if ($dt !== $this->created_at) { if ($dt !== $this->created_at) {
$this->created_at = $dt; $this->created_at = $dt;
$this->modifiedColumns[] = DelivzoneTableMap::CREATED_AT; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::CREATED_AT;
} }
} // if either are not null } // if either are not null
@@ -519,7 +530,7 @@ abstract class Delivzone implements ActiveRecordInterface
* *
* @param mixed $v string, integer (timestamp), or \DateTime value. * @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL. * Empty strings are treated as NULL.
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/ */
public function setUpdatedAt($v) public function setUpdatedAt($v)
{ {
@@ -527,7 +538,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->updated_at !== null || $dt !== null) { if ($this->updated_at !== null || $dt !== null) {
if ($dt !== $this->updated_at) { if ($dt !== $this->updated_at) {
$this->updated_at = $dt; $this->updated_at = $dt;
$this->modifiedColumns[] = DelivzoneTableMap::UPDATED_AT; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::UPDATED_AT;
} }
} // if either are not null } // if either are not null
@@ -572,22 +583,22 @@ abstract class Delivzone implements ActiveRecordInterface
try { try {
$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : DelivzoneTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : AreaDeliveryModuleTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
$this->id = (null !== $col) ? (int) $col : null; $this->id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : DelivzoneTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : AreaDeliveryModuleTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)];
$this->area_id = (null !== $col) ? (int) $col : null; $this->area_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : DelivzoneTableMap::translateFieldName('Delivery', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AreaDeliveryModuleTableMap::translateFieldName('DeliveryModuleId', TableMap::TYPE_PHPNAME, $indexType)];
$this->delivery = (null !== $col) ? (string) $col : null; $this->delivery_module_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : DelivzoneTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : AreaDeliveryModuleTableMap::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 ? 4 + $startcol : DelivzoneTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : AreaDeliveryModuleTableMap::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;
} }
@@ -600,10 +611,10 @@ abstract class Delivzone implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 5; // 5 = DelivzoneTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 5; // 5 = AreaDeliveryModuleTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Delivzone object", 0, $e); throw new PropelException("Error populating \Thelia\Model\AreaDeliveryModule object", 0, $e);
} }
} }
@@ -625,6 +636,9 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) { if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) {
$this->aArea = null; $this->aArea = null;
} }
if ($this->aModule !== null && $this->delivery_module_id !== $this->aModule->getId()) {
$this->aModule = null;
}
} // ensureConsistency } // ensureConsistency
/** /**
@@ -648,13 +662,13 @@ abstract class Delivzone implements ActiveRecordInterface
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getReadConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
// We don't need to alter the object instance pool; we're just modifying this instance // We don't need to alter the object instance pool; we're just modifying this instance
// already in the pool. // already in the pool.
$dataFetcher = ChildDelivzoneQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $dataFetcher = ChildAreaDeliveryModuleQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
$row = $dataFetcher->fetch(); $row = $dataFetcher->fetch();
$dataFetcher->close(); $dataFetcher->close();
if (!$row) { if (!$row) {
@@ -665,6 +679,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects? if ($deep) { // also de-associate any related objects?
$this->aArea = null; $this->aArea = null;
$this->aModule = null;
} // if (deep) } // if (deep)
} }
@@ -674,8 +689,8 @@ abstract class Delivzone implements ActiveRecordInterface
* @param ConnectionInterface $con * @param ConnectionInterface $con
* @return void * @return void
* @throws PropelException * @throws PropelException
* @see Delivzone::setDeleted() * @see AreaDeliveryModule::setDeleted()
* @see Delivzone::isDeleted() * @see AreaDeliveryModule::isDeleted()
*/ */
public function delete(ConnectionInterface $con = null) public function delete(ConnectionInterface $con = null)
{ {
@@ -684,12 +699,12 @@ abstract class Delivzone implements ActiveRecordInterface
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
$con->beginTransaction(); $con->beginTransaction();
try { try {
$deleteQuery = ChildDelivzoneQuery::create() $deleteQuery = ChildAreaDeliveryModuleQuery::create()
->filterByPrimaryKey($this->getPrimaryKey()); ->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con); $ret = $this->preDelete($con);
if ($ret) { if ($ret) {
@@ -726,7 +741,7 @@ abstract class Delivzone implements ActiveRecordInterface
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
$con->beginTransaction(); $con->beginTransaction();
@@ -736,16 +751,16 @@ abstract class Delivzone implements ActiveRecordInterface
if ($isInsert) { if ($isInsert) {
$ret = $ret && $this->preInsert($con); $ret = $ret && $this->preInsert($con);
// timestampable behavior // timestampable behavior
if (!$this->isColumnModified(DelivzoneTableMap::CREATED_AT)) { if (!$this->isColumnModified(AreaDeliveryModuleTableMap::CREATED_AT)) {
$this->setCreatedAt(time()); $this->setCreatedAt(time());
} }
if (!$this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) { if (!$this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time()); $this->setUpdatedAt(time());
} }
} else { } else {
$ret = $ret && $this->preUpdate($con); $ret = $ret && $this->preUpdate($con);
// timestampable behavior // timestampable behavior
if ($this->isModified() && !$this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) { if ($this->isModified() && !$this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time()); $this->setUpdatedAt(time());
} }
} }
@@ -757,7 +772,7 @@ abstract class Delivzone implements ActiveRecordInterface
$this->postUpdate($con); $this->postUpdate($con);
} }
$this->postSave($con); $this->postSave($con);
DelivzoneTableMap::addInstanceToPool($this); AreaDeliveryModuleTableMap::addInstanceToPool($this);
} else { } else {
$affectedRows = 0; $affectedRows = 0;
} }
@@ -799,6 +814,13 @@ abstract class Delivzone implements ActiveRecordInterface
$this->setArea($this->aArea); $this->setArea($this->aArea);
} }
if ($this->aModule !== null) {
if ($this->aModule->isModified() || $this->aModule->isNew()) {
$affectedRows += $this->aModule->save($con);
}
$this->setModule($this->aModule);
}
if ($this->isNew() || $this->isModified()) { if ($this->isNew() || $this->isModified()) {
// persist changes // persist changes
if ($this->isNew()) { if ($this->isNew()) {
@@ -830,30 +852,30 @@ abstract class Delivzone implements ActiveRecordInterface
$modifiedColumns = array(); $modifiedColumns = array();
$index = 0; $index = 0;
$this->modifiedColumns[] = DelivzoneTableMap::ID; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::ID;
if (null !== $this->id) { if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . DelivzoneTableMap::ID . ')'); throw new PropelException('Cannot insert a value for auto-increment primary key (' . AreaDeliveryModuleTableMap::ID . ')');
} }
// check the columns in natural order for more readable SQL queries // check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(DelivzoneTableMap::ID)) { if ($this->isColumnModified(AreaDeliveryModuleTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID'; $modifiedColumns[':p' . $index++] = 'ID';
} }
if ($this->isColumnModified(DelivzoneTableMap::AREA_ID)) { if ($this->isColumnModified(AreaDeliveryModuleTableMap::AREA_ID)) {
$modifiedColumns[':p' . $index++] = 'AREA_ID'; $modifiedColumns[':p' . $index++] = 'AREA_ID';
} }
if ($this->isColumnModified(DelivzoneTableMap::DELIVERY)) { if ($this->isColumnModified(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID)) {
$modifiedColumns[':p' . $index++] = 'DELIVERY'; $modifiedColumns[':p' . $index++] = 'DELIVERY_MODULE_ID';
} }
if ($this->isColumnModified(DelivzoneTableMap::CREATED_AT)) { if ($this->isColumnModified(AreaDeliveryModuleTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
if ($this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) { if ($this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) {
$modifiedColumns[':p' . $index++] = 'UPDATED_AT'; $modifiedColumns[':p' . $index++] = 'UPDATED_AT';
} }
$sql = sprintf( $sql = sprintf(
'INSERT INTO delivzone (%s) VALUES (%s)', 'INSERT INTO area_delivery_module (%s) VALUES (%s)',
implode(', ', $modifiedColumns), implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns)) implode(', ', array_keys($modifiedColumns))
); );
@@ -868,8 +890,8 @@ abstract class Delivzone implements ActiveRecordInterface
case 'AREA_ID': case 'AREA_ID':
$stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT);
break; break;
case 'DELIVERY': case 'DELIVERY_MODULE_ID':
$stmt->bindValue($identifier, $this->delivery, PDO::PARAM_STR); $stmt->bindValue($identifier, $this->delivery_module_id, PDO::PARAM_INT);
break; 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);
@@ -923,7 +945,7 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function getByName($name, $type = TableMap::TYPE_PHPNAME) public function getByName($name, $type = TableMap::TYPE_PHPNAME)
{ {
$pos = DelivzoneTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $pos = AreaDeliveryModuleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
$field = $this->getByPosition($pos); $field = $this->getByPosition($pos);
return $field; return $field;
@@ -946,7 +968,7 @@ abstract class Delivzone implements ActiveRecordInterface
return $this->getAreaId(); return $this->getAreaId();
break; break;
case 2: case 2:
return $this->getDelivery(); return $this->getDeliveryModuleId();
break; break;
case 3: case 3:
return $this->getCreatedAt(); return $this->getCreatedAt();
@@ -977,15 +999,15 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{ {
if (isset($alreadyDumpedObjects['Delivzone'][$this->getPrimaryKey()])) { if (isset($alreadyDumpedObjects['AreaDeliveryModule'][$this->getPrimaryKey()])) {
return '*RECURSION*'; return '*RECURSION*';
} }
$alreadyDumpedObjects['Delivzone'][$this->getPrimaryKey()] = true; $alreadyDumpedObjects['AreaDeliveryModule'][$this->getPrimaryKey()] = true;
$keys = DelivzoneTableMap::getFieldNames($keyType); $keys = AreaDeliveryModuleTableMap::getFieldNames($keyType);
$result = array( $result = array(
$keys[0] => $this->getId(), $keys[0] => $this->getId(),
$keys[1] => $this->getAreaId(), $keys[1] => $this->getAreaId(),
$keys[2] => $this->getDelivery(), $keys[2] => $this->getDeliveryModuleId(),
$keys[3] => $this->getCreatedAt(), $keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(), $keys[4] => $this->getUpdatedAt(),
); );
@@ -999,6 +1021,9 @@ abstract class Delivzone implements ActiveRecordInterface
if (null !== $this->aArea) { if (null !== $this->aArea) {
$result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); $result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
} }
if (null !== $this->aModule) {
$result['Module'] = $this->aModule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
} }
return $result; return $result;
@@ -1017,7 +1042,7 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
{ {
$pos = DelivzoneTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $pos = AreaDeliveryModuleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
return $this->setByPosition($pos, $value); return $this->setByPosition($pos, $value);
} }
@@ -1040,7 +1065,7 @@ abstract class Delivzone implements ActiveRecordInterface
$this->setAreaId($value); $this->setAreaId($value);
break; break;
case 2: case 2:
$this->setDelivery($value); $this->setDeliveryModuleId($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value); $this->setCreatedAt($value);
@@ -1070,11 +1095,11 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
{ {
$keys = DelivzoneTableMap::getFieldNames($keyType); $keys = AreaDeliveryModuleTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setAreaId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setAreaId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDelivery($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setDeliveryModuleId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
} }
@@ -1086,13 +1111,13 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function buildCriteria() public function buildCriteria()
{ {
$criteria = new Criteria(DelivzoneTableMap::DATABASE_NAME); $criteria = new Criteria(AreaDeliveryModuleTableMap::DATABASE_NAME);
if ($this->isColumnModified(DelivzoneTableMap::ID)) $criteria->add(DelivzoneTableMap::ID, $this->id); if ($this->isColumnModified(AreaDeliveryModuleTableMap::ID)) $criteria->add(AreaDeliveryModuleTableMap::ID, $this->id);
if ($this->isColumnModified(DelivzoneTableMap::AREA_ID)) $criteria->add(DelivzoneTableMap::AREA_ID, $this->area_id); if ($this->isColumnModified(AreaDeliveryModuleTableMap::AREA_ID)) $criteria->add(AreaDeliveryModuleTableMap::AREA_ID, $this->area_id);
if ($this->isColumnModified(DelivzoneTableMap::DELIVERY)) $criteria->add(DelivzoneTableMap::DELIVERY, $this->delivery); if ($this->isColumnModified(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID)) $criteria->add(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $this->delivery_module_id);
if ($this->isColumnModified(DelivzoneTableMap::CREATED_AT)) $criteria->add(DelivzoneTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(AreaDeliveryModuleTableMap::CREATED_AT)) $criteria->add(AreaDeliveryModuleTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) $criteria->add(DelivzoneTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) $criteria->add(AreaDeliveryModuleTableMap::UPDATED_AT, $this->updated_at);
return $criteria; return $criteria;
} }
@@ -1107,8 +1132,8 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function buildPkeyCriteria() public function buildPkeyCriteria()
{ {
$criteria = new Criteria(DelivzoneTableMap::DATABASE_NAME); $criteria = new Criteria(AreaDeliveryModuleTableMap::DATABASE_NAME);
$criteria->add(DelivzoneTableMap::ID, $this->id); $criteria->add(AreaDeliveryModuleTableMap::ID, $this->id);
return $criteria; return $criteria;
} }
@@ -1149,7 +1174,7 @@ abstract class Delivzone implements ActiveRecordInterface
* If desired, this method can also make copies of all associated (fkey referrers) * If desired, this method can also make copies of all associated (fkey referrers)
* objects. * objects.
* *
* @param object $copyObj An object of \Thelia\Model\Delivzone (or compatible) type. * @param object $copyObj An object of \Thelia\Model\AreaDeliveryModule (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException * @throws PropelException
@@ -1157,7 +1182,7 @@ abstract class Delivzone implements ActiveRecordInterface
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{ {
$copyObj->setAreaId($this->getAreaId()); $copyObj->setAreaId($this->getAreaId());
$copyObj->setDelivery($this->getDelivery()); $copyObj->setDeliveryModuleId($this->getDeliveryModuleId());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) { if ($makeNew) {
@@ -1175,7 +1200,7 @@ abstract class Delivzone implements ActiveRecordInterface
* objects. * objects.
* *
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @return \Thelia\Model\Delivzone Clone of current object. * @return \Thelia\Model\AreaDeliveryModule Clone of current object.
* @throws PropelException * @throws PropelException
*/ */
public function copy($deepCopy = false) public function copy($deepCopy = false)
@@ -1192,7 +1217,7 @@ abstract class Delivzone implements ActiveRecordInterface
* Declares an association between this object and a ChildArea object. * Declares an association between this object and a ChildArea object.
* *
* @param ChildArea $v * @param ChildArea $v
* @return \Thelia\Model\Delivzone The current object (for fluent API support) * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
* @throws PropelException * @throws PropelException
*/ */
public function setArea(ChildArea $v = null) public function setArea(ChildArea $v = null)
@@ -1208,7 +1233,7 @@ abstract class Delivzone implements ActiveRecordInterface
// Add binding for other direction of this n:n relationship. // Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildArea object, it will not be re-added. // If this object has already been added to the ChildArea object, it will not be re-added.
if ($v !== null) { if ($v !== null) {
$v->addDelivzone($this); $v->addAreaDeliveryModule($this);
} }
@@ -1232,13 +1257,64 @@ abstract class Delivzone implements ActiveRecordInterface
to this object. This level of coupling may, however, be to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection undesirable since it could result in an only partially populated collection
in the referenced object. in the referenced object.
$this->aArea->addDelivzones($this); $this->aArea->addAreaDeliveryModules($this);
*/ */
} }
return $this->aArea; return $this->aArea;
} }
/**
* Declares an association between this object and a ChildModule object.
*
* @param ChildModule $v
* @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
* @throws PropelException
*/
public function setModule(ChildModule $v = null)
{
if ($v === null) {
$this->setDeliveryModuleId(NULL);
} else {
$this->setDeliveryModuleId($v->getId());
}
$this->aModule = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the ChildModule object, it will not be re-added.
if ($v !== null) {
$v->addAreaDeliveryModule($this);
}
return $this;
}
/**
* Get the associated ChildModule object
*
* @param ConnectionInterface $con Optional Connection object.
* @return ChildModule The associated ChildModule object.
* @throws PropelException
*/
public function getModule(ConnectionInterface $con = null)
{
if ($this->aModule === null && ($this->delivery_module_id !== null)) {
$this->aModule = ChildModuleQuery::create()->findPk($this->delivery_module_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aModule->addAreaDeliveryModules($this);
*/
}
return $this->aModule;
}
/** /**
* Clears the current object and sets all attributes to their default values * Clears the current object and sets all attributes to their default values
*/ */
@@ -1246,7 +1322,7 @@ abstract class Delivzone implements ActiveRecordInterface
{ {
$this->id = null; $this->id = null;
$this->area_id = null; $this->area_id = null;
$this->delivery = null; $this->delivery_module_id = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;
@@ -1271,6 +1347,7 @@ abstract class Delivzone implements ActiveRecordInterface
} // if ($deep) } // if ($deep)
$this->aArea = null; $this->aArea = null;
$this->aModule = null;
} }
/** /**
@@ -1280,7 +1357,7 @@ abstract class Delivzone implements ActiveRecordInterface
*/ */
public function __toString() public function __toString()
{ {
return (string) $this->exportTo(DelivzoneTableMap::DEFAULT_STRING_FORMAT); return (string) $this->exportTo(AreaDeliveryModuleTableMap::DEFAULT_STRING_FORMAT);
} }
// timestampable behavior // timestampable behavior
@@ -1288,11 +1365,11 @@ abstract class Delivzone implements ActiveRecordInterface
/** /**
* Mark the current object so that the update date doesn't get updated during next save * Mark the current object so that the update date doesn't get updated during next save
* *
* @return ChildDelivzone The current object (for fluent API support) * @return ChildAreaDeliveryModule The current object (for fluent API support)
*/ */
public function keepUpdateDateUnchanged() public function keepUpdateDateUnchanged()
{ {
$this->modifiedColumns[] = DelivzoneTableMap::UPDATED_AT; $this->modifiedColumns[] = AreaDeliveryModuleTableMap::UPDATED_AT;
return $this; return $this;
} }

View File

@@ -12,80 +12,84 @@ use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Delivzone as ChildDelivzone; use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
use Thelia\Model\DelivzoneQuery as ChildDelivzoneQuery; use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
use Thelia\Model\Map\DelivzoneTableMap; use Thelia\Model\Map\AreaDeliveryModuleTableMap;
/** /**
* Base class that represents a query for the 'delivzone' table. * Base class that represents a query for the 'area_delivery_module' table.
* *
* *
* *
* @method ChildDelivzoneQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildAreaDeliveryModuleQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildDelivzoneQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column * @method ChildAreaDeliveryModuleQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
* @method ChildDelivzoneQuery orderByDelivery($order = Criteria::ASC) Order by the delivery column * @method ChildAreaDeliveryModuleQuery orderByDeliveryModuleId($order = Criteria::ASC) Order by the delivery_module_id column
* @method ChildDelivzoneQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildAreaDeliveryModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildDelivzoneQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildAreaDeliveryModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildDelivzoneQuery groupById() Group by the id column * @method ChildAreaDeliveryModuleQuery groupById() Group by the id column
* @method ChildDelivzoneQuery groupByAreaId() Group by the area_id column * @method ChildAreaDeliveryModuleQuery groupByAreaId() Group by the area_id column
* @method ChildDelivzoneQuery groupByDelivery() Group by the delivery column * @method ChildAreaDeliveryModuleQuery groupByDeliveryModuleId() Group by the delivery_module_id column
* @method ChildDelivzoneQuery groupByCreatedAt() Group by the created_at column * @method ChildAreaDeliveryModuleQuery groupByCreatedAt() Group by the created_at column
* @method ChildDelivzoneQuery groupByUpdatedAt() Group by the updated_at column * @method ChildAreaDeliveryModuleQuery groupByUpdatedAt() Group by the updated_at column
* *
* @method ChildDelivzoneQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method ChildAreaDeliveryModuleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildDelivzoneQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method ChildAreaDeliveryModuleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildDelivzoneQuery innerJoin($relation) Adds a INNER JOIN clause to the query * @method ChildAreaDeliveryModuleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
* *
* @method ChildDelivzoneQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation * @method ChildAreaDeliveryModuleQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method ChildDelivzoneQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation * @method ChildAreaDeliveryModuleQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method ChildDelivzoneQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation * @method ChildAreaDeliveryModuleQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
* *
* @method ChildDelivzone findOne(ConnectionInterface $con = null) Return the first ChildDelivzone matching the query * @method ChildAreaDeliveryModuleQuery leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
* @method ChildDelivzone findOneOrCreate(ConnectionInterface $con = null) Return the first ChildDelivzone matching the query, or a new ChildDelivzone object populated from the query conditions when no match is found * @method ChildAreaDeliveryModuleQuery rightJoinModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Module relation
* @method ChildAreaDeliveryModuleQuery innerJoinModule($relationAlias = null) Adds a INNER JOIN clause to the query using the Module relation
* *
* @method ChildDelivzone findOneById(int $id) Return the first ChildDelivzone filtered by the id column * @method ChildAreaDeliveryModule findOne(ConnectionInterface $con = null) Return the first ChildAreaDeliveryModule matching the query
* @method ChildDelivzone findOneByAreaId(int $area_id) Return the first ChildDelivzone filtered by the area_id column * @method ChildAreaDeliveryModule findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAreaDeliveryModule matching the query, or a new ChildAreaDeliveryModule object populated from the query conditions when no match is found
* @method ChildDelivzone findOneByDelivery(string $delivery) Return the first ChildDelivzone filtered by the delivery column
* @method ChildDelivzone findOneByCreatedAt(string $created_at) Return the first ChildDelivzone filtered by the created_at column
* @method ChildDelivzone findOneByUpdatedAt(string $updated_at) Return the first ChildDelivzone filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildDelivzone objects filtered by the id column * @method ChildAreaDeliveryModule findOneById(int $id) Return the first ChildAreaDeliveryModule filtered by the id column
* @method array findByAreaId(int $area_id) Return ChildDelivzone objects filtered by the area_id column * @method ChildAreaDeliveryModule findOneByAreaId(int $area_id) Return the first ChildAreaDeliveryModule filtered by the area_id column
* @method array findByDelivery(string $delivery) Return ChildDelivzone objects filtered by the delivery column * @method ChildAreaDeliveryModule findOneByDeliveryModuleId(int $delivery_module_id) Return the first ChildAreaDeliveryModule filtered by the delivery_module_id column
* @method array findByCreatedAt(string $created_at) Return ChildDelivzone objects filtered by the created_at column * @method ChildAreaDeliveryModule findOneByCreatedAt(string $created_at) Return the first ChildAreaDeliveryModule filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildDelivzone objects filtered by the updated_at column * @method ChildAreaDeliveryModule findOneByUpdatedAt(string $updated_at) Return the first ChildAreaDeliveryModule filtered by the updated_at column
*
* @method array findById(int $id) Return ChildAreaDeliveryModule objects filtered by the id column
* @method array findByAreaId(int $area_id) Return ChildAreaDeliveryModule objects filtered by the area_id column
* @method array findByDeliveryModuleId(int $delivery_module_id) Return ChildAreaDeliveryModule objects filtered by the delivery_module_id column
* @method array findByCreatedAt(string $created_at) Return ChildAreaDeliveryModule objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildAreaDeliveryModule objects filtered by the updated_at column
* *
*/ */
abstract class DelivzoneQuery extends ModelCriteria abstract class AreaDeliveryModuleQuery extends ModelCriteria
{ {
/** /**
* Initializes internal state of \Thelia\Model\Base\DelivzoneQuery object. * Initializes internal state of \Thelia\Model\Base\AreaDeliveryModuleQuery object.
* *
* @param string $dbName The database name * @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book' * @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b' * @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/ */
public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\Delivzone', $modelAlias = null) public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\AreaDeliveryModule', $modelAlias = null)
{ {
parent::__construct($dbName, $modelName, $modelAlias); parent::__construct($dbName, $modelName, $modelAlias);
} }
/** /**
* Returns a new ChildDelivzoneQuery object. * Returns a new ChildAreaDeliveryModuleQuery object.
* *
* @param string $modelAlias The alias of a model in the query * @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from * @param Criteria $criteria Optional Criteria to build the query from
* *
* @return ChildDelivzoneQuery * @return ChildAreaDeliveryModuleQuery
*/ */
public static function create($modelAlias = null, $criteria = null) public static function create($modelAlias = null, $criteria = null)
{ {
if ($criteria instanceof \Thelia\Model\DelivzoneQuery) { if ($criteria instanceof \Thelia\Model\AreaDeliveryModuleQuery) {
return $criteria; return $criteria;
} }
$query = new \Thelia\Model\DelivzoneQuery(); $query = new \Thelia\Model\AreaDeliveryModuleQuery();
if (null !== $modelAlias) { if (null !== $modelAlias) {
$query->setModelAlias($modelAlias); $query->setModelAlias($modelAlias);
} }
@@ -108,19 +112,19 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con an optional connection object * @param ConnectionInterface $con an optional connection object
* *
* @return ChildDelivzone|array|mixed the result, formatted by the current formatter * @return ChildAreaDeliveryModule|array|mixed the result, formatted by the current formatter
*/ */
public function findPk($key, $con = null) public function findPk($key, $con = null)
{ {
if ($key === null) { if ($key === null) {
return null; return null;
} }
if ((null !== ($obj = DelivzoneTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { if ((null !== ($obj = AreaDeliveryModuleTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool // the object is already in the instance pool
return $obj; return $obj;
} }
if ($con === null) { if ($con === null) {
$con = Propel::getServiceContainer()->getReadConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getReadConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
$this->basePreSelect($con); $this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select if ($this->formatter || $this->modelAlias || $this->with || $this->select
@@ -139,11 +143,11 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object * @param ConnectionInterface $con A connection object
* *
* @return ChildDelivzone A model object, or null if the key is not found * @return ChildAreaDeliveryModule A model object, or null if the key is not found
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, AREA_ID, DELIVERY, CREATED_AT, UPDATED_AT FROM delivzone WHERE ID = :p0'; $sql = 'SELECT ID, AREA_ID, DELIVERY_MODULE_ID, CREATED_AT, UPDATED_AT FROM area_delivery_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);
@@ -154,9 +158,9 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
$obj = null; $obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
$obj = new ChildDelivzone(); $obj = new ChildAreaDeliveryModule();
$obj->hydrate($row); $obj->hydrate($row);
DelivzoneTableMap::addInstanceToPool($obj, (string) $key); AreaDeliveryModuleTableMap::addInstanceToPool($obj, (string) $key);
} }
$stmt->closeCursor(); $stmt->closeCursor();
@@ -169,7 +173,7 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* @param ConnectionInterface $con A connection object * @param ConnectionInterface $con A connection object
* *
* @return ChildDelivzone|array|mixed the result, formatted by the current formatter * @return ChildAreaDeliveryModule|array|mixed the result, formatted by the current formatter
*/ */
protected function findPkComplex($key, $con) protected function findPkComplex($key, $con)
{ {
@@ -211,12 +215,12 @@ abstract class DelivzoneQuery extends ModelCriteria
* *
* @param mixed $key Primary key to use for the query * @param mixed $key Primary key to use for the query
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByPrimaryKey($key) public function filterByPrimaryKey($key)
{ {
return $this->addUsingAlias(DelivzoneTableMap::ID, $key, Criteria::EQUAL); return $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $key, Criteria::EQUAL);
} }
/** /**
@@ -224,12 +228,12 @@ abstract class DelivzoneQuery extends ModelCriteria
* *
* @param array $keys The list of primary key to use for the query * @param array $keys The list of primary key to use for the query
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByPrimaryKeys($keys) public function filterByPrimaryKeys($keys)
{ {
return $this->addUsingAlias(DelivzoneTableMap::ID, $keys, Criteria::IN); return $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $keys, Criteria::IN);
} }
/** /**
@@ -248,18 +252,18 @@ abstract class DelivzoneQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterById($id = null, $comparison = null) public function filterById($id = null, $comparison = null)
{ {
if (is_array($id)) { if (is_array($id)) {
$useMinMax = false; $useMinMax = false;
if (isset($id['min'])) { if (isset($id['min'])) {
$this->addUsingAlias(DelivzoneTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($id['max'])) { if (isset($id['max'])) {
$this->addUsingAlias(DelivzoneTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -270,7 +274,7 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(DelivzoneTableMap::ID, $id, $comparison); return $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $id, $comparison);
} }
/** /**
@@ -291,18 +295,18 @@ abstract class DelivzoneQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByAreaId($areaId = null, $comparison = null) public function filterByAreaId($areaId = null, $comparison = null)
{ {
if (is_array($areaId)) { if (is_array($areaId)) {
$useMinMax = false; $useMinMax = false;
if (isset($areaId['min'])) { if (isset($areaId['min'])) {
$this->addUsingAlias(DelivzoneTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($areaId['max'])) { if (isset($areaId['max'])) {
$this->addUsingAlias(DelivzoneTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -313,36 +317,50 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(DelivzoneTableMap::AREA_ID, $areaId, $comparison); return $this->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $areaId, $comparison);
} }
/** /**
* Filter the query on the delivery column * Filter the query on the delivery_module_id column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByDelivery('fooValue'); // WHERE delivery = 'fooValue' * $query->filterByDeliveryModuleId(1234); // WHERE delivery_module_id = 1234
* $query->filterByDelivery('%fooValue%'); // WHERE delivery LIKE '%fooValue%' * $query->filterByDeliveryModuleId(array(12, 34)); // WHERE delivery_module_id IN (12, 34)
* $query->filterByDeliveryModuleId(array('min' => 12)); // WHERE delivery_module_id > 12
* </code> * </code>
* *
* @param string $delivery The value to use as filter. * @see filterByModule()
* Accepts wildcards (* and % trigger a LIKE) *
* @param mixed $deliveryModuleId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByDelivery($delivery = null, $comparison = null) public function filterByDeliveryModuleId($deliveryModuleId = null, $comparison = null)
{ {
if (null === $comparison) { if (is_array($deliveryModuleId)) {
if (is_array($delivery)) { $useMinMax = false;
if (isset($deliveryModuleId['min'])) {
$this->addUsingAlias(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $deliveryModuleId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($deliveryModuleId['max'])) {
$this->addUsingAlias(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $deliveryModuleId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $delivery)) {
$delivery = str_replace('*', '%', $delivery);
$comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(DelivzoneTableMap::DELIVERY, $delivery, $comparison); return $this->addUsingAlias(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $deliveryModuleId, $comparison);
} }
/** /**
@@ -363,18 +381,18 @@ abstract class DelivzoneQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByCreatedAt($createdAt = null, $comparison = null) public function filterByCreatedAt($createdAt = null, $comparison = null)
{ {
if (is_array($createdAt)) { if (is_array($createdAt)) {
$useMinMax = false; $useMinMax = false;
if (isset($createdAt['min'])) { if (isset($createdAt['min'])) {
$this->addUsingAlias(DelivzoneTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($createdAt['max'])) { if (isset($createdAt['max'])) {
$this->addUsingAlias(DelivzoneTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -385,7 +403,7 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(DelivzoneTableMap::CREATED_AT, $createdAt, $comparison); return $this->addUsingAlias(AreaDeliveryModuleTableMap::CREATED_AT, $createdAt, $comparison);
} }
/** /**
@@ -406,18 +424,18 @@ abstract class DelivzoneQuery extends ModelCriteria
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByUpdatedAt($updatedAt = null, $comparison = null) public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{ {
if (is_array($updatedAt)) { if (is_array($updatedAt)) {
$useMinMax = false; $useMinMax = false;
if (isset($updatedAt['min'])) { if (isset($updatedAt['min'])) {
$this->addUsingAlias(DelivzoneTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($updatedAt['max'])) { if (isset($updatedAt['max'])) {
$this->addUsingAlias(DelivzoneTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(AreaDeliveryModuleTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -428,7 +446,7 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(DelivzoneTableMap::UPDATED_AT, $updatedAt, $comparison); return $this->addUsingAlias(AreaDeliveryModuleTableMap::UPDATED_AT, $updatedAt, $comparison);
} }
/** /**
@@ -437,20 +455,20 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param \Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter * @param \Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function filterByArea($area, $comparison = null) public function filterByArea($area, $comparison = null)
{ {
if ($area instanceof \Thelia\Model\Area) { if ($area instanceof \Thelia\Model\Area) {
return $this return $this
->addUsingAlias(DelivzoneTableMap::AREA_ID, $area->getId(), $comparison); ->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof ObjectCollection) { } elseif ($area instanceof ObjectCollection) {
if (null === $comparison) { if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} }
return $this return $this
->addUsingAlias(DelivzoneTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison); ->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else { } else {
throw new PropelException('filterByArea() only accepts arguments of type \Thelia\Model\Area or Collection'); throw new PropelException('filterByArea() only accepts arguments of type \Thelia\Model\Area or Collection');
} }
@@ -462,9 +480,9 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function joinArea($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinArea($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Area'); $relationMap = $tableMap->getRelation('Area');
@@ -499,7 +517,7 @@ abstract class DelivzoneQuery extends ModelCriteria
* *
* @return \Thelia\Model\AreaQuery A secondary query class using the current class as primary query * @return \Thelia\Model\AreaQuery A secondary query class using the current class as primary query
*/ */
public function useAreaQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinArea($relationAlias, $joinType) ->joinArea($relationAlias, $joinType)
@@ -507,23 +525,98 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
/** /**
* Exclude object from result * Filter the query by a related \Thelia\Model\Module object
* *
* @param ChildDelivzone $delivzone Object to remove from the list of results * @param \Thelia\Model\Module|ObjectCollection $module The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function prune($delivzone = null) public function filterByModule($module, $comparison = null)
{ {
if ($delivzone) { if ($module instanceof \Thelia\Model\Module) {
$this->addUsingAlias(DelivzoneTableMap::ID, $delivzone->getId(), Criteria::NOT_EQUAL); return $this
->addUsingAlias(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $module->getId(), $comparison);
} elseif ($module instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByModule() only accepts arguments of type \Thelia\Model\Module or Collection');
}
}
/**
* Adds a JOIN clause to the query using the Module relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/
public function joinModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Module');
// 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, 'Module');
} }
return $this; return $this;
} }
/** /**
* Deletes all rows from the delivzone table. * Use the Module relation Module 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\ModuleQuery A secondary query class using the current class as primary query
*/
public function useModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
}
/**
* Exclude object from result
*
* @param ChildAreaDeliveryModule $areaDeliveryModule Object to remove from the list of results
*
* @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/
public function prune($areaDeliveryModule = null)
{
if ($areaDeliveryModule) {
$this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $areaDeliveryModule->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
/**
* Deletes all rows from the area_delivery_module table.
* *
* @param ConnectionInterface $con the connection to use * @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). * @return int The number of affected rows (if supported by underlying database driver).
@@ -531,7 +624,7 @@ abstract class DelivzoneQuery extends ModelCriteria
public function doDeleteAll(ConnectionInterface $con = null) public function doDeleteAll(ConnectionInterface $con = null)
{ {
if (null === $con) { if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
$affectedRows = 0; // initialize var to track total num of affected rows $affectedRows = 0; // initialize var to track total num of affected rows
try { try {
@@ -542,8 +635,8 @@ abstract class DelivzoneQuery extends ModelCriteria
// Because this db requires some delete cascade/set null emulation, we have to // Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since // clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein). // instances get re-added by the select statement contained therein).
DelivzoneTableMap::clearInstancePool(); AreaDeliveryModuleTableMap::clearInstancePool();
DelivzoneTableMap::clearRelatedInstancePool(); AreaDeliveryModuleTableMap::clearRelatedInstancePool();
$con->commit(); $con->commit();
} catch (PropelException $e) { } catch (PropelException $e) {
@@ -555,9 +648,9 @@ abstract class DelivzoneQuery extends ModelCriteria
} }
/** /**
* Performs a DELETE on the database, given a ChildDelivzone or Criteria object OR a primary key value. * Performs a DELETE on the database, given a ChildAreaDeliveryModule or Criteria object OR a primary key value.
* *
* @param mixed $values Criteria or ChildDelivzone object or primary key or array of primary keys * @param mixed $values Criteria or ChildAreaDeliveryModule object or primary key or array of primary keys
* which is used to create the DELETE statement * which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use * @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
@@ -568,13 +661,13 @@ abstract class DelivzoneQuery extends ModelCriteria
public function delete(ConnectionInterface $con = null) public function delete(ConnectionInterface $con = null)
{ {
if (null === $con) { if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
$criteria = $this; $criteria = $this;
// Set the correct dbName // Set the correct dbName
$criteria->setDbName(DelivzoneTableMap::DATABASE_NAME); $criteria->setDbName(AreaDeliveryModuleTableMap::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows $affectedRows = 0; // initialize var to track total num of affected rows
@@ -584,10 +677,10 @@ abstract class DelivzoneQuery extends ModelCriteria
$con->beginTransaction(); $con->beginTransaction();
DelivzoneTableMap::removeInstanceFromPool($criteria); AreaDeliveryModuleTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con); $affectedRows += ModelCriteria::delete($con);
DelivzoneTableMap::clearRelatedInstancePool(); AreaDeliveryModuleTableMap::clearRelatedInstancePool();
$con->commit(); $con->commit();
return $affectedRows; return $affectedRows;
@@ -604,11 +697,11 @@ abstract class DelivzoneQuery extends ModelCriteria
* *
* @param int $nbDays Maximum age of the latest update in days * @param int $nbDays Maximum age of the latest update in days
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function recentlyUpdated($nbDays = 7) public function recentlyUpdated($nbDays = 7)
{ {
return $this->addUsingAlias(DelivzoneTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); return $this->addUsingAlias(AreaDeliveryModuleTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
} }
/** /**
@@ -616,51 +709,51 @@ abstract class DelivzoneQuery extends ModelCriteria
* *
* @param int $nbDays Maximum age of in days * @param int $nbDays Maximum age of in days
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function recentlyCreated($nbDays = 7) public function recentlyCreated($nbDays = 7)
{ {
return $this->addUsingAlias(DelivzoneTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); return $this->addUsingAlias(AreaDeliveryModuleTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
} }
/** /**
* Order by update date desc * Order by update date desc
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function lastUpdatedFirst() public function lastUpdatedFirst()
{ {
return $this->addDescendingOrderByColumn(DelivzoneTableMap::UPDATED_AT); return $this->addDescendingOrderByColumn(AreaDeliveryModuleTableMap::UPDATED_AT);
} }
/** /**
* Order by update date asc * Order by update date asc
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function firstUpdatedFirst() public function firstUpdatedFirst()
{ {
return $this->addAscendingOrderByColumn(DelivzoneTableMap::UPDATED_AT); return $this->addAscendingOrderByColumn(AreaDeliveryModuleTableMap::UPDATED_AT);
} }
/** /**
* Order by create date desc * Order by create date desc
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function lastCreatedFirst() public function lastCreatedFirst()
{ {
return $this->addDescendingOrderByColumn(DelivzoneTableMap::CREATED_AT); return $this->addDescendingOrderByColumn(AreaDeliveryModuleTableMap::CREATED_AT);
} }
/** /**
* Order by create date asc * Order by create date asc
* *
* @return ChildDelivzoneQuery The current query, for fluid interface * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/ */
public function firstCreatedFirst() public function firstCreatedFirst()
{ {
return $this->addAscendingOrderByColumn(DelivzoneTableMap::CREATED_AT); return $this->addAscendingOrderByColumn(AreaDeliveryModuleTableMap::CREATED_AT);
} }
} // DelivzoneQuery } // AreaDeliveryModuleQuery

View File

@@ -23,13 +23,13 @@ use Thelia\Model\Map\AreaTableMap;
* *
* @method ChildAreaQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildAreaQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildAreaQuery orderByName($order = Criteria::ASC) Order by the name column * @method ChildAreaQuery orderByName($order = Criteria::ASC) Order by the name column
* @method ChildAreaQuery orderByUnit($order = Criteria::ASC) Order by the unit column * @method ChildAreaQuery orderByPostage($order = Criteria::ASC) Order by the postage column
* @method ChildAreaQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildAreaQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildAreaQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildAreaQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildAreaQuery groupById() Group by the id column * @method ChildAreaQuery groupById() Group by the id column
* @method ChildAreaQuery groupByName() Group by the name column * @method ChildAreaQuery groupByName() Group by the name column
* @method ChildAreaQuery groupByUnit() Group by the unit column * @method ChildAreaQuery groupByPostage() Group by the postage column
* @method ChildAreaQuery groupByCreatedAt() Group by the created_at column * @method ChildAreaQuery groupByCreatedAt() Group by the created_at column
* @method ChildAreaQuery groupByUpdatedAt() Group by the updated_at column * @method ChildAreaQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -41,22 +41,22 @@ use Thelia\Model\Map\AreaTableMap;
* @method ChildAreaQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation * @method ChildAreaQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
* @method ChildAreaQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation * @method ChildAreaQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
* *
* @method ChildAreaQuery leftJoinDelivzone($relationAlias = null) Adds a LEFT JOIN clause to the query using the Delivzone relation * @method ChildAreaQuery leftJoinAreaDeliveryModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the AreaDeliveryModule relation
* @method ChildAreaQuery rightJoinDelivzone($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Delivzone relation * @method ChildAreaQuery rightJoinAreaDeliveryModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AreaDeliveryModule relation
* @method ChildAreaQuery innerJoinDelivzone($relationAlias = null) Adds a INNER JOIN clause to the query using the Delivzone relation * @method ChildAreaQuery innerJoinAreaDeliveryModule($relationAlias = null) Adds a INNER JOIN clause to the query using the AreaDeliveryModule relation
* *
* @method ChildArea findOne(ConnectionInterface $con = null) Return the first ChildArea matching the query * @method ChildArea findOne(ConnectionInterface $con = null) Return the first ChildArea matching the query
* @method ChildArea findOneOrCreate(ConnectionInterface $con = null) Return the first ChildArea matching the query, or a new ChildArea object populated from the query conditions when no match is found * @method ChildArea findOneOrCreate(ConnectionInterface $con = null) Return the first ChildArea matching the query, or a new ChildArea object populated from the query conditions when no match is found
* *
* @method ChildArea findOneById(int $id) Return the first ChildArea filtered by the id column * @method ChildArea findOneById(int $id) Return the first ChildArea filtered by the id column
* @method ChildArea findOneByName(string $name) Return the first ChildArea filtered by the name column * @method ChildArea findOneByName(string $name) Return the first ChildArea filtered by the name column
* @method ChildArea findOneByUnit(double $unit) Return the first ChildArea filtered by the unit column * @method ChildArea findOneByPostage(double $postage) Return the first ChildArea filtered by the postage column
* @method ChildArea findOneByCreatedAt(string $created_at) Return the first ChildArea filtered by the created_at column * @method ChildArea findOneByCreatedAt(string $created_at) Return the first ChildArea filtered by the created_at column
* @method ChildArea findOneByUpdatedAt(string $updated_at) Return the first ChildArea filtered by the updated_at column * @method ChildArea findOneByUpdatedAt(string $updated_at) Return the first ChildArea filtered by the updated_at column
* *
* @method array findById(int $id) Return ChildArea objects filtered by the id column * @method array findById(int $id) Return ChildArea objects filtered by the id column
* @method array findByName(string $name) Return ChildArea objects filtered by the name column * @method array findByName(string $name) Return ChildArea objects filtered by the name column
* @method array findByUnit(double $unit) Return ChildArea objects filtered by the unit column * @method array findByPostage(double $postage) Return ChildArea objects filtered by the postage column
* @method array findByCreatedAt(string $created_at) Return ChildArea objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildArea objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildArea objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildArea objects filtered by the updated_at column
* *
@@ -147,7 +147,7 @@ abstract class AreaQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT ID, NAME, UNIT, CREATED_AT, UPDATED_AT FROM area WHERE ID = :p0'; $sql = 'SELECT ID, NAME, POSTAGE, CREATED_AT, UPDATED_AT FROM area 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);
@@ -307,16 +307,16 @@ abstract class AreaQuery extends ModelCriteria
} }
/** /**
* Filter the query on the unit column * Filter the query on the postage column
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByUnit(1234); // WHERE unit = 1234 * $query->filterByPostage(1234); // WHERE postage = 1234
* $query->filterByUnit(array(12, 34)); // WHERE unit IN (12, 34) * $query->filterByPostage(array(12, 34)); // WHERE postage IN (12, 34)
* $query->filterByUnit(array('min' => 12)); // WHERE unit > 12 * $query->filterByPostage(array('min' => 12)); // WHERE postage > 12
* </code> * </code>
* *
* @param mixed $unit The value to use as filter. * @param mixed $postage The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -324,16 +324,16 @@ abstract class AreaQuery extends ModelCriteria
* *
* @return ChildAreaQuery The current query, for fluid interface * @return ChildAreaQuery The current query, for fluid interface
*/ */
public function filterByUnit($unit = null, $comparison = null) public function filterByPostage($postage = null, $comparison = null)
{ {
if (is_array($unit)) { if (is_array($postage)) {
$useMinMax = false; $useMinMax = false;
if (isset($unit['min'])) { if (isset($postage['min'])) {
$this->addUsingAlias(AreaTableMap::UNIT, $unit['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(AreaTableMap::POSTAGE, $postage['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($unit['max'])) { if (isset($postage['max'])) {
$this->addUsingAlias(AreaTableMap::UNIT, $unit['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(AreaTableMap::POSTAGE, $postage['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
@@ -344,7 +344,7 @@ abstract class AreaQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(AreaTableMap::UNIT, $unit, $comparison); return $this->addUsingAlias(AreaTableMap::POSTAGE, $postage, $comparison);
} }
/** /**
@@ -507,40 +507,40 @@ abstract class AreaQuery extends ModelCriteria
} }
/** /**
* Filter the query by a related \Thelia\Model\Delivzone object * Filter the query by a related \Thelia\Model\AreaDeliveryModule object
* *
* @param \Thelia\Model\Delivzone|ObjectCollection $delivzone the related object to use as filter * @param \Thelia\Model\AreaDeliveryModule|ObjectCollection $areaDeliveryModule the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return ChildAreaQuery The current query, for fluid interface * @return ChildAreaQuery The current query, for fluid interface
*/ */
public function filterByDelivzone($delivzone, $comparison = null) public function filterByAreaDeliveryModule($areaDeliveryModule, $comparison = null)
{ {
if ($delivzone instanceof \Thelia\Model\Delivzone) { if ($areaDeliveryModule instanceof \Thelia\Model\AreaDeliveryModule) {
return $this return $this
->addUsingAlias(AreaTableMap::ID, $delivzone->getAreaId(), $comparison); ->addUsingAlias(AreaTableMap::ID, $areaDeliveryModule->getAreaId(), $comparison);
} elseif ($delivzone instanceof ObjectCollection) { } elseif ($areaDeliveryModule instanceof ObjectCollection) {
return $this return $this
->useDelivzoneQuery() ->useAreaDeliveryModuleQuery()
->filterByPrimaryKeys($delivzone->getPrimaryKeys()) ->filterByPrimaryKeys($areaDeliveryModule->getPrimaryKeys())
->endUse(); ->endUse();
} else { } else {
throw new PropelException('filterByDelivzone() only accepts arguments of type \Thelia\Model\Delivzone or Collection'); throw new PropelException('filterByAreaDeliveryModule() only accepts arguments of type \Thelia\Model\AreaDeliveryModule or Collection');
} }
} }
/** /**
* Adds a JOIN clause to the query using the Delivzone relation * Adds a JOIN clause to the query using the AreaDeliveryModule relation
* *
* @param string $relationAlias optional alias for the relation * @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return ChildAreaQuery The current query, for fluid interface * @return ChildAreaQuery The current query, for fluid interface
*/ */
public function joinDelivzone($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function joinAreaDeliveryModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
$tableMap = $this->getTableMap(); $tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Delivzone'); $relationMap = $tableMap->getRelation('AreaDeliveryModule');
// create a ModelJoin object for this join // create a ModelJoin object for this join
$join = new ModelJoin(); $join = new ModelJoin();
@@ -555,14 +555,14 @@ abstract class AreaQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias); $this->addJoinObject($join, $relationAlias);
} else { } else {
$this->addJoinObject($join, 'Delivzone'); $this->addJoinObject($join, 'AreaDeliveryModule');
} }
return $this; return $this;
} }
/** /**
* Use the Delivzone relation Delivzone object * Use the AreaDeliveryModule relation AreaDeliveryModule object
* *
* @see useQuery() * @see useQuery()
* *
@@ -570,13 +570,13 @@ abstract class AreaQuery extends ModelCriteria
* to be used as main alias in the secondary query * to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
* *
* @return \Thelia\Model\DelivzoneQuery A secondary query class using the current class as primary query * @return \Thelia\Model\AreaDeliveryModuleQuery A secondary query class using the current class as primary query
*/ */
public function useDelivzoneQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) public function useAreaDeliveryModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{ {
return $this return $this
->joinDelivzone($relationAlias, $joinType) ->joinAreaDeliveryModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Delivzone', '\Thelia\Model\DelivzoneQuery'); ->useQuery($relationAlias ? $relationAlias : 'AreaDeliveryModule', '\Thelia\Model\AreaDeliveryModuleQuery');
} }
/** /**

View File

@@ -70,6 +70,12 @@ abstract class ContentFolder implements ActiveRecordInterface
*/ */
protected $folder_id; protected $folder_id;
/**
* The value for the default_folder field.
* @var boolean
*/
protected $default_folder;
/** /**
* The value for the created_at field. * The value for the created_at field.
* @var string * @var string
@@ -376,6 +382,17 @@ abstract class ContentFolder implements ActiveRecordInterface
return $this->folder_id; return $this->folder_id;
} }
/**
* Get the [default_folder] column value.
*
* @return boolean
*/
public function getDefaultFolder()
{
return $this->default_folder;
}
/** /**
* Get the [optionally formatted] temporal [created_at] column value. * Get the [optionally formatted] temporal [created_at] column value.
* *
@@ -466,6 +483,35 @@ abstract class ContentFolder implements ActiveRecordInterface
return $this; return $this;
} // setFolderId() } // setFolderId()
/**
* Sets the value of the [default_folder] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean|integer|string $v The new value
* @return \Thelia\Model\ContentFolder The current object (for fluent API support)
*/
public function setDefaultFolder($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->default_folder !== $v) {
$this->default_folder = $v;
$this->modifiedColumns[] = ContentFolderTableMap::DEFAULT_FOLDER;
}
return $this;
} // setDefaultFolder()
/** /**
* 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.
* *
@@ -551,13 +597,16 @@ abstract class ContentFolder implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ContentFolderTableMap::translateFieldName('FolderId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ContentFolderTableMap::translateFieldName('FolderId', TableMap::TYPE_PHPNAME, $indexType)];
$this->folder_id = (null !== $col) ? (int) $col : null; $this->folder_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ContentFolderTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ContentFolderTableMap::translateFieldName('DefaultFolder', TableMap::TYPE_PHPNAME, $indexType)];
$this->default_folder = (null !== $col) ? (boolean) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ContentFolderTableMap::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 ? 3 + $startcol : ContentFolderTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ContentFolderTableMap::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;
} }
@@ -570,7 +619,7 @@ abstract class ContentFolder implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 4; // 4 = ContentFolderTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 5; // 5 = ContentFolderTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ContentFolder object", 0, $e); throw new PropelException("Error populating \Thelia\Model\ContentFolder object", 0, $e);
@@ -819,6 +868,9 @@ abstract class ContentFolder implements ActiveRecordInterface
if ($this->isColumnModified(ContentFolderTableMap::FOLDER_ID)) { if ($this->isColumnModified(ContentFolderTableMap::FOLDER_ID)) {
$modifiedColumns[':p' . $index++] = 'FOLDER_ID'; $modifiedColumns[':p' . $index++] = 'FOLDER_ID';
} }
if ($this->isColumnModified(ContentFolderTableMap::DEFAULT_FOLDER)) {
$modifiedColumns[':p' . $index++] = 'DEFAULT_FOLDER';
}
if ($this->isColumnModified(ContentFolderTableMap::CREATED_AT)) { if ($this->isColumnModified(ContentFolderTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
@@ -842,6 +894,9 @@ abstract class ContentFolder implements ActiveRecordInterface
case 'FOLDER_ID': case 'FOLDER_ID':
$stmt->bindValue($identifier, $this->folder_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->folder_id, PDO::PARAM_INT);
break; break;
case 'DEFAULT_FOLDER':
$stmt->bindValue($identifier, (int) $this->default_folder, PDO::PARAM_INT);
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;
@@ -910,9 +965,12 @@ abstract class ContentFolder implements ActiveRecordInterface
return $this->getFolderId(); return $this->getFolderId();
break; break;
case 2: case 2:
return $this->getCreatedAt(); return $this->getDefaultFolder();
break; break;
case 3: case 3:
return $this->getCreatedAt();
break;
case 4:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -946,8 +1004,9 @@ abstract class ContentFolder implements ActiveRecordInterface
$result = array( $result = array(
$keys[0] => $this->getContentId(), $keys[0] => $this->getContentId(),
$keys[1] => $this->getFolderId(), $keys[1] => $this->getFolderId(),
$keys[2] => $this->getCreatedAt(), $keys[2] => $this->getDefaultFolder(),
$keys[3] => $this->getUpdatedAt(), $keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -1003,9 +1062,12 @@ abstract class ContentFolder implements ActiveRecordInterface
$this->setFolderId($value); $this->setFolderId($value);
break; break;
case 2: case 2:
$this->setCreatedAt($value); $this->setDefaultFolder($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value);
break;
case 4:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1034,8 +1096,9 @@ abstract class ContentFolder implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setContentId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setContentId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setFolderId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setFolderId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setDefaultFolder($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
} }
/** /**
@@ -1049,6 +1112,7 @@ abstract class ContentFolder implements ActiveRecordInterface
if ($this->isColumnModified(ContentFolderTableMap::CONTENT_ID)) $criteria->add(ContentFolderTableMap::CONTENT_ID, $this->content_id); if ($this->isColumnModified(ContentFolderTableMap::CONTENT_ID)) $criteria->add(ContentFolderTableMap::CONTENT_ID, $this->content_id);
if ($this->isColumnModified(ContentFolderTableMap::FOLDER_ID)) $criteria->add(ContentFolderTableMap::FOLDER_ID, $this->folder_id); if ($this->isColumnModified(ContentFolderTableMap::FOLDER_ID)) $criteria->add(ContentFolderTableMap::FOLDER_ID, $this->folder_id);
if ($this->isColumnModified(ContentFolderTableMap::DEFAULT_FOLDER)) $criteria->add(ContentFolderTableMap::DEFAULT_FOLDER, $this->default_folder);
if ($this->isColumnModified(ContentFolderTableMap::CREATED_AT)) $criteria->add(ContentFolderTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(ContentFolderTableMap::CREATED_AT)) $criteria->add(ContentFolderTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ContentFolderTableMap::UPDATED_AT)) $criteria->add(ContentFolderTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(ContentFolderTableMap::UPDATED_AT)) $criteria->add(ContentFolderTableMap::UPDATED_AT, $this->updated_at);
@@ -1123,6 +1187,7 @@ abstract class ContentFolder implements ActiveRecordInterface
{ {
$copyObj->setContentId($this->getContentId()); $copyObj->setContentId($this->getContentId());
$copyObj->setFolderId($this->getFolderId()); $copyObj->setFolderId($this->getFolderId());
$copyObj->setDefaultFolder($this->getDefaultFolder());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) { if ($makeNew) {
@@ -1261,6 +1326,7 @@ abstract class ContentFolder implements ActiveRecordInterface
{ {
$this->content_id = null; $this->content_id = null;
$this->folder_id = null; $this->folder_id = null;
$this->default_folder = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;

View File

@@ -23,11 +23,13 @@ use Thelia\Model\Map\ContentFolderTableMap;
* *
* @method ChildContentFolderQuery orderByContentId($order = Criteria::ASC) Order by the content_id column * @method ChildContentFolderQuery orderByContentId($order = Criteria::ASC) Order by the content_id column
* @method ChildContentFolderQuery orderByFolderId($order = Criteria::ASC) Order by the folder_id column * @method ChildContentFolderQuery orderByFolderId($order = Criteria::ASC) Order by the folder_id column
* @method ChildContentFolderQuery orderByDefaultFolder($order = Criteria::ASC) Order by the default_folder column
* @method ChildContentFolderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildContentFolderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildContentFolderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildContentFolderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildContentFolderQuery groupByContentId() Group by the content_id column * @method ChildContentFolderQuery groupByContentId() Group by the content_id column
* @method ChildContentFolderQuery groupByFolderId() Group by the folder_id column * @method ChildContentFolderQuery groupByFolderId() Group by the folder_id column
* @method ChildContentFolderQuery groupByDefaultFolder() Group by the default_folder column
* @method ChildContentFolderQuery groupByCreatedAt() Group by the created_at column * @method ChildContentFolderQuery groupByCreatedAt() Group by the created_at column
* @method ChildContentFolderQuery groupByUpdatedAt() Group by the updated_at column * @method ChildContentFolderQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -48,11 +50,13 @@ use Thelia\Model\Map\ContentFolderTableMap;
* *
* @method ChildContentFolder findOneByContentId(int $content_id) Return the first ChildContentFolder filtered by the content_id column * @method ChildContentFolder findOneByContentId(int $content_id) Return the first ChildContentFolder filtered by the content_id column
* @method ChildContentFolder findOneByFolderId(int $folder_id) Return the first ChildContentFolder filtered by the folder_id column * @method ChildContentFolder findOneByFolderId(int $folder_id) Return the first ChildContentFolder filtered by the folder_id column
* @method ChildContentFolder findOneByDefaultFolder(boolean $default_folder) Return the first ChildContentFolder filtered by the default_folder column
* @method ChildContentFolder findOneByCreatedAt(string $created_at) Return the first ChildContentFolder filtered by the created_at column * @method ChildContentFolder findOneByCreatedAt(string $created_at) Return the first ChildContentFolder filtered by the created_at column
* @method ChildContentFolder findOneByUpdatedAt(string $updated_at) Return the first ChildContentFolder filtered by the updated_at column * @method ChildContentFolder findOneByUpdatedAt(string $updated_at) Return the first ChildContentFolder filtered by the updated_at column
* *
* @method array findByContentId(int $content_id) Return ChildContentFolder objects filtered by the content_id column * @method array findByContentId(int $content_id) Return ChildContentFolder objects filtered by the content_id column
* @method array findByFolderId(int $folder_id) Return ChildContentFolder objects filtered by the folder_id column * @method array findByFolderId(int $folder_id) Return ChildContentFolder objects filtered by the folder_id column
* @method array findByDefaultFolder(boolean $default_folder) Return ChildContentFolder objects filtered by the default_folder column
* @method array findByCreatedAt(string $created_at) Return ChildContentFolder objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildContentFolder objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildContentFolder objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildContentFolder objects filtered by the updated_at column
* *
@@ -143,7 +147,7 @@ abstract class ContentFolderQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT CONTENT_ID, FOLDER_ID, CREATED_AT, UPDATED_AT FROM content_folder WHERE CONTENT_ID = :p0 AND FOLDER_ID = :p1'; $sql = 'SELECT CONTENT_ID, FOLDER_ID, DEFAULT_FOLDER, CREATED_AT, UPDATED_AT FROM content_folder WHERE CONTENT_ID = :p0 AND FOLDER_ID = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -330,6 +334,33 @@ abstract class ContentFolderQuery extends ModelCriteria
return $this->addUsingAlias(ContentFolderTableMap::FOLDER_ID, $folderId, $comparison); return $this->addUsingAlias(ContentFolderTableMap::FOLDER_ID, $folderId, $comparison);
} }
/**
* Filter the query on the default_folder column
*
* Example usage:
* <code>
* $query->filterByDefaultFolder(true); // WHERE default_folder = true
* $query->filterByDefaultFolder('yes'); // WHERE default_folder = true
* </code>
*
* @param boolean|string $defaultFolder The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildContentFolderQuery The current query, for fluid interface
*/
public function filterByDefaultFolder($defaultFolder = null, $comparison = null)
{
if (is_string($defaultFolder)) {
$default_folder = in_array(strtolower($defaultFolder), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(ContentFolderTableMap::DEFAULT_FOLDER, $defaultFolder, $comparison);
}
/** /**
* Filter the query on the created_at column * Filter the query on the created_at column
* *

View File

@@ -17,6 +17,8 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime; use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
use Thelia\Model\GroupModule as ChildGroupModule; use Thelia\Model\GroupModule as ChildGroupModule;
use Thelia\Model\GroupModuleQuery as ChildGroupModuleQuery; use Thelia\Model\GroupModuleQuery as ChildGroupModuleQuery;
use Thelia\Model\Module as ChildModule; use Thelia\Model\Module as ChildModule;
@@ -121,6 +123,12 @@ abstract class Module implements ActiveRecordInterface
protected $collOrdersRelatedByDeliveryModuleId; protected $collOrdersRelatedByDeliveryModuleId;
protected $collOrdersRelatedByDeliveryModuleIdPartial; protected $collOrdersRelatedByDeliveryModuleIdPartial;
/**
* @var ObjectCollection|ChildAreaDeliveryModule[] Collection to store aggregation of ChildAreaDeliveryModule objects.
*/
protected $collAreaDeliveryModules;
protected $collAreaDeliveryModulesPartial;
/** /**
* @var ObjectCollection|ChildGroupModule[] Collection to store aggregation of ChildGroupModule objects. * @var ObjectCollection|ChildGroupModule[] Collection to store aggregation of ChildGroupModule objects.
*/ */
@@ -167,6 +175,12 @@ abstract class Module implements ActiveRecordInterface
*/ */
protected $ordersRelatedByDeliveryModuleIdScheduledForDeletion = null; protected $ordersRelatedByDeliveryModuleIdScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
*/
protected $areaDeliveryModulesScheduledForDeletion = null;
/** /**
* An array of objects scheduled for deletion. * An array of objects scheduled for deletion.
* @var ObjectCollection * @var ObjectCollection
@@ -846,6 +860,8 @@ abstract class Module implements ActiveRecordInterface
$this->collOrdersRelatedByDeliveryModuleId = null; $this->collOrdersRelatedByDeliveryModuleId = null;
$this->collAreaDeliveryModules = null;
$this->collGroupModules = null; $this->collGroupModules = null;
$this->collModuleI18ns = null; $this->collModuleI18ns = null;
@@ -1017,6 +1033,23 @@ abstract class Module implements ActiveRecordInterface
} }
} }
if ($this->areaDeliveryModulesScheduledForDeletion !== null) {
if (!$this->areaDeliveryModulesScheduledForDeletion->isEmpty()) {
\Thelia\Model\AreaDeliveryModuleQuery::create()
->filterByPrimaryKeys($this->areaDeliveryModulesScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
$this->areaDeliveryModulesScheduledForDeletion = null;
}
}
if ($this->collAreaDeliveryModules !== null) {
foreach ($this->collAreaDeliveryModules as $referrerFK) {
if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->groupModulesScheduledForDeletion !== null) { if ($this->groupModulesScheduledForDeletion !== null) {
if (!$this->groupModulesScheduledForDeletion->isEmpty()) { if (!$this->groupModulesScheduledForDeletion->isEmpty()) {
\Thelia\Model\GroupModuleQuery::create() \Thelia\Model\GroupModuleQuery::create()
@@ -1273,6 +1306,9 @@ abstract class Module implements ActiveRecordInterface
if (null !== $this->collOrdersRelatedByDeliveryModuleId) { if (null !== $this->collOrdersRelatedByDeliveryModuleId) {
$result['OrdersRelatedByDeliveryModuleId'] = $this->collOrdersRelatedByDeliveryModuleId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['OrdersRelatedByDeliveryModuleId'] = $this->collOrdersRelatedByDeliveryModuleId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
if (null !== $this->collAreaDeliveryModules) {
$result['AreaDeliveryModules'] = $this->collAreaDeliveryModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collGroupModules) { if (null !== $this->collGroupModules) {
$result['GroupModules'] = $this->collGroupModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); $result['GroupModules'] = $this->collGroupModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
} }
@@ -1476,6 +1512,12 @@ abstract class Module implements ActiveRecordInterface
} }
} }
foreach ($this->getAreaDeliveryModules() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addAreaDeliveryModule($relObj->copy($deepCopy));
}
}
foreach ($this->getGroupModules() as $relObj) { foreach ($this->getGroupModules() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addGroupModule($relObj->copy($deepCopy)); $copyObj->addGroupModule($relObj->copy($deepCopy));
@@ -1535,6 +1577,9 @@ abstract class Module implements ActiveRecordInterface
if ('OrderRelatedByDeliveryModuleId' == $relationName) { if ('OrderRelatedByDeliveryModuleId' == $relationName) {
return $this->initOrdersRelatedByDeliveryModuleId(); return $this->initOrdersRelatedByDeliveryModuleId();
} }
if ('AreaDeliveryModule' == $relationName) {
return $this->initAreaDeliveryModules();
}
if ('GroupModule' == $relationName) { if ('GroupModule' == $relationName) {
return $this->initGroupModules(); return $this->initGroupModules();
} }
@@ -2279,6 +2324,249 @@ abstract class Module implements ActiveRecordInterface
return $this->getOrdersRelatedByDeliveryModuleId($query, $con); return $this->getOrdersRelatedByDeliveryModuleId($query, $con);
} }
/**
* Clears out the collAreaDeliveryModules 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 addAreaDeliveryModules()
*/
public function clearAreaDeliveryModules()
{
$this->collAreaDeliveryModules = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Reset is the collAreaDeliveryModules collection loaded partially.
*/
public function resetPartialAreaDeliveryModules($v = true)
{
$this->collAreaDeliveryModulesPartial = $v;
}
/**
* Initializes the collAreaDeliveryModules collection.
*
* By default this just sets the collAreaDeliveryModules collection to an empty array (like clearcollAreaDeliveryModules());
* 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 initAreaDeliveryModules($overrideExisting = true)
{
if (null !== $this->collAreaDeliveryModules && !$overrideExisting) {
return;
}
$this->collAreaDeliveryModules = new ObjectCollection();
$this->collAreaDeliveryModules->setModel('\Thelia\Model\AreaDeliveryModule');
}
/**
* Gets an array of ChildAreaDeliveryModule 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 ChildModule 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|ChildAreaDeliveryModule[] List of ChildAreaDeliveryModule objects
* @throws PropelException
*/
public function getAreaDeliveryModules($criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collAreaDeliveryModulesPartial && !$this->isNew();
if (null === $this->collAreaDeliveryModules || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collAreaDeliveryModules) {
// return empty collection
$this->initAreaDeliveryModules();
} else {
$collAreaDeliveryModules = ChildAreaDeliveryModuleQuery::create(null, $criteria)
->filterByModule($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collAreaDeliveryModulesPartial && count($collAreaDeliveryModules)) {
$this->initAreaDeliveryModules(false);
foreach ($collAreaDeliveryModules as $obj) {
if (false == $this->collAreaDeliveryModules->contains($obj)) {
$this->collAreaDeliveryModules->append($obj);
}
}
$this->collAreaDeliveryModulesPartial = true;
}
$collAreaDeliveryModules->getInternalIterator()->rewind();
return $collAreaDeliveryModules;
}
if ($partial && $this->collAreaDeliveryModules) {
foreach ($this->collAreaDeliveryModules as $obj) {
if ($obj->isNew()) {
$collAreaDeliveryModules[] = $obj;
}
}
}
$this->collAreaDeliveryModules = $collAreaDeliveryModules;
$this->collAreaDeliveryModulesPartial = false;
}
}
return $this->collAreaDeliveryModules;
}
/**
* Sets a collection of AreaDeliveryModule 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 $areaDeliveryModules A Propel collection.
* @param ConnectionInterface $con Optional connection object
* @return ChildModule The current object (for fluent API support)
*/
public function setAreaDeliveryModules(Collection $areaDeliveryModules, ConnectionInterface $con = null)
{
$areaDeliveryModulesToDelete = $this->getAreaDeliveryModules(new Criteria(), $con)->diff($areaDeliveryModules);
$this->areaDeliveryModulesScheduledForDeletion = $areaDeliveryModulesToDelete;
foreach ($areaDeliveryModulesToDelete as $areaDeliveryModuleRemoved) {
$areaDeliveryModuleRemoved->setModule(null);
}
$this->collAreaDeliveryModules = null;
foreach ($areaDeliveryModules as $areaDeliveryModule) {
$this->addAreaDeliveryModule($areaDeliveryModule);
}
$this->collAreaDeliveryModules = $areaDeliveryModules;
$this->collAreaDeliveryModulesPartial = false;
return $this;
}
/**
* Returns the number of related AreaDeliveryModule objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param ConnectionInterface $con
* @return int Count of related AreaDeliveryModule objects.
* @throws PropelException
*/
public function countAreaDeliveryModules(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collAreaDeliveryModulesPartial && !$this->isNew();
if (null === $this->collAreaDeliveryModules || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collAreaDeliveryModules) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getAreaDeliveryModules());
}
$query = ChildAreaDeliveryModuleQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByModule($this)
->count($con);
}
return count($this->collAreaDeliveryModules);
}
/**
* Method called to associate a ChildAreaDeliveryModule object to this object
* through the ChildAreaDeliveryModule foreign key attribute.
*
* @param ChildAreaDeliveryModule $l ChildAreaDeliveryModule
* @return \Thelia\Model\Module The current object (for fluent API support)
*/
public function addAreaDeliveryModule(ChildAreaDeliveryModule $l)
{
if ($this->collAreaDeliveryModules === null) {
$this->initAreaDeliveryModules();
$this->collAreaDeliveryModulesPartial = true;
}
if (!in_array($l, $this->collAreaDeliveryModules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
$this->doAddAreaDeliveryModule($l);
}
return $this;
}
/**
* @param AreaDeliveryModule $areaDeliveryModule The areaDeliveryModule object to add.
*/
protected function doAddAreaDeliveryModule($areaDeliveryModule)
{
$this->collAreaDeliveryModules[]= $areaDeliveryModule;
$areaDeliveryModule->setModule($this);
}
/**
* @param AreaDeliveryModule $areaDeliveryModule The areaDeliveryModule object to remove.
* @return ChildModule The current object (for fluent API support)
*/
public function removeAreaDeliveryModule($areaDeliveryModule)
{
if ($this->getAreaDeliveryModules()->contains($areaDeliveryModule)) {
$this->collAreaDeliveryModules->remove($this->collAreaDeliveryModules->search($areaDeliveryModule));
if (null === $this->areaDeliveryModulesScheduledForDeletion) {
$this->areaDeliveryModulesScheduledForDeletion = clone $this->collAreaDeliveryModules;
$this->areaDeliveryModulesScheduledForDeletion->clear();
}
$this->areaDeliveryModulesScheduledForDeletion[]= clone $areaDeliveryModule;
$areaDeliveryModule->setModule(null);
}
return $this;
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Module is new, it will return
* an empty collection; or if this Module has previously
* been saved, it will retrieve related AreaDeliveryModules 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 Module.
*
* @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|ChildAreaDeliveryModule[] List of ChildAreaDeliveryModule objects
*/
public function getAreaDeliveryModulesJoinArea($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildAreaDeliveryModuleQuery::create(null, $criteria);
$query->joinWith('Area', $joinBehavior);
return $this->getAreaDeliveryModules($query, $con);
}
/** /**
* Clears out the collGroupModules collection * Clears out the collGroupModules collection
* *
@@ -2789,6 +3077,11 @@ abstract class Module implements ActiveRecordInterface
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
} }
} }
if ($this->collAreaDeliveryModules) {
foreach ($this->collAreaDeliveryModules as $o) {
$o->clearAllReferences($deep);
}
}
if ($this->collGroupModules) { if ($this->collGroupModules) {
foreach ($this->collGroupModules as $o) { foreach ($this->collGroupModules as $o) {
$o->clearAllReferences($deep); $o->clearAllReferences($deep);
@@ -2813,6 +3106,10 @@ abstract class Module implements ActiveRecordInterface
$this->collOrdersRelatedByDeliveryModuleId->clearIterator(); $this->collOrdersRelatedByDeliveryModuleId->clearIterator();
} }
$this->collOrdersRelatedByDeliveryModuleId = null; $this->collOrdersRelatedByDeliveryModuleId = null;
if ($this->collAreaDeliveryModules instanceof Collection) {
$this->collAreaDeliveryModules->clearIterator();
}
$this->collAreaDeliveryModules = null;
if ($this->collGroupModules instanceof Collection) { if ($this->collGroupModules instanceof Collection) {
$this->collGroupModules->clearIterator(); $this->collGroupModules->clearIterator();
} }

View File

@@ -52,6 +52,10 @@ use Thelia\Model\Map\ModuleTableMap;
* @method ChildModuleQuery rightJoinOrderRelatedByDeliveryModuleId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderRelatedByDeliveryModuleId relation * @method ChildModuleQuery rightJoinOrderRelatedByDeliveryModuleId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderRelatedByDeliveryModuleId relation
* @method ChildModuleQuery innerJoinOrderRelatedByDeliveryModuleId($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderRelatedByDeliveryModuleId relation * @method ChildModuleQuery innerJoinOrderRelatedByDeliveryModuleId($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderRelatedByDeliveryModuleId relation
* *
* @method ChildModuleQuery leftJoinAreaDeliveryModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the AreaDeliveryModule relation
* @method ChildModuleQuery rightJoinAreaDeliveryModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AreaDeliveryModule relation
* @method ChildModuleQuery innerJoinAreaDeliveryModule($relationAlias = null) Adds a INNER JOIN clause to the query using the AreaDeliveryModule relation
*
* @method ChildModuleQuery leftJoinGroupModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupModule relation * @method ChildModuleQuery leftJoinGroupModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupModule relation
* @method ChildModuleQuery rightJoinGroupModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupModule relation * @method ChildModuleQuery rightJoinGroupModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupModule relation
* @method ChildModuleQuery innerJoinGroupModule($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupModule relation * @method ChildModuleQuery innerJoinGroupModule($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupModule relation
@@ -711,6 +715,79 @@ abstract class ModuleQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'OrderRelatedByDeliveryModuleId', '\Thelia\Model\OrderQuery'); ->useQuery($relationAlias ? $relationAlias : 'OrderRelatedByDeliveryModuleId', '\Thelia\Model\OrderQuery');
} }
/**
* Filter the query by a related \Thelia\Model\AreaDeliveryModule object
*
* @param \Thelia\Model\AreaDeliveryModule|ObjectCollection $areaDeliveryModule the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function filterByAreaDeliveryModule($areaDeliveryModule, $comparison = null)
{
if ($areaDeliveryModule instanceof \Thelia\Model\AreaDeliveryModule) {
return $this
->addUsingAlias(ModuleTableMap::ID, $areaDeliveryModule->getDeliveryModuleId(), $comparison);
} elseif ($areaDeliveryModule instanceof ObjectCollection) {
return $this
->useAreaDeliveryModuleQuery()
->filterByPrimaryKeys($areaDeliveryModule->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByAreaDeliveryModule() only accepts arguments of type \Thelia\Model\AreaDeliveryModule or Collection');
}
}
/**
* Adds a JOIN clause to the query using the AreaDeliveryModule relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ChildModuleQuery The current query, for fluid interface
*/
public function joinAreaDeliveryModule($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('AreaDeliveryModule');
// 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, 'AreaDeliveryModule');
}
return $this;
}
/**
* Use the AreaDeliveryModule relation AreaDeliveryModule 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\AreaDeliveryModuleQuery A secondary query class using the current class as primary query
*/
public function useAreaDeliveryModuleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAreaDeliveryModule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'AreaDeliveryModule', '\Thelia\Model\AreaDeliveryModuleQuery');
}
/** /**
* Filter the query by a related \Thelia\Model\GroupModule object * Filter the query by a related \Thelia\Model\GroupModule object
* *

View File

@@ -70,6 +70,12 @@ abstract class ProductCategory implements ActiveRecordInterface
*/ */
protected $category_id; protected $category_id;
/**
* The value for the default_category field.
* @var boolean
*/
protected $default_category;
/** /**
* The value for the created_at field. * The value for the created_at field.
* @var string * @var string
@@ -376,6 +382,17 @@ abstract class ProductCategory implements ActiveRecordInterface
return $this->category_id; return $this->category_id;
} }
/**
* Get the [default_category] column value.
*
* @return boolean
*/
public function getDefaultCategory()
{
return $this->default_category;
}
/** /**
* Get the [optionally formatted] temporal [created_at] column value. * Get the [optionally formatted] temporal [created_at] column value.
* *
@@ -466,6 +483,35 @@ abstract class ProductCategory implements ActiveRecordInterface
return $this; return $this;
} // setCategoryId() } // setCategoryId()
/**
* Sets the value of the [default_category] column.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
*
* @param boolean|integer|string $v The new value
* @return \Thelia\Model\ProductCategory The current object (for fluent API support)
*/
public function setDefaultCategory($v)
{
if ($v !== null) {
if (is_string($v)) {
$v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
} else {
$v = (boolean) $v;
}
}
if ($this->default_category !== $v) {
$this->default_category = $v;
$this->modifiedColumns[] = ProductCategoryTableMap::DEFAULT_CATEGORY;
}
return $this;
} // setDefaultCategory()
/** /**
* 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.
* *
@@ -551,13 +597,16 @@ abstract class ProductCategory implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductCategoryTableMap::translateFieldName('CategoryId', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductCategoryTableMap::translateFieldName('CategoryId', TableMap::TYPE_PHPNAME, $indexType)];
$this->category_id = (null !== $col) ? (int) $col : null; $this->category_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductCategoryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ProductCategoryTableMap::translateFieldName('DefaultCategory', TableMap::TYPE_PHPNAME, $indexType)];
$this->default_category = (null !== $col) ? (boolean) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductCategoryTableMap::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 ? 3 + $startcol : ProductCategoryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductCategoryTableMap::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;
} }
@@ -570,7 +619,7 @@ abstract class ProductCategory implements ActiveRecordInterface
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 4; // 4 = ProductCategoryTableMap::NUM_HYDRATE_COLUMNS. return $startcol + 5; // 5 = ProductCategoryTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductCategory object", 0, $e); throw new PropelException("Error populating \Thelia\Model\ProductCategory object", 0, $e);
@@ -819,6 +868,9 @@ abstract class ProductCategory implements ActiveRecordInterface
if ($this->isColumnModified(ProductCategoryTableMap::CATEGORY_ID)) { if ($this->isColumnModified(ProductCategoryTableMap::CATEGORY_ID)) {
$modifiedColumns[':p' . $index++] = 'CATEGORY_ID'; $modifiedColumns[':p' . $index++] = 'CATEGORY_ID';
} }
if ($this->isColumnModified(ProductCategoryTableMap::DEFAULT_CATEGORY)) {
$modifiedColumns[':p' . $index++] = 'DEFAULT_CATEGORY';
}
if ($this->isColumnModified(ProductCategoryTableMap::CREATED_AT)) { if ($this->isColumnModified(ProductCategoryTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT'; $modifiedColumns[':p' . $index++] = 'CREATED_AT';
} }
@@ -842,6 +894,9 @@ abstract class ProductCategory implements ActiveRecordInterface
case 'CATEGORY_ID': case 'CATEGORY_ID':
$stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT); $stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT);
break; break;
case 'DEFAULT_CATEGORY':
$stmt->bindValue($identifier, (int) $this->default_category, PDO::PARAM_INT);
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;
@@ -910,9 +965,12 @@ abstract class ProductCategory implements ActiveRecordInterface
return $this->getCategoryId(); return $this->getCategoryId();
break; break;
case 2: case 2:
return $this->getCreatedAt(); return $this->getDefaultCategory();
break; break;
case 3: case 3:
return $this->getCreatedAt();
break;
case 4:
return $this->getUpdatedAt(); return $this->getUpdatedAt();
break; break;
default: default:
@@ -946,8 +1004,9 @@ abstract class ProductCategory implements ActiveRecordInterface
$result = array( $result = array(
$keys[0] => $this->getProductId(), $keys[0] => $this->getProductId(),
$keys[1] => $this->getCategoryId(), $keys[1] => $this->getCategoryId(),
$keys[2] => $this->getCreatedAt(), $keys[2] => $this->getDefaultCategory(),
$keys[3] => $this->getUpdatedAt(), $keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(),
); );
$virtualColumns = $this->virtualColumns; $virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn) foreach($virtualColumns as $key => $virtualColumn)
@@ -1003,9 +1062,12 @@ abstract class ProductCategory implements ActiveRecordInterface
$this->setCategoryId($value); $this->setCategoryId($value);
break; break;
case 2: case 2:
$this->setCreatedAt($value); $this->setDefaultCategory($value);
break; break;
case 3: case 3:
$this->setCreatedAt($value);
break;
case 4:
$this->setUpdatedAt($value); $this->setUpdatedAt($value);
break; break;
} // switch() } // switch()
@@ -1034,8 +1096,9 @@ abstract class ProductCategory implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setProductId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setProductId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setCategoryId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setCategoryId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setDefaultCategory($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
} }
/** /**
@@ -1049,6 +1112,7 @@ abstract class ProductCategory implements ActiveRecordInterface
if ($this->isColumnModified(ProductCategoryTableMap::PRODUCT_ID)) $criteria->add(ProductCategoryTableMap::PRODUCT_ID, $this->product_id); if ($this->isColumnModified(ProductCategoryTableMap::PRODUCT_ID)) $criteria->add(ProductCategoryTableMap::PRODUCT_ID, $this->product_id);
if ($this->isColumnModified(ProductCategoryTableMap::CATEGORY_ID)) $criteria->add(ProductCategoryTableMap::CATEGORY_ID, $this->category_id); if ($this->isColumnModified(ProductCategoryTableMap::CATEGORY_ID)) $criteria->add(ProductCategoryTableMap::CATEGORY_ID, $this->category_id);
if ($this->isColumnModified(ProductCategoryTableMap::DEFAULT_CATEGORY)) $criteria->add(ProductCategoryTableMap::DEFAULT_CATEGORY, $this->default_category);
if ($this->isColumnModified(ProductCategoryTableMap::CREATED_AT)) $criteria->add(ProductCategoryTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(ProductCategoryTableMap::CREATED_AT)) $criteria->add(ProductCategoryTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductCategoryTableMap::UPDATED_AT)) $criteria->add(ProductCategoryTableMap::UPDATED_AT, $this->updated_at); if ($this->isColumnModified(ProductCategoryTableMap::UPDATED_AT)) $criteria->add(ProductCategoryTableMap::UPDATED_AT, $this->updated_at);
@@ -1123,6 +1187,7 @@ abstract class ProductCategory implements ActiveRecordInterface
{ {
$copyObj->setProductId($this->getProductId()); $copyObj->setProductId($this->getProductId());
$copyObj->setCategoryId($this->getCategoryId()); $copyObj->setCategoryId($this->getCategoryId());
$copyObj->setDefaultCategory($this->getDefaultCategory());
$copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) { if ($makeNew) {
@@ -1261,6 +1326,7 @@ abstract class ProductCategory implements ActiveRecordInterface
{ {
$this->product_id = null; $this->product_id = null;
$this->category_id = null; $this->category_id = null;
$this->default_category = null;
$this->created_at = null; $this->created_at = null;
$this->updated_at = null; $this->updated_at = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;

View File

@@ -23,11 +23,13 @@ use Thelia\Model\Map\ProductCategoryTableMap;
* *
* @method ChildProductCategoryQuery orderByProductId($order = Criteria::ASC) Order by the product_id column * @method ChildProductCategoryQuery orderByProductId($order = Criteria::ASC) Order by the product_id column
* @method ChildProductCategoryQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column * @method ChildProductCategoryQuery orderByCategoryId($order = Criteria::ASC) Order by the category_id column
* @method ChildProductCategoryQuery orderByDefaultCategory($order = Criteria::ASC) Order by the default_category column
* @method ChildProductCategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildProductCategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductCategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @method ChildProductCategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* *
* @method ChildProductCategoryQuery groupByProductId() Group by the product_id column * @method ChildProductCategoryQuery groupByProductId() Group by the product_id column
* @method ChildProductCategoryQuery groupByCategoryId() Group by the category_id column * @method ChildProductCategoryQuery groupByCategoryId() Group by the category_id column
* @method ChildProductCategoryQuery groupByDefaultCategory() Group by the default_category column
* @method ChildProductCategoryQuery groupByCreatedAt() Group by the created_at column * @method ChildProductCategoryQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductCategoryQuery groupByUpdatedAt() Group by the updated_at column * @method ChildProductCategoryQuery groupByUpdatedAt() Group by the updated_at column
* *
@@ -48,11 +50,13 @@ use Thelia\Model\Map\ProductCategoryTableMap;
* *
* @method ChildProductCategory findOneByProductId(int $product_id) Return the first ChildProductCategory filtered by the product_id column * @method ChildProductCategory findOneByProductId(int $product_id) Return the first ChildProductCategory filtered by the product_id column
* @method ChildProductCategory findOneByCategoryId(int $category_id) Return the first ChildProductCategory filtered by the category_id column * @method ChildProductCategory findOneByCategoryId(int $category_id) Return the first ChildProductCategory filtered by the category_id column
* @method ChildProductCategory findOneByDefaultCategory(boolean $default_category) Return the first ChildProductCategory filtered by the default_category column
* @method ChildProductCategory findOneByCreatedAt(string $created_at) Return the first ChildProductCategory filtered by the created_at column * @method ChildProductCategory findOneByCreatedAt(string $created_at) Return the first ChildProductCategory filtered by the created_at column
* @method ChildProductCategory findOneByUpdatedAt(string $updated_at) Return the first ChildProductCategory filtered by the updated_at column * @method ChildProductCategory findOneByUpdatedAt(string $updated_at) Return the first ChildProductCategory filtered by the updated_at column
* *
* @method array findByProductId(int $product_id) Return ChildProductCategory objects filtered by the product_id column * @method array findByProductId(int $product_id) Return ChildProductCategory objects filtered by the product_id column
* @method array findByCategoryId(int $category_id) Return ChildProductCategory objects filtered by the category_id column * @method array findByCategoryId(int $category_id) Return ChildProductCategory objects filtered by the category_id column
* @method array findByDefaultCategory(boolean $default_category) Return ChildProductCategory objects filtered by the default_category column
* @method array findByCreatedAt(string $created_at) Return ChildProductCategory objects filtered by the created_at column * @method array findByCreatedAt(string $created_at) Return ChildProductCategory objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProductCategory objects filtered by the updated_at column * @method array findByUpdatedAt(string $updated_at) Return ChildProductCategory objects filtered by the updated_at column
* *
@@ -143,7 +147,7 @@ abstract class ProductCategoryQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT PRODUCT_ID, CATEGORY_ID, CREATED_AT, UPDATED_AT FROM product_category WHERE PRODUCT_ID = :p0 AND CATEGORY_ID = :p1'; $sql = 'SELECT PRODUCT_ID, CATEGORY_ID, DEFAULT_CATEGORY, CREATED_AT, UPDATED_AT FROM product_category WHERE PRODUCT_ID = :p0 AND CATEGORY_ID = :p1';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -330,6 +334,33 @@ abstract class ProductCategoryQuery extends ModelCriteria
return $this->addUsingAlias(ProductCategoryTableMap::CATEGORY_ID, $categoryId, $comparison); return $this->addUsingAlias(ProductCategoryTableMap::CATEGORY_ID, $categoryId, $comparison);
} }
/**
* Filter the query on the default_category column
*
* Example usage:
* <code>
* $query->filterByDefaultCategory(true); // WHERE default_category = true
* $query->filterByDefaultCategory('yes'); // WHERE default_category = true
* </code>
*
* @param boolean|string $defaultCategory The value to use as filter.
* Non-boolean arguments are converted using the following rules:
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildProductCategoryQuery The current query, for fluid interface
*/
public function filterByDefaultCategory($defaultCategory = null, $comparison = null)
{
if (is_string($defaultCategory)) {
$default_category = in_array(strtolower($defaultCategory), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(ProductCategoryTableMap::DEFAULT_CATEGORY, $defaultCategory, $comparison);
}
/** /**
* Filter the query on the created_at column * Filter the query on the created_at column
* *

View File

@@ -1,9 +0,0 @@
<?php
namespace Thelia\Model;
use Thelia\Model\Base\Delivzone as BaseDelivzone;
class Delivzone extends BaseDelivzone {
}

View File

@@ -10,12 +10,12 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap; use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait; use Propel\Runtime\Map\TableMapTrait;
use Thelia\Model\Delivzone; use Thelia\Model\AreaDeliveryModule;
use Thelia\Model\DelivzoneQuery; use Thelia\Model\AreaDeliveryModuleQuery;
/** /**
* This class defines the structure of the 'delivzone' table. * This class defines the structure of the 'area_delivery_module' table.
* *
* *
* *
@@ -25,14 +25,14 @@ use Thelia\Model\DelivzoneQuery;
* (i.e. if it's a text column type). * (i.e. if it's a text column type).
* *
*/ */
class DelivzoneTableMap extends TableMap class AreaDeliveryModuleTableMap extends TableMap
{ {
use InstancePoolTrait; use InstancePoolTrait;
use TableMapTrait; use TableMapTrait;
/** /**
* The (dot-path) name of this class * The (dot-path) name of this class
*/ */
const CLASS_NAME = 'Thelia.Model.Map.DelivzoneTableMap'; const CLASS_NAME = 'Thelia.Model.Map.AreaDeliveryModuleTableMap';
/** /**
* The default database name for this class * The default database name for this class
@@ -42,17 +42,17 @@ class DelivzoneTableMap extends TableMap
/** /**
* The table name for this class * The table name for this class
*/ */
const TABLE_NAME = 'delivzone'; const TABLE_NAME = 'area_delivery_module';
/** /**
* The related Propel class for this table * The related Propel class for this table
*/ */
const OM_CLASS = '\\Thelia\\Model\\Delivzone'; const OM_CLASS = '\\Thelia\\Model\\AreaDeliveryModule';
/** /**
* A class that can be returned by this tableMap * A class that can be returned by this tableMap
*/ */
const CLASS_DEFAULT = 'Thelia.Model.Delivzone'; const CLASS_DEFAULT = 'Thelia.Model.AreaDeliveryModule';
/** /**
* The total number of columns * The total number of columns
@@ -72,27 +72,27 @@ class DelivzoneTableMap extends TableMap
/** /**
* the column name for the ID field * the column name for the ID field
*/ */
const ID = 'delivzone.ID'; const ID = 'area_delivery_module.ID';
/** /**
* the column name for the AREA_ID field * the column name for the AREA_ID field
*/ */
const AREA_ID = 'delivzone.AREA_ID'; const AREA_ID = 'area_delivery_module.AREA_ID';
/** /**
* the column name for the DELIVERY field * the column name for the DELIVERY_MODULE_ID field
*/ */
const DELIVERY = 'delivzone.DELIVERY'; const DELIVERY_MODULE_ID = 'area_delivery_module.DELIVERY_MODULE_ID';
/** /**
* the column name for the CREATED_AT field * the column name for the CREATED_AT field
*/ */
const CREATED_AT = 'delivzone.CREATED_AT'; const CREATED_AT = 'area_delivery_module.CREATED_AT';
/** /**
* the column name for the UPDATED_AT field * the column name for the UPDATED_AT field
*/ */
const UPDATED_AT = 'delivzone.UPDATED_AT'; const UPDATED_AT = 'area_delivery_module.UPDATED_AT';
/** /**
* The default string format for model objects of the related table * The default string format for model objects of the related table
@@ -106,11 +106,11 @@ class DelivzoneTableMap 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', 'AreaId', 'Delivery', 'CreatedAt', 'UpdatedAt', ), self::TYPE_PHPNAME => array('Id', 'AreaId', 'DeliveryModuleId', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'delivery', 'createdAt', 'updatedAt', ), self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'deliveryModuleId', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(DelivzoneTableMap::ID, DelivzoneTableMap::AREA_ID, DelivzoneTableMap::DELIVERY, DelivzoneTableMap::CREATED_AT, DelivzoneTableMap::UPDATED_AT, ), self::TYPE_COLNAME => array(AreaDeliveryModuleTableMap::ID, AreaDeliveryModuleTableMap::AREA_ID, AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, AreaDeliveryModuleTableMap::CREATED_AT, AreaDeliveryModuleTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'DELIVERY', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'DELIVERY_MODULE_ID', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'area_id', 'delivery', 'created_at', 'updated_at', ), self::TYPE_FIELDNAME => array('id', 'area_id', 'delivery_module_id', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, )
); );
@@ -121,11 +121,11 @@ class DelivzoneTableMap 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, 'AreaId' => 1, 'Delivery' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'DeliveryModuleId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'delivery' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'deliveryModuleId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(DelivzoneTableMap::ID => 0, DelivzoneTableMap::AREA_ID => 1, DelivzoneTableMap::DELIVERY => 2, DelivzoneTableMap::CREATED_AT => 3, DelivzoneTableMap::UPDATED_AT => 4, ), self::TYPE_COLNAME => array(AreaDeliveryModuleTableMap::ID => 0, AreaDeliveryModuleTableMap::AREA_ID => 1, AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID => 2, AreaDeliveryModuleTableMap::CREATED_AT => 3, AreaDeliveryModuleTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'DELIVERY' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'DELIVERY_MODULE_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'delivery' => 2, 'created_at' => 3, 'updated_at' => 4, ), self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'delivery_module_id' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, )
); );
@@ -139,15 +139,15 @@ class DelivzoneTableMap extends TableMap
public function initialize() public function initialize()
{ {
// attributes // attributes
$this->setName('delivzone'); $this->setName('area_delivery_module');
$this->setPhpName('Delivzone'); $this->setPhpName('AreaDeliveryModule');
$this->setClassName('\\Thelia\\Model\\Delivzone'); $this->setClassName('\\Thelia\\Model\\AreaDeliveryModule');
$this->setPackage('Thelia.Model'); $this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true); $this->setUseIdGenerator(true);
// columns // columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', false, null, null); $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
$this->addColumn('DELIVERY', 'Delivery', 'VARCHAR', true, 45, null); $this->addForeignKey('DELIVERY_MODULE_ID', 'DeliveryModuleId', 'INTEGER', 'module', 'ID', true, null, 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()
@@ -157,7 +157,8 @@ class DelivzoneTableMap extends TableMap
*/ */
public function buildRelations() public function buildRelations()
{ {
$this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'SET NULL', 'RESTRICT'); $this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('delivery_module_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations() } // buildRelations()
/** /**
@@ -229,7 +230,7 @@ class DelivzoneTableMap extends TableMap
*/ */
public static function getOMClass($withPrefix = true) public static function getOMClass($withPrefix = true)
{ {
return $withPrefix ? DelivzoneTableMap::CLASS_DEFAULT : DelivzoneTableMap::OM_CLASS; return $withPrefix ? AreaDeliveryModuleTableMap::CLASS_DEFAULT : AreaDeliveryModuleTableMap::OM_CLASS;
} }
/** /**
@@ -243,21 +244,21 @@ class DelivzoneTableMap extends TableMap
* *
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException. * rethrown wrapped into a PropelException.
* @return array (Delivzone object, last column rank) * @return array (AreaDeliveryModule object, last column rank)
*/ */
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
{ {
$key = DelivzoneTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); $key = AreaDeliveryModuleTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
if (null !== ($obj = DelivzoneTableMap::getInstanceFromPool($key))) { if (null !== ($obj = AreaDeliveryModuleTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss. // We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509 // See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $offset, true); // rehydrate // $obj->hydrate($row, $offset, true); // rehydrate
$col = $offset + DelivzoneTableMap::NUM_HYDRATE_COLUMNS; $col = $offset + AreaDeliveryModuleTableMap::NUM_HYDRATE_COLUMNS;
} else { } else {
$cls = DelivzoneTableMap::OM_CLASS; $cls = AreaDeliveryModuleTableMap::OM_CLASS;
$obj = new $cls(); $obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType); $col = $obj->hydrate($row, $offset, false, $indexType);
DelivzoneTableMap::addInstanceToPool($obj, $key); AreaDeliveryModuleTableMap::addInstanceToPool($obj, $key);
} }
return array($obj, $col); return array($obj, $col);
@@ -280,8 +281,8 @@ class DelivzoneTableMap extends TableMap
$cls = static::getOMClass(false); $cls = static::getOMClass(false);
// populate the object(s) // populate the object(s)
while ($row = $dataFetcher->fetch()) { while ($row = $dataFetcher->fetch()) {
$key = DelivzoneTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); $key = AreaDeliveryModuleTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
if (null !== ($obj = DelivzoneTableMap::getInstanceFromPool($key))) { if (null !== ($obj = AreaDeliveryModuleTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss. // We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509 // See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, 0, true); // rehydrate // $obj->hydrate($row, 0, true); // rehydrate
@@ -290,7 +291,7 @@ class DelivzoneTableMap extends TableMap
$obj = new $cls(); $obj = new $cls();
$obj->hydrate($row); $obj->hydrate($row);
$results[] = $obj; $results[] = $obj;
DelivzoneTableMap::addInstanceToPool($obj, $key); AreaDeliveryModuleTableMap::addInstanceToPool($obj, $key);
} // if key exists } // if key exists
} }
@@ -311,15 +312,15 @@ class DelivzoneTableMap extends TableMap
public static function addSelectColumns(Criteria $criteria, $alias = null) public static function addSelectColumns(Criteria $criteria, $alias = null)
{ {
if (null === $alias) { if (null === $alias) {
$criteria->addSelectColumn(DelivzoneTableMap::ID); $criteria->addSelectColumn(AreaDeliveryModuleTableMap::ID);
$criteria->addSelectColumn(DelivzoneTableMap::AREA_ID); $criteria->addSelectColumn(AreaDeliveryModuleTableMap::AREA_ID);
$criteria->addSelectColumn(DelivzoneTableMap::DELIVERY); $criteria->addSelectColumn(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID);
$criteria->addSelectColumn(DelivzoneTableMap::CREATED_AT); $criteria->addSelectColumn(AreaDeliveryModuleTableMap::CREATED_AT);
$criteria->addSelectColumn(DelivzoneTableMap::UPDATED_AT); $criteria->addSelectColumn(AreaDeliveryModuleTableMap::UPDATED_AT);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.AREA_ID'); $criteria->addSelectColumn($alias . '.AREA_ID');
$criteria->addSelectColumn($alias . '.DELIVERY'); $criteria->addSelectColumn($alias . '.DELIVERY_MODULE_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
} }
@@ -334,7 +335,7 @@ class DelivzoneTableMap extends TableMap
*/ */
public static function getTableMap() public static function getTableMap()
{ {
return Propel::getServiceContainer()->getDatabaseMap(DelivzoneTableMap::DATABASE_NAME)->getTable(DelivzoneTableMap::TABLE_NAME); return Propel::getServiceContainer()->getDatabaseMap(AreaDeliveryModuleTableMap::DATABASE_NAME)->getTable(AreaDeliveryModuleTableMap::TABLE_NAME);
} }
/** /**
@@ -342,16 +343,16 @@ class DelivzoneTableMap extends TableMap
*/ */
public static function buildTableMap() public static function buildTableMap()
{ {
$dbMap = Propel::getServiceContainer()->getDatabaseMap(DelivzoneTableMap::DATABASE_NAME); $dbMap = Propel::getServiceContainer()->getDatabaseMap(AreaDeliveryModuleTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(DelivzoneTableMap::TABLE_NAME)) { if (!$dbMap->hasTable(AreaDeliveryModuleTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new DelivzoneTableMap()); $dbMap->addTableObject(new AreaDeliveryModuleTableMap());
} }
} }
/** /**
* Performs a DELETE on the database, given a Delivzone or Criteria object OR a primary key value. * Performs a DELETE on the database, given a AreaDeliveryModule or Criteria object OR a primary key value.
* *
* @param mixed $values Criteria or Delivzone object or primary key or array of primary keys * @param mixed $values Criteria or AreaDeliveryModule object or primary key or array of primary keys
* which is used to create the DELETE statement * which is used to create the DELETE statement
* @param ConnectionInterface $con the connection to use * @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
@@ -362,25 +363,25 @@ class DelivzoneTableMap extends TableMap
public static function doDelete($values, ConnectionInterface $con = null) public static function doDelete($values, ConnectionInterface $con = null)
{ {
if (null === $con) { if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
if ($values instanceof Criteria) { if ($values instanceof Criteria) {
// rename for clarity // rename for clarity
$criteria = $values; $criteria = $values;
} elseif ($values instanceof \Thelia\Model\Delivzone) { // it's a model object } elseif ($values instanceof \Thelia\Model\AreaDeliveryModule) { // it's a model object
// create criteria based on pk values // create criteria based on pk values
$criteria = $values->buildPkeyCriteria(); $criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks } else { // it's a primary key, or an array of pks
$criteria = new Criteria(DelivzoneTableMap::DATABASE_NAME); $criteria = new Criteria(AreaDeliveryModuleTableMap::DATABASE_NAME);
$criteria->add(DelivzoneTableMap::ID, (array) $values, Criteria::IN); $criteria->add(AreaDeliveryModuleTableMap::ID, (array) $values, Criteria::IN);
} }
$query = DelivzoneQuery::create()->mergeWith($criteria); $query = AreaDeliveryModuleQuery::create()->mergeWith($criteria);
if ($values instanceof Criteria) { DelivzoneTableMap::clearInstancePool(); if ($values instanceof Criteria) { AreaDeliveryModuleTableMap::clearInstancePool();
} elseif (!is_object($values)) { // it's a primary key, or an array of pks } elseif (!is_object($values)) { // it's a primary key, or an array of pks
foreach ((array) $values as $singleval) { DelivzoneTableMap::removeInstanceFromPool($singleval); foreach ((array) $values as $singleval) { AreaDeliveryModuleTableMap::removeInstanceFromPool($singleval);
} }
} }
@@ -388,20 +389,20 @@ class DelivzoneTableMap extends TableMap
} }
/** /**
* Deletes all rows from the delivzone table. * Deletes all rows from the area_delivery_module table.
* *
* @param ConnectionInterface $con the connection to use * @param ConnectionInterface $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). * @return int The number of affected rows (if supported by underlying database driver).
*/ */
public static function doDeleteAll(ConnectionInterface $con = null) public static function doDeleteAll(ConnectionInterface $con = null)
{ {
return DelivzoneQuery::create()->doDeleteAll($con); return AreaDeliveryModuleQuery::create()->doDeleteAll($con);
} }
/** /**
* Performs an INSERT on the database, given a Delivzone or Criteria object. * Performs an INSERT on the database, given a AreaDeliveryModule or Criteria object.
* *
* @param mixed $criteria Criteria or Delivzone object containing data that is used to create the INSERT statement. * @param mixed $criteria Criteria or AreaDeliveryModule object containing data that is used to create the INSERT statement.
* @param ConnectionInterface $con the ConnectionInterface connection to use * @param ConnectionInterface $con the ConnectionInterface connection to use
* @return mixed The new primary key. * @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be * @throws PropelException Any exceptions caught during processing will be
@@ -410,22 +411,22 @@ class DelivzoneTableMap extends TableMap
public static function doInsert($criteria, ConnectionInterface $con = null) public static function doInsert($criteria, ConnectionInterface $con = null)
{ {
if (null === $con) { if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME); $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
} }
if ($criteria instanceof Criteria) { if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity $criteria = clone $criteria; // rename for clarity
} else { } else {
$criteria = $criteria->buildCriteria(); // build Criteria from Delivzone object $criteria = $criteria->buildCriteria(); // build Criteria from AreaDeliveryModule object
} }
if ($criteria->containsKey(DelivzoneTableMap::ID) && $criteria->keyContainsValue(DelivzoneTableMap::ID) ) { if ($criteria->containsKey(AreaDeliveryModuleTableMap::ID) && $criteria->keyContainsValue(AreaDeliveryModuleTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.DelivzoneTableMap::ID.')'); throw new PropelException('Cannot insert a value for auto-increment primary key ('.AreaDeliveryModuleTableMap::ID.')');
} }
// Set the correct dbName // Set the correct dbName
$query = DelivzoneQuery::create()->mergeWith($criteria); $query = AreaDeliveryModuleQuery::create()->mergeWith($criteria);
try { try {
// use transaction because $criteria could contain info // use transaction because $criteria could contain info
@@ -441,7 +442,7 @@ class DelivzoneTableMap extends TableMap
return $pk; return $pk;
} }
} // DelivzoneTableMap } // AreaDeliveryModuleTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class. // This is the static code needed to register the TableMap for this table with the main Propel class.
// //
DelivzoneTableMap::buildTableMap(); AreaDeliveryModuleTableMap::buildTableMap();

View File

@@ -80,9 +80,9 @@ class AreaTableMap extends TableMap
const NAME = 'area.NAME'; const NAME = 'area.NAME';
/** /**
* the column name for the UNIT field * the column name for the POSTAGE field
*/ */
const UNIT = 'area.UNIT'; const POSTAGE = 'area.POSTAGE';
/** /**
* the column name for the CREATED_AT field * the column name for the CREATED_AT field
@@ -106,11 +106,11 @@ class AreaTableMap 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', 'Name', 'Unit', 'CreatedAt', 'UpdatedAt', ), self::TYPE_PHPNAME => array('Id', 'Name', 'Postage', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'name', 'unit', 'createdAt', 'updatedAt', ), self::TYPE_STUDLYPHPNAME => array('id', 'name', 'postage', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(AreaTableMap::ID, AreaTableMap::NAME, AreaTableMap::UNIT, AreaTableMap::CREATED_AT, AreaTableMap::UPDATED_AT, ), self::TYPE_COLNAME => array(AreaTableMap::ID, AreaTableMap::NAME, AreaTableMap::POSTAGE, AreaTableMap::CREATED_AT, AreaTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'UNIT', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'POSTAGE', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'name', 'unit', 'created_at', 'updated_at', ), self::TYPE_FIELDNAME => array('id', 'name', 'postage', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, )
); );
@@ -121,11 +121,11 @@ class AreaTableMap 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, 'Name' => 1, 'Unit' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Postage' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'unit' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'postage' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(AreaTableMap::ID => 0, AreaTableMap::NAME => 1, AreaTableMap::UNIT => 2, AreaTableMap::CREATED_AT => 3, AreaTableMap::UPDATED_AT => 4, ), self::TYPE_COLNAME => array(AreaTableMap::ID => 0, AreaTableMap::NAME => 1, AreaTableMap::POSTAGE => 2, AreaTableMap::CREATED_AT => 3, AreaTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'UNIT' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'POSTAGE' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'unit' => 2, 'created_at' => 3, 'updated_at' => 4, ), self::TYPE_FIELDNAME => array('id' => 0, 'name' => 1, 'postage' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, )
); );
@@ -147,7 +147,7 @@ class AreaTableMap extends TableMap
// columns // columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('NAME', 'Name', 'VARCHAR', true, 100, null); $this->addColumn('NAME', 'Name', 'VARCHAR', true, 100, null);
$this->addColumn('UNIT', 'Unit', 'FLOAT', false, null, null); $this->addColumn('POSTAGE', 'Postage', 'FLOAT', false, null, 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()
@@ -158,7 +158,7 @@ class AreaTableMap extends TableMap
public function buildRelations() public function buildRelations()
{ {
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::ONE_TO_MANY, array('id' => 'area_id', ), 'SET NULL', 'RESTRICT', 'Countries'); $this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::ONE_TO_MANY, array('id' => 'area_id', ), 'SET NULL', 'RESTRICT', 'Countries');
$this->addRelation('Delivzone', '\\Thelia\\Model\\Delivzone', RelationMap::ONE_TO_MANY, array('id' => 'area_id', ), 'SET NULL', 'RESTRICT', 'Delivzones'); $this->addRelation('AreaDeliveryModule', '\\Thelia\\Model\\AreaDeliveryModule', RelationMap::ONE_TO_MANY, array('id' => 'area_id', ), 'CASCADE', 'RESTRICT', 'AreaDeliveryModules');
} // buildRelations() } // buildRelations()
/** /**
@@ -181,7 +181,7 @@ class AreaTableMap extends TableMap
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool, // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CountryTableMap::clearInstancePool(); CountryTableMap::clearInstancePool();
DelivzoneTableMap::clearInstancePool(); AreaDeliveryModuleTableMap::clearInstancePool();
} }
/** /**
@@ -324,13 +324,13 @@ class AreaTableMap extends TableMap
if (null === $alias) { if (null === $alias) {
$criteria->addSelectColumn(AreaTableMap::ID); $criteria->addSelectColumn(AreaTableMap::ID);
$criteria->addSelectColumn(AreaTableMap::NAME); $criteria->addSelectColumn(AreaTableMap::NAME);
$criteria->addSelectColumn(AreaTableMap::UNIT); $criteria->addSelectColumn(AreaTableMap::POSTAGE);
$criteria->addSelectColumn(AreaTableMap::CREATED_AT); $criteria->addSelectColumn(AreaTableMap::CREATED_AT);
$criteria->addSelectColumn(AreaTableMap::UPDATED_AT); $criteria->addSelectColumn(AreaTableMap::UPDATED_AT);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME'); $criteria->addSelectColumn($alias . '.NAME');
$criteria->addSelectColumn($alias . '.UNIT'); $criteria->addSelectColumn($alias . '.POSTAGE');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
} }

View File

@@ -57,7 +57,7 @@ class ContentFolderTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 4; const NUM_COLUMNS = 5;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ContentFolderTableMap 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 = 4; const NUM_HYDRATE_COLUMNS = 5;
/** /**
* the column name for the CONTENT_ID field * the column name for the CONTENT_ID field
@@ -79,6 +79,11 @@ class ContentFolderTableMap extends TableMap
*/ */
const FOLDER_ID = 'content_folder.FOLDER_ID'; const FOLDER_ID = 'content_folder.FOLDER_ID';
/**
* the column name for the DEFAULT_FOLDER field
*/
const DEFAULT_FOLDER = 'content_folder.DEFAULT_FOLDER';
/** /**
* the column name for the CREATED_AT field * the column name for the CREATED_AT field
*/ */
@@ -101,12 +106,12 @@ class ContentFolderTableMap 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('ContentId', 'FolderId', 'CreatedAt', 'UpdatedAt', ), self::TYPE_PHPNAME => array('ContentId', 'FolderId', 'DefaultFolder', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('contentId', 'folderId', 'createdAt', 'updatedAt', ), self::TYPE_STUDLYPHPNAME => array('contentId', 'folderId', 'defaultFolder', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ContentFolderTableMap::CONTENT_ID, ContentFolderTableMap::FOLDER_ID, ContentFolderTableMap::CREATED_AT, ContentFolderTableMap::UPDATED_AT, ), self::TYPE_COLNAME => array(ContentFolderTableMap::CONTENT_ID, ContentFolderTableMap::FOLDER_ID, ContentFolderTableMap::DEFAULT_FOLDER, ContentFolderTableMap::CREATED_AT, ContentFolderTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('CONTENT_ID', 'FOLDER_ID', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_RAW_COLNAME => array('CONTENT_ID', 'FOLDER_ID', 'DEFAULT_FOLDER', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('content_id', 'folder_id', 'created_at', 'updated_at', ), self::TYPE_FIELDNAME => array('content_id', 'folder_id', 'default_folder', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, )
); );
/** /**
@@ -116,12 +121,12 @@ class ContentFolderTableMap 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('ContentId' => 0, 'FolderId' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ), self::TYPE_PHPNAME => array('ContentId' => 0, 'FolderId' => 1, 'DefaultFolder' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('contentId' => 0, 'folderId' => 1, 'createdAt' => 2, 'updatedAt' => 3, ), self::TYPE_STUDLYPHPNAME => array('contentId' => 0, 'folderId' => 1, 'defaultFolder' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(ContentFolderTableMap::CONTENT_ID => 0, ContentFolderTableMap::FOLDER_ID => 1, ContentFolderTableMap::CREATED_AT => 2, ContentFolderTableMap::UPDATED_AT => 3, ), self::TYPE_COLNAME => array(ContentFolderTableMap::CONTENT_ID => 0, ContentFolderTableMap::FOLDER_ID => 1, ContentFolderTableMap::DEFAULT_FOLDER => 2, ContentFolderTableMap::CREATED_AT => 3, ContentFolderTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('CONTENT_ID' => 0, 'FOLDER_ID' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ), self::TYPE_RAW_COLNAME => array('CONTENT_ID' => 0, 'FOLDER_ID' => 1, 'DEFAULT_FOLDER' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('content_id' => 0, 'folder_id' => 1, 'created_at' => 2, 'updated_at' => 3, ), self::TYPE_FIELDNAME => array('content_id' => 0, 'folder_id' => 1, 'default_folder' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, )
); );
/** /**
@@ -143,6 +148,7 @@ class ContentFolderTableMap extends TableMap
// columns // columns
$this->addForeignPrimaryKey('CONTENT_ID', 'ContentId', 'INTEGER' , 'content', 'ID', true, null, null); $this->addForeignPrimaryKey('CONTENT_ID', 'ContentId', 'INTEGER' , 'content', 'ID', true, null, null);
$this->addForeignPrimaryKey('FOLDER_ID', 'FolderId', 'INTEGER' , 'folder', 'ID', true, null, null); $this->addForeignPrimaryKey('FOLDER_ID', 'FolderId', 'INTEGER' , 'folder', 'ID', true, null, null);
$this->addColumn('DEFAULT_FOLDER', 'DefaultFolder', 'BOOLEAN', false, 1, 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()
@@ -358,11 +364,13 @@ class ContentFolderTableMap extends TableMap
if (null === $alias) { if (null === $alias) {
$criteria->addSelectColumn(ContentFolderTableMap::CONTENT_ID); $criteria->addSelectColumn(ContentFolderTableMap::CONTENT_ID);
$criteria->addSelectColumn(ContentFolderTableMap::FOLDER_ID); $criteria->addSelectColumn(ContentFolderTableMap::FOLDER_ID);
$criteria->addSelectColumn(ContentFolderTableMap::DEFAULT_FOLDER);
$criteria->addSelectColumn(ContentFolderTableMap::CREATED_AT); $criteria->addSelectColumn(ContentFolderTableMap::CREATED_AT);
$criteria->addSelectColumn(ContentFolderTableMap::UPDATED_AT); $criteria->addSelectColumn(ContentFolderTableMap::UPDATED_AT);
} else { } else {
$criteria->addSelectColumn($alias . '.CONTENT_ID'); $criteria->addSelectColumn($alias . '.CONTENT_ID');
$criteria->addSelectColumn($alias . '.FOLDER_ID'); $criteria->addSelectColumn($alias . '.FOLDER_ID');
$criteria->addSelectColumn($alias . '.DEFAULT_FOLDER');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
} }

View File

@@ -186,6 +186,7 @@ class ModuleTableMap extends TableMap
{ {
$this->addRelation('OrderRelatedByPaymentModuleId', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'payment_module_id', ), 'RESTRICT', 'RESTRICT', 'OrdersRelatedByPaymentModuleId'); $this->addRelation('OrderRelatedByPaymentModuleId', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'payment_module_id', ), 'RESTRICT', 'RESTRICT', 'OrdersRelatedByPaymentModuleId');
$this->addRelation('OrderRelatedByDeliveryModuleId', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'delivery_module_id', ), 'RESTRICT', 'RESTRICT', 'OrdersRelatedByDeliveryModuleId'); $this->addRelation('OrderRelatedByDeliveryModuleId', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'delivery_module_id', ), 'RESTRICT', 'RESTRICT', 'OrdersRelatedByDeliveryModuleId');
$this->addRelation('AreaDeliveryModule', '\\Thelia\\Model\\AreaDeliveryModule', RelationMap::ONE_TO_MANY, array('id' => 'delivery_module_id', ), 'CASCADE', 'RESTRICT', 'AreaDeliveryModules');
$this->addRelation('GroupModule', '\\Thelia\\Model\\GroupModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'GroupModules'); $this->addRelation('GroupModule', '\\Thelia\\Model\\GroupModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'GroupModules');
$this->addRelation('ModuleI18n', '\\Thelia\\Model\\ModuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ModuleI18ns'); $this->addRelation('ModuleI18n', '\\Thelia\\Model\\ModuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ModuleI18ns');
} // buildRelations() } // buildRelations()
@@ -210,6 +211,7 @@ class ModuleTableMap extends TableMap
{ {
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool, // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AreaDeliveryModuleTableMap::clearInstancePool();
GroupModuleTableMap::clearInstancePool(); GroupModuleTableMap::clearInstancePool();
ModuleI18nTableMap::clearInstancePool(); ModuleI18nTableMap::clearInstancePool();
} }

View File

@@ -57,7 +57,7 @@ class ProductCategoryTableMap extends TableMap
/** /**
* The total number of columns * The total number of columns
*/ */
const NUM_COLUMNS = 4; const NUM_COLUMNS = 5;
/** /**
* The number of lazy-loaded columns * The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ProductCategoryTableMap 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 = 4; const NUM_HYDRATE_COLUMNS = 5;
/** /**
* the column name for the PRODUCT_ID field * the column name for the PRODUCT_ID field
@@ -79,6 +79,11 @@ class ProductCategoryTableMap extends TableMap
*/ */
const CATEGORY_ID = 'product_category.CATEGORY_ID'; const CATEGORY_ID = 'product_category.CATEGORY_ID';
/**
* the column name for the DEFAULT_CATEGORY field
*/
const DEFAULT_CATEGORY = 'product_category.DEFAULT_CATEGORY';
/** /**
* the column name for the CREATED_AT field * the column name for the CREATED_AT field
*/ */
@@ -101,12 +106,12 @@ class ProductCategoryTableMap 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('ProductId', 'CategoryId', 'CreatedAt', 'UpdatedAt', ), self::TYPE_PHPNAME => array('ProductId', 'CategoryId', 'DefaultCategory', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('productId', 'categoryId', 'createdAt', 'updatedAt', ), self::TYPE_STUDLYPHPNAME => array('productId', 'categoryId', 'defaultCategory', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ProductCategoryTableMap::PRODUCT_ID, ProductCategoryTableMap::CATEGORY_ID, ProductCategoryTableMap::CREATED_AT, ProductCategoryTableMap::UPDATED_AT, ), self::TYPE_COLNAME => array(ProductCategoryTableMap::PRODUCT_ID, ProductCategoryTableMap::CATEGORY_ID, ProductCategoryTableMap::DEFAULT_CATEGORY, ProductCategoryTableMap::CREATED_AT, ProductCategoryTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('PRODUCT_ID', 'CATEGORY_ID', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_RAW_COLNAME => array('PRODUCT_ID', 'CATEGORY_ID', 'DEFAULT_CATEGORY', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('product_id', 'category_id', 'created_at', 'updated_at', ), self::TYPE_FIELDNAME => array('product_id', 'category_id', 'default_category', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, )
); );
/** /**
@@ -116,12 +121,12 @@ class ProductCategoryTableMap 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('ProductId' => 0, 'CategoryId' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ), self::TYPE_PHPNAME => array('ProductId' => 0, 'CategoryId' => 1, 'DefaultCategory' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('productId' => 0, 'categoryId' => 1, 'createdAt' => 2, 'updatedAt' => 3, ), self::TYPE_STUDLYPHPNAME => array('productId' => 0, 'categoryId' => 1, 'defaultCategory' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(ProductCategoryTableMap::PRODUCT_ID => 0, ProductCategoryTableMap::CATEGORY_ID => 1, ProductCategoryTableMap::CREATED_AT => 2, ProductCategoryTableMap::UPDATED_AT => 3, ), self::TYPE_COLNAME => array(ProductCategoryTableMap::PRODUCT_ID => 0, ProductCategoryTableMap::CATEGORY_ID => 1, ProductCategoryTableMap::DEFAULT_CATEGORY => 2, ProductCategoryTableMap::CREATED_AT => 3, ProductCategoryTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('PRODUCT_ID' => 0, 'CATEGORY_ID' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ), self::TYPE_RAW_COLNAME => array('PRODUCT_ID' => 0, 'CATEGORY_ID' => 1, 'DEFAULT_CATEGORY' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('product_id' => 0, 'category_id' => 1, 'created_at' => 2, 'updated_at' => 3, ), self::TYPE_FIELDNAME => array('product_id' => 0, 'category_id' => 1, 'default_category' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, ) self::TYPE_NUM => array(0, 1, 2, 3, 4, )
); );
/** /**
@@ -143,6 +148,7 @@ class ProductCategoryTableMap extends TableMap
// columns // columns
$this->addForeignPrimaryKey('PRODUCT_ID', 'ProductId', 'INTEGER' , 'product', 'ID', true, null, null); $this->addForeignPrimaryKey('PRODUCT_ID', 'ProductId', 'INTEGER' , 'product', 'ID', true, null, null);
$this->addForeignPrimaryKey('CATEGORY_ID', 'CategoryId', 'INTEGER' , 'category', 'ID', true, null, null); $this->addForeignPrimaryKey('CATEGORY_ID', 'CategoryId', 'INTEGER' , 'category', 'ID', true, null, null);
$this->addColumn('DEFAULT_CATEGORY', 'DefaultCategory', 'BOOLEAN', false, 1, 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()
@@ -358,11 +364,13 @@ class ProductCategoryTableMap extends TableMap
if (null === $alias) { if (null === $alias) {
$criteria->addSelectColumn(ProductCategoryTableMap::PRODUCT_ID); $criteria->addSelectColumn(ProductCategoryTableMap::PRODUCT_ID);
$criteria->addSelectColumn(ProductCategoryTableMap::CATEGORY_ID); $criteria->addSelectColumn(ProductCategoryTableMap::CATEGORY_ID);
$criteria->addSelectColumn(ProductCategoryTableMap::DEFAULT_CATEGORY);
$criteria->addSelectColumn(ProductCategoryTableMap::CREATED_AT); $criteria->addSelectColumn(ProductCategoryTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductCategoryTableMap::UPDATED_AT); $criteria->addSelectColumn(ProductCategoryTableMap::UPDATED_AT);
} else { } else {
$criteria->addSelectColumn($alias . '.PRODUCT_ID'); $criteria->addSelectColumn($alias . '.PRODUCT_ID');
$criteria->addSelectColumn($alias . '.CATEGORY_ID'); $criteria->addSelectColumn($alias . '.CATEGORY_ID');
$criteria->addSelectColumn($alias . '.DEFAULT_CATEGORY');
$criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');
} }

View File

@@ -66,11 +66,13 @@ CREATE TABLE `product_category`
( (
`product_id` INTEGER NOT NULL, `product_id` INTEGER NOT NULL,
`category_id` INTEGER NOT NULL, `category_id` INTEGER NOT NULL,
`default_category` TINYINT(1),
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`product_id`,`category_id`), PRIMARY KEY (`product_id`,`category_id`),
INDEX `idx_product_has_category_category1` (`category_id`), INDEX `idx_product_has_category_category1` (`category_id`),
INDEX `idx_product_has_category_product1` (`product_id`), INDEX `idx_product_has_category_product1` (`product_id`),
INDEX `idx_product_has_category_default` (`default_category`),
CONSTRAINT `fk_product_has_category_product1` CONSTRAINT `fk_product_has_category_product1`
FOREIGN KEY (`product_id`) FOREIGN KEY (`product_id`)
REFERENCES `product` (`id`) REFERENCES `product` (`id`)
@@ -656,9 +658,9 @@ CREATE TABLE `order`
INDEX `idx_order_invoice_order_address_id` (`invoice_order_address_id`), INDEX `idx_order_invoice_order_address_id` (`invoice_order_address_id`),
INDEX `idx_order_delivery_order_address_id` (`delivery_order_address_id`), INDEX `idx_order_delivery_order_address_id` (`delivery_order_address_id`),
INDEX `idx_order_status_id` (`status_id`), INDEX `idx_order_status_id` (`status_id`),
INDEX `fk_order_payment_module_id` (`payment_module_id`), INDEX `fk_order_payment_module_id_idx` (`payment_module_id`),
INDEX `fk_order_delivery_module_id` (`delivery_module_id`), INDEX `fk_order_delivery_module_id_idx` (`delivery_module_id`),
INDEX `fk_order_lang_id` (`lang_id`), INDEX `fk_order_lang_id_idx` (`lang_id`),
CONSTRAINT `fk_order_currency_id` CONSTRAINT `fk_order_currency_id`
FOREIGN KEY (`currency_id`) FOREIGN KEY (`currency_id`)
REFERENCES `currency` (`id`) REFERENCES `currency` (`id`)
@@ -871,32 +873,38 @@ CREATE TABLE `area`
( (
`id` INTEGER NOT NULL AUTO_INCREMENT, `id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL, `name` VARCHAR(100) NOT NULL,
`unit` FLOAT, `postage` FLOAT,
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- delivzone -- area_delivery_module
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `delivzone`; DROP TABLE IF EXISTS `area_delivery_module`;
CREATE TABLE `delivzone` CREATE TABLE `area_delivery_module`
( (
`id` INTEGER NOT NULL AUTO_INCREMENT, `id` INTEGER NOT NULL AUTO_INCREMENT,
`area_id` INTEGER, `area_id` INTEGER NOT NULL,
`delivery` VARCHAR(45) NOT NULL, `delivery_module_id` INTEGER NOT NULL,
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
INDEX `idx_delivzone_area_id` (`area_id`), INDEX `idx_area_delivery_module_area_id` (`area_id`),
CONSTRAINT `fk_delivzone_area_id` INDEX `idx_area_delivery_module_delivery_module_id` (`delivery_module_id`),
CONSTRAINT `fk_area_delivery_module_area_id`
FOREIGN KEY (`area_id`) FOREIGN KEY (`area_id`)
REFERENCES `area` (`id`) REFERENCES `area` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE SET NULL ON DELETE CASCADE,
CONSTRAINT `idx_area_delivery_module_delivery_module_id`
FOREIGN KEY (`delivery_module_id`)
REFERENCES `module` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@@ -1147,11 +1155,13 @@ CREATE TABLE `content_folder`
( (
`content_id` INTEGER NOT NULL, `content_id` INTEGER NOT NULL,
`folder_id` INTEGER NOT NULL, `folder_id` INTEGER NOT NULL,
`default_folder` TINYINT(1),
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`content_id`,`folder_id`), PRIMARY KEY (`content_id`,`folder_id`),
INDEX `idx_content_folder_content_id` (`content_id`), INDEX `idx_content_folder_content_id` (`content_id`),
INDEX `idx_content_folder_folder_id` (`folder_id`), INDEX `idx_content_folder_folder_id` (`folder_id`),
INDEX `idx_content_folder_default` (`default_folder`),
CONSTRAINT `fk_content_folder_content_id` CONSTRAINT `fk_content_folder_content_id`
FOREIGN KEY (`content_id`) FOREIGN KEY (`content_id`)
REFERENCES `content` (`id`) REFERENCES `content` (`id`)

View File

@@ -56,6 +56,7 @@
<table isCrossRef="true" name="product_category" namespace="Thelia\Model"> <table isCrossRef="true" name="product_category" namespace="Thelia\Model">
<column name="product_id" primaryKey="true" required="true" type="INTEGER" /> <column name="product_id" primaryKey="true" required="true" type="INTEGER" />
<column name="category_id" primaryKey="true" required="true" type="INTEGER" /> <column name="category_id" primaryKey="true" required="true" type="INTEGER" />
<column name="default_category" type="BOOLEAN" />
<foreign-key foreignTable="product" name="fk_product_has_category_product1" onDelete="CASCADE" onUpdate="RESTRICT"> <foreign-key foreignTable="product" name="fk_product_has_category_product1" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="product_id" /> <reference foreign="id" local="product_id" />
</foreign-key> </foreign-key>
@@ -68,6 +69,9 @@
<index name="idx_product_has_category_product1"> <index name="idx_product_has_category_product1">
<index-column name="product_id" /> <index-column name="product_id" />
</index> </index>
<index name="idx_product_has_category_default">
<index-column name="default_category" />
</index>
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
<table name="country" namespace="Thelia\Model"> <table name="country" namespace="Thelia\Model">
@@ -548,13 +552,13 @@
<unique name="ref_UNIQUE"> <unique name="ref_UNIQUE">
<unique-column name="ref" /> <unique-column name="ref" />
</unique> </unique>
<index name="fk_order_payment_module_id"> <index name="fk_order_payment_module_id_idx">
<index-column name="payment_module_id" /> <index-column name="payment_module_id" />
</index> </index>
<index name="fk_order_delivery_module_id"> <index name="fk_order_delivery_module_id_idx">
<index-column name="delivery_module_id" /> <index-column name="delivery_module_id" />
</index> </index>
<index name="fk_order_lang_id"> <index name="fk_order_lang_id_idx">
<index-column name="lang_id" /> <index-column name="lang_id" />
</index> </index>
<behavior name="timestampable" /> <behavior name="timestampable" />
@@ -672,19 +676,25 @@
<table name="area" namespace="Thelia\Model"> <table name="area" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="name" required="true" size="100" type="VARCHAR" /> <column name="name" required="true" size="100" type="VARCHAR" />
<column name="unit" type="FLOAT" /> <column name="postage" type="FLOAT" />
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
<table name="delivzone" namespace="Thelia\Model"> <table name="area_delivery_module" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="area_id" type="INTEGER" /> <column name="area_id" required="true" type="INTEGER" />
<column name="delivery" required="true" size="45" type="VARCHAR" /> <column name="delivery_module_id" required="true" type="INTEGER" />
<foreign-key foreignTable="area" name="fk_delivzone_area_id" onDelete="SET NULL" onUpdate="RESTRICT"> <foreign-key foreignTable="area" name="fk_area_delivery_module_area_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="area_id" /> <reference foreign="id" local="area_id" />
</foreign-key> </foreign-key>
<index name="idx_delivzone_area_id"> <foreign-key foreignTable="module" name="idx_area_delivery_module_delivery_module_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="delivery_module_id" />
</foreign-key>
<index name="idx_area_delivery_module_area_id">
<index-column name="area_id" /> <index-column name="area_id" />
</index> </index>
<index name="idx_area_delivery_module_delivery_module_id">
<index-column name="delivery_module_id" />
</index>
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
<table name="group" namespace="Thelia\Model"> <table name="group" namespace="Thelia\Model">
@@ -882,6 +892,7 @@
<table isCrossRef="true" name="content_folder" namespace="Thelia\Model"> <table isCrossRef="true" name="content_folder" namespace="Thelia\Model">
<column name="content_id" primaryKey="true" required="true" type="INTEGER" /> <column name="content_id" primaryKey="true" required="true" type="INTEGER" />
<column name="folder_id" primaryKey="true" required="true" type="INTEGER" /> <column name="folder_id" primaryKey="true" required="true" type="INTEGER" />
<column name="default_folder" type="BOOLEAN" />
<foreign-key foreignTable="content" name="fk_content_folder_content_id" onDelete="CASCADE" onUpdate="RESTRICT"> <foreign-key foreignTable="content" name="fk_content_folder_content_id" onDelete="CASCADE" onUpdate="RESTRICT">
<reference foreign="id" local="content_id" /> <reference foreign="id" local="content_id" />
</foreign-key> </foreign-key>
@@ -894,6 +905,9 @@
<index name="idx_content_folder_folder_id"> <index name="idx_content_folder_folder_id">
<index-column name="folder_id" /> <index-column name="folder_id" />
</index> </index>
<index name="idx_content_folder_default">
<index-column name="default_folder" />
</index>
<behavior name="timestampable" /> <behavior name="timestampable" />
</table> </table>
<table name="cart" namespace="Thelia\Model"> <table name="cart" namespace="Thelia\Model">

View File

@@ -94,7 +94,7 @@ URL: http://www.thelia.net
<li><a href="{url path="/login"}" class="login">{intl l="Log In!"}</a></li> <li><a href="{url path="/login"}" class="login">{intl l="Log In!"}</a></li>
{/elseloop} {/elseloop}
<li class="dropdown"> <li class="dropdown">
<a href="cart.html" class="dropdown-toggle cart" data-toggle="dropdown"> <a href="{url path="/cart"}" class="dropdown-toggle cart" data-toggle="dropdown">
Cart <span class="badge">{cart attr="count_item"}</span> Cart <span class="badge">{cart attr="count_item"}</span>
</a> </a>
</li> </li>

View File

@@ -168,7 +168,7 @@ jQuery(function($cart) {
$cart(".js-remove-address").click(function(e){ $cart(".js-remove-address").click(function(e){
e.preventDefault(); e.preventDefault();
$cart("#address-delete-link").attr("href", $(this).attr("href")); $cart("#address-delete-link").attr("href", $cart(this).attr("href"));
$cart('#address-delete-modal').modal('show'); $cart('#address-delete-modal').modal('show');
}) })

View File

@@ -0,0 +1,203 @@
{extends file="layout.tpl"}
{block name="breadcrumb"}
<nav class="nav-breadcrumb" role="navigation" aria-labelledby="breadcrumb-label">
<strong id="breadcrumb-label">You are here: </strong>
<ul class="breadcrumb" itemprop="breadcrumb">
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="{navigate to="index"}" itemprop="url"><span itemprop="title">Home</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="{url path="/cart"}" itemprop="url"><span itemprop="title">Cart</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">My order</span></li>
</ul>
</nav><!-- /.nav-breadcrumb -->
{/block}
{block name="main-content"}
<div class="main">
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">Your Cart</h1>
<div class="btn-group checkout-progress">
<a href="cart.php" role="button" class="btn btn-step"><span class="step-nb">1</span> <span class="step-label"> <span>Your Cart</span></a>
<a href="cart-step2.php" role="button" class="btn btn-step"><span class="step-nb">2</span> <span class="step-label">Billing and delivery</span></a>
<a href="cart-step3.php" role="button" class="btn btn-step active"><span class="step-nb">3</span> <span class="step-label">Check my order</span></a>
<a href="cart-step4.php" role="button" class="btn btn-step disabled"><span class="step-nb">4</span> <span class="step-label">Secure payment</span></a>
</div>
<form id="form-cart" action="cart-step4.php" method="post" role="form">
<table class="table table-cart">
<colgroup>
<col width="150">
<col>
<col width="200">
<col width="250">
</colgroup>
<thead>
<tr>
<th class="image">&nbsp;</th>
<th class="product">
<span class="hidden-xs">Product Name</span>
<span class="visible-xs">Name</span>
</th>
<th class="unitprice">
<span class="hidden-xs">Unit Price</span>
<span class="visible-xs">Price</span>
</th>
<th class="subprice">
<span class="hidden-xs">Total <abbr title="Tax Inclusive">TTC</abbr></span>
<span class="visible-xs">Total</span>
</th>
</tr>
</thead>
<tbody>
{loop type="cart" name="cartloop"}
<tr>
<td class="image">
<a href="{$PRODUCT_URL}" class="thumbnail">
{assign "cart_count" $LOOP_COUNT}
{ifloop rel='product-image'}
{loop type="image" name="product-image" product=$PRODUCT_ID limit="1" width="118" height="85" force_return="true"}
<img src="{$IMAGE_URL}" alt="Product #{$cart_count}"></a>
{/loop}
{/ifloop}
{elseloop rel="product-image"}
{images file='assets/img/product/1/118x85.png'}<img itemprop="image" src="{$asset_url}" alt="Product #{$cart_count}">{/images}
{/elseloop}
</td>
<td class="product" >
<h3 class="name">
Product #{$cart_count}
</h3>
<div class="product-options">
<dl class="dl-horizontal">
<dt>Available :</dt>
<dd>In Stock</dd>
<dt>No.</dt>
<dd>{$REF}</dd>
{*<dt>Select Size</dt>
<dd>Large</dd>
<dt>Select Delivery Date</dt>
<dd>Jan 2, 2013</dd>
<dt>Additional Option</dt>
<dd>Option 1</dd>*}
</dl>
</div>
</td>
<td class="unitprice">
{if $IS_PROMO == 1}
{assign "real_price" $PROMO_TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$PROMO_TAXED_PRICE}</span></div>
<small class="old-price">instead of <span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></small>
{else}
{assign "real_price" $TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></div>
{/if}
</td>
<td class="subprice">
<span class="price">{currency attr="symbol"} {$real_price * $QUANTITY}</span>
</td>
</tr>
{/loop}
</tbody>
<tfoot>
<tr >
<td rowspan="3" colspan="2" class="empty">&nbsp;</td>
<th class="shipping">Shipping Tax</th>
<td class="shipping">
<div class="shipping-price">
<span class="price">{order attr="postage"}</span>
</div>
</td>
</tr>
<tr >
<th class="coupon"><label for="coupon">Enter your coupon code if you have one</label></th>
<td class="coupon">
<div class="input-group">
<input type="text" name="coupon" id="coupon" class="form-control">
<span class="input-group-btn">
<button type="button" class="btn btn-coupon">Ok</button>
</span>
</div><!-- /input-group -->
</td>
</tr>
<tr >
<th class="total">Total <abbr title="Tax Inclusive">TTC</abbr></th>
<td class="total">
<div class="total-price">
<span class="price">$200.00</span>
</div>
</td>
</tr>
</tfoot>
</table>
<div id="cart-address">
<div class="panel">
<div class="panel-heading">Delivery address</div>
<div class="panel-body">
<span class="fn">M. DUPONT Jean</span>
<span class="org">Agency XY</span>
<address class="adr">
<span class="street-address">street name of my business</span><br>
<span class="postal-code">75000</span>
<span class="locality">City, <span class="country-name">Country</span></span>
</address>
</div>
</div>
<div class="panel">
<div class="panel-heading">Billing address</div>
<div class="panel-body">
<span class="fn">M. DUPONT Jean</span>
<span class="org">Agency XY</span>
<address class="adr">
<span class="street-address">street name of my business</span><br>
<span class="postal-code">75000</span>
<span class="locality">City, <span class="country-name">Country</span></span>
</address>
<a href="address.php" class="btn btn-change-address">Change address</a>
</div>
</div>
</div>
<div id="payment-method" class="panel">
<div class="panel-heading">Choose your payment method</div>
<div class="panel-body">
<ul class="list-payment">
<?php foreach ($payment as $key => $value) { ?>
<li>
<div class="radio">
<label for="payment_<?php echo $key; ?>">
<input type="radio" name="payment" id="payment_<?php echo $key; ?>" value="<?php echo $value; ?>">
<img src="img/payment/<?php echo $value; ?>.png">
</label>
</div>
</li>
<?php } ?>
</div>
</div>
<a href="cart-step2.php" role="button" class="btn btn-back"><span>Back</span></a>
<button type="submit" class="btn btn-checkout-next"><span>Next Step</span></button>
</form>
</article>
</div>
{/block}
{block name="javascript-initialization"}
<script type="text/javascript">
jQuery(function($cart) {
});
</script>
{/block}