Delivzone instance. If
- * obj is an instance of Delivzone, delegates to
- * equals(Delivzone). Otherwise, returns false.
+ * Compares this with another AreaDeliveryModule instance. If
+ * obj is an instance of AreaDeliveryModule, delegates to
+ * equals(AreaDeliveryModule). Otherwise, returns false.
*
* @param obj The object to compare to.
* @return Whether equal to the object specified.
@@ -278,7 +285,7 @@ abstract class Delivzone implements ActiveRecordInterface
* @param string $name The virtual column name
* @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)
{
@@ -310,7 +317,7 @@ abstract class Delivzone implements ActiveRecordInterface
* or a format name ('XML', 'YAML', 'JSON', 'CSV')
* @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)
{
@@ -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.
*
* @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)
{
@@ -440,7 +447,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($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.
*
* @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)
{
@@ -461,7 +468,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($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) {
@@ -473,32 +480,36 @@ abstract class Delivzone implements ActiveRecordInterface
} // setAreaId()
/**
- * Set the value of [delivery] column.
+ * Set the value of [delivery_module_id] column.
*
- * @param string $v new value
- * @return \Thelia\Model\Delivzone The current object (for fluent API support)
+ * @param int $v new value
+ * @return \Thelia\Model\AreaDeliveryModule The current object (for fluent API support)
*/
- public function setDelivery($v)
+ public function setDeliveryModuleId($v)
{
if ($v !== null) {
- $v = (string) $v;
+ $v = (int) $v;
}
- if ($this->delivery !== $v) {
- $this->delivery = $v;
- $this->modifiedColumns[] = DelivzoneTableMap::DELIVERY;
+ if ($this->delivery_module_id !== $v) {
+ $this->delivery_module_id = $v;
+ $this->modifiedColumns[] = AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID;
+ }
+
+ if ($this->aModule !== null && $this->aModule->getId() !== $v) {
+ $this->aModule = null;
}
return $this;
- } // setDelivery()
+ } // setDeliveryModuleId()
/**
* 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.
* 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)
{
@@ -506,7 +517,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->created_at !== null || $dt !== null) {
if ($dt !== $this->created_at) {
$this->created_at = $dt;
- $this->modifiedColumns[] = DelivzoneTableMap::CREATED_AT;
+ $this->modifiedColumns[] = AreaDeliveryModuleTableMap::CREATED_AT;
}
} // if either are not null
@@ -519,7 +530,7 @@ abstract class Delivzone implements ActiveRecordInterface
*
* @param mixed $v string, integer (timestamp), or \DateTime value.
* 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)
{
@@ -527,7 +538,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($this->updated_at !== null || $dt !== null) {
if ($dt !== $this->updated_at) {
$this->updated_at = $dt;
- $this->modifiedColumns[] = DelivzoneTableMap::UPDATED_AT;
+ $this->modifiedColumns[] = AreaDeliveryModuleTableMap::UPDATED_AT;
}
} // if either are not null
@@ -572,22 +583,22 @@ abstract class Delivzone implements ActiveRecordInterface
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;
- $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;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : DelivzoneTableMap::translateFieldName('Delivery', TableMap::TYPE_PHPNAME, $indexType)];
- $this->delivery = (null !== $col) ? (string) $col : null;
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : AreaDeliveryModuleTableMap::translateFieldName('DeliveryModuleId', TableMap::TYPE_PHPNAME, $indexType)];
+ $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') {
$col = 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') {
$col = null;
}
@@ -600,10 +611,10 @@ abstract class Delivzone implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 5; // 5 = DelivzoneTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 5; // 5 = AreaDeliveryModuleTableMap::NUM_HYDRATE_COLUMNS.
} 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()) {
$this->aArea = null;
}
+ if ($this->aModule !== null && $this->delivery_module_id !== $this->aModule->getId()) {
+ $this->aModule = null;
+ }
} // ensureConsistency
/**
@@ -648,13 +662,13 @@ abstract class Delivzone implements ActiveRecordInterface
}
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
// 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();
$dataFetcher->close();
if (!$row) {
@@ -665,6 +679,7 @@ abstract class Delivzone implements ActiveRecordInterface
if ($deep) { // also de-associate any related objects?
$this->aArea = null;
+ $this->aModule = null;
} // if (deep)
}
@@ -674,8 +689,8 @@ abstract class Delivzone implements ActiveRecordInterface
* @param ConnectionInterface $con
* @return void
* @throws PropelException
- * @see Delivzone::setDeleted()
- * @see Delivzone::isDeleted()
+ * @see AreaDeliveryModule::setDeleted()
+ * @see AreaDeliveryModule::isDeleted()
*/
public function delete(ConnectionInterface $con = null)
{
@@ -684,12 +699,12 @@ abstract class Delivzone implements ActiveRecordInterface
}
if ($con === null) {
- $con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME);
+ $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
}
$con->beginTransaction();
try {
- $deleteQuery = ChildDelivzoneQuery::create()
+ $deleteQuery = ChildAreaDeliveryModuleQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
@@ -726,7 +741,7 @@ abstract class Delivzone implements ActiveRecordInterface
}
if ($con === null) {
- $con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME);
+ $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
}
$con->beginTransaction();
@@ -736,16 +751,16 @@ abstract class Delivzone implements ActiveRecordInterface
if ($isInsert) {
$ret = $ret && $this->preInsert($con);
// timestampable behavior
- if (!$this->isColumnModified(DelivzoneTableMap::CREATED_AT)) {
+ if (!$this->isColumnModified(AreaDeliveryModuleTableMap::CREATED_AT)) {
$this->setCreatedAt(time());
}
- if (!$this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) {
+ if (!$this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time());
}
} else {
$ret = $ret && $this->preUpdate($con);
// timestampable behavior
- if ($this->isModified() && !$this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) {
+ if ($this->isModified() && !$this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time());
}
}
@@ -757,7 +772,7 @@ abstract class Delivzone implements ActiveRecordInterface
$this->postUpdate($con);
}
$this->postSave($con);
- DelivzoneTableMap::addInstanceToPool($this);
+ AreaDeliveryModuleTableMap::addInstanceToPool($this);
} else {
$affectedRows = 0;
}
@@ -799,6 +814,13 @@ abstract class Delivzone implements ActiveRecordInterface
$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()) {
// persist changes
if ($this->isNew()) {
@@ -830,30 +852,30 @@ abstract class Delivzone implements ActiveRecordInterface
$modifiedColumns = array();
$index = 0;
- $this->modifiedColumns[] = DelivzoneTableMap::ID;
+ $this->modifiedColumns[] = AreaDeliveryModuleTableMap::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
- if ($this->isColumnModified(DelivzoneTableMap::ID)) {
+ if ($this->isColumnModified(AreaDeliveryModuleTableMap::ID)) {
$modifiedColumns[':p' . $index++] = 'ID';
}
- if ($this->isColumnModified(DelivzoneTableMap::AREA_ID)) {
+ if ($this->isColumnModified(AreaDeliveryModuleTableMap::AREA_ID)) {
$modifiedColumns[':p' . $index++] = 'AREA_ID';
}
- if ($this->isColumnModified(DelivzoneTableMap::DELIVERY)) {
- $modifiedColumns[':p' . $index++] = 'DELIVERY';
+ if ($this->isColumnModified(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID)) {
+ $modifiedColumns[':p' . $index++] = 'DELIVERY_MODULE_ID';
}
- if ($this->isColumnModified(DelivzoneTableMap::CREATED_AT)) {
+ if ($this->isColumnModified(AreaDeliveryModuleTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
- if ($this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) {
+ if ($this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) {
$modifiedColumns[':p' . $index++] = 'UPDATED_AT';
}
$sql = sprintf(
- 'INSERT INTO delivzone (%s) VALUES (%s)',
+ 'INSERT INTO area_delivery_module (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
@@ -868,8 +890,8 @@ abstract class Delivzone implements ActiveRecordInterface
case 'AREA_ID':
$stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT);
break;
- case 'DELIVERY':
- $stmt->bindValue($identifier, $this->delivery, PDO::PARAM_STR);
+ case 'DELIVERY_MODULE_ID':
+ $stmt->bindValue($identifier, $this->delivery_module_id, PDO::PARAM_INT);
break;
case 'CREATED_AT':
$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)
{
- $pos = DelivzoneTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $pos = AreaDeliveryModuleTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
@@ -946,7 +968,7 @@ abstract class Delivzone implements ActiveRecordInterface
return $this->getAreaId();
break;
case 2:
- return $this->getDelivery();
+ return $this->getDeliveryModuleId();
break;
case 3:
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)
{
- if (isset($alreadyDumpedObjects['Delivzone'][$this->getPrimaryKey()])) {
+ if (isset($alreadyDumpedObjects['AreaDeliveryModule'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
- $alreadyDumpedObjects['Delivzone'][$this->getPrimaryKey()] = true;
- $keys = DelivzoneTableMap::getFieldNames($keyType);
+ $alreadyDumpedObjects['AreaDeliveryModule'][$this->getPrimaryKey()] = true;
+ $keys = AreaDeliveryModuleTableMap::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getAreaId(),
- $keys[2] => $this->getDelivery(),
+ $keys[2] => $this->getDeliveryModuleId(),
$keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(),
);
@@ -999,6 +1021,9 @@ abstract class Delivzone implements ActiveRecordInterface
if (null !== $this->aArea) {
$result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
+ if (null !== $this->aModule) {
+ $result['Module'] = $this->aModule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
}
return $result;
@@ -1017,7 +1042,7 @@ abstract class Delivzone implements ActiveRecordInterface
*/
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);
}
@@ -1040,7 +1065,7 @@ abstract class Delivzone implements ActiveRecordInterface
$this->setAreaId($value);
break;
case 2:
- $this->setDelivery($value);
+ $this->setDeliveryModuleId($value);
break;
case 3:
$this->setCreatedAt($value);
@@ -1070,11 +1095,11 @@ abstract class Delivzone implements ActiveRecordInterface
*/
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[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[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
}
@@ -1086,13 +1111,13 @@ abstract class Delivzone implements ActiveRecordInterface
*/
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(DelivzoneTableMap::AREA_ID)) $criteria->add(DelivzoneTableMap::AREA_ID, $this->area_id);
- if ($this->isColumnModified(DelivzoneTableMap::DELIVERY)) $criteria->add(DelivzoneTableMap::DELIVERY, $this->delivery);
- if ($this->isColumnModified(DelivzoneTableMap::CREATED_AT)) $criteria->add(DelivzoneTableMap::CREATED_AT, $this->created_at);
- if ($this->isColumnModified(DelivzoneTableMap::UPDATED_AT)) $criteria->add(DelivzoneTableMap::UPDATED_AT, $this->updated_at);
+ if ($this->isColumnModified(AreaDeliveryModuleTableMap::ID)) $criteria->add(AreaDeliveryModuleTableMap::ID, $this->id);
+ if ($this->isColumnModified(AreaDeliveryModuleTableMap::AREA_ID)) $criteria->add(AreaDeliveryModuleTableMap::AREA_ID, $this->area_id);
+ if ($this->isColumnModified(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID)) $criteria->add(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID, $this->delivery_module_id);
+ if ($this->isColumnModified(AreaDeliveryModuleTableMap::CREATED_AT)) $criteria->add(AreaDeliveryModuleTableMap::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(AreaDeliveryModuleTableMap::UPDATED_AT)) $criteria->add(AreaDeliveryModuleTableMap::UPDATED_AT, $this->updated_at);
return $criteria;
}
@@ -1107,8 +1132,8 @@ abstract class Delivzone implements ActiveRecordInterface
*/
public function buildPkeyCriteria()
{
- $criteria = new Criteria(DelivzoneTableMap::DATABASE_NAME);
- $criteria->add(DelivzoneTableMap::ID, $this->id);
+ $criteria = new Criteria(AreaDeliveryModuleTableMap::DATABASE_NAME);
+ $criteria->add(AreaDeliveryModuleTableMap::ID, $this->id);
return $criteria;
}
@@ -1149,7 +1174,7 @@ abstract class Delivzone implements ActiveRecordInterface
* If desired, this method can also make copies of all associated (fkey referrers)
* 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 $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
@@ -1157,7 +1182,7 @@ abstract class Delivzone implements ActiveRecordInterface
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setAreaId($this->getAreaId());
- $copyObj->setDelivery($this->getDelivery());
+ $copyObj->setDeliveryModuleId($this->getDeliveryModuleId());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
@@ -1175,7 +1200,7 @@ abstract class Delivzone implements ActiveRecordInterface
* objects.
*
* @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
*/
public function copy($deepCopy = false)
@@ -1192,7 +1217,7 @@ abstract class Delivzone implements ActiveRecordInterface
* Declares an association between this object and a ChildArea object.
*
* @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
*/
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.
// If this object has already been added to the ChildArea object, it will not be re-added.
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
undesirable since it could result in an only partially populated collection
in the referenced object.
- $this->aArea->addDelivzones($this);
+ $this->aArea->addAreaDeliveryModules($this);
*/
}
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
*/
@@ -1246,7 +1322,7 @@ abstract class Delivzone implements ActiveRecordInterface
{
$this->id = null;
$this->area_id = null;
- $this->delivery = null;
+ $this->delivery_module_id = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
@@ -1271,6 +1347,7 @@ abstract class Delivzone implements ActiveRecordInterface
} // if ($deep)
$this->aArea = null;
+ $this->aModule = null;
}
/**
@@ -1280,7 +1357,7 @@ abstract class Delivzone implements ActiveRecordInterface
*/
public function __toString()
{
- return (string) $this->exportTo(DelivzoneTableMap::DEFAULT_STRING_FORMAT);
+ return (string) $this->exportTo(AreaDeliveryModuleTableMap::DEFAULT_STRING_FORMAT);
}
// 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
*
- * @return ChildDelivzone The current object (for fluent API support)
+ * @return ChildAreaDeliveryModule The current object (for fluent API support)
*/
public function keepUpdateDateUnchanged()
{
- $this->modifiedColumns[] = DelivzoneTableMap::UPDATED_AT;
+ $this->modifiedColumns[] = AreaDeliveryModuleTableMap::UPDATED_AT;
return $this;
}
diff --git a/core/lib/Thelia/Model/Base/DelivzoneQuery.php b/core/lib/Thelia/Model/Base/AreaDeliveryModuleQuery.php
similarity index 53%
rename from core/lib/Thelia/Model/Base/DelivzoneQuery.php
rename to core/lib/Thelia/Model/Base/AreaDeliveryModuleQuery.php
index e4b8a8ab5..394fe651e 100644
--- a/core/lib/Thelia/Model/Base/DelivzoneQuery.php
+++ b/core/lib/Thelia/Model/Base/AreaDeliveryModuleQuery.php
@@ -12,80 +12,84 @@ use Propel\Runtime\Collection\Collection;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
-use Thelia\Model\Delivzone as ChildDelivzone;
-use Thelia\Model\DelivzoneQuery as ChildDelivzoneQuery;
-use Thelia\Model\Map\DelivzoneTableMap;
+use Thelia\Model\AreaDeliveryModule as ChildAreaDeliveryModule;
+use Thelia\Model\AreaDeliveryModuleQuery as ChildAreaDeliveryModuleQuery;
+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 ChildDelivzoneQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
- * @method ChildDelivzoneQuery orderByDelivery($order = Criteria::ASC) Order by the delivery column
- * @method ChildDelivzoneQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
- * @method ChildDelivzoneQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
+ * @method ChildAreaDeliveryModuleQuery orderById($order = Criteria::ASC) Order by the id column
+ * @method ChildAreaDeliveryModuleQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
+ * @method ChildAreaDeliveryModuleQuery orderByDeliveryModuleId($order = Criteria::ASC) Order by the delivery_module_id column
+ * @method ChildAreaDeliveryModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
+ * @method ChildAreaDeliveryModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
- * @method ChildDelivzoneQuery groupById() Group by the id column
- * @method ChildDelivzoneQuery groupByAreaId() Group by the area_id column
- * @method ChildDelivzoneQuery groupByDelivery() Group by the delivery column
- * @method ChildDelivzoneQuery groupByCreatedAt() Group by the created_at column
- * @method ChildDelivzoneQuery groupByUpdatedAt() Group by the updated_at column
+ * @method ChildAreaDeliveryModuleQuery groupById() Group by the id column
+ * @method ChildAreaDeliveryModuleQuery groupByAreaId() Group by the area_id column
+ * @method ChildAreaDeliveryModuleQuery groupByDeliveryModuleId() Group by the delivery_module_id column
+ * @method ChildAreaDeliveryModuleQuery groupByCreatedAt() Group by the created_at column
+ * @method ChildAreaDeliveryModuleQuery groupByUpdatedAt() Group by the updated_at column
*
- * @method ChildDelivzoneQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method ChildDelivzoneQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method ChildDelivzoneQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method ChildAreaDeliveryModuleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method ChildAreaDeliveryModuleQuery rightJoin($relation) Adds a RIGHT 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 ChildDelivzoneQuery 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 leftJoinArea($relationAlias = null) Adds a LEFT 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 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 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 leftJoinModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the Module relation
+ * @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 ChildDelivzone findOneByAreaId(int $area_id) Return the first ChildDelivzone filtered by the area_id column
- * @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 ChildAreaDeliveryModule findOne(ConnectionInterface $con = null) Return the first ChildAreaDeliveryModule matching the query
+ * @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 array findById(int $id) Return ChildDelivzone objects filtered by the id column
- * @method array findByAreaId(int $area_id) Return ChildDelivzone objects filtered by the area_id column
- * @method array findByDelivery(string $delivery) Return ChildDelivzone objects filtered by the delivery column
- * @method array findByCreatedAt(string $created_at) Return ChildDelivzone objects filtered by the created_at column
- * @method array findByUpdatedAt(string $updated_at) Return ChildDelivzone objects filtered by the updated_at column
+ * @method ChildAreaDeliveryModule findOneById(int $id) Return the first ChildAreaDeliveryModule filtered by the id column
+ * @method ChildAreaDeliveryModule findOneByAreaId(int $area_id) Return the first ChildAreaDeliveryModule filtered by the area_id column
+ * @method ChildAreaDeliveryModule findOneByDeliveryModuleId(int $delivery_module_id) Return the first ChildAreaDeliveryModule filtered by the delivery_module_id column
+ * @method ChildAreaDeliveryModule findOneByCreatedAt(string $created_at) Return the first ChildAreaDeliveryModule filtered by the created_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 $modelName The phpName of a model, e.g. 'Book'
* @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);
}
/**
- * Returns a new ChildDelivzoneQuery object.
+ * Returns a new ChildAreaDeliveryModuleQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
- * @return ChildDelivzoneQuery
+ * @return ChildAreaDeliveryModuleQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
- if ($criteria instanceof \Thelia\Model\DelivzoneQuery) {
+ if ($criteria instanceof \Thelia\Model\AreaDeliveryModuleQuery) {
return $criteria;
}
- $query = new \Thelia\Model\DelivzoneQuery();
+ $query = new \Thelia\Model\AreaDeliveryModuleQuery();
if (null !== $modelAlias) {
$query->setModelAlias($modelAlias);
}
@@ -108,19 +112,19 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query
* @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)
{
if ($key === 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
return $obj;
}
if ($con === null) {
- $con = Propel::getServiceContainer()->getReadConnection(DelivzoneTableMap::DATABASE_NAME);
+ $con = Propel::getServiceContainer()->getReadConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
}
$this->basePreSelect($con);
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 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)
{
- $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 {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -154,9 +158,9 @@ abstract class DelivzoneQuery extends ModelCriteria
}
$obj = null;
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
- $obj = new ChildDelivzone();
+ $obj = new ChildAreaDeliveryModule();
$obj->hydrate($row);
- DelivzoneTableMap::addInstanceToPool($obj, (string) $key);
+ AreaDeliveryModuleTableMap::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
@@ -169,7 +173,7 @@ abstract class DelivzoneQuery extends ModelCriteria
* @param mixed $key Primary key to use for the query
* @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)
{
@@ -211,12 +215,12 @@ abstract class DelivzoneQuery extends ModelCriteria
*
* @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)
{
- 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
*
- * @return ChildDelivzoneQuery The current query, for fluid interface
+ * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/
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.
* @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)
{
if (is_array($id)) {
$useMinMax = false;
if (isset($id['min'])) {
- $this->addUsingAlias(DelivzoneTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($id['max'])) {
- $this->addUsingAlias(DelivzoneTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $this->addUsingAlias(AreaDeliveryModuleTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
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.
* @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)
{
if (is_array($areaId)) {
$useMinMax = false;
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;
}
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;
}
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:
*
- * $query->filterByDelivery('fooValue'); // WHERE delivery = 'fooValue'
- * $query->filterByDelivery('%fooValue%'); // WHERE delivery LIKE '%fooValue%'
+ * $query->filterByDeliveryModuleId(1234); // WHERE delivery_module_id = 1234
+ * $query->filterByDeliveryModuleId(array(12, 34)); // WHERE delivery_module_id IN (12, 34)
+ * $query->filterByDeliveryModuleId(array('min' => 12)); // WHERE delivery_module_id > 12
*
*
- * @param string $delivery The value to use as filter.
- * Accepts wildcards (* and % trigger a LIKE)
+ * @see filterByModule()
+ *
+ * @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
*
- * @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($delivery)) {
+ if (is_array($deliveryModuleId)) {
+ $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;
- } 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.
* @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)
{
if (is_array($createdAt)) {
$useMinMax = false;
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;
}
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;
}
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.
* @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)
{
if (is_array($updatedAt)) {
$useMinMax = false;
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;
}
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;
}
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 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)
{
if ($area instanceof \Thelia\Model\Area) {
return $this
- ->addUsingAlias(DelivzoneTableMap::AREA_ID, $area->getId(), $comparison);
+ ->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $area->getId(), $comparison);
} elseif ($area instanceof ObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
- ->addUsingAlias(DelivzoneTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ ->addUsingAlias(AreaDeliveryModuleTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
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 $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();
$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
*/
- public function useAreaQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->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) {
- $this->addUsingAlias(DelivzoneTableMap::ID, $delivzone->getId(), Criteria::NOT_EQUAL);
+ if ($module instanceof \Thelia\Model\Module) {
+ 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;
}
/**
- * 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
* @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)
{
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
try {
@@ -542,8 +635,8 @@ abstract class DelivzoneQuery extends ModelCriteria
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
- DelivzoneTableMap::clearInstancePool();
- DelivzoneTableMap::clearRelatedInstancePool();
+ AreaDeliveryModuleTableMap::clearInstancePool();
+ AreaDeliveryModuleTableMap::clearRelatedInstancePool();
$con->commit();
} 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
* @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
@@ -568,13 +661,13 @@ abstract class DelivzoneQuery extends ModelCriteria
public function delete(ConnectionInterface $con = null)
{
if (null === $con) {
- $con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME);
+ $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
}
$criteria = $this;
// 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
@@ -584,10 +677,10 @@ abstract class DelivzoneQuery extends ModelCriteria
$con->beginTransaction();
- DelivzoneTableMap::removeInstanceFromPool($criteria);
+ AreaDeliveryModuleTableMap::removeInstanceFromPool($criteria);
$affectedRows += ModelCriteria::delete($con);
- DelivzoneTableMap::clearRelatedInstancePool();
+ AreaDeliveryModuleTableMap::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
@@ -604,11 +697,11 @@ abstract class DelivzoneQuery extends ModelCriteria
*
* @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)
{
- 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
*
- * @return ChildDelivzoneQuery The current query, for fluid interface
+ * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/
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
*
- * @return ChildDelivzoneQuery The current query, for fluid interface
+ * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
- return $this->addDescendingOrderByColumn(DelivzoneTableMap::UPDATED_AT);
+ return $this->addDescendingOrderByColumn(AreaDeliveryModuleTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
- * @return ChildDelivzoneQuery The current query, for fluid interface
+ * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
- return $this->addAscendingOrderByColumn(DelivzoneTableMap::UPDATED_AT);
+ return $this->addAscendingOrderByColumn(AreaDeliveryModuleTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
- * @return ChildDelivzoneQuery The current query, for fluid interface
+ * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
- return $this->addDescendingOrderByColumn(DelivzoneTableMap::CREATED_AT);
+ return $this->addDescendingOrderByColumn(AreaDeliveryModuleTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
- * @return ChildDelivzoneQuery The current query, for fluid interface
+ * @return ChildAreaDeliveryModuleQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
- return $this->addAscendingOrderByColumn(DelivzoneTableMap::CREATED_AT);
+ return $this->addAscendingOrderByColumn(AreaDeliveryModuleTableMap::CREATED_AT);
}
-} // DelivzoneQuery
+} // AreaDeliveryModuleQuery
diff --git a/core/lib/Thelia/Model/Base/AreaQuery.php b/core/lib/Thelia/Model/Base/AreaQuery.php
index f583a30dd..ea4cd8b90 100644
--- a/core/lib/Thelia/Model/Base/AreaQuery.php
+++ b/core/lib/Thelia/Model/Base/AreaQuery.php
@@ -23,13 +23,13 @@ use Thelia\Model\Map\AreaTableMap;
*
* @method ChildAreaQuery orderById($order = Criteria::ASC) Order by the id 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 orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildAreaQuery groupById() Group by the id 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 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 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 rightJoinDelivzone($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Delivzone relation
- * @method ChildAreaQuery innerJoinDelivzone($relationAlias = null) Adds a INNER 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 rightJoinAreaDeliveryModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AreaDeliveryModule 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 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 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 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 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 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)
{
- $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 {
$stmt = $con->prepare($sql);
$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:
*
- * $query->filterByUnit(1234); // WHERE unit = 1234
- * $query->filterByUnit(array(12, 34)); // WHERE unit IN (12, 34)
- * $query->filterByUnit(array('min' => 12)); // WHERE unit > 12
+ * $query->filterByPostage(1234); // WHERE postage = 1234
+ * $query->filterByPostage(array(12, 34)); // WHERE postage IN (12, 34)
+ * $query->filterByPostage(array('min' => 12)); // WHERE postage > 12
*
*
- * @param mixed $unit The value to use as filter.
+ * @param mixed $postage 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.
@@ -324,16 +324,16 @@ abstract class AreaQuery extends ModelCriteria
*
* @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;
- if (isset($unit['min'])) {
- $this->addUsingAlias(AreaTableMap::UNIT, $unit['min'], Criteria::GREATER_EQUAL);
+ if (isset($postage['min'])) {
+ $this->addUsingAlias(AreaTableMap::POSTAGE, $postage['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
- if (isset($unit['max'])) {
- $this->addUsingAlias(AreaTableMap::UNIT, $unit['max'], Criteria::LESS_EQUAL);
+ if (isset($postage['max'])) {
+ $this->addUsingAlias(AreaTableMap::POSTAGE, $postage['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
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
*
* @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
- ->addUsingAlias(AreaTableMap::ID, $delivzone->getAreaId(), $comparison);
- } elseif ($delivzone instanceof ObjectCollection) {
+ ->addUsingAlias(AreaTableMap::ID, $areaDeliveryModule->getAreaId(), $comparison);
+ } elseif ($areaDeliveryModule instanceof ObjectCollection) {
return $this
- ->useDelivzoneQuery()
- ->filterByPrimaryKeys($delivzone->getPrimaryKeys())
+ ->useAreaDeliveryModuleQuery()
+ ->filterByPrimaryKeys($areaDeliveryModule->getPrimaryKeys())
->endUse();
} 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 $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @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();
- $relationMap = $tableMap->getRelation('Delivzone');
+ $relationMap = $tableMap->getRelation('AreaDeliveryModule');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -555,14 +555,14 @@ abstract class AreaQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'Delivzone');
+ $this->addJoinObject($join, 'AreaDeliveryModule');
}
return $this;
}
/**
- * Use the Delivzone relation Delivzone object
+ * Use the AreaDeliveryModule relation AreaDeliveryModule object
*
* @see useQuery()
*
@@ -570,13 +570,13 @@ abstract class AreaQuery extends ModelCriteria
* 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\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
- ->joinDelivzone($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'Delivzone', '\Thelia\Model\DelivzoneQuery');
+ ->joinAreaDeliveryModule($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'AreaDeliveryModule', '\Thelia\Model\AreaDeliveryModuleQuery');
}
/**
diff --git a/core/lib/Thelia/Model/Base/ContentFolder.php b/core/lib/Thelia/Model/Base/ContentFolder.php
index 51d72b974..809825d51 100644
--- a/core/lib/Thelia/Model/Base/ContentFolder.php
+++ b/core/lib/Thelia/Model/Base/ContentFolder.php
@@ -70,6 +70,12 @@ abstract class ContentFolder implements ActiveRecordInterface
*/
protected $folder_id;
+ /**
+ * The value for the default_folder field.
+ * @var boolean
+ */
+ protected $default_folder;
+
/**
* The value for the created_at field.
* @var string
@@ -376,6 +382,17 @@ abstract class ContentFolder implements ActiveRecordInterface
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.
*
@@ -466,6 +483,35 @@ abstract class ContentFolder implements ActiveRecordInterface
return $this;
} // 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.
*
@@ -551,13 +597,16 @@ abstract class ContentFolder implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ContentFolderTableMap::translateFieldName('FolderId', TableMap::TYPE_PHPNAME, $indexType)];
$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') {
$col = 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') {
$col = null;
}
@@ -570,7 +619,7 @@ abstract class ContentFolder implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 4; // 4 = ContentFolderTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 5; // 5 = ContentFolderTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $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)) {
$modifiedColumns[':p' . $index++] = 'FOLDER_ID';
}
+ if ($this->isColumnModified(ContentFolderTableMap::DEFAULT_FOLDER)) {
+ $modifiedColumns[':p' . $index++] = 'DEFAULT_FOLDER';
+ }
if ($this->isColumnModified(ContentFolderTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -842,6 +894,9 @@ abstract class ContentFolder implements ActiveRecordInterface
case 'FOLDER_ID':
$stmt->bindValue($identifier, $this->folder_id, PDO::PARAM_INT);
break;
+ case 'DEFAULT_FOLDER':
+ $stmt->bindValue($identifier, (int) $this->default_folder, PDO::PARAM_INT);
+ break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -910,9 +965,12 @@ abstract class ContentFolder implements ActiveRecordInterface
return $this->getFolderId();
break;
case 2:
- return $this->getCreatedAt();
+ return $this->getDefaultFolder();
break;
case 3:
+ return $this->getCreatedAt();
+ break;
+ case 4:
return $this->getUpdatedAt();
break;
default:
@@ -946,8 +1004,9 @@ abstract class ContentFolder implements ActiveRecordInterface
$result = array(
$keys[0] => $this->getContentId(),
$keys[1] => $this->getFolderId(),
- $keys[2] => $this->getCreatedAt(),
- $keys[3] => $this->getUpdatedAt(),
+ $keys[2] => $this->getDefaultFolder(),
+ $keys[3] => $this->getCreatedAt(),
+ $keys[4] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1003,9 +1062,12 @@ abstract class ContentFolder implements ActiveRecordInterface
$this->setFolderId($value);
break;
case 2:
- $this->setCreatedAt($value);
+ $this->setDefaultFolder($value);
break;
case 3:
+ $this->setCreatedAt($value);
+ break;
+ case 4:
$this->setUpdatedAt($value);
break;
} // 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[1], $arr)) $this->setFolderId($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDefaultFolder($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
}
/**
@@ -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::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::UPDATED_AT)) $criteria->add(ContentFolderTableMap::UPDATED_AT, $this->updated_at);
@@ -1123,6 +1187,7 @@ abstract class ContentFolder implements ActiveRecordInterface
{
$copyObj->setContentId($this->getContentId());
$copyObj->setFolderId($this->getFolderId());
+ $copyObj->setDefaultFolder($this->getDefaultFolder());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
@@ -1261,6 +1326,7 @@ abstract class ContentFolder implements ActiveRecordInterface
{
$this->content_id = null;
$this->folder_id = null;
+ $this->default_folder = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
diff --git a/core/lib/Thelia/Model/Base/ContentFolderQuery.php b/core/lib/Thelia/Model/Base/ContentFolderQuery.php
index 208ba80cf..72561ae77 100644
--- a/core/lib/Thelia/Model/Base/ContentFolderQuery.php
+++ b/core/lib/Thelia/Model/Base/ContentFolderQuery.php
@@ -23,11 +23,13 @@ use Thelia\Model\Map\ContentFolderTableMap;
*
* @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 orderByDefaultFolder($order = Criteria::ASC) Order by the default_folder 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 groupByContentId() Group by the content_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 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 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 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 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 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)
{
- $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 {
$stmt = $con->prepare($sql);
$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);
}
+ /**
+ * Filter the query on the default_folder column
+ *
+ * Example usage:
+ *
+ * $query->filterByDefaultFolder(true); // WHERE default_folder = true
+ * $query->filterByDefaultFolder('yes'); // WHERE default_folder = true
+ *
+ *
+ * @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
*
diff --git a/core/lib/Thelia/Model/Base/Module.php b/core/lib/Thelia/Model/Base/Module.php
index a154c382d..7f4df77ce 100644
--- a/core/lib/Thelia/Model/Base/Module.php
+++ b/core/lib/Thelia/Model/Base/Module.php
@@ -17,6 +17,8 @@ use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
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\GroupModuleQuery as ChildGroupModuleQuery;
use Thelia\Model\Module as ChildModule;
@@ -121,6 +123,12 @@ abstract class Module implements ActiveRecordInterface
protected $collOrdersRelatedByDeliveryModuleId;
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.
*/
@@ -167,6 +175,12 @@ abstract class Module implements ActiveRecordInterface
*/
protected $ordersRelatedByDeliveryModuleIdScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var ObjectCollection
+ */
+ protected $areaDeliveryModulesScheduledForDeletion = null;
+
/**
* An array of objects scheduled for deletion.
* @var ObjectCollection
@@ -846,6 +860,8 @@ abstract class Module implements ActiveRecordInterface
$this->collOrdersRelatedByDeliveryModuleId = null;
+ $this->collAreaDeliveryModules = null;
+
$this->collGroupModules = 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->isEmpty()) {
\Thelia\Model\GroupModuleQuery::create()
@@ -1273,6 +1306,9 @@ abstract class Module implements ActiveRecordInterface
if (null !== $this->collOrdersRelatedByDeliveryModuleId) {
$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) {
$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) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addGroupModule($relObj->copy($deepCopy));
@@ -1535,6 +1577,9 @@ abstract class Module implements ActiveRecordInterface
if ('OrderRelatedByDeliveryModuleId' == $relationName) {
return $this->initOrdersRelatedByDeliveryModuleId();
}
+ if ('AreaDeliveryModule' == $relationName) {
+ return $this->initAreaDeliveryModules();
+ }
if ('GroupModule' == $relationName) {
return $this->initGroupModules();
}
@@ -2279,6 +2324,249 @@ abstract class Module implements ActiveRecordInterface
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
*
@@ -2789,6 +3077,11 @@ abstract class Module implements ActiveRecordInterface
$o->clearAllReferences($deep);
}
}
+ if ($this->collAreaDeliveryModules) {
+ foreach ($this->collAreaDeliveryModules as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
if ($this->collGroupModules) {
foreach ($this->collGroupModules as $o) {
$o->clearAllReferences($deep);
@@ -2813,6 +3106,10 @@ abstract class Module implements ActiveRecordInterface
$this->collOrdersRelatedByDeliveryModuleId->clearIterator();
}
$this->collOrdersRelatedByDeliveryModuleId = null;
+ if ($this->collAreaDeliveryModules instanceof Collection) {
+ $this->collAreaDeliveryModules->clearIterator();
+ }
+ $this->collAreaDeliveryModules = null;
if ($this->collGroupModules instanceof Collection) {
$this->collGroupModules->clearIterator();
}
diff --git a/core/lib/Thelia/Model/Base/ModuleQuery.php b/core/lib/Thelia/Model/Base/ModuleQuery.php
index 30bdd9178..0ed6c5293 100644
--- a/core/lib/Thelia/Model/Base/ModuleQuery.php
+++ b/core/lib/Thelia/Model/Base/ModuleQuery.php
@@ -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 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 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
@@ -711,6 +715,79 @@ abstract class ModuleQuery extends ModelCriteria
->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
*
diff --git a/core/lib/Thelia/Model/Base/ProductCategory.php b/core/lib/Thelia/Model/Base/ProductCategory.php
index 62a6ea425..2c6db3184 100644
--- a/core/lib/Thelia/Model/Base/ProductCategory.php
+++ b/core/lib/Thelia/Model/Base/ProductCategory.php
@@ -70,6 +70,12 @@ abstract class ProductCategory implements ActiveRecordInterface
*/
protected $category_id;
+ /**
+ * The value for the default_category field.
+ * @var boolean
+ */
+ protected $default_category;
+
/**
* The value for the created_at field.
* @var string
@@ -376,6 +382,17 @@ abstract class ProductCategory implements ActiveRecordInterface
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.
*
@@ -466,6 +483,35 @@ abstract class ProductCategory implements ActiveRecordInterface
return $this;
} // 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.
*
@@ -551,13 +597,16 @@ abstract class ProductCategory implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ProductCategoryTableMap::translateFieldName('CategoryId', TableMap::TYPE_PHPNAME, $indexType)];
$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') {
$col = 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') {
$col = null;
}
@@ -570,7 +619,7 @@ abstract class ProductCategory implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 4; // 4 = ProductCategoryTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 5; // 5 = ProductCategoryTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $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)) {
$modifiedColumns[':p' . $index++] = 'CATEGORY_ID';
}
+ if ($this->isColumnModified(ProductCategoryTableMap::DEFAULT_CATEGORY)) {
+ $modifiedColumns[':p' . $index++] = 'DEFAULT_CATEGORY';
+ }
if ($this->isColumnModified(ProductCategoryTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -842,6 +894,9 @@ abstract class ProductCategory implements ActiveRecordInterface
case 'CATEGORY_ID':
$stmt->bindValue($identifier, $this->category_id, PDO::PARAM_INT);
break;
+ case 'DEFAULT_CATEGORY':
+ $stmt->bindValue($identifier, (int) $this->default_category, PDO::PARAM_INT);
+ break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -910,9 +965,12 @@ abstract class ProductCategory implements ActiveRecordInterface
return $this->getCategoryId();
break;
case 2:
- return $this->getCreatedAt();
+ return $this->getDefaultCategory();
break;
case 3:
+ return $this->getCreatedAt();
+ break;
+ case 4:
return $this->getUpdatedAt();
break;
default:
@@ -946,8 +1004,9 @@ abstract class ProductCategory implements ActiveRecordInterface
$result = array(
$keys[0] => $this->getProductId(),
$keys[1] => $this->getCategoryId(),
- $keys[2] => $this->getCreatedAt(),
- $keys[3] => $this->getUpdatedAt(),
+ $keys[2] => $this->getDefaultCategory(),
+ $keys[3] => $this->getCreatedAt(),
+ $keys[4] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach($virtualColumns as $key => $virtualColumn)
@@ -1003,9 +1062,12 @@ abstract class ProductCategory implements ActiveRecordInterface
$this->setCategoryId($value);
break;
case 2:
- $this->setCreatedAt($value);
+ $this->setDefaultCategory($value);
break;
case 3:
+ $this->setCreatedAt($value);
+ break;
+ case 4:
$this->setUpdatedAt($value);
break;
} // 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[1], $arr)) $this->setCategoryId($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDefaultCategory($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
}
/**
@@ -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::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::UPDATED_AT)) $criteria->add(ProductCategoryTableMap::UPDATED_AT, $this->updated_at);
@@ -1123,6 +1187,7 @@ abstract class ProductCategory implements ActiveRecordInterface
{
$copyObj->setProductId($this->getProductId());
$copyObj->setCategoryId($this->getCategoryId());
+ $copyObj->setDefaultCategory($this->getDefaultCategory());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
@@ -1261,6 +1326,7 @@ abstract class ProductCategory implements ActiveRecordInterface
{
$this->product_id = null;
$this->category_id = null;
+ $this->default_category = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
diff --git a/core/lib/Thelia/Model/Base/ProductCategoryQuery.php b/core/lib/Thelia/Model/Base/ProductCategoryQuery.php
index fd40e93c7..df9fc630b 100644
--- a/core/lib/Thelia/Model/Base/ProductCategoryQuery.php
+++ b/core/lib/Thelia/Model/Base/ProductCategoryQuery.php
@@ -23,11 +23,13 @@ use Thelia\Model\Map\ProductCategoryTableMap;
*
* @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 orderByDefaultCategory($order = Criteria::ASC) Order by the default_category 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 groupByProductId() Group by the product_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 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 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 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 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 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)
{
- $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 {
$stmt = $con->prepare($sql);
$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);
}
+ /**
+ * Filter the query on the default_category column
+ *
+ * Example usage:
+ *
+ * $query->filterByDefaultCategory(true); // WHERE default_category = true
+ * $query->filterByDefaultCategory('yes'); // WHERE default_category = true
+ *
+ *
+ * @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
*
diff --git a/core/lib/Thelia/Model/Delivzone.php b/core/lib/Thelia/Model/Delivzone.php
deleted file mode 100755
index 58d4f0f7b..000000000
--- a/core/lib/Thelia/Model/Delivzone.php
+++ /dev/null
@@ -1,9 +0,0 @@
- array('Id', 'AreaId', 'Delivery', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'delivery', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(DelivzoneTableMap::ID, DelivzoneTableMap::AREA_ID, DelivzoneTableMap::DELIVERY, DelivzoneTableMap::CREATED_AT, DelivzoneTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'DELIVERY', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'area_id', 'delivery', 'created_at', 'updated_at', ),
+ self::TYPE_PHPNAME => array('Id', 'AreaId', 'DeliveryModuleId', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'deliveryModuleId', 'createdAt', 'updatedAt', ),
+ 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_MODULE_ID', '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, )
);
@@ -121,11 +121,11 @@ class DelivzoneTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'Delivery' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'delivery' => 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_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'DELIVERY' => 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_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'DeliveryModuleId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'deliveryModuleId' => 2, 'createdAt' => 3, 'updatedAt' => 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_MODULE_ID' => 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, )
);
@@ -139,15 +139,15 @@ class DelivzoneTableMap extends TableMap
public function initialize()
{
// attributes
- $this->setName('delivzone');
- $this->setPhpName('Delivzone');
- $this->setClassName('\\Thelia\\Model\\Delivzone');
+ $this->setName('area_delivery_module');
+ $this->setPhpName('AreaDeliveryModule');
+ $this->setClassName('\\Thelia\\Model\\AreaDeliveryModule');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
- $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', false, null, null);
- $this->addColumn('DELIVERY', 'Delivery', 'VARCHAR', true, 45, null);
+ $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
+ $this->addForeignKey('DELIVERY_MODULE_ID', 'DeliveryModuleId', 'INTEGER', 'module', 'ID', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -157,7 +157,8 @@ class DelivzoneTableMap extends TableMap
*/
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()
/**
@@ -229,7 +230,7 @@ class DelivzoneTableMap extends TableMap
*/
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
* 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)
{
- $key = DelivzoneTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
- if (null !== ($obj = DelivzoneTableMap::getInstanceFromPool($key))) {
+ $key = AreaDeliveryModuleTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = AreaDeliveryModuleTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $offset, true); // rehydrate
- $col = $offset + DelivzoneTableMap::NUM_HYDRATE_COLUMNS;
+ $col = $offset + AreaDeliveryModuleTableMap::NUM_HYDRATE_COLUMNS;
} else {
- $cls = DelivzoneTableMap::OM_CLASS;
+ $cls = AreaDeliveryModuleTableMap::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $offset, false, $indexType);
- DelivzoneTableMap::addInstanceToPool($obj, $key);
+ AreaDeliveryModuleTableMap::addInstanceToPool($obj, $key);
}
return array($obj, $col);
@@ -280,8 +281,8 @@ class DelivzoneTableMap extends TableMap
$cls = static::getOMClass(false);
// populate the object(s)
while ($row = $dataFetcher->fetch()) {
- $key = DelivzoneTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
- if (null !== ($obj = DelivzoneTableMap::getInstanceFromPool($key))) {
+ $key = AreaDeliveryModuleTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = AreaDeliveryModuleTableMap::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, 0, true); // rehydrate
@@ -290,7 +291,7 @@ class DelivzoneTableMap extends TableMap
$obj = new $cls();
$obj->hydrate($row);
$results[] = $obj;
- DelivzoneTableMap::addInstanceToPool($obj, $key);
+ AreaDeliveryModuleTableMap::addInstanceToPool($obj, $key);
} // if key exists
}
@@ -311,15 +312,15 @@ class DelivzoneTableMap extends TableMap
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
- $criteria->addSelectColumn(DelivzoneTableMap::ID);
- $criteria->addSelectColumn(DelivzoneTableMap::AREA_ID);
- $criteria->addSelectColumn(DelivzoneTableMap::DELIVERY);
- $criteria->addSelectColumn(DelivzoneTableMap::CREATED_AT);
- $criteria->addSelectColumn(DelivzoneTableMap::UPDATED_AT);
+ $criteria->addSelectColumn(AreaDeliveryModuleTableMap::ID);
+ $criteria->addSelectColumn(AreaDeliveryModuleTableMap::AREA_ID);
+ $criteria->addSelectColumn(AreaDeliveryModuleTableMap::DELIVERY_MODULE_ID);
+ $criteria->addSelectColumn(AreaDeliveryModuleTableMap::CREATED_AT);
+ $criteria->addSelectColumn(AreaDeliveryModuleTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.AREA_ID');
- $criteria->addSelectColumn($alias . '.DELIVERY');
+ $criteria->addSelectColumn($alias . '.DELIVERY_MODULE_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
@@ -334,7 +335,7 @@ class DelivzoneTableMap extends TableMap
*/
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()
{
- $dbMap = Propel::getServiceContainer()->getDatabaseMap(DelivzoneTableMap::DATABASE_NAME);
- if (!$dbMap->hasTable(DelivzoneTableMap::TABLE_NAME)) {
- $dbMap->addTableObject(new DelivzoneTableMap());
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(AreaDeliveryModuleTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(AreaDeliveryModuleTableMap::TABLE_NAME)) {
+ $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
* @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
@@ -362,25 +363,25 @@ class DelivzoneTableMap extends TableMap
public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
- $con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME);
+ $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$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
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
- $criteria = new Criteria(DelivzoneTableMap::DATABASE_NAME);
- $criteria->add(DelivzoneTableMap::ID, (array) $values, Criteria::IN);
+ $criteria = new Criteria(AreaDeliveryModuleTableMap::DATABASE_NAME);
+ $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
- 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
* @return int The number of affected rows (if supported by underlying database driver).
*/
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
* @return mixed The new primary key.
* @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)
{
if (null === $con) {
- $con = Propel::getServiceContainer()->getWriteConnection(DelivzoneTableMap::DATABASE_NAME);
+ $con = Propel::getServiceContainer()->getWriteConnection(AreaDeliveryModuleTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for clarity
} 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) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.DelivzoneTableMap::ID.')');
+ if ($criteria->containsKey(AreaDeliveryModuleTableMap::ID) && $criteria->keyContainsValue(AreaDeliveryModuleTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.AreaDeliveryModuleTableMap::ID.')');
}
// Set the correct dbName
- $query = DelivzoneQuery::create()->mergeWith($criteria);
+ $query = AreaDeliveryModuleQuery::create()->mergeWith($criteria);
try {
// use transaction because $criteria could contain info
@@ -441,7 +442,7 @@ class DelivzoneTableMap extends TableMap
return $pk;
}
-} // DelivzoneTableMap
+} // AreaDeliveryModuleTableMap
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
-DelivzoneTableMap::buildTableMap();
+AreaDeliveryModuleTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Map/AreaTableMap.php b/core/lib/Thelia/Model/Map/AreaTableMap.php
index 9dc308de5..3c1bc5ee4 100644
--- a/core/lib/Thelia/Model/Map/AreaTableMap.php
+++ b/core/lib/Thelia/Model/Map/AreaTableMap.php
@@ -80,9 +80,9 @@ class AreaTableMap extends TableMap
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
@@ -106,11 +106,11 @@ class AreaTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Name', 'Unit', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'name', 'unit', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(AreaTableMap::ID, AreaTableMap::NAME, AreaTableMap::UNIT, AreaTableMap::CREATED_AT, AreaTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'UNIT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'name', 'unit', 'created_at', 'updated_at', ),
+ self::TYPE_PHPNAME => array('Id', 'Name', 'Postage', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'name', 'postage', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(AreaTableMap::ID, AreaTableMap::NAME, AreaTableMap::POSTAGE, AreaTableMap::CREATED_AT, AreaTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'NAME', 'POSTAGE', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'name', 'postage', 'created_at', 'updated_at', ),
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
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Name' => 1, 'Unit' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'name' => 1, 'unit' => 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_RAW_COLNAME => array('ID' => 0, 'NAME' => 1, 'UNIT' => 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_PHPNAME => array('Id' => 0, 'Name' => 1, 'Postage' => 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::POSTAGE => 2, AreaTableMap::CREATED_AT => 3, AreaTableMap::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, 'postage' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
@@ -147,7 +147,7 @@ class AreaTableMap extends TableMap
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, 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('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -158,7 +158,7 @@ class AreaTableMap extends TableMap
public function buildRelations()
{
$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()
/**
@@ -181,7 +181,7 @@ class AreaTableMap extends TableMap
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CountryTableMap::clearInstancePool();
- DelivzoneTableMap::clearInstancePool();
+ AreaDeliveryModuleTableMap::clearInstancePool();
}
/**
@@ -324,13 +324,13 @@ class AreaTableMap extends TableMap
if (null === $alias) {
$criteria->addSelectColumn(AreaTableMap::ID);
$criteria->addSelectColumn(AreaTableMap::NAME);
- $criteria->addSelectColumn(AreaTableMap::UNIT);
+ $criteria->addSelectColumn(AreaTableMap::POSTAGE);
$criteria->addSelectColumn(AreaTableMap::CREATED_AT);
$criteria->addSelectColumn(AreaTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME');
- $criteria->addSelectColumn($alias . '.UNIT');
+ $criteria->addSelectColumn($alias . '.POSTAGE');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Map/ContentFolderTableMap.php b/core/lib/Thelia/Model/Map/ContentFolderTableMap.php
index 4fedae441..9808399ff 100644
--- a/core/lib/Thelia/Model/Map/ContentFolderTableMap.php
+++ b/core/lib/Thelia/Model/Map/ContentFolderTableMap.php
@@ -57,7 +57,7 @@ class ContentFolderTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 4;
+ const NUM_COLUMNS = 5;
/**
* 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)
*/
- const NUM_HYDRATE_COLUMNS = 4;
+ const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the CONTENT_ID field
@@ -79,6 +79,11 @@ class ContentFolderTableMap extends TableMap
*/
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
*/
@@ -101,12 +106,12 @@ class ContentFolderTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('ContentId', 'FolderId', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('contentId', 'folderId', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(ContentFolderTableMap::CONTENT_ID, ContentFolderTableMap::FOLDER_ID, ContentFolderTableMap::CREATED_AT, ContentFolderTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('CONTENT_ID', 'FOLDER_ID', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('content_id', 'folder_id', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, )
+ self::TYPE_PHPNAME => array('ContentId', 'FolderId', 'DefaultFolder', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('contentId', 'folderId', 'defaultFolder', 'createdAt', 'updatedAt', ),
+ 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', 'DEFAULT_FOLDER', '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, 4, )
);
/**
@@ -116,12 +121,12 @@ class ContentFolderTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('ContentId' => 0, 'FolderId' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ),
- self::TYPE_STUDLYPHPNAME => array('contentId' => 0, 'folderId' => 1, 'createdAt' => 2, 'updatedAt' => 3, ),
- self::TYPE_COLNAME => array(ContentFolderTableMap::CONTENT_ID => 0, ContentFolderTableMap::FOLDER_ID => 1, ContentFolderTableMap::CREATED_AT => 2, ContentFolderTableMap::UPDATED_AT => 3, ),
- self::TYPE_RAW_COLNAME => array('CONTENT_ID' => 0, 'FOLDER_ID' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ),
- self::TYPE_FIELDNAME => array('content_id' => 0, 'folder_id' => 1, 'created_at' => 2, 'updated_at' => 3, ),
- self::TYPE_NUM => array(0, 1, 2, 3, )
+ self::TYPE_PHPNAME => array('ContentId' => 0, 'FolderId' => 1, 'DefaultFolder' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
+ 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::DEFAULT_FOLDER => 2, ContentFolderTableMap::CREATED_AT => 3, ContentFolderTableMap::UPDATED_AT => 4, ),
+ 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, 'default_folder' => 2, 'created_at' => 3, 'updated_at' => 4, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -143,6 +148,7 @@ class ContentFolderTableMap extends TableMap
// columns
$this->addForeignPrimaryKey('CONTENT_ID', 'ContentId', 'INTEGER' , 'content', '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('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -358,11 +364,13 @@ class ContentFolderTableMap extends TableMap
if (null === $alias) {
$criteria->addSelectColumn(ContentFolderTableMap::CONTENT_ID);
$criteria->addSelectColumn(ContentFolderTableMap::FOLDER_ID);
+ $criteria->addSelectColumn(ContentFolderTableMap::DEFAULT_FOLDER);
$criteria->addSelectColumn(ContentFolderTableMap::CREATED_AT);
$criteria->addSelectColumn(ContentFolderTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.CONTENT_ID');
$criteria->addSelectColumn($alias . '.FOLDER_ID');
+ $criteria->addSelectColumn($alias . '.DEFAULT_FOLDER');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Map/ModuleTableMap.php b/core/lib/Thelia/Model/Map/ModuleTableMap.php
index 252cad5cf..1a2f63692 100644
--- a/core/lib/Thelia/Model/Map/ModuleTableMap.php
+++ b/core/lib/Thelia/Model/Map/ModuleTableMap.php
@@ -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('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('ModuleI18n', '\\Thelia\\Model\\ModuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ModuleI18ns');
} // buildRelations()
@@ -210,6 +211,7 @@ class ModuleTableMap extends TableMap
{
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ AreaDeliveryModuleTableMap::clearInstancePool();
GroupModuleTableMap::clearInstancePool();
ModuleI18nTableMap::clearInstancePool();
}
diff --git a/core/lib/Thelia/Model/Map/ProductCategoryTableMap.php b/core/lib/Thelia/Model/Map/ProductCategoryTableMap.php
index 6a8361f27..73c87ce9f 100644
--- a/core/lib/Thelia/Model/Map/ProductCategoryTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductCategoryTableMap.php
@@ -57,7 +57,7 @@ class ProductCategoryTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 4;
+ const NUM_COLUMNS = 5;
/**
* 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)
*/
- const NUM_HYDRATE_COLUMNS = 4;
+ const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the PRODUCT_ID field
@@ -79,6 +79,11 @@ class ProductCategoryTableMap extends TableMap
*/
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
*/
@@ -101,12 +106,12 @@ class ProductCategoryTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('ProductId', 'CategoryId', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('productId', 'categoryId', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(ProductCategoryTableMap::PRODUCT_ID, ProductCategoryTableMap::CATEGORY_ID, ProductCategoryTableMap::CREATED_AT, ProductCategoryTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('PRODUCT_ID', 'CATEGORY_ID', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('product_id', 'category_id', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, )
+ self::TYPE_PHPNAME => array('ProductId', 'CategoryId', 'DefaultCategory', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('productId', 'categoryId', 'defaultCategory', 'createdAt', 'updatedAt', ),
+ 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', 'DEFAULT_CATEGORY', '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, 4, )
);
/**
@@ -116,12 +121,12 @@ class ProductCategoryTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('ProductId' => 0, 'CategoryId' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ),
- self::TYPE_STUDLYPHPNAME => array('productId' => 0, 'categoryId' => 1, 'createdAt' => 2, 'updatedAt' => 3, ),
- self::TYPE_COLNAME => array(ProductCategoryTableMap::PRODUCT_ID => 0, ProductCategoryTableMap::CATEGORY_ID => 1, ProductCategoryTableMap::CREATED_AT => 2, ProductCategoryTableMap::UPDATED_AT => 3, ),
- self::TYPE_RAW_COLNAME => array('PRODUCT_ID' => 0, 'CATEGORY_ID' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ),
- self::TYPE_FIELDNAME => array('product_id' => 0, 'category_id' => 1, 'created_at' => 2, 'updated_at' => 3, ),
- self::TYPE_NUM => array(0, 1, 2, 3, )
+ self::TYPE_PHPNAME => array('ProductId' => 0, 'CategoryId' => 1, 'DefaultCategory' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
+ 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::DEFAULT_CATEGORY => 2, ProductCategoryTableMap::CREATED_AT => 3, ProductCategoryTableMap::UPDATED_AT => 4, ),
+ 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, 'default_category' => 2, 'created_at' => 3, 'updated_at' => 4, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -143,6 +148,7 @@ class ProductCategoryTableMap extends TableMap
// columns
$this->addForeignPrimaryKey('PRODUCT_ID', 'ProductId', 'INTEGER' , 'product', '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('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -358,11 +364,13 @@ class ProductCategoryTableMap extends TableMap
if (null === $alias) {
$criteria->addSelectColumn(ProductCategoryTableMap::PRODUCT_ID);
$criteria->addSelectColumn(ProductCategoryTableMap::CATEGORY_ID);
+ $criteria->addSelectColumn(ProductCategoryTableMap::DEFAULT_CATEGORY);
$criteria->addSelectColumn(ProductCategoryTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductCategoryTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.PRODUCT_ID');
$criteria->addSelectColumn($alias . '.CATEGORY_ID');
+ $criteria->addSelectColumn($alias . '.DEFAULT_CATEGORY');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/install/thelia.sql b/install/thelia.sql
index deb13f9d6..3d003091f 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -66,11 +66,13 @@ CREATE TABLE `product_category`
(
`product_id` INTEGER NOT NULL,
`category_id` INTEGER NOT NULL,
+ `default_category` TINYINT(1),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`product_id`,`category_id`),
INDEX `idx_product_has_category_category1` (`category_id`),
INDEX `idx_product_has_category_product1` (`product_id`),
+ INDEX `idx_product_has_category_default` (`default_category`),
CONSTRAINT `fk_product_has_category_product1`
FOREIGN KEY (`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_delivery_order_address_id` (`delivery_order_address_id`),
INDEX `idx_order_status_id` (`status_id`),
- INDEX `fk_order_payment_module_id` (`payment_module_id`),
- INDEX `fk_order_delivery_module_id` (`delivery_module_id`),
- INDEX `fk_order_lang_id` (`lang_id`),
+ INDEX `fk_order_payment_module_id_idx` (`payment_module_id`),
+ INDEX `fk_order_delivery_module_id_idx` (`delivery_module_id`),
+ INDEX `fk_order_lang_id_idx` (`lang_id`),
CONSTRAINT `fk_order_currency_id`
FOREIGN KEY (`currency_id`)
REFERENCES `currency` (`id`)
@@ -871,32 +873,38 @@ CREATE TABLE `area`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL,
- `unit` FLOAT,
+ `postage` FLOAT,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`)
) 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,
- `area_id` INTEGER,
- `delivery` VARCHAR(45) NOT NULL,
+ `area_id` INTEGER NOT NULL,
+ `delivery_module_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
- INDEX `idx_delivzone_area_id` (`area_id`),
- CONSTRAINT `fk_delivzone_area_id`
+ INDEX `idx_area_delivery_module_area_id` (`area_id`),
+ INDEX `idx_area_delivery_module_delivery_module_id` (`delivery_module_id`),
+ CONSTRAINT `fk_area_delivery_module_area_id`
FOREIGN KEY (`area_id`)
REFERENCES `area` (`id`)
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;
-- ---------------------------------------------------------------------
@@ -1147,11 +1155,13 @@ CREATE TABLE `content_folder`
(
`content_id` INTEGER NOT NULL,
`folder_id` INTEGER NOT NULL,
+ `default_folder` TINYINT(1),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`content_id`,`folder_id`),
INDEX `idx_content_folder_content_id` (`content_id`),
INDEX `idx_content_folder_folder_id` (`folder_id`),
+ INDEX `idx_content_folder_default` (`default_folder`),
CONSTRAINT `fk_content_folder_content_id`
FOREIGN KEY (`content_id`)
REFERENCES `content` (`id`)
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 01a1c5350..688fc1fa4 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -56,6 +56,7 @@