ChronopostHomeDeliveryAreaFreeshipping instance. If
+ * obj is an instance of ChronopostHomeDeliveryAreaFreeshipping, delegates to
+ * equals(ChronopostHomeDeliveryAreaFreeshipping). Otherwise, returns false.
+ *
+ * @param mixed $obj The object to compare to.
+ * @return boolean Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return mixed
+ *
+ * @throws PropelException
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return ChronopostHomeDeliveryAreaFreeshipping The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return ChronopostHomeDeliveryAreaFreeshipping The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+
+ return $this;
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [area_id] column value.
+ *
+ * @return int
+ */
+ public function getAreaId()
+ {
+
+ return $this->area_id;
+ }
+
+ /**
+ * Get the [delivery_mode_id] column value.
+ *
+ * @return int
+ */
+ public function getDeliveryModeId()
+ {
+
+ return $this->delivery_mode_id;
+ }
+
+ /**
+ * Get the [cart_amount] column value.
+ *
+ * @return string
+ */
+ public function getCartAmount()
+ {
+
+ return $this->cart_amount;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryAreaFreeshippingTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [area_id] column.
+ *
+ * @param int $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping The current object (for fluent API support)
+ */
+ public function setAreaId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->area_id !== $v) {
+ $this->area_id = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID] = true;
+ }
+
+ if ($this->aArea !== null && $this->aArea->getId() !== $v) {
+ $this->aArea = null;
+ }
+
+
+ return $this;
+ } // setAreaId()
+
+ /**
+ * Set the value of [delivery_mode_id] column.
+ *
+ * @param int $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping The current object (for fluent API support)
+ */
+ public function setDeliveryModeId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->delivery_mode_id !== $v) {
+ $this->delivery_mode_id = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID] = true;
+ }
+
+ if ($this->aChronopostHomeDeliveryDeliveryMode !== null && $this->aChronopostHomeDeliveryDeliveryMode->getId() !== $v) {
+ $this->aChronopostHomeDeliveryDeliveryMode = null;
+ }
+
+
+ return $this;
+ } // setDeliveryModeId()
+
+ /**
+ * Set the value of [cart_amount] column.
+ *
+ * @param string $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping The current object (for fluent API support)
+ */
+ public function setCartAmount($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->cart_amount !== $v) {
+ $this->cart_amount = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT] = true;
+ }
+
+
+ return $this;
+ } // setCartAmount()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->cart_amount !== '0.000000') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ChronopostHomeDeliveryAreaFreeshippingTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ChronopostHomeDeliveryAreaFreeshippingTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->area_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ChronopostHomeDeliveryAreaFreeshippingTableMap::translateFieldName('DeliveryModeId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->delivery_mode_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ChronopostHomeDeliveryAreaFreeshippingTableMap::translateFieldName('CartAmount', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->cart_amount = (null !== $col) ? (string) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 4; // 4 = ChronopostHomeDeliveryAreaFreeshippingTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) {
+ $this->aArea = null;
+ }
+ if ($this->aChronopostHomeDeliveryDeliveryMode !== null && $this->delivery_mode_id !== $this->aChronopostHomeDeliveryDeliveryMode->getId()) {
+ $this->aChronopostHomeDeliveryDeliveryMode = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildChronopostHomeDeliveryAreaFreeshippingQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aArea = null;
+ $this->aChronopostHomeDeliveryDeliveryMode = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see ChronopostHomeDeliveryAreaFreeshipping::setDeleted()
+ * @see ChronopostHomeDeliveryAreaFreeshipping::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildChronopostHomeDeliveryAreaFreeshippingQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ChronopostHomeDeliveryAreaFreeshippingTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aArea !== null) {
+ if ($this->aArea->isModified() || $this->aArea->isNew()) {
+ $affectedRows += $this->aArea->save($con);
+ }
+ $this->setArea($this->aArea);
+ }
+
+ if ($this->aChronopostHomeDeliveryDeliveryMode !== null) {
+ if ($this->aChronopostHomeDeliveryDeliveryMode->isModified() || $this->aChronopostHomeDeliveryDeliveryMode->isNew()) {
+ $affectedRows += $this->aChronopostHomeDeliveryDeliveryMode->save($con);
+ }
+ $this->setChronopostHomeDeliveryDeliveryMode($this->aChronopostHomeDeliveryDeliveryMode);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[ChronopostHomeDeliveryAreaFreeshippingTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . ChronopostHomeDeliveryAreaFreeshippingTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID)) {
+ $modifiedColumns[':p' . $index++] = 'AREA_ID';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID)) {
+ $modifiedColumns[':p' . $index++] = 'DELIVERY_MODE_ID';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT)) {
+ $modifiedColumns[':p' . $index++] = 'CART_AMOUNT';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO chronopost_home_delivery_area_freeshipping (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'AREA_ID':
+ $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT);
+ break;
+ case 'DELIVERY_MODE_ID':
+ $stmt->bindValue($identifier, $this->delivery_mode_id, PDO::PARAM_INT);
+ break;
+ case 'CART_AMOUNT':
+ $stmt->bindValue($identifier, $this->cart_amount, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = ChronopostHomeDeliveryAreaFreeshippingTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getAreaId();
+ break;
+ case 2:
+ return $this->getDeliveryModeId();
+ break;
+ case 3:
+ return $this->getCartAmount();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ChronopostHomeDeliveryAreaFreeshipping'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ChronopostHomeDeliveryAreaFreeshipping'][$this->getPrimaryKey()] = true;
+ $keys = ChronopostHomeDeliveryAreaFreeshippingTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getAreaId(),
+ $keys[2] => $this->getDeliveryModeId(),
+ $keys[3] => $this->getCartAmount(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aArea) {
+ $result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aChronopostHomeDeliveryDeliveryMode) {
+ $result['ChronopostHomeDeliveryDeliveryMode'] = $this->aChronopostHomeDeliveryDeliveryMode->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = ChronopostHomeDeliveryAreaFreeshippingTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setAreaId($value);
+ break;
+ case 2:
+ $this->setDeliveryModeId($value);
+ break;
+ case 3:
+ $this->setCartAmount($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = ChronopostHomeDeliveryAreaFreeshippingTableMap::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->setDeliveryModeId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setCartAmount($arr[$keys[3]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID)) $criteria->add(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $this->id);
+ if ($this->isColumnModified(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID)) $criteria->add(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $this->area_id);
+ if ($this->isColumnModified(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID)) $criteria->add(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $this->delivery_mode_id);
+ if ($this->isColumnModified(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT)) $criteria->add(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT, $this->cart_amount);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ $criteria->add(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping (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
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setAreaId($this->getAreaId());
+ $copyObj->setDeliveryModeId($this->getDeliveryModeId());
+ $copyObj->setCartAmount($this->getCartAmount());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Declares an association between this object and a ChildArea object.
+ *
+ * @param ChildArea $v
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setArea(ChildArea $v = null)
+ {
+ if ($v === null) {
+ $this->setAreaId(NULL);
+ } else {
+ $this->setAreaId($v->getId());
+ }
+
+ $this->aArea = $v;
+
+ // 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->addChronopostHomeDeliveryAreaFreeshipping($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildArea object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildArea The associated ChildArea object.
+ * @throws PropelException
+ */
+ public function getArea(ConnectionInterface $con = null)
+ {
+ if ($this->aArea === null && ($this->area_id !== null)) {
+ $this->aArea = AreaQuery::create()->findPk($this->area_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->aArea->addChronopostHomeDeliveryAreaFreeshippings($this);
+ */
+ }
+
+ return $this->aArea;
+ }
+
+ /**
+ * Declares an association between this object and a ChildChronopostHomeDeliveryDeliveryMode object.
+ *
+ * @param ChildChronopostHomeDeliveryDeliveryMode $v
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setChronopostHomeDeliveryDeliveryMode(ChildChronopostHomeDeliveryDeliveryMode $v = null)
+ {
+ if ($v === null) {
+ $this->setDeliveryModeId(NULL);
+ } else {
+ $this->setDeliveryModeId($v->getId());
+ }
+
+ $this->aChronopostHomeDeliveryDeliveryMode = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildChronopostHomeDeliveryDeliveryMode object, it will not be re-added.
+ if ($v !== null) {
+ $v->addChronopostHomeDeliveryAreaFreeshipping($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildChronopostHomeDeliveryDeliveryMode object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildChronopostHomeDeliveryDeliveryMode The associated ChildChronopostHomeDeliveryDeliveryMode object.
+ * @throws PropelException
+ */
+ public function getChronopostHomeDeliveryDeliveryMode(ConnectionInterface $con = null)
+ {
+ if ($this->aChronopostHomeDeliveryDeliveryMode === null && ($this->delivery_mode_id !== null)) {
+ $this->aChronopostHomeDeliveryDeliveryMode = ChildChronopostHomeDeliveryDeliveryModeQuery::create()->findPk($this->delivery_mode_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->aChronopostHomeDeliveryDeliveryMode->addChronopostHomeDeliveryAreaFreeshippings($this);
+ */
+ }
+
+ return $this->aChronopostHomeDeliveryDeliveryMode;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->area_id = null;
+ $this->delivery_mode_id = null;
+ $this->cart_amount = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aArea = null;
+ $this->aChronopostHomeDeliveryDeliveryMode = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ChronopostHomeDeliveryAreaFreeshippingTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryAreaFreeshippingQuery.php b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryAreaFreeshippingQuery.php
new file mode 100644
index 00000000..888e4371
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryAreaFreeshippingQuery.php
@@ -0,0 +1,645 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildChronopostHomeDeliveryAreaFreeshipping|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ChronopostHomeDeliveryAreaFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con A connection object
+ *
+ * @return ChildChronopostHomeDeliveryAreaFreeshipping A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, AREA_ID, DELIVERY_MODE_ID, CART_AMOUNT FROM chronopost_home_delivery_area_freeshipping WHERE ID = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
+ $obj = new ChildChronopostHomeDeliveryAreaFreeshipping();
+ $obj->hydrate($row);
+ ChronopostHomeDeliveryAreaFreeshippingTableMap::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con A connection object
+ *
+ * @return ChildChronopostHomeDeliveryAreaFreeshipping|array|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @param mixed $id 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 ChildChronopostHomeDeliveryAreaFreeshippingQuery 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(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the area_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByAreaId(1234); // WHERE area_id = 1234
+ * $query->filterByAreaId(array(12, 34)); // WHERE area_id IN (12, 34)
+ * $query->filterByAreaId(array('min' => 12)); // WHERE area_id > 12
+ *
+ *
+ * @see filterByArea()
+ *
+ * @param mixed $areaId 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 ChildChronopostHomeDeliveryAreaFreeshippingQuery 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(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($areaId['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $areaId, $comparison);
+ }
+
+ /**
+ * Filter the query on the delivery_mode_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDeliveryModeId(1234); // WHERE delivery_mode_id = 1234
+ * $query->filterByDeliveryModeId(array(12, 34)); // WHERE delivery_mode_id IN (12, 34)
+ * $query->filterByDeliveryModeId(array('min' => 12)); // WHERE delivery_mode_id > 12
+ *
+ *
+ * @see filterByChronopostHomeDeliveryDeliveryMode()
+ *
+ * @param mixed $deliveryModeId 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 ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
+ */
+ public function filterByDeliveryModeId($deliveryModeId = null, $comparison = null)
+ {
+ if (is_array($deliveryModeId)) {
+ $useMinMax = false;
+ if (isset($deliveryModeId['min'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $deliveryModeId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($deliveryModeId['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $deliveryModeId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $deliveryModeId, $comparison);
+ }
+
+ /**
+ * Filter the query on the cart_amount column
+ *
+ * Example usage:
+ *
+ * $query->filterByCartAmount(1234); // WHERE cart_amount = 1234
+ * $query->filterByCartAmount(array(12, 34)); // WHERE cart_amount IN (12, 34)
+ * $query->filterByCartAmount(array('min' => 12)); // WHERE cart_amount > 12
+ *
+ *
+ * @param mixed $cartAmount 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 ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
+ */
+ public function filterByCartAmount($cartAmount = null, $comparison = null)
+ {
+ if (is_array($cartAmount)) {
+ $useMinMax = false;
+ if (isset($cartAmount['min'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($cartAmount['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \ChronopostHomeDelivery\Model\Thelia\Model\Area object
+ *
+ * @param \ChronopostHomeDelivery\Model\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 ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
+ */
+ public function filterByArea($area, $comparison = null)
+ {
+ if ($area instanceof \ChronopostHomeDelivery\Model\Thelia\Model\Area) {
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $area->getId(), $comparison);
+ } elseif ($area instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByArea() only accepts arguments of type \ChronopostHomeDelivery\Model\Thelia\Model\Area or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Area relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
+ */
+ public function joinArea($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Area');
+
+ // 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, 'Area');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Area relation Area 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 \ChronopostHomeDelivery\Model\Thelia\Model\AreaQuery A secondary query class using the current class as primary query
+ */
+ public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinArea($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Area', '\ChronopostHomeDelivery\Model\Thelia\Model\AreaQuery');
+ }
+
+ /**
+ * Filter the query by a related \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode object
+ *
+ * @param \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode|ObjectCollection $chronopostHomeDeliveryDeliveryMode The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
+ */
+ public function filterByChronopostHomeDeliveryDeliveryMode($chronopostHomeDeliveryDeliveryMode, $comparison = null)
+ {
+ if ($chronopostHomeDeliveryDeliveryMode instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode) {
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $chronopostHomeDeliveryDeliveryMode->getId(), $comparison);
+ } elseif ($chronopostHomeDeliveryDeliveryMode instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, $chronopostHomeDeliveryDeliveryMode->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByChronopostHomeDeliveryDeliveryMode() only accepts arguments of type \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the ChronopostHomeDeliveryDeliveryMode relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
+ */
+ public function joinChronopostHomeDeliveryDeliveryMode($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('ChronopostHomeDeliveryDeliveryMode');
+
+ // 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, 'ChronopostHomeDeliveryDeliveryMode');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the ChronopostHomeDeliveryDeliveryMode relation ChronopostHomeDeliveryDeliveryMode 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 \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery A secondary query class using the current class as primary query
+ */
+ public function useChronopostHomeDeliveryDeliveryModeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinChronopostHomeDeliveryDeliveryMode($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ChronopostHomeDeliveryDeliveryMode', '\ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildChronopostHomeDeliveryAreaFreeshipping $chronopostHomeDeliveryAreaFreeshipping Object to remove from the list of results
+ *
+ * @return ChildChronopostHomeDeliveryAreaFreeshippingQuery The current query, for fluid interface
+ */
+ public function prune($chronopostHomeDeliveryAreaFreeshipping = null)
+ {
+ if ($chronopostHomeDeliveryAreaFreeshipping) {
+ $this->addUsingAlias(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, $chronopostHomeDeliveryAreaFreeshipping->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the chronopost_home_delivery_area_freeshipping table.
+ *
+ * @param ConnectionInterface $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public function doDeleteAll(ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += parent::doDeleteAll($con);
+ // 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).
+ ChronopostHomeDeliveryAreaFreeshippingTableMap::clearInstancePool();
+ ChronopostHomeDeliveryAreaFreeshippingTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildChronopostHomeDeliveryAreaFreeshipping or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildChronopostHomeDeliveryAreaFreeshipping 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
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+
+ ChronopostHomeDeliveryAreaFreeshippingTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ ChronopostHomeDeliveryAreaFreeshippingTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // ChronopostHomeDeliveryAreaFreeshippingQuery
diff --git a/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryDeliveryMode.php b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryDeliveryMode.php
new file mode 100644
index 00000000..0f9f86b1
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryDeliveryMode.php
@@ -0,0 +1,1906 @@
+modifiedColumns;
+ }
+
+ /**
+ * Has specified column been modified?
+ *
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @return boolean True if $col has been modified.
+ */
+ public function isColumnModified($col)
+ {
+ return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
+ }
+
+ /**
+ * Get the columns that have been modified in this object.
+ * @return array A unique list of the modified column names for this object.
+ */
+ public function getModifiedColumns()
+ {
+ return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
+ }
+
+ /**
+ * Returns whether the object has ever been saved. This will
+ * be false, if the object was retrieved from storage or was created
+ * and then saved.
+ *
+ * @return boolean true, if the object has never been persisted.
+ */
+ public function isNew()
+ {
+ return $this->new;
+ }
+
+ /**
+ * Setter for the isNew attribute. This method will be called
+ * by Propel-generated children and objects.
+ *
+ * @param boolean $b the state of the object.
+ */
+ public function setNew($b)
+ {
+ $this->new = (Boolean) $b;
+ }
+
+ /**
+ * Whether this object has been deleted.
+ * @return boolean The deleted state of this object.
+ */
+ public function isDeleted()
+ {
+ return $this->deleted;
+ }
+
+ /**
+ * Specify whether this object has been deleted.
+ * @param boolean $b The deleted state of this object.
+ * @return void
+ */
+ public function setDeleted($b)
+ {
+ $this->deleted = (Boolean) $b;
+ }
+
+ /**
+ * Sets the modified state for the object to be false.
+ * @param string $col If supplied, only the specified column is reset.
+ * @return void
+ */
+ public function resetModified($col = null)
+ {
+ if (null !== $col) {
+ if (isset($this->modifiedColumns[$col])) {
+ unset($this->modifiedColumns[$col]);
+ }
+ } else {
+ $this->modifiedColumns = array();
+ }
+ }
+
+ /**
+ * Compares this with another ChronopostHomeDeliveryDeliveryMode instance. If
+ * obj is an instance of ChronopostHomeDeliveryDeliveryMode, delegates to
+ * equals(ChronopostHomeDeliveryDeliveryMode). Otherwise, returns false.
+ *
+ * @param mixed $obj The object to compare to.
+ * @return boolean Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return mixed
+ *
+ * @throws PropelException
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return ChronopostHomeDeliveryDeliveryMode The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return ChronopostHomeDeliveryDeliveryMode The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+
+ return $this;
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+
+ return $this->title;
+ }
+
+ /**
+ * Get the [code] column value.
+ *
+ * @return string
+ */
+ public function getCode()
+ {
+
+ return $this->code;
+ }
+
+ /**
+ * Get the [freeshipping_active] column value.
+ *
+ * @return boolean
+ */
+ public function getFreeshippingActive()
+ {
+
+ return $this->freeshipping_active;
+ }
+
+ /**
+ * Get the [freeshipping_from] column value.
+ *
+ * @return double
+ */
+ public function getFreeshippingFrom()
+ {
+
+ return $this->freeshipping_from;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryDeliveryModeTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryDeliveryModeTableMap::TITLE] = true;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [code] column.
+ *
+ * @param string $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function setCode($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->code !== $v) {
+ $this->code = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryDeliveryModeTableMap::CODE] = true;
+ }
+
+
+ return $this;
+ } // setCode()
+
+ /**
+ * Sets the value of the [freeshipping_active] 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 \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function setFreeshippingActive($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->freeshipping_active !== $v) {
+ $this->freeshipping_active = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE] = true;
+ }
+
+
+ return $this;
+ } // setFreeshippingActive()
+
+ /**
+ * Set the value of [freeshipping_from] column.
+ *
+ * @param double $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function setFreeshippingFrom($v)
+ {
+ if ($v !== null) {
+ $v = (double) $v;
+ }
+
+ if ($this->freeshipping_from !== $v) {
+ $this->freeshipping_from = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM] = true;
+ }
+
+
+ return $this;
+ } // setFreeshippingFrom()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ChronopostHomeDeliveryDeliveryModeTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ChronopostHomeDeliveryDeliveryModeTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->title = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ChronopostHomeDeliveryDeliveryModeTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->code = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ChronopostHomeDeliveryDeliveryModeTableMap::translateFieldName('FreeshippingActive', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->freeshipping_active = (null !== $col) ? (boolean) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ChronopostHomeDeliveryDeliveryModeTableMap::translateFieldName('FreeshippingFrom', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->freeshipping_from = (null !== $col) ? (double) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 5; // 5 = ChronopostHomeDeliveryDeliveryModeTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildChronopostHomeDeliveryDeliveryModeQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->collChronopostHomeDeliveryPrices = null;
+
+ $this->collChronopostHomeDeliveryAreaFreeshippings = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see ChronopostHomeDeliveryDeliveryMode::setDeleted()
+ * @see ChronopostHomeDeliveryDeliveryMode::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildChronopostHomeDeliveryDeliveryModeQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ChronopostHomeDeliveryDeliveryModeTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->chronopostHomeDeliveryPricesScheduledForDeletion !== null) {
+ if (!$this->chronopostHomeDeliveryPricesScheduledForDeletion->isEmpty()) {
+ \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery::create()
+ ->filterByPrimaryKeys($this->chronopostHomeDeliveryPricesScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->chronopostHomeDeliveryPricesScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collChronopostHomeDeliveryPrices !== null) {
+ foreach ($this->collChronopostHomeDeliveryPrices as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->chronopostHomeDeliveryAreaFreeshippingsScheduledForDeletion !== null) {
+ if (!$this->chronopostHomeDeliveryAreaFreeshippingsScheduledForDeletion->isEmpty()) {
+ \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery::create()
+ ->filterByPrimaryKeys($this->chronopostHomeDeliveryAreaFreeshippingsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->chronopostHomeDeliveryAreaFreeshippingsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collChronopostHomeDeliveryAreaFreeshippings !== null) {
+ foreach ($this->collChronopostHomeDeliveryAreaFreeshippings as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[ChronopostHomeDeliveryDeliveryModeTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . ChronopostHomeDeliveryDeliveryModeTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ChronopostHomeDeliveryDeliveryModeTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryDeliveryModeTableMap::TITLE)) {
+ $modifiedColumns[':p' . $index++] = 'TITLE';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryDeliveryModeTableMap::CODE)) {
+ $modifiedColumns[':p' . $index++] = 'CODE';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE)) {
+ $modifiedColumns[':p' . $index++] = 'FREESHIPPING_ACTIVE';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM)) {
+ $modifiedColumns[':p' . $index++] = 'FREESHIPPING_FROM';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO chronopost_home_delivery_delivery_mode (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'TITLE':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case 'CODE':
+ $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR);
+ break;
+ case 'FREESHIPPING_ACTIVE':
+ $stmt->bindValue($identifier, (int) $this->freeshipping_active, PDO::PARAM_INT);
+ break;
+ case 'FREESHIPPING_FROM':
+ $stmt->bindValue($identifier, $this->freeshipping_from, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = ChronopostHomeDeliveryDeliveryModeTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getTitle();
+ break;
+ case 2:
+ return $this->getCode();
+ break;
+ case 3:
+ return $this->getFreeshippingActive();
+ break;
+ case 4:
+ return $this->getFreeshippingFrom();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ChronopostHomeDeliveryDeliveryMode'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ChronopostHomeDeliveryDeliveryMode'][$this->getPrimaryKey()] = true;
+ $keys = ChronopostHomeDeliveryDeliveryModeTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getTitle(),
+ $keys[2] => $this->getCode(),
+ $keys[3] => $this->getFreeshippingActive(),
+ $keys[4] => $this->getFreeshippingFrom(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->collChronopostHomeDeliveryPrices) {
+ $result['ChronopostHomeDeliveryPrices'] = $this->collChronopostHomeDeliveryPrices->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collChronopostHomeDeliveryAreaFreeshippings) {
+ $result['ChronopostHomeDeliveryAreaFreeshippings'] = $this->collChronopostHomeDeliveryAreaFreeshippings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = ChronopostHomeDeliveryDeliveryModeTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setTitle($value);
+ break;
+ case 2:
+ $this->setCode($value);
+ break;
+ case 3:
+ $this->setFreeshippingActive($value);
+ break;
+ case 4:
+ $this->setFreeshippingFrom($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = ChronopostHomeDeliveryDeliveryModeTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setTitle($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setFreeshippingActive($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setFreeshippingFrom($arr[$keys[4]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(ChronopostHomeDeliveryDeliveryModeTableMap::ID)) $criteria->add(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $this->id);
+ if ($this->isColumnModified(ChronopostHomeDeliveryDeliveryModeTableMap::TITLE)) $criteria->add(ChronopostHomeDeliveryDeliveryModeTableMap::TITLE, $this->title);
+ if ($this->isColumnModified(ChronopostHomeDeliveryDeliveryModeTableMap::CODE)) $criteria->add(ChronopostHomeDeliveryDeliveryModeTableMap::CODE, $this->code);
+ if ($this->isColumnModified(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE)) $criteria->add(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE, $this->freeshipping_active);
+ if ($this->isColumnModified(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM)) $criteria->add(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM, $this->freeshipping_from);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ $criteria->add(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode (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
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setCode($this->getCode());
+ $copyObj->setFreeshippingActive($this->getFreeshippingActive());
+ $copyObj->setFreeshippingFrom($this->getFreeshippingFrom());
+
+ if ($deepCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+
+ foreach ($this->getChronopostHomeDeliveryPrices() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addChronopostHomeDeliveryPrice($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getChronopostHomeDeliveryAreaFreeshippings() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addChronopostHomeDeliveryAreaFreeshipping($relObj->copy($deepCopy));
+ }
+ }
+
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('ChronopostHomeDeliveryPrice' == $relationName) {
+ return $this->initChronopostHomeDeliveryPrices();
+ }
+ if ('ChronopostHomeDeliveryAreaFreeshipping' == $relationName) {
+ return $this->initChronopostHomeDeliveryAreaFreeshippings();
+ }
+ }
+
+ /**
+ * Clears out the collChronopostHomeDeliveryPrices 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 addChronopostHomeDeliveryPrices()
+ */
+ public function clearChronopostHomeDeliveryPrices()
+ {
+ $this->collChronopostHomeDeliveryPrices = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collChronopostHomeDeliveryPrices collection loaded partially.
+ */
+ public function resetPartialChronopostHomeDeliveryPrices($v = true)
+ {
+ $this->collChronopostHomeDeliveryPricesPartial = $v;
+ }
+
+ /**
+ * Initializes the collChronopostHomeDeliveryPrices collection.
+ *
+ * By default this just sets the collChronopostHomeDeliveryPrices collection to an empty array (like clearcollChronopostHomeDeliveryPrices());
+ * 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 initChronopostHomeDeliveryPrices($overrideExisting = true)
+ {
+ if (null !== $this->collChronopostHomeDeliveryPrices && !$overrideExisting) {
+ return;
+ }
+ $this->collChronopostHomeDeliveryPrices = new ObjectCollection();
+ $this->collChronopostHomeDeliveryPrices->setModel('\ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice');
+ }
+
+ /**
+ * Gets an array of ChildChronopostHomeDeliveryPrice 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 ChildChronopostHomeDeliveryDeliveryMode 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|ChildChronopostHomeDeliveryPrice[] List of ChildChronopostHomeDeliveryPrice objects
+ * @throws PropelException
+ */
+ public function getChronopostHomeDeliveryPrices($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collChronopostHomeDeliveryPricesPartial && !$this->isNew();
+ if (null === $this->collChronopostHomeDeliveryPrices || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collChronopostHomeDeliveryPrices) {
+ // return empty collection
+ $this->initChronopostHomeDeliveryPrices();
+ } else {
+ $collChronopostHomeDeliveryPrices = ChildChronopostHomeDeliveryPriceQuery::create(null, $criteria)
+ ->filterByChronopostHomeDeliveryDeliveryMode($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collChronopostHomeDeliveryPricesPartial && count($collChronopostHomeDeliveryPrices)) {
+ $this->initChronopostHomeDeliveryPrices(false);
+
+ foreach ($collChronopostHomeDeliveryPrices as $obj) {
+ if (false == $this->collChronopostHomeDeliveryPrices->contains($obj)) {
+ $this->collChronopostHomeDeliveryPrices->append($obj);
+ }
+ }
+
+ $this->collChronopostHomeDeliveryPricesPartial = true;
+ }
+
+ reset($collChronopostHomeDeliveryPrices);
+
+ return $collChronopostHomeDeliveryPrices;
+ }
+
+ if ($partial && $this->collChronopostHomeDeliveryPrices) {
+ foreach ($this->collChronopostHomeDeliveryPrices as $obj) {
+ if ($obj->isNew()) {
+ $collChronopostHomeDeliveryPrices[] = $obj;
+ }
+ }
+ }
+
+ $this->collChronopostHomeDeliveryPrices = $collChronopostHomeDeliveryPrices;
+ $this->collChronopostHomeDeliveryPricesPartial = false;
+ }
+ }
+
+ return $this->collChronopostHomeDeliveryPrices;
+ }
+
+ /**
+ * Sets a collection of ChronopostHomeDeliveryPrice 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 $chronopostHomeDeliveryPrices A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function setChronopostHomeDeliveryPrices(Collection $chronopostHomeDeliveryPrices, ConnectionInterface $con = null)
+ {
+ $chronopostHomeDeliveryPricesToDelete = $this->getChronopostHomeDeliveryPrices(new Criteria(), $con)->diff($chronopostHomeDeliveryPrices);
+
+
+ $this->chronopostHomeDeliveryPricesScheduledForDeletion = $chronopostHomeDeliveryPricesToDelete;
+
+ foreach ($chronopostHomeDeliveryPricesToDelete as $chronopostHomeDeliveryPriceRemoved) {
+ $chronopostHomeDeliveryPriceRemoved->setChronopostHomeDeliveryDeliveryMode(null);
+ }
+
+ $this->collChronopostHomeDeliveryPrices = null;
+ foreach ($chronopostHomeDeliveryPrices as $chronopostHomeDeliveryPrice) {
+ $this->addChronopostHomeDeliveryPrice($chronopostHomeDeliveryPrice);
+ }
+
+ $this->collChronopostHomeDeliveryPrices = $chronopostHomeDeliveryPrices;
+ $this->collChronopostHomeDeliveryPricesPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related ChronopostHomeDeliveryPrice objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related ChronopostHomeDeliveryPrice objects.
+ * @throws PropelException
+ */
+ public function countChronopostHomeDeliveryPrices(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collChronopostHomeDeliveryPricesPartial && !$this->isNew();
+ if (null === $this->collChronopostHomeDeliveryPrices || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collChronopostHomeDeliveryPrices) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getChronopostHomeDeliveryPrices());
+ }
+
+ $query = ChildChronopostHomeDeliveryPriceQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByChronopostHomeDeliveryDeliveryMode($this)
+ ->count($con);
+ }
+
+ return count($this->collChronopostHomeDeliveryPrices);
+ }
+
+ /**
+ * Method called to associate a ChildChronopostHomeDeliveryPrice object to this object
+ * through the ChildChronopostHomeDeliveryPrice foreign key attribute.
+ *
+ * @param ChildChronopostHomeDeliveryPrice $l ChildChronopostHomeDeliveryPrice
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function addChronopostHomeDeliveryPrice(ChildChronopostHomeDeliveryPrice $l)
+ {
+ if ($this->collChronopostHomeDeliveryPrices === null) {
+ $this->initChronopostHomeDeliveryPrices();
+ $this->collChronopostHomeDeliveryPricesPartial = true;
+ }
+
+ if (!in_array($l, $this->collChronopostHomeDeliveryPrices->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddChronopostHomeDeliveryPrice($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param ChronopostHomeDeliveryPrice $chronopostHomeDeliveryPrice The chronopostHomeDeliveryPrice object to add.
+ */
+ protected function doAddChronopostHomeDeliveryPrice($chronopostHomeDeliveryPrice)
+ {
+ $this->collChronopostHomeDeliveryPrices[]= $chronopostHomeDeliveryPrice;
+ $chronopostHomeDeliveryPrice->setChronopostHomeDeliveryDeliveryMode($this);
+ }
+
+ /**
+ * @param ChronopostHomeDeliveryPrice $chronopostHomeDeliveryPrice The chronopostHomeDeliveryPrice object to remove.
+ * @return ChildChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function removeChronopostHomeDeliveryPrice($chronopostHomeDeliveryPrice)
+ {
+ if ($this->getChronopostHomeDeliveryPrices()->contains($chronopostHomeDeliveryPrice)) {
+ $this->collChronopostHomeDeliveryPrices->remove($this->collChronopostHomeDeliveryPrices->search($chronopostHomeDeliveryPrice));
+ if (null === $this->chronopostHomeDeliveryPricesScheduledForDeletion) {
+ $this->chronopostHomeDeliveryPricesScheduledForDeletion = clone $this->collChronopostHomeDeliveryPrices;
+ $this->chronopostHomeDeliveryPricesScheduledForDeletion->clear();
+ }
+ $this->chronopostHomeDeliveryPricesScheduledForDeletion[]= clone $chronopostHomeDeliveryPrice;
+ $chronopostHomeDeliveryPrice->setChronopostHomeDeliveryDeliveryMode(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this ChronopostHomeDeliveryDeliveryMode is new, it will return
+ * an empty collection; or if this ChronopostHomeDeliveryDeliveryMode has previously
+ * been saved, it will retrieve related ChronopostHomeDeliveryPrices 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 ChronopostHomeDeliveryDeliveryMode.
+ *
+ * @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|ChildChronopostHomeDeliveryPrice[] List of ChildChronopostHomeDeliveryPrice objects
+ */
+ public function getChronopostHomeDeliveryPricesJoinArea($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildChronopostHomeDeliveryPriceQuery::create(null, $criteria);
+ $query->joinWith('Area', $joinBehavior);
+
+ return $this->getChronopostHomeDeliveryPrices($query, $con);
+ }
+
+ /**
+ * Clears out the collChronopostHomeDeliveryAreaFreeshippings 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 addChronopostHomeDeliveryAreaFreeshippings()
+ */
+ public function clearChronopostHomeDeliveryAreaFreeshippings()
+ {
+ $this->collChronopostHomeDeliveryAreaFreeshippings = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collChronopostHomeDeliveryAreaFreeshippings collection loaded partially.
+ */
+ public function resetPartialChronopostHomeDeliveryAreaFreeshippings($v = true)
+ {
+ $this->collChronopostHomeDeliveryAreaFreeshippingsPartial = $v;
+ }
+
+ /**
+ * Initializes the collChronopostHomeDeliveryAreaFreeshippings collection.
+ *
+ * By default this just sets the collChronopostHomeDeliveryAreaFreeshippings collection to an empty array (like clearcollChronopostHomeDeliveryAreaFreeshippings());
+ * 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 initChronopostHomeDeliveryAreaFreeshippings($overrideExisting = true)
+ {
+ if (null !== $this->collChronopostHomeDeliveryAreaFreeshippings && !$overrideExisting) {
+ return;
+ }
+ $this->collChronopostHomeDeliveryAreaFreeshippings = new ObjectCollection();
+ $this->collChronopostHomeDeliveryAreaFreeshippings->setModel('\ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping');
+ }
+
+ /**
+ * Gets an array of ChildChronopostHomeDeliveryAreaFreeshipping 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 ChildChronopostHomeDeliveryDeliveryMode 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|ChildChronopostHomeDeliveryAreaFreeshipping[] List of ChildChronopostHomeDeliveryAreaFreeshipping objects
+ * @throws PropelException
+ */
+ public function getChronopostHomeDeliveryAreaFreeshippings($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collChronopostHomeDeliveryAreaFreeshippingsPartial && !$this->isNew();
+ if (null === $this->collChronopostHomeDeliveryAreaFreeshippings || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collChronopostHomeDeliveryAreaFreeshippings) {
+ // return empty collection
+ $this->initChronopostHomeDeliveryAreaFreeshippings();
+ } else {
+ $collChronopostHomeDeliveryAreaFreeshippings = ChildChronopostHomeDeliveryAreaFreeshippingQuery::create(null, $criteria)
+ ->filterByChronopostHomeDeliveryDeliveryMode($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collChronopostHomeDeliveryAreaFreeshippingsPartial && count($collChronopostHomeDeliveryAreaFreeshippings)) {
+ $this->initChronopostHomeDeliveryAreaFreeshippings(false);
+
+ foreach ($collChronopostHomeDeliveryAreaFreeshippings as $obj) {
+ if (false == $this->collChronopostHomeDeliveryAreaFreeshippings->contains($obj)) {
+ $this->collChronopostHomeDeliveryAreaFreeshippings->append($obj);
+ }
+ }
+
+ $this->collChronopostHomeDeliveryAreaFreeshippingsPartial = true;
+ }
+
+ reset($collChronopostHomeDeliveryAreaFreeshippings);
+
+ return $collChronopostHomeDeliveryAreaFreeshippings;
+ }
+
+ if ($partial && $this->collChronopostHomeDeliveryAreaFreeshippings) {
+ foreach ($this->collChronopostHomeDeliveryAreaFreeshippings as $obj) {
+ if ($obj->isNew()) {
+ $collChronopostHomeDeliveryAreaFreeshippings[] = $obj;
+ }
+ }
+ }
+
+ $this->collChronopostHomeDeliveryAreaFreeshippings = $collChronopostHomeDeliveryAreaFreeshippings;
+ $this->collChronopostHomeDeliveryAreaFreeshippingsPartial = false;
+ }
+ }
+
+ return $this->collChronopostHomeDeliveryAreaFreeshippings;
+ }
+
+ /**
+ * Sets a collection of ChronopostHomeDeliveryAreaFreeshipping 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 $chronopostHomeDeliveryAreaFreeshippings A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function setChronopostHomeDeliveryAreaFreeshippings(Collection $chronopostHomeDeliveryAreaFreeshippings, ConnectionInterface $con = null)
+ {
+ $chronopostHomeDeliveryAreaFreeshippingsToDelete = $this->getChronopostHomeDeliveryAreaFreeshippings(new Criteria(), $con)->diff($chronopostHomeDeliveryAreaFreeshippings);
+
+
+ $this->chronopostHomeDeliveryAreaFreeshippingsScheduledForDeletion = $chronopostHomeDeliveryAreaFreeshippingsToDelete;
+
+ foreach ($chronopostHomeDeliveryAreaFreeshippingsToDelete as $chronopostHomeDeliveryAreaFreeshippingRemoved) {
+ $chronopostHomeDeliveryAreaFreeshippingRemoved->setChronopostHomeDeliveryDeliveryMode(null);
+ }
+
+ $this->collChronopostHomeDeliveryAreaFreeshippings = null;
+ foreach ($chronopostHomeDeliveryAreaFreeshippings as $chronopostHomeDeliveryAreaFreeshipping) {
+ $this->addChronopostHomeDeliveryAreaFreeshipping($chronopostHomeDeliveryAreaFreeshipping);
+ }
+
+ $this->collChronopostHomeDeliveryAreaFreeshippings = $chronopostHomeDeliveryAreaFreeshippings;
+ $this->collChronopostHomeDeliveryAreaFreeshippingsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related ChronopostHomeDeliveryAreaFreeshipping objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related ChronopostHomeDeliveryAreaFreeshipping objects.
+ * @throws PropelException
+ */
+ public function countChronopostHomeDeliveryAreaFreeshippings(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collChronopostHomeDeliveryAreaFreeshippingsPartial && !$this->isNew();
+ if (null === $this->collChronopostHomeDeliveryAreaFreeshippings || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collChronopostHomeDeliveryAreaFreeshippings) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getChronopostHomeDeliveryAreaFreeshippings());
+ }
+
+ $query = ChildChronopostHomeDeliveryAreaFreeshippingQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByChronopostHomeDeliveryDeliveryMode($this)
+ ->count($con);
+ }
+
+ return count($this->collChronopostHomeDeliveryAreaFreeshippings);
+ }
+
+ /**
+ * Method called to associate a ChildChronopostHomeDeliveryAreaFreeshipping object to this object
+ * through the ChildChronopostHomeDeliveryAreaFreeshipping foreign key attribute.
+ *
+ * @param ChildChronopostHomeDeliveryAreaFreeshipping $l ChildChronopostHomeDeliveryAreaFreeshipping
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function addChronopostHomeDeliveryAreaFreeshipping(ChildChronopostHomeDeliveryAreaFreeshipping $l)
+ {
+ if ($this->collChronopostHomeDeliveryAreaFreeshippings === null) {
+ $this->initChronopostHomeDeliveryAreaFreeshippings();
+ $this->collChronopostHomeDeliveryAreaFreeshippingsPartial = true;
+ }
+
+ if (!in_array($l, $this->collChronopostHomeDeliveryAreaFreeshippings->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddChronopostHomeDeliveryAreaFreeshipping($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param ChronopostHomeDeliveryAreaFreeshipping $chronopostHomeDeliveryAreaFreeshipping The chronopostHomeDeliveryAreaFreeshipping object to add.
+ */
+ protected function doAddChronopostHomeDeliveryAreaFreeshipping($chronopostHomeDeliveryAreaFreeshipping)
+ {
+ $this->collChronopostHomeDeliveryAreaFreeshippings[]= $chronopostHomeDeliveryAreaFreeshipping;
+ $chronopostHomeDeliveryAreaFreeshipping->setChronopostHomeDeliveryDeliveryMode($this);
+ }
+
+ /**
+ * @param ChronopostHomeDeliveryAreaFreeshipping $chronopostHomeDeliveryAreaFreeshipping The chronopostHomeDeliveryAreaFreeshipping object to remove.
+ * @return ChildChronopostHomeDeliveryDeliveryMode The current object (for fluent API support)
+ */
+ public function removeChronopostHomeDeliveryAreaFreeshipping($chronopostHomeDeliveryAreaFreeshipping)
+ {
+ if ($this->getChronopostHomeDeliveryAreaFreeshippings()->contains($chronopostHomeDeliveryAreaFreeshipping)) {
+ $this->collChronopostHomeDeliveryAreaFreeshippings->remove($this->collChronopostHomeDeliveryAreaFreeshippings->search($chronopostHomeDeliveryAreaFreeshipping));
+ if (null === $this->chronopostHomeDeliveryAreaFreeshippingsScheduledForDeletion) {
+ $this->chronopostHomeDeliveryAreaFreeshippingsScheduledForDeletion = clone $this->collChronopostHomeDeliveryAreaFreeshippings;
+ $this->chronopostHomeDeliveryAreaFreeshippingsScheduledForDeletion->clear();
+ }
+ $this->chronopostHomeDeliveryAreaFreeshippingsScheduledForDeletion[]= clone $chronopostHomeDeliveryAreaFreeshipping;
+ $chronopostHomeDeliveryAreaFreeshipping->setChronopostHomeDeliveryDeliveryMode(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this ChronopostHomeDeliveryDeliveryMode is new, it will return
+ * an empty collection; or if this ChronopostHomeDeliveryDeliveryMode has previously
+ * been saved, it will retrieve related ChronopostHomeDeliveryAreaFreeshippings 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 ChronopostHomeDeliveryDeliveryMode.
+ *
+ * @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|ChildChronopostHomeDeliveryAreaFreeshipping[] List of ChildChronopostHomeDeliveryAreaFreeshipping objects
+ */
+ public function getChronopostHomeDeliveryAreaFreeshippingsJoinArea($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildChronopostHomeDeliveryAreaFreeshippingQuery::create(null, $criteria);
+ $query->joinWith('Area', $joinBehavior);
+
+ return $this->getChronopostHomeDeliveryAreaFreeshippings($query, $con);
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->title = null;
+ $this->code = null;
+ $this->freeshipping_active = null;
+ $this->freeshipping_from = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ if ($this->collChronopostHomeDeliveryPrices) {
+ foreach ($this->collChronopostHomeDeliveryPrices as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collChronopostHomeDeliveryAreaFreeshippings) {
+ foreach ($this->collChronopostHomeDeliveryAreaFreeshippings as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ } // if ($deep)
+
+ $this->collChronopostHomeDeliveryPrices = null;
+ $this->collChronopostHomeDeliveryAreaFreeshippings = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ChronopostHomeDeliveryDeliveryModeTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryDeliveryModeQuery.php b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryDeliveryModeQuery.php
new file mode 100644
index 00000000..f3c7c0a9
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryDeliveryModeQuery.php
@@ -0,0 +1,643 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryMode|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ChronopostHomeDeliveryDeliveryModeTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con A connection object
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryMode A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, TITLE, CODE, FREESHIPPING_ACTIVE, FREESHIPPING_FROM FROM chronopost_home_delivery_delivery_mode WHERE ID = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
+ $obj = new ChildChronopostHomeDeliveryDeliveryMode();
+ $obj->hydrate($row);
+ ChronopostHomeDeliveryDeliveryModeTableMap::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con A connection object
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryMode|array|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @param mixed $id 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 ChildChronopostHomeDeliveryDeliveryModeQuery 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(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the code column
+ *
+ * Example usage:
+ *
+ * $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
+ * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
+ *
+ *
+ * @param string $code The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function filterByCode($code = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($code)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $code)) {
+ $code = str_replace('*', '%', $code);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::CODE, $code, $comparison);
+ }
+
+ /**
+ * Filter the query on the freeshipping_active column
+ *
+ * Example usage:
+ *
+ * $query->filterByFreeshippingActive(true); // WHERE freeshipping_active = true
+ * $query->filterByFreeshippingActive('yes'); // WHERE freeshipping_active = true
+ *
+ *
+ * @param boolean|string $freeshippingActive 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 ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function filterByFreeshippingActive($freeshippingActive = null, $comparison = null)
+ {
+ if (is_string($freeshippingActive)) {
+ $freeshipping_active = in_array(strtolower($freeshippingActive), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE, $freeshippingActive, $comparison);
+ }
+
+ /**
+ * Filter the query on the freeshipping_from column
+ *
+ * Example usage:
+ *
+ * $query->filterByFreeshippingFrom(1234); // WHERE freeshipping_from = 1234
+ * $query->filterByFreeshippingFrom(array(12, 34)); // WHERE freeshipping_from IN (12, 34)
+ * $query->filterByFreeshippingFrom(array('min' => 12)); // WHERE freeshipping_from > 12
+ *
+ *
+ * @param mixed $freeshippingFrom 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 ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function filterByFreeshippingFrom($freeshippingFrom = null, $comparison = null)
+ {
+ if (is_array($freeshippingFrom)) {
+ $useMinMax = false;
+ if (isset($freeshippingFrom['min'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM, $freeshippingFrom['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($freeshippingFrom['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM, $freeshippingFrom['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM, $freeshippingFrom, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice object
+ *
+ * @param \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice|ObjectCollection $chronopostHomeDeliveryPrice the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function filterByChronopostHomeDeliveryPrice($chronopostHomeDeliveryPrice, $comparison = null)
+ {
+ if ($chronopostHomeDeliveryPrice instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice) {
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $chronopostHomeDeliveryPrice->getDeliveryModeId(), $comparison);
+ } elseif ($chronopostHomeDeliveryPrice instanceof ObjectCollection) {
+ return $this
+ ->useChronopostHomeDeliveryPriceQuery()
+ ->filterByPrimaryKeys($chronopostHomeDeliveryPrice->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByChronopostHomeDeliveryPrice() only accepts arguments of type \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the ChronopostHomeDeliveryPrice relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function joinChronopostHomeDeliveryPrice($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('ChronopostHomeDeliveryPrice');
+
+ // 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, 'ChronopostHomeDeliveryPrice');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the ChronopostHomeDeliveryPrice relation ChronopostHomeDeliveryPrice 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 \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery A secondary query class using the current class as primary query
+ */
+ public function useChronopostHomeDeliveryPriceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinChronopostHomeDeliveryPrice($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ChronopostHomeDeliveryPrice', '\ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPriceQuery');
+ }
+
+ /**
+ * Filter the query by a related \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping object
+ *
+ * @param \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping|ObjectCollection $chronopostHomeDeliveryAreaFreeshipping the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function filterByChronopostHomeDeliveryAreaFreeshipping($chronopostHomeDeliveryAreaFreeshipping, $comparison = null)
+ {
+ if ($chronopostHomeDeliveryAreaFreeshipping instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping) {
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $chronopostHomeDeliveryAreaFreeshipping->getDeliveryModeId(), $comparison);
+ } elseif ($chronopostHomeDeliveryAreaFreeshipping instanceof ObjectCollection) {
+ return $this
+ ->useChronopostHomeDeliveryAreaFreeshippingQuery()
+ ->filterByPrimaryKeys($chronopostHomeDeliveryAreaFreeshipping->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByChronopostHomeDeliveryAreaFreeshipping() only accepts arguments of type \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the ChronopostHomeDeliveryAreaFreeshipping relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function joinChronopostHomeDeliveryAreaFreeshipping($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('ChronopostHomeDeliveryAreaFreeshipping');
+
+ // 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, 'ChronopostHomeDeliveryAreaFreeshipping');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the ChronopostHomeDeliveryAreaFreeshipping relation ChronopostHomeDeliveryAreaFreeshipping 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 \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery A secondary query class using the current class as primary query
+ */
+ public function useChronopostHomeDeliveryAreaFreeshippingQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinChronopostHomeDeliveryAreaFreeshipping($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ChronopostHomeDeliveryAreaFreeshipping', '\ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshippingQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildChronopostHomeDeliveryDeliveryMode $chronopostHomeDeliveryDeliveryMode Object to remove from the list of results
+ *
+ * @return ChildChronopostHomeDeliveryDeliveryModeQuery The current query, for fluid interface
+ */
+ public function prune($chronopostHomeDeliveryDeliveryMode = null)
+ {
+ if ($chronopostHomeDeliveryDeliveryMode) {
+ $this->addUsingAlias(ChronopostHomeDeliveryDeliveryModeTableMap::ID, $chronopostHomeDeliveryDeliveryMode->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the chronopost_home_delivery_delivery_mode table.
+ *
+ * @param ConnectionInterface $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public function doDeleteAll(ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += parent::doDeleteAll($con);
+ // 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).
+ ChronopostHomeDeliveryDeliveryModeTableMap::clearInstancePool();
+ ChronopostHomeDeliveryDeliveryModeTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildChronopostHomeDeliveryDeliveryMode or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildChronopostHomeDeliveryDeliveryMode 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
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+
+ ChronopostHomeDeliveryDeliveryModeTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ ChronopostHomeDeliveryDeliveryModeTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // ChronopostHomeDeliveryDeliveryModeQuery
diff --git a/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryOrder.php b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryOrder.php
new file mode 100644
index 00000000..bfb48155
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryOrder.php
@@ -0,0 +1,1427 @@
+modifiedColumns;
+ }
+
+ /**
+ * Has specified column been modified?
+ *
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @return boolean True if $col has been modified.
+ */
+ public function isColumnModified($col)
+ {
+ return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
+ }
+
+ /**
+ * Get the columns that have been modified in this object.
+ * @return array A unique list of the modified column names for this object.
+ */
+ public function getModifiedColumns()
+ {
+ return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
+ }
+
+ /**
+ * Returns whether the object has ever been saved. This will
+ * be false, if the object was retrieved from storage or was created
+ * and then saved.
+ *
+ * @return boolean true, if the object has never been persisted.
+ */
+ public function isNew()
+ {
+ return $this->new;
+ }
+
+ /**
+ * Setter for the isNew attribute. This method will be called
+ * by Propel-generated children and objects.
+ *
+ * @param boolean $b the state of the object.
+ */
+ public function setNew($b)
+ {
+ $this->new = (Boolean) $b;
+ }
+
+ /**
+ * Whether this object has been deleted.
+ * @return boolean The deleted state of this object.
+ */
+ public function isDeleted()
+ {
+ return $this->deleted;
+ }
+
+ /**
+ * Specify whether this object has been deleted.
+ * @param boolean $b The deleted state of this object.
+ * @return void
+ */
+ public function setDeleted($b)
+ {
+ $this->deleted = (Boolean) $b;
+ }
+
+ /**
+ * Sets the modified state for the object to be false.
+ * @param string $col If supplied, only the specified column is reset.
+ * @return void
+ */
+ public function resetModified($col = null)
+ {
+ if (null !== $col) {
+ if (isset($this->modifiedColumns[$col])) {
+ unset($this->modifiedColumns[$col]);
+ }
+ } else {
+ $this->modifiedColumns = array();
+ }
+ }
+
+ /**
+ * Compares this with another ChronopostHomeDeliveryOrder instance. If
+ * obj is an instance of ChronopostHomeDeliveryOrder, delegates to
+ * equals(ChronopostHomeDeliveryOrder). Otherwise, returns false.
+ *
+ * @param mixed $obj The object to compare to.
+ * @return boolean Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return mixed
+ *
+ * @throws PropelException
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return ChronopostHomeDeliveryOrder The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return ChronopostHomeDeliveryOrder The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+
+ return $this;
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [order_id] column value.
+ *
+ * @return int
+ */
+ public function getOrderId()
+ {
+
+ return $this->order_id;
+ }
+
+ /**
+ * Get the [delivery_type] column value.
+ *
+ * @return string
+ */
+ public function getDeliveryType()
+ {
+
+ return $this->delivery_type;
+ }
+
+ /**
+ * Get the [delivery_code] column value.
+ *
+ * @return string
+ */
+ public function getDeliveryCode()
+ {
+
+ return $this->delivery_code;
+ }
+
+ /**
+ * Get the [label_directory] column value.
+ *
+ * @return string
+ */
+ public function getLabelDirectory()
+ {
+
+ return $this->label_directory;
+ }
+
+ /**
+ * Get the [label_number] column value.
+ *
+ * @return string
+ */
+ public function getLabelNumber()
+ {
+
+ return $this->label_number;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryOrderTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [order_id] column.
+ *
+ * @param int $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder The current object (for fluent API support)
+ */
+ public function setOrderId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->order_id !== $v) {
+ $this->order_id = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryOrderTableMap::ORDER_ID] = true;
+ }
+
+ if ($this->aOrder !== null && $this->aOrder->getId() !== $v) {
+ $this->aOrder = null;
+ }
+
+
+ return $this;
+ } // setOrderId()
+
+ /**
+ * Set the value of [delivery_type] column.
+ *
+ * @param string $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder The current object (for fluent API support)
+ */
+ public function setDeliveryType($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->delivery_type !== $v) {
+ $this->delivery_type = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE] = true;
+ }
+
+
+ return $this;
+ } // setDeliveryType()
+
+ /**
+ * Set the value of [delivery_code] column.
+ *
+ * @param string $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder The current object (for fluent API support)
+ */
+ public function setDeliveryCode($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->delivery_code !== $v) {
+ $this->delivery_code = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE] = true;
+ }
+
+
+ return $this;
+ } // setDeliveryCode()
+
+ /**
+ * Set the value of [label_directory] column.
+ *
+ * @param string $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder The current object (for fluent API support)
+ */
+ public function setLabelDirectory($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->label_directory !== $v) {
+ $this->label_directory = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY] = true;
+ }
+
+
+ return $this;
+ } // setLabelDirectory()
+
+ /**
+ * Set the value of [label_number] column.
+ *
+ * @param string $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder The current object (for fluent API support)
+ */
+ public function setLabelNumber($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->label_number !== $v) {
+ $this->label_number = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER] = true;
+ }
+
+
+ return $this;
+ } // setLabelNumber()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ChronopostHomeDeliveryOrderTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ChronopostHomeDeliveryOrderTableMap::translateFieldName('OrderId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->order_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ChronopostHomeDeliveryOrderTableMap::translateFieldName('DeliveryType', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->delivery_type = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ChronopostHomeDeliveryOrderTableMap::translateFieldName('DeliveryCode', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->delivery_code = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ChronopostHomeDeliveryOrderTableMap::translateFieldName('LabelDirectory', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->label_directory = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ChronopostHomeDeliveryOrderTableMap::translateFieldName('LabelNumber', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->label_number = (null !== $col) ? (string) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = ChronopostHomeDeliveryOrderTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ if ($this->aOrder !== null && $this->order_id !== $this->aOrder->getId()) {
+ $this->aOrder = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildChronopostHomeDeliveryOrderQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aOrder = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see ChronopostHomeDeliveryOrder::setDeleted()
+ * @see ChronopostHomeDeliveryOrder::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildChronopostHomeDeliveryOrderQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ChronopostHomeDeliveryOrderTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aOrder !== null) {
+ if ($this->aOrder->isModified() || $this->aOrder->isNew()) {
+ $affectedRows += $this->aOrder->save($con);
+ }
+ $this->setOrder($this->aOrder);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[ChronopostHomeDeliveryOrderTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . ChronopostHomeDeliveryOrderTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::ORDER_ID)) {
+ $modifiedColumns[':p' . $index++] = 'ORDER_ID';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE)) {
+ $modifiedColumns[':p' . $index++] = 'DELIVERY_TYPE';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE)) {
+ $modifiedColumns[':p' . $index++] = 'DELIVERY_CODE';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY)) {
+ $modifiedColumns[':p' . $index++] = 'LABEL_DIRECTORY';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER)) {
+ $modifiedColumns[':p' . $index++] = 'LABEL_NUMBER';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO chronopost_home_delivery_order (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'ORDER_ID':
+ $stmt->bindValue($identifier, $this->order_id, PDO::PARAM_INT);
+ break;
+ case 'DELIVERY_TYPE':
+ $stmt->bindValue($identifier, $this->delivery_type, PDO::PARAM_STR);
+ break;
+ case 'DELIVERY_CODE':
+ $stmt->bindValue($identifier, $this->delivery_code, PDO::PARAM_STR);
+ break;
+ case 'LABEL_DIRECTORY':
+ $stmt->bindValue($identifier, $this->label_directory, PDO::PARAM_STR);
+ break;
+ case 'LABEL_NUMBER':
+ $stmt->bindValue($identifier, $this->label_number, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = ChronopostHomeDeliveryOrderTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getOrderId();
+ break;
+ case 2:
+ return $this->getDeliveryType();
+ break;
+ case 3:
+ return $this->getDeliveryCode();
+ break;
+ case 4:
+ return $this->getLabelDirectory();
+ break;
+ case 5:
+ return $this->getLabelNumber();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ChronopostHomeDeliveryOrder'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ChronopostHomeDeliveryOrder'][$this->getPrimaryKey()] = true;
+ $keys = ChronopostHomeDeliveryOrderTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getOrderId(),
+ $keys[2] => $this->getDeliveryType(),
+ $keys[3] => $this->getDeliveryCode(),
+ $keys[4] => $this->getLabelDirectory(),
+ $keys[5] => $this->getLabelNumber(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aOrder) {
+ $result['Order'] = $this->aOrder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = ChronopostHomeDeliveryOrderTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setOrderId($value);
+ break;
+ case 2:
+ $this->setDeliveryType($value);
+ break;
+ case 3:
+ $this->setDeliveryCode($value);
+ break;
+ case 4:
+ $this->setLabelDirectory($value);
+ break;
+ case 5:
+ $this->setLabelNumber($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = ChronopostHomeDeliveryOrderTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setOrderId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDeliveryType($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDeliveryCode($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setLabelDirectory($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setLabelNumber($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::ID)) $criteria->add(ChronopostHomeDeliveryOrderTableMap::ID, $this->id);
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::ORDER_ID)) $criteria->add(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $this->order_id);
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE)) $criteria->add(ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE, $this->delivery_type);
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE)) $criteria->add(ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE, $this->delivery_code);
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY)) $criteria->add(ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY, $this->label_directory);
+ if ($this->isColumnModified(ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER)) $criteria->add(ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER, $this->label_number);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ $criteria->add(ChronopostHomeDeliveryOrderTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder (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
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setOrderId($this->getOrderId());
+ $copyObj->setDeliveryType($this->getDeliveryType());
+ $copyObj->setDeliveryCode($this->getDeliveryCode());
+ $copyObj->setLabelDirectory($this->getLabelDirectory());
+ $copyObj->setLabelNumber($this->getLabelNumber());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Declares an association between this object and a ChildOrder object.
+ *
+ * @param ChildOrder $v
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setOrder(ChildOrder $v = null)
+ {
+ if ($v === null) {
+ $this->setOrderId(NULL);
+ } else {
+ $this->setOrderId($v->getId());
+ }
+
+ $this->aOrder = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildOrder object, it will not be re-added.
+ if ($v !== null) {
+ $v->addChronopostHomeDeliveryOrder($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildOrder object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildOrder The associated ChildOrder object.
+ * @throws PropelException
+ */
+ public function getOrder(ConnectionInterface $con = null)
+ {
+ if ($this->aOrder === null && ($this->order_id !== null)) {
+ $this->aOrder = OrderQuery::create()->findPk($this->order_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->aOrder->addChronopostHomeDeliveryOrders($this);
+ */
+ }
+
+ return $this->aOrder;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->order_id = null;
+ $this->delivery_type = null;
+ $this->delivery_code = null;
+ $this->label_directory = null;
+ $this->label_number = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aOrder = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ChronopostHomeDeliveryOrderTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryOrderQuery.php b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryOrderQuery.php
new file mode 100644
index 00000000..09c59428
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryOrderQuery.php
@@ -0,0 +1,606 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildChronopostHomeDeliveryOrder|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ChronopostHomeDeliveryOrderTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con A connection object
+ *
+ * @return ChildChronopostHomeDeliveryOrder A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, ORDER_ID, DELIVERY_TYPE, DELIVERY_CODE, LABEL_DIRECTORY, LABEL_NUMBER FROM chronopost_home_delivery_order WHERE ID = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
+ $obj = new ChildChronopostHomeDeliveryOrder();
+ $obj->hydrate($row);
+ ChronopostHomeDeliveryOrderTableMap::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con A connection object
+ *
+ * @return ChildChronopostHomeDeliveryOrder|array|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @param mixed $id 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 ChildChronopostHomeDeliveryOrderQuery 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(ChronopostHomeDeliveryOrderTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the order_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByOrderId(1234); // WHERE order_id = 1234
+ * $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34)
+ * $query->filterByOrderId(array('min' => 12)); // WHERE order_id > 12
+ *
+ *
+ * @see filterByOrder()
+ *
+ * @param mixed $orderId 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 ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
+ */
+ public function filterByOrderId($orderId = null, $comparison = null)
+ {
+ if (is_array($orderId)) {
+ $useMinMax = false;
+ if (isset($orderId['min'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($orderId['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $orderId, $comparison);
+ }
+
+ /**
+ * Filter the query on the delivery_type column
+ *
+ * Example usage:
+ *
+ * $query->filterByDeliveryType('fooValue'); // WHERE delivery_type = 'fooValue'
+ * $query->filterByDeliveryType('%fooValue%'); // WHERE delivery_type LIKE '%fooValue%'
+ *
+ *
+ * @param string $deliveryType The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
+ */
+ public function filterByDeliveryType($deliveryType = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($deliveryType)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $deliveryType)) {
+ $deliveryType = str_replace('*', '%', $deliveryType);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE, $deliveryType, $comparison);
+ }
+
+ /**
+ * Filter the query on the delivery_code column
+ *
+ * Example usage:
+ *
+ * $query->filterByDeliveryCode('fooValue'); // WHERE delivery_code = 'fooValue'
+ * $query->filterByDeliveryCode('%fooValue%'); // WHERE delivery_code LIKE '%fooValue%'
+ *
+ *
+ * @param string $deliveryCode The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
+ */
+ public function filterByDeliveryCode($deliveryCode = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($deliveryCode)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $deliveryCode)) {
+ $deliveryCode = str_replace('*', '%', $deliveryCode);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE, $deliveryCode, $comparison);
+ }
+
+ /**
+ * Filter the query on the label_directory column
+ *
+ * Example usage:
+ *
+ * $query->filterByLabelDirectory('fooValue'); // WHERE label_directory = 'fooValue'
+ * $query->filterByLabelDirectory('%fooValue%'); // WHERE label_directory LIKE '%fooValue%'
+ *
+ *
+ * @param string $labelDirectory The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
+ */
+ public function filterByLabelDirectory($labelDirectory = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($labelDirectory)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $labelDirectory)) {
+ $labelDirectory = str_replace('*', '%', $labelDirectory);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY, $labelDirectory, $comparison);
+ }
+
+ /**
+ * Filter the query on the label_number column
+ *
+ * Example usage:
+ *
+ * $query->filterByLabelNumber('fooValue'); // WHERE label_number = 'fooValue'
+ * $query->filterByLabelNumber('%fooValue%'); // WHERE label_number LIKE '%fooValue%'
+ *
+ *
+ * @param string $labelNumber The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
+ */
+ public function filterByLabelNumber($labelNumber = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($labelNumber)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $labelNumber)) {
+ $labelNumber = str_replace('*', '%', $labelNumber);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER, $labelNumber, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \ChronopostHomeDelivery\Model\Thelia\Model\Order object
+ *
+ * @param \ChronopostHomeDelivery\Model\Thelia\Model\Order|ObjectCollection $order The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
+ */
+ public function filterByOrder($order, $comparison = null)
+ {
+ if ($order instanceof \ChronopostHomeDelivery\Model\Thelia\Model\Order) {
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $order->getId(), $comparison);
+ } elseif ($order instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByOrder() only accepts arguments of type \ChronopostHomeDelivery\Model\Thelia\Model\Order or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Order relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
+ */
+ public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Order');
+
+ // 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, 'Order');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Order relation Order 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 \ChronopostHomeDelivery\Model\Thelia\Model\OrderQuery A secondary query class using the current class as primary query
+ */
+ public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinOrder($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Order', '\ChronopostHomeDelivery\Model\Thelia\Model\OrderQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildChronopostHomeDeliveryOrder $chronopostHomeDeliveryOrder Object to remove from the list of results
+ *
+ * @return ChildChronopostHomeDeliveryOrderQuery The current query, for fluid interface
+ */
+ public function prune($chronopostHomeDeliveryOrder = null)
+ {
+ if ($chronopostHomeDeliveryOrder) {
+ $this->addUsingAlias(ChronopostHomeDeliveryOrderTableMap::ID, $chronopostHomeDeliveryOrder->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the chronopost_home_delivery_order table.
+ *
+ * @param ConnectionInterface $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public function doDeleteAll(ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += parent::doDeleteAll($con);
+ // 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).
+ ChronopostHomeDeliveryOrderTableMap::clearInstancePool();
+ ChronopostHomeDeliveryOrderTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildChronopostHomeDeliveryOrder or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildChronopostHomeDeliveryOrder 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
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+
+ ChronopostHomeDeliveryOrderTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ ChronopostHomeDeliveryOrderTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // ChronopostHomeDeliveryOrderQuery
diff --git a/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryPrice.php b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryPrice.php
new file mode 100644
index 00000000..999e4c7b
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryPrice.php
@@ -0,0 +1,1562 @@
+modifiedColumns;
+ }
+
+ /**
+ * Has specified column been modified?
+ *
+ * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
+ * @return boolean True if $col has been modified.
+ */
+ public function isColumnModified($col)
+ {
+ return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
+ }
+
+ /**
+ * Get the columns that have been modified in this object.
+ * @return array A unique list of the modified column names for this object.
+ */
+ public function getModifiedColumns()
+ {
+ return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
+ }
+
+ /**
+ * Returns whether the object has ever been saved. This will
+ * be false, if the object was retrieved from storage or was created
+ * and then saved.
+ *
+ * @return boolean true, if the object has never been persisted.
+ */
+ public function isNew()
+ {
+ return $this->new;
+ }
+
+ /**
+ * Setter for the isNew attribute. This method will be called
+ * by Propel-generated children and objects.
+ *
+ * @param boolean $b the state of the object.
+ */
+ public function setNew($b)
+ {
+ $this->new = (Boolean) $b;
+ }
+
+ /**
+ * Whether this object has been deleted.
+ * @return boolean The deleted state of this object.
+ */
+ public function isDeleted()
+ {
+ return $this->deleted;
+ }
+
+ /**
+ * Specify whether this object has been deleted.
+ * @param boolean $b The deleted state of this object.
+ * @return void
+ */
+ public function setDeleted($b)
+ {
+ $this->deleted = (Boolean) $b;
+ }
+
+ /**
+ * Sets the modified state for the object to be false.
+ * @param string $col If supplied, only the specified column is reset.
+ * @return void
+ */
+ public function resetModified($col = null)
+ {
+ if (null !== $col) {
+ if (isset($this->modifiedColumns[$col])) {
+ unset($this->modifiedColumns[$col]);
+ }
+ } else {
+ $this->modifiedColumns = array();
+ }
+ }
+
+ /**
+ * Compares this with another ChronopostHomeDeliveryPrice instance. If
+ * obj is an instance of ChronopostHomeDeliveryPrice, delegates to
+ * equals(ChronopostHomeDeliveryPrice). Otherwise, returns false.
+ *
+ * @param mixed $obj The object to compare to.
+ * @return boolean Whether equal to the object specified.
+ */
+ public function equals($obj)
+ {
+ $thisclazz = get_class($this);
+ if (!is_object($obj) || !($obj instanceof $thisclazz)) {
+ return false;
+ }
+
+ if ($this === $obj) {
+ return true;
+ }
+
+ if (null === $this->getPrimaryKey()
+ || null === $obj->getPrimaryKey()) {
+ return false;
+ }
+
+ return $this->getPrimaryKey() === $obj->getPrimaryKey();
+ }
+
+ /**
+ * If the primary key is not null, return the hashcode of the
+ * primary key. Otherwise, return the hash code of the object.
+ *
+ * @return int Hashcode
+ */
+ public function hashCode()
+ {
+ if (null !== $this->getPrimaryKey()) {
+ return crc32(serialize($this->getPrimaryKey()));
+ }
+
+ return crc32(serialize(clone $this));
+ }
+
+ /**
+ * Get the associative array of the virtual columns in this object
+ *
+ * @return array
+ */
+ public function getVirtualColumns()
+ {
+ return $this->virtualColumns;
+ }
+
+ /**
+ * Checks the existence of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return boolean
+ */
+ public function hasVirtualColumn($name)
+ {
+ return array_key_exists($name, $this->virtualColumns);
+ }
+
+ /**
+ * Get the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @return mixed
+ *
+ * @throws PropelException
+ */
+ public function getVirtualColumn($name)
+ {
+ if (!$this->hasVirtualColumn($name)) {
+ throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
+ }
+
+ return $this->virtualColumns[$name];
+ }
+
+ /**
+ * Set the value of a virtual column in this object
+ *
+ * @param string $name The virtual column name
+ * @param mixed $value The value to give to the virtual column
+ *
+ * @return ChronopostHomeDeliveryPrice The current object, for fluid interface
+ */
+ public function setVirtualColumn($name, $value)
+ {
+ $this->virtualColumns[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Logs a message using Propel::log().
+ *
+ * @param string $msg
+ * @param int $priority One of the Propel::LOG_* logging levels
+ * @return boolean
+ */
+ protected function log($msg, $priority = Propel::LOG_INFO)
+ {
+ return Propel::log(get_class($this) . ': ' . $msg, $priority);
+ }
+
+ /**
+ * Populate the current object from a string, using a given parser format
+ *
+ * $book = new Book();
+ * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance,
+ * or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param string $data The source data to import from
+ *
+ * @return ChronopostHomeDeliveryPrice The current object, for fluid interface
+ */
+ public function importFrom($parser, $data)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME);
+
+ return $this;
+ }
+
+ /**
+ * Export the current object properties to a string, using a given parser format
+ *
+ * $book = BookQuery::create()->findPk(9012);
+ * echo $book->exportTo('JSON');
+ * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
+ *
+ *
+ * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
+ * @return string The exported data
+ */
+ public function exportTo($parser, $includeLazyLoadColumns = true)
+ {
+ if (!$parser instanceof AbstractParser) {
+ $parser = AbstractParser::getParser($parser);
+ }
+
+ return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
+ }
+
+ /**
+ * Clean up internal collections prior to serializing
+ * Avoids recursive loops that turn into segmentation faults when serializing
+ */
+ public function __sleep()
+ {
+ $this->clearAllReferences();
+
+ return array_keys(get_object_vars($this));
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [area_id] column value.
+ *
+ * @return int
+ */
+ public function getAreaId()
+ {
+
+ return $this->area_id;
+ }
+
+ /**
+ * Get the [delivery_mode_id] column value.
+ *
+ * @return int
+ */
+ public function getDeliveryModeId()
+ {
+
+ return $this->delivery_mode_id;
+ }
+
+ /**
+ * Get the [weight_max] column value.
+ *
+ * @return double
+ */
+ public function getWeightMax()
+ {
+
+ return $this->weight_max;
+ }
+
+ /**
+ * Get the [price_max] column value.
+ *
+ * @return double
+ */
+ public function getPriceMax()
+ {
+
+ return $this->price_max;
+ }
+
+ /**
+ * Get the [franco_min_price] column value.
+ *
+ * @return double
+ */
+ public function getFrancoMinPrice()
+ {
+
+ return $this->franco_min_price;
+ }
+
+ /**
+ * Get the [price] column value.
+ *
+ * @return double
+ */
+ public function getPrice()
+ {
+
+ return $this->price;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryPriceTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [area_id] column.
+ *
+ * @param int $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice The current object (for fluent API support)
+ */
+ public function setAreaId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->area_id !== $v) {
+ $this->area_id = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryPriceTableMap::AREA_ID] = true;
+ }
+
+ if ($this->aArea !== null && $this->aArea->getId() !== $v) {
+ $this->aArea = null;
+ }
+
+
+ return $this;
+ } // setAreaId()
+
+ /**
+ * Set the value of [delivery_mode_id] column.
+ *
+ * @param int $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice The current object (for fluent API support)
+ */
+ public function setDeliveryModeId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->delivery_mode_id !== $v) {
+ $this->delivery_mode_id = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID] = true;
+ }
+
+ if ($this->aChronopostHomeDeliveryDeliveryMode !== null && $this->aChronopostHomeDeliveryDeliveryMode->getId() !== $v) {
+ $this->aChronopostHomeDeliveryDeliveryMode = null;
+ }
+
+
+ return $this;
+ } // setDeliveryModeId()
+
+ /**
+ * Set the value of [weight_max] column.
+ *
+ * @param double $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice The current object (for fluent API support)
+ */
+ public function setWeightMax($v)
+ {
+ if ($v !== null) {
+ $v = (double) $v;
+ }
+
+ if ($this->weight_max !== $v) {
+ $this->weight_max = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX] = true;
+ }
+
+
+ return $this;
+ } // setWeightMax()
+
+ /**
+ * Set the value of [price_max] column.
+ *
+ * @param double $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice The current object (for fluent API support)
+ */
+ public function setPriceMax($v)
+ {
+ if ($v !== null) {
+ $v = (double) $v;
+ }
+
+ if ($this->price_max !== $v) {
+ $this->price_max = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryPriceTableMap::PRICE_MAX] = true;
+ }
+
+
+ return $this;
+ } // setPriceMax()
+
+ /**
+ * Set the value of [franco_min_price] column.
+ *
+ * @param double $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice The current object (for fluent API support)
+ */
+ public function setFrancoMinPrice($v)
+ {
+ if ($v !== null) {
+ $v = (double) $v;
+ }
+
+ if ($this->franco_min_price !== $v) {
+ $this->franco_min_price = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE] = true;
+ }
+
+
+ return $this;
+ } // setFrancoMinPrice()
+
+ /**
+ * Set the value of [price] column.
+ *
+ * @param double $v new value
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice The current object (for fluent API support)
+ */
+ public function setPrice($v)
+ {
+ if ($v !== null) {
+ $v = (double) $v;
+ }
+
+ if ($this->price !== $v) {
+ $this->price = $v;
+ $this->modifiedColumns[ChronopostHomeDeliveryPriceTableMap::PRICE] = true;
+ }
+
+
+ return $this;
+ } // setPrice()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return TRUE
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by DataFetcher->fetch().
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
+ {
+ try {
+
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ChronopostHomeDeliveryPriceTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ChronopostHomeDeliveryPriceTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->area_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ChronopostHomeDeliveryPriceTableMap::translateFieldName('DeliveryModeId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->delivery_mode_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ChronopostHomeDeliveryPriceTableMap::translateFieldName('WeightMax', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->weight_max = (null !== $col) ? (double) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ChronopostHomeDeliveryPriceTableMap::translateFieldName('PriceMax', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->price_max = (null !== $col) ? (double) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ChronopostHomeDeliveryPriceTableMap::translateFieldName('FrancoMinPrice', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->franco_min_price = (null !== $col) ? (double) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ChronopostHomeDeliveryPriceTableMap::translateFieldName('Price', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->price = (null !== $col) ? (double) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 7; // 7 = ChronopostHomeDeliveryPriceTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice object", 0, $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+ if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) {
+ $this->aArea = null;
+ }
+ if ($this->aChronopostHomeDeliveryDeliveryMode !== null && $this->delivery_mode_id !== $this->aChronopostHomeDeliveryDeliveryMode->getId()) {
+ $this->aChronopostHomeDeliveryDeliveryMode = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildChronopostHomeDeliveryPriceQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
+ $row = $dataFetcher->fetch();
+ $dataFetcher->close();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aArea = null;
+ $this->aChronopostHomeDeliveryDeliveryMode = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see ChronopostHomeDeliveryPrice::setDeleted()
+ * @see ChronopostHomeDeliveryPrice::isDeleted()
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildChronopostHomeDeliveryPriceQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save(ConnectionInterface $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ChronopostHomeDeliveryPriceTableMap::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param ConnectionInterface $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(ConnectionInterface $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aArea !== null) {
+ if ($this->aArea->isModified() || $this->aArea->isNew()) {
+ $affectedRows += $this->aArea->save($con);
+ }
+ $this->setArea($this->aArea);
+ }
+
+ if ($this->aChronopostHomeDeliveryDeliveryMode !== null) {
+ if ($this->aChronopostHomeDeliveryDeliveryMode->isModified() || $this->aChronopostHomeDeliveryDeliveryMode->isNew()) {
+ $affectedRows += $this->aChronopostHomeDeliveryDeliveryMode->save($con);
+ }
+ $this->setChronopostHomeDeliveryDeliveryMode($this->aChronopostHomeDeliveryDeliveryMode);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[ChronopostHomeDeliveryPriceTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . ChronopostHomeDeliveryPriceTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::AREA_ID)) {
+ $modifiedColumns[':p' . $index++] = 'AREA_ID';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID)) {
+ $modifiedColumns[':p' . $index++] = 'DELIVERY_MODE_ID';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX)) {
+ $modifiedColumns[':p' . $index++] = 'WEIGHT_MAX';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX)) {
+ $modifiedColumns[':p' . $index++] = 'PRICE_MAX';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE)) {
+ $modifiedColumns[':p' . $index++] = 'FRANCO_MIN_PRICE';
+ }
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::PRICE)) {
+ $modifiedColumns[':p' . $index++] = 'PRICE';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO chronopost_home_delivery_price (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case 'ID':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case 'AREA_ID':
+ $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT);
+ break;
+ case 'DELIVERY_MODE_ID':
+ $stmt->bindValue($identifier, $this->delivery_mode_id, PDO::PARAM_INT);
+ break;
+ case 'WEIGHT_MAX':
+ $stmt->bindValue($identifier, $this->weight_max, PDO::PARAM_STR);
+ break;
+ case 'PRICE_MAX':
+ $stmt->bindValue($identifier, $this->price_max, PDO::PARAM_STR);
+ break;
+ case 'FRANCO_MIN_PRICE':
+ $stmt->bindValue($identifier, $this->franco_min_price, PDO::PARAM_STR);
+ break;
+ case 'PRICE':
+ $stmt->bindValue($identifier, $this->price, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', 0, $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @return Integer Number of updated rows
+ * @see doSave()
+ */
+ protected function doUpdate(ConnectionInterface $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+
+ return $selectCriteria->doUpdate($valuesCriteria, $con);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = ChronopostHomeDeliveryPriceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getAreaId();
+ break;
+ case 2:
+ return $this->getDeliveryModeId();
+ break;
+ case 3:
+ return $this->getWeightMax();
+ break;
+ case 4:
+ return $this->getPriceMax();
+ break;
+ case 5:
+ return $this->getFrancoMinPrice();
+ break;
+ case 6:
+ return $this->getPrice();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ChronopostHomeDeliveryPrice'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ChronopostHomeDeliveryPrice'][$this->getPrimaryKey()] = true;
+ $keys = ChronopostHomeDeliveryPriceTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getAreaId(),
+ $keys[2] => $this->getDeliveryModeId(),
+ $keys[3] => $this->getWeightMax(),
+ $keys[4] => $this->getPriceMax(),
+ $keys[5] => $this->getFrancoMinPrice(),
+ $keys[6] => $this->getPrice(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aArea) {
+ $result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aChronopostHomeDeliveryDeliveryMode) {
+ $result['ChronopostHomeDeliveryDeliveryMode'] = $this->aChronopostHomeDeliveryDeliveryMode->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = ChronopostHomeDeliveryPriceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
+
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setAreaId($value);
+ break;
+ case 2:
+ $this->setDeliveryModeId($value);
+ break;
+ case 3:
+ $this->setWeightMax($value);
+ break;
+ case 4:
+ $this->setPriceMax($value);
+ break;
+ case 5:
+ $this->setFrancoMinPrice($value);
+ break;
+ case 6:
+ $this->setPrice($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * The default key type is the column's TableMap::TYPE_PHPNAME.
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
+ {
+ $keys = ChronopostHomeDeliveryPriceTableMap::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->setDeliveryModeId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setWeightMax($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setPriceMax($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setFrancoMinPrice($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setPrice($arr[$keys[6]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::ID)) $criteria->add(ChronopostHomeDeliveryPriceTableMap::ID, $this->id);
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::AREA_ID)) $criteria->add(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $this->area_id);
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID)) $criteria->add(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $this->delivery_mode_id);
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX)) $criteria->add(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX, $this->weight_max);
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX)) $criteria->add(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX, $this->price_max);
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE)) $criteria->add(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE, $this->franco_min_price);
+ if ($this->isColumnModified(ChronopostHomeDeliveryPriceTableMap::PRICE)) $criteria->add(ChronopostHomeDeliveryPriceTableMap::PRICE, $this->price);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ $criteria->add(ChronopostHomeDeliveryPriceTableMap::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice (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
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setAreaId($this->getAreaId());
+ $copyObj->setDeliveryModeId($this->getDeliveryModeId());
+ $copyObj->setWeightMax($this->getWeightMax());
+ $copyObj->setPriceMax($this->getPriceMax());
+ $copyObj->setFrancoMinPrice($this->getFrancoMinPrice());
+ $copyObj->setPrice($this->getPrice());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Declares an association between this object and a ChildArea object.
+ *
+ * @param ChildArea $v
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setArea(ChildArea $v = null)
+ {
+ if ($v === null) {
+ $this->setAreaId(NULL);
+ } else {
+ $this->setAreaId($v->getId());
+ }
+
+ $this->aArea = $v;
+
+ // 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->addChronopostHomeDeliveryPrice($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildArea object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildArea The associated ChildArea object.
+ * @throws PropelException
+ */
+ public function getArea(ConnectionInterface $con = null)
+ {
+ if ($this->aArea === null && ($this->area_id !== null)) {
+ $this->aArea = AreaQuery::create()->findPk($this->area_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->aArea->addChronopostHomeDeliveryPrices($this);
+ */
+ }
+
+ return $this->aArea;
+ }
+
+ /**
+ * Declares an association between this object and a ChildChronopostHomeDeliveryDeliveryMode object.
+ *
+ * @param ChildChronopostHomeDeliveryDeliveryMode $v
+ * @return \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setChronopostHomeDeliveryDeliveryMode(ChildChronopostHomeDeliveryDeliveryMode $v = null)
+ {
+ if ($v === null) {
+ $this->setDeliveryModeId(NULL);
+ } else {
+ $this->setDeliveryModeId($v->getId());
+ }
+
+ $this->aChronopostHomeDeliveryDeliveryMode = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildChronopostHomeDeliveryDeliveryMode object, it will not be re-added.
+ if ($v !== null) {
+ $v->addChronopostHomeDeliveryPrice($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildChronopostHomeDeliveryDeliveryMode object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildChronopostHomeDeliveryDeliveryMode The associated ChildChronopostHomeDeliveryDeliveryMode object.
+ * @throws PropelException
+ */
+ public function getChronopostHomeDeliveryDeliveryMode(ConnectionInterface $con = null)
+ {
+ if ($this->aChronopostHomeDeliveryDeliveryMode === null && ($this->delivery_mode_id !== null)) {
+ $this->aChronopostHomeDeliveryDeliveryMode = ChildChronopostHomeDeliveryDeliveryModeQuery::create()->findPk($this->delivery_mode_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->aChronopostHomeDeliveryDeliveryMode->addChronopostHomeDeliveryPrices($this);
+ */
+ }
+
+ return $this->aChronopostHomeDeliveryDeliveryMode;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->area_id = null;
+ $this->delivery_mode_id = null;
+ $this->weight_max = null;
+ $this->price_max = null;
+ $this->franco_min_price = null;
+ $this->price = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aArea = null;
+ $this->aChronopostHomeDeliveryDeliveryMode = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ChronopostHomeDeliveryPriceTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * Code to be run before persisting the object
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preSave(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after persisting the object
+ * @param ConnectionInterface $con
+ */
+ public function postSave(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before inserting to database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after inserting to database
+ * @param ConnectionInterface $con
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before updating the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after updating the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+
+ }
+
+ /**
+ * Code to be run before deleting the object in database
+ * @param ConnectionInterface $con
+ * @return boolean
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ return true;
+ }
+
+ /**
+ * Code to be run after deleting the object in database
+ * @param ConnectionInterface $con
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+
+ }
+
+
+ /**
+ * Derived method to catches calls to undefined methods.
+ *
+ * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
+ * Allows to define default __call() behavior if you overwrite __call()
+ *
+ * @param string $name
+ * @param mixed $params
+ *
+ * @return array|string
+ */
+ public function __call($name, $params)
+ {
+ if (0 === strpos($name, 'get')) {
+ $virtualColumn = substr($name, 3);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+
+ $virtualColumn = lcfirst($virtualColumn);
+ if ($this->hasVirtualColumn($virtualColumn)) {
+ return $this->getVirtualColumn($virtualColumn);
+ }
+ }
+
+ if (0 === strpos($name, 'from')) {
+ $format = substr($name, 4);
+
+ return $this->importFrom($format, reset($params));
+ }
+
+ if (0 === strpos($name, 'to')) {
+ $format = substr($name, 2);
+ $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
+
+ return $this->exportTo($format, $includeLazyLoadColumns);
+ }
+
+ throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
+ }
+
+}
diff --git a/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryPriceQuery.php b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryPriceQuery.php
new file mode 100644
index 00000000..5f8fa717
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/Base/ChronopostHomeDeliveryPriceQuery.php
@@ -0,0 +1,780 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildChronopostHomeDeliveryPrice|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ChronopostHomeDeliveryPriceTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con A connection object
+ *
+ * @return ChildChronopostHomeDeliveryPrice A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, AREA_ID, DELIVERY_MODE_ID, WEIGHT_MAX, PRICE_MAX, FRANCO_MIN_PRICE, PRICE FROM chronopost_home_delivery_price WHERE ID = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
+ $obj = new ChildChronopostHomeDeliveryPrice();
+ $obj->hydrate($row);
+ ChronopostHomeDeliveryPriceTableMap::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param ConnectionInterface $con A connection object
+ *
+ * @return ChildChronopostHomeDeliveryPrice|array|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $dataFetcher = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @param mixed $id 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 ChildChronopostHomeDeliveryPriceQuery 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(ChronopostHomeDeliveryPriceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the area_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByAreaId(1234); // WHERE area_id = 1234
+ * $query->filterByAreaId(array(12, 34)); // WHERE area_id IN (12, 34)
+ * $query->filterByAreaId(array('min' => 12)); // WHERE area_id > 12
+ *
+ *
+ * @see filterByArea()
+ *
+ * @param mixed $areaId 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 ChildChronopostHomeDeliveryPriceQuery 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(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($areaId['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $areaId, $comparison);
+ }
+
+ /**
+ * Filter the query on the delivery_mode_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDeliveryModeId(1234); // WHERE delivery_mode_id = 1234
+ * $query->filterByDeliveryModeId(array(12, 34)); // WHERE delivery_mode_id IN (12, 34)
+ * $query->filterByDeliveryModeId(array('min' => 12)); // WHERE delivery_mode_id > 12
+ *
+ *
+ * @see filterByChronopostHomeDeliveryDeliveryMode()
+ *
+ * @param mixed $deliveryModeId 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByDeliveryModeId($deliveryModeId = null, $comparison = null)
+ {
+ if (is_array($deliveryModeId)) {
+ $useMinMax = false;
+ if (isset($deliveryModeId['min'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $deliveryModeId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($deliveryModeId['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $deliveryModeId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $deliveryModeId, $comparison);
+ }
+
+ /**
+ * Filter the query on the weight_max column
+ *
+ * Example usage:
+ *
+ * $query->filterByWeightMax(1234); // WHERE weight_max = 1234
+ * $query->filterByWeightMax(array(12, 34)); // WHERE weight_max IN (12, 34)
+ * $query->filterByWeightMax(array('min' => 12)); // WHERE weight_max > 12
+ *
+ *
+ * @param mixed $weightMax 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByWeightMax($weightMax = null, $comparison = null)
+ {
+ if (is_array($weightMax)) {
+ $useMinMax = false;
+ if (isset($weightMax['min'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX, $weightMax['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($weightMax['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX, $weightMax['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX, $weightMax, $comparison);
+ }
+
+ /**
+ * Filter the query on the price_max column
+ *
+ * Example usage:
+ *
+ * $query->filterByPriceMax(1234); // WHERE price_max = 1234
+ * $query->filterByPriceMax(array(12, 34)); // WHERE price_max IN (12, 34)
+ * $query->filterByPriceMax(array('min' => 12)); // WHERE price_max > 12
+ *
+ *
+ * @param mixed $priceMax 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByPriceMax($priceMax = null, $comparison = null)
+ {
+ if (is_array($priceMax)) {
+ $useMinMax = false;
+ if (isset($priceMax['min'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX, $priceMax['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($priceMax['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX, $priceMax['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX, $priceMax, $comparison);
+ }
+
+ /**
+ * Filter the query on the franco_min_price column
+ *
+ * Example usage:
+ *
+ * $query->filterByFrancoMinPrice(1234); // WHERE franco_min_price = 1234
+ * $query->filterByFrancoMinPrice(array(12, 34)); // WHERE franco_min_price IN (12, 34)
+ * $query->filterByFrancoMinPrice(array('min' => 12)); // WHERE franco_min_price > 12
+ *
+ *
+ * @param mixed $francoMinPrice 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByFrancoMinPrice($francoMinPrice = null, $comparison = null)
+ {
+ if (is_array($francoMinPrice)) {
+ $useMinMax = false;
+ if (isset($francoMinPrice['min'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE, $francoMinPrice['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($francoMinPrice['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE, $francoMinPrice['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE, $francoMinPrice, $comparison);
+ }
+
+ /**
+ * Filter the query on the price column
+ *
+ * Example usage:
+ *
+ * $query->filterByPrice(1234); // WHERE price = 1234
+ * $query->filterByPrice(array(12, 34)); // WHERE price IN (12, 34)
+ * $query->filterByPrice(array('min' => 12)); // WHERE price > 12
+ *
+ *
+ * @param mixed $price 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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByPrice($price = null, $comparison = null)
+ {
+ if (is_array($price)) {
+ $useMinMax = false;
+ if (isset($price['min'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE, $price['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($price['max'])) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE, $price['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::PRICE, $price, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \ChronopostHomeDelivery\Model\Thelia\Model\Area object
+ *
+ * @param \ChronopostHomeDelivery\Model\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 ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByArea($area, $comparison = null)
+ {
+ if ($area instanceof \ChronopostHomeDelivery\Model\Thelia\Model\Area) {
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $area->getId(), $comparison);
+ } elseif ($area instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByArea() only accepts arguments of type \ChronopostHomeDelivery\Model\Thelia\Model\Area or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Area relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function joinArea($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Area');
+
+ // 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, 'Area');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Area relation Area 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 \ChronopostHomeDelivery\Model\Thelia\Model\AreaQuery A secondary query class using the current class as primary query
+ */
+ public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinArea($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Area', '\ChronopostHomeDelivery\Model\Thelia\Model\AreaQuery');
+ }
+
+ /**
+ * Filter the query by a related \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode object
+ *
+ * @param \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode|ObjectCollection $chronopostHomeDeliveryDeliveryMode The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function filterByChronopostHomeDeliveryDeliveryMode($chronopostHomeDeliveryDeliveryMode, $comparison = null)
+ {
+ if ($chronopostHomeDeliveryDeliveryMode instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode) {
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $chronopostHomeDeliveryDeliveryMode->getId(), $comparison);
+ } elseif ($chronopostHomeDeliveryDeliveryMode instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, $chronopostHomeDeliveryDeliveryMode->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByChronopostHomeDeliveryDeliveryMode() only accepts arguments of type \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the ChronopostHomeDeliveryDeliveryMode relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function joinChronopostHomeDeliveryDeliveryMode($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('ChronopostHomeDeliveryDeliveryMode');
+
+ // 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, 'ChronopostHomeDeliveryDeliveryMode');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the ChronopostHomeDeliveryDeliveryMode relation ChronopostHomeDeliveryDeliveryMode 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 \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery A secondary query class using the current class as primary query
+ */
+ public function useChronopostHomeDeliveryDeliveryModeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinChronopostHomeDeliveryDeliveryMode($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ChronopostHomeDeliveryDeliveryMode', '\ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryModeQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildChronopostHomeDeliveryPrice $chronopostHomeDeliveryPrice Object to remove from the list of results
+ *
+ * @return ChildChronopostHomeDeliveryPriceQuery The current query, for fluid interface
+ */
+ public function prune($chronopostHomeDeliveryPrice = null)
+ {
+ if ($chronopostHomeDeliveryPrice) {
+ $this->addUsingAlias(ChronopostHomeDeliveryPriceTableMap::ID, $chronopostHomeDeliveryPrice->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the chronopost_home_delivery_price table.
+ *
+ * @param ConnectionInterface $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public function doDeleteAll(ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += parent::doDeleteAll($con);
+ // 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).
+ ChronopostHomeDeliveryPriceTableMap::clearInstancePool();
+ ChronopostHomeDeliveryPriceTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildChronopostHomeDeliveryPrice or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildChronopostHomeDeliveryPrice 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
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public function delete(ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+
+ ChronopostHomeDeliveryPriceTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ ChronopostHomeDeliveryPriceTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // ChronopostHomeDeliveryPriceQuery
diff --git a/local/modules/ChronopostHomeDelivery/Model/ChronopostHomeDeliveryAreaFreeshipping.php b/local/modules/ChronopostHomeDelivery/Model/ChronopostHomeDeliveryAreaFreeshipping.php
new file mode 100644
index 00000000..2790dca8
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/ChronopostHomeDeliveryAreaFreeshipping.php
@@ -0,0 +1,10 @@
+ array('Id', 'AreaId', 'DeliveryModeId', 'CartAmount', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'deliveryModeId', 'cartAmount', ),
+ self::TYPE_COLNAME => array(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID, ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID, ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'DELIVERY_MODE_ID', 'CART_AMOUNT', ),
+ self::TYPE_FIELDNAME => array('id', 'area_id', 'delivery_mode_id', 'cart_amount', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'DeliveryModeId' => 2, 'CartAmount' => 3, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'deliveryModeId' => 2, 'cartAmount' => 3, ),
+ self::TYPE_COLNAME => array(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID => 0, ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID => 1, ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID => 2, ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT => 3, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'DELIVERY_MODE_ID' => 2, 'CART_AMOUNT' => 3, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'delivery_mode_id' => 2, 'cart_amount' => 3, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, )
+ );
+
+ /**
+ * Initialize the table attributes and columns
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('chronopost_home_delivery_area_freeshipping');
+ $this->setPhpName('ChronopostHomeDeliveryAreaFreeshipping');
+ $this->setClassName('\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryAreaFreeshipping');
+ $this->setPackage('ChronopostHomeDelivery.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
+ $this->addForeignKey('DELIVERY_MODE_ID', 'DeliveryModeId', 'INTEGER', 'chronopost_home_delivery_delivery_mode', 'ID', true, null, null);
+ $this->addColumn('CART_AMOUNT', 'CartAmount', 'DECIMAL', false, 16, 0);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Area', '\\ChronopostHomeDelivery\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', 'RESTRICT');
+ $this->addRelation('ChronopostHomeDeliveryDeliveryMode', '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryDeliveryMode', RelationMap::MANY_TO_ONE, array('delivery_mode_id' => 'id', ), 'RESTRICT', 'RESTRICT');
+ } // buildRelations()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ */
+ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ return null;
+ }
+
+ return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ *
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+
+ return (int) $row[
+ $indexType == TableMap::TYPE_NUM
+ ? 0 + $offset
+ : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
+ ];
+ }
+
+ /**
+ * The class that the tableMap will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is translated into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? ChronopostHomeDeliveryAreaFreeshippingTableMap::CLASS_DEFAULT : ChronopostHomeDeliveryAreaFreeshippingTableMap::OM_CLASS;
+ }
+
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row row returned by DataFetcher->fetch().
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ChronopostHomeDeliveryAreaFreeshipping object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = ChronopostHomeDeliveryAreaFreeshippingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = ChronopostHomeDeliveryAreaFreeshippingTableMap::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 + ChronopostHomeDeliveryAreaFreeshippingTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ChronopostHomeDeliveryAreaFreeshippingTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ ChronopostHomeDeliveryAreaFreeshippingTableMap::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @param DataFetcherInterface $dataFetcher
+ * @return array
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(DataFetcherInterface $dataFetcher)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = static::getOMClass(false);
+ // populate the object(s)
+ while ($row = $dataFetcher->fetch()) {
+ $key = ChronopostHomeDeliveryAreaFreeshippingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = ChronopostHomeDeliveryAreaFreeshippingTableMap::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
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ChronopostHomeDeliveryAreaFreeshippingTableMap::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+
+ return $results;
+ }
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryAreaFreeshippingTableMap::AREA_ID);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryAreaFreeshippingTableMap::DELIVERY_MODE_ID);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryAreaFreeshippingTableMap::CART_AMOUNT);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.AREA_ID');
+ $criteria->addSelectColumn($alias . '.DELIVERY_MODE_ID');
+ $criteria->addSelectColumn($alias . '.CART_AMOUNT');
+ }
+ }
+
+ /**
+ * Returns the TableMap related to this object.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME)->getTable(ChronopostHomeDeliveryAreaFreeshippingTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(ChronopostHomeDeliveryAreaFreeshippingTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new ChronopostHomeDeliveryAreaFreeshippingTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChronopostHomeDeliveryAreaFreeshipping or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChronopostHomeDeliveryAreaFreeshipping 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
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryAreaFreeshipping) { // 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(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ $criteria->add(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = ChronopostHomeDeliveryAreaFreeshippingQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { ChronopostHomeDeliveryAreaFreeshippingTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { ChronopostHomeDeliveryAreaFreeshippingTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the chronopost_home_delivery_area_freeshipping 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 ChronopostHomeDeliveryAreaFreeshippingQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ChronopostHomeDeliveryAreaFreeshipping or Criteria object.
+ *
+ * @param mixed $criteria Criteria or ChronopostHomeDeliveryAreaFreeshipping 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
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($criteria, ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryAreaFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from ChronopostHomeDeliveryAreaFreeshipping object
+ }
+
+ if ($criteria->containsKey(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID) && $criteria->keyContainsValue(ChronopostHomeDeliveryAreaFreeshippingTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChronopostHomeDeliveryAreaFreeshippingTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = ChronopostHomeDeliveryAreaFreeshippingQuery::create()->mergeWith($criteria);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = $query->doInsert($con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+} // ChronopostHomeDeliveryAreaFreeshippingTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+ChronopostHomeDeliveryAreaFreeshippingTableMap::buildTableMap();
diff --git a/local/modules/ChronopostHomeDelivery/Model/Map/ChronopostHomeDeliveryDeliveryModeTableMap.php b/local/modules/ChronopostHomeDelivery/Model/Map/ChronopostHomeDeliveryDeliveryModeTableMap.php
new file mode 100644
index 00000000..a2093f8a
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/Map/ChronopostHomeDeliveryDeliveryModeTableMap.php
@@ -0,0 +1,436 @@
+ array('Id', 'Title', 'Code', 'FreeshippingActive', 'FreeshippingFrom', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'title', 'code', 'freeshippingActive', 'freeshippingFrom', ),
+ self::TYPE_COLNAME => array(ChronopostHomeDeliveryDeliveryModeTableMap::ID, ChronopostHomeDeliveryDeliveryModeTableMap::TITLE, ChronopostHomeDeliveryDeliveryModeTableMap::CODE, ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE, ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CODE', 'FREESHIPPING_ACTIVE', 'FREESHIPPING_FROM', ),
+ self::TYPE_FIELDNAME => array('id', 'title', 'code', 'freeshipping_active', 'freeshipping_from', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'Code' => 2, 'FreeshippingActive' => 3, 'FreeshippingFrom' => 4, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'freeshippingActive' => 3, 'freeshippingFrom' => 4, ),
+ self::TYPE_COLNAME => array(ChronopostHomeDeliveryDeliveryModeTableMap::ID => 0, ChronopostHomeDeliveryDeliveryModeTableMap::TITLE => 1, ChronopostHomeDeliveryDeliveryModeTableMap::CODE => 2, ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE => 3, ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM => 4, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CODE' => 2, 'FREESHIPPING_ACTIVE' => 3, 'FREESHIPPING_FROM' => 4, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'code' => 2, 'freeshipping_active' => 3, 'freeshipping_from' => 4, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * Initialize the table attributes and columns
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('chronopost_home_delivery_delivery_mode');
+ $this->setPhpName('ChronopostHomeDeliveryDeliveryMode');
+ $this->setClassName('\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryDeliveryMode');
+ $this->setPackage('ChronopostHomeDelivery.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('CODE', 'Code', 'VARCHAR', true, 55, null);
+ $this->addColumn('FREESHIPPING_ACTIVE', 'FreeshippingActive', 'BOOLEAN', false, 1, null);
+ $this->addColumn('FREESHIPPING_FROM', 'FreeshippingFrom', 'FLOAT', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('ChronopostHomeDeliveryPrice', '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryPrice', RelationMap::ONE_TO_MANY, array('id' => 'delivery_mode_id', ), 'RESTRICT', 'RESTRICT', 'ChronopostHomeDeliveryPrices');
+ $this->addRelation('ChronopostHomeDeliveryAreaFreeshipping', '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryAreaFreeshipping', RelationMap::ONE_TO_MANY, array('id' => 'delivery_mode_id', ), 'RESTRICT', 'RESTRICT', 'ChronopostHomeDeliveryAreaFreeshippings');
+ } // buildRelations()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ */
+ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ return null;
+ }
+
+ return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ *
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+
+ return (int) $row[
+ $indexType == TableMap::TYPE_NUM
+ ? 0 + $offset
+ : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
+ ];
+ }
+
+ /**
+ * The class that the tableMap will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is translated into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? ChronopostHomeDeliveryDeliveryModeTableMap::CLASS_DEFAULT : ChronopostHomeDeliveryDeliveryModeTableMap::OM_CLASS;
+ }
+
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row row returned by DataFetcher->fetch().
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ChronopostHomeDeliveryDeliveryMode object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = ChronopostHomeDeliveryDeliveryModeTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = ChronopostHomeDeliveryDeliveryModeTableMap::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 + ChronopostHomeDeliveryDeliveryModeTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ChronopostHomeDeliveryDeliveryModeTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ ChronopostHomeDeliveryDeliveryModeTableMap::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @param DataFetcherInterface $dataFetcher
+ * @return array
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(DataFetcherInterface $dataFetcher)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = static::getOMClass(false);
+ // populate the object(s)
+ while ($row = $dataFetcher->fetch()) {
+ $key = ChronopostHomeDeliveryDeliveryModeTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = ChronopostHomeDeliveryDeliveryModeTableMap::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
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ChronopostHomeDeliveryDeliveryModeTableMap::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+
+ return $results;
+ }
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ChronopostHomeDeliveryDeliveryModeTableMap::ID);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryDeliveryModeTableMap::TITLE);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryDeliveryModeTableMap::CODE);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_ACTIVE);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryDeliveryModeTableMap::FREESHIPPING_FROM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.CODE');
+ $criteria->addSelectColumn($alias . '.FREESHIPPING_ACTIVE');
+ $criteria->addSelectColumn($alias . '.FREESHIPPING_FROM');
+ }
+ }
+
+ /**
+ * Returns the TableMap related to this object.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME)->getTable(ChronopostHomeDeliveryDeliveryModeTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(ChronopostHomeDeliveryDeliveryModeTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new ChronopostHomeDeliveryDeliveryModeTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChronopostHomeDeliveryDeliveryMode or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChronopostHomeDeliveryDeliveryMode 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
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryDeliveryMode) { // 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(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ $criteria->add(ChronopostHomeDeliveryDeliveryModeTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = ChronopostHomeDeliveryDeliveryModeQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { ChronopostHomeDeliveryDeliveryModeTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { ChronopostHomeDeliveryDeliveryModeTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the chronopost_home_delivery_delivery_mode 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 ChronopostHomeDeliveryDeliveryModeQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ChronopostHomeDeliveryDeliveryMode or Criteria object.
+ *
+ * @param mixed $criteria Criteria or ChronopostHomeDeliveryDeliveryMode 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
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($criteria, ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryDeliveryModeTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from ChronopostHomeDeliveryDeliveryMode object
+ }
+
+ if ($criteria->containsKey(ChronopostHomeDeliveryDeliveryModeTableMap::ID) && $criteria->keyContainsValue(ChronopostHomeDeliveryDeliveryModeTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChronopostHomeDeliveryDeliveryModeTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = ChronopostHomeDeliveryDeliveryModeQuery::create()->mergeWith($criteria);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = $query->doInsert($con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+} // ChronopostHomeDeliveryDeliveryModeTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+ChronopostHomeDeliveryDeliveryModeTableMap::buildTableMap();
diff --git a/local/modules/ChronopostHomeDelivery/Model/Map/ChronopostHomeDeliveryOrderTableMap.php b/local/modules/ChronopostHomeDelivery/Model/Map/ChronopostHomeDeliveryOrderTableMap.php
new file mode 100644
index 00000000..d19e0d50
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/Map/ChronopostHomeDeliveryOrderTableMap.php
@@ -0,0 +1,443 @@
+ array('Id', 'OrderId', 'DeliveryType', 'DeliveryCode', 'LabelDirectory', 'LabelNumber', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'deliveryType', 'deliveryCode', 'labelDirectory', 'labelNumber', ),
+ self::TYPE_COLNAME => array(ChronopostHomeDeliveryOrderTableMap::ID, ChronopostHomeDeliveryOrderTableMap::ORDER_ID, ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE, ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE, ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY, ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'DELIVERY_TYPE', 'DELIVERY_CODE', 'LABEL_DIRECTORY', 'LABEL_NUMBER', ),
+ self::TYPE_FIELDNAME => array('id', 'order_id', 'delivery_type', 'delivery_code', 'label_directory', 'label_number', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ self::TYPE_PHPNAME => array('Id' => 0, 'OrderId' => 1, 'DeliveryType' => 2, 'DeliveryCode' => 3, 'LabelDirectory' => 4, 'LabelNumber' => 5, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'deliveryType' => 2, 'deliveryCode' => 3, 'labelDirectory' => 4, 'labelNumber' => 5, ),
+ self::TYPE_COLNAME => array(ChronopostHomeDeliveryOrderTableMap::ID => 0, ChronopostHomeDeliveryOrderTableMap::ORDER_ID => 1, ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE => 2, ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE => 3, ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY => 4, ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER => 5, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'DELIVERY_TYPE' => 2, 'DELIVERY_CODE' => 3, 'LABEL_DIRECTORY' => 4, 'LABEL_NUMBER' => 5, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'delivery_type' => 2, 'delivery_code' => 3, 'label_directory' => 4, 'label_number' => 5, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Initialize the table attributes and columns
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('chronopost_home_delivery_order');
+ $this->setPhpName('ChronopostHomeDeliveryOrder');
+ $this->setClassName('\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryOrder');
+ $this->setPackage('ChronopostHomeDelivery.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null);
+ $this->addColumn('DELIVERY_TYPE', 'DeliveryType', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('DELIVERY_CODE', 'DeliveryCode', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('LABEL_DIRECTORY', 'LabelDirectory', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('LABEL_NUMBER', 'LabelNumber', 'LONGVARCHAR', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Order', '\\ChronopostHomeDelivery\\Model\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ } // buildRelations()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ */
+ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ return null;
+ }
+
+ return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ *
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+
+ return (int) $row[
+ $indexType == TableMap::TYPE_NUM
+ ? 0 + $offset
+ : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
+ ];
+ }
+
+ /**
+ * The class that the tableMap will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is translated into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? ChronopostHomeDeliveryOrderTableMap::CLASS_DEFAULT : ChronopostHomeDeliveryOrderTableMap::OM_CLASS;
+ }
+
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row row returned by DataFetcher->fetch().
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ChronopostHomeDeliveryOrder object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = ChronopostHomeDeliveryOrderTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = ChronopostHomeDeliveryOrderTableMap::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 + ChronopostHomeDeliveryOrderTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ChronopostHomeDeliveryOrderTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ ChronopostHomeDeliveryOrderTableMap::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @param DataFetcherInterface $dataFetcher
+ * @return array
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(DataFetcherInterface $dataFetcher)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = static::getOMClass(false);
+ // populate the object(s)
+ while ($row = $dataFetcher->fetch()) {
+ $key = ChronopostHomeDeliveryOrderTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = ChronopostHomeDeliveryOrderTableMap::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
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ChronopostHomeDeliveryOrderTableMap::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+
+ return $results;
+ }
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::ID);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::ORDER_ID);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::DELIVERY_TYPE);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::DELIVERY_CODE);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::LABEL_DIRECTORY);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryOrderTableMap::LABEL_NUMBER);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.ORDER_ID');
+ $criteria->addSelectColumn($alias . '.DELIVERY_TYPE');
+ $criteria->addSelectColumn($alias . '.DELIVERY_CODE');
+ $criteria->addSelectColumn($alias . '.LABEL_DIRECTORY');
+ $criteria->addSelectColumn($alias . '.LABEL_NUMBER');
+ }
+ }
+
+ /**
+ * Returns the TableMap related to this object.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME)->getTable(ChronopostHomeDeliveryOrderTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(ChronopostHomeDeliveryOrderTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new ChronopostHomeDeliveryOrderTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChronopostHomeDeliveryOrder or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChronopostHomeDeliveryOrder 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
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryOrder) { // 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(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ $criteria->add(ChronopostHomeDeliveryOrderTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = ChronopostHomeDeliveryOrderQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { ChronopostHomeDeliveryOrderTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { ChronopostHomeDeliveryOrderTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the chronopost_home_delivery_order 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 ChronopostHomeDeliveryOrderQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ChronopostHomeDeliveryOrder or Criteria object.
+ *
+ * @param mixed $criteria Criteria or ChronopostHomeDeliveryOrder 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
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($criteria, ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryOrderTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from ChronopostHomeDeliveryOrder object
+ }
+
+ if ($criteria->containsKey(ChronopostHomeDeliveryOrderTableMap::ID) && $criteria->keyContainsValue(ChronopostHomeDeliveryOrderTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChronopostHomeDeliveryOrderTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = ChronopostHomeDeliveryOrderQuery::create()->mergeWith($criteria);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = $query->doInsert($con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+} // ChronopostHomeDeliveryOrderTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+ChronopostHomeDeliveryOrderTableMap::buildTableMap();
diff --git a/local/modules/ChronopostHomeDelivery/Model/Map/ChronopostHomeDeliveryPriceTableMap.php b/local/modules/ChronopostHomeDelivery/Model/Map/ChronopostHomeDeliveryPriceTableMap.php
new file mode 100644
index 00000000..cb135f45
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/Model/Map/ChronopostHomeDeliveryPriceTableMap.php
@@ -0,0 +1,452 @@
+ array('Id', 'AreaId', 'DeliveryModeId', 'WeightMax', 'PriceMax', 'FrancoMinPrice', 'Price', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'deliveryModeId', 'weightMax', 'priceMax', 'francoMinPrice', 'price', ),
+ self::TYPE_COLNAME => array(ChronopostHomeDeliveryPriceTableMap::ID, ChronopostHomeDeliveryPriceTableMap::AREA_ID, ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID, ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX, ChronopostHomeDeliveryPriceTableMap::PRICE_MAX, ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE, ChronopostHomeDeliveryPriceTableMap::PRICE, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'DELIVERY_MODE_ID', 'WEIGHT_MAX', 'PRICE_MAX', 'FRANCO_MIN_PRICE', 'PRICE', ),
+ self::TYPE_FIELDNAME => array('id', 'area_id', 'delivery_mode_id', 'weight_max', 'price_max', 'franco_min_price', 'price', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'DeliveryModeId' => 2, 'WeightMax' => 3, 'PriceMax' => 4, 'FrancoMinPrice' => 5, 'Price' => 6, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'deliveryModeId' => 2, 'weightMax' => 3, 'priceMax' => 4, 'francoMinPrice' => 5, 'price' => 6, ),
+ self::TYPE_COLNAME => array(ChronopostHomeDeliveryPriceTableMap::ID => 0, ChronopostHomeDeliveryPriceTableMap::AREA_ID => 1, ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID => 2, ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX => 3, ChronopostHomeDeliveryPriceTableMap::PRICE_MAX => 4, ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE => 5, ChronopostHomeDeliveryPriceTableMap::PRICE => 6, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'DELIVERY_MODE_ID' => 2, 'WEIGHT_MAX' => 3, 'PRICE_MAX' => 4, 'FRANCO_MIN_PRICE' => 5, 'PRICE' => 6, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'delivery_mode_id' => 2, 'weight_max' => 3, 'price_max' => 4, 'franco_min_price' => 5, 'price' => 6, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
+ );
+
+ /**
+ * Initialize the table attributes and columns
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('chronopost_home_delivery_price');
+ $this->setPhpName('ChronopostHomeDeliveryPrice');
+ $this->setClassName('\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryPrice');
+ $this->setPackage('ChronopostHomeDelivery.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
+ $this->addForeignKey('DELIVERY_MODE_ID', 'DeliveryModeId', 'INTEGER', 'chronopost_home_delivery_delivery_mode', 'ID', true, null, null);
+ $this->addColumn('WEIGHT_MAX', 'WeightMax', 'FLOAT', false, null, null);
+ $this->addColumn('PRICE_MAX', 'PriceMax', 'FLOAT', false, null, null);
+ $this->addColumn('FRANCO_MIN_PRICE', 'FrancoMinPrice', 'FLOAT', false, null, null);
+ $this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Area', '\\ChronopostHomeDelivery\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', 'RESTRICT');
+ $this->addRelation('ChronopostHomeDeliveryDeliveryMode', '\\ChronopostHomeDelivery\\Model\\ChronopostHomeDeliveryDeliveryMode', RelationMap::MANY_TO_ONE, array('delivery_mode_id' => 'id', ), 'RESTRICT', 'RESTRICT');
+ } // buildRelations()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ */
+ public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ // If the PK cannot be derived from the row, return NULL.
+ if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ return null;
+ }
+
+ return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row resultset row.
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
+ *
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+
+ return (int) $row[
+ $indexType == TableMap::TYPE_NUM
+ ? 0 + $offset
+ : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
+ ];
+ }
+
+ /**
+ * The class that the tableMap will make instances of.
+ *
+ * If $withPrefix is true, the returned path
+ * uses a dot-path notation which is translated into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @param boolean $withPrefix Whether or not to return the path with the class name
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass($withPrefix = true)
+ {
+ return $withPrefix ? ChronopostHomeDeliveryPriceTableMap::CLASS_DEFAULT : ChronopostHomeDeliveryPriceTableMap::OM_CLASS;
+ }
+
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row row returned by DataFetcher->fetch().
+ * @param int $offset The 0-based offset for reading from the resultset row.
+ * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
+ One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ChronopostHomeDeliveryPrice object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = ChronopostHomeDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = ChronopostHomeDeliveryPriceTableMap::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 + ChronopostHomeDeliveryPriceTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ChronopostHomeDeliveryPriceTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ ChronopostHomeDeliveryPriceTableMap::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @param DataFetcherInterface $dataFetcher
+ * @return array
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(DataFetcherInterface $dataFetcher)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = static::getOMClass(false);
+ // populate the object(s)
+ while ($row = $dataFetcher->fetch()) {
+ $key = ChronopostHomeDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = ChronopostHomeDeliveryPriceTableMap::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
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ChronopostHomeDeliveryPriceTableMap::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+
+ return $results;
+ }
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::ID);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::AREA_ID);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::DELIVERY_MODE_ID);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::WEIGHT_MAX);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::PRICE_MAX);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::FRANCO_MIN_PRICE);
+ $criteria->addSelectColumn(ChronopostHomeDeliveryPriceTableMap::PRICE);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.AREA_ID');
+ $criteria->addSelectColumn($alias . '.DELIVERY_MODE_ID');
+ $criteria->addSelectColumn($alias . '.WEIGHT_MAX');
+ $criteria->addSelectColumn($alias . '.PRICE_MAX');
+ $criteria->addSelectColumn($alias . '.FRANCO_MIN_PRICE');
+ $criteria->addSelectColumn($alias . '.PRICE');
+ }
+ }
+
+ /**
+ * Returns the TableMap related to this object.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME)->getTable(ChronopostHomeDeliveryPriceTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(ChronopostHomeDeliveryPriceTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new ChronopostHomeDeliveryPriceTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChronopostHomeDeliveryPrice or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChronopostHomeDeliveryPrice 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
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \ChronopostHomeDelivery\Model\ChronopostHomeDeliveryPrice) { // 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(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ $criteria->add(ChronopostHomeDeliveryPriceTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = ChronopostHomeDeliveryPriceQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { ChronopostHomeDeliveryPriceTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { ChronopostHomeDeliveryPriceTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the chronopost_home_delivery_price 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 ChronopostHomeDeliveryPriceQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ChronopostHomeDeliveryPrice or Criteria object.
+ *
+ * @param mixed $criteria Criteria or ChronopostHomeDeliveryPrice 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
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($criteria, ConnectionInterface $con = null)
+ {
+ if (null === $con) {
+ $con = Propel::getServiceContainer()->getWriteConnection(ChronopostHomeDeliveryPriceTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from ChronopostHomeDeliveryPrice object
+ }
+
+ if ($criteria->containsKey(ChronopostHomeDeliveryPriceTableMap::ID) && $criteria->keyContainsValue(ChronopostHomeDeliveryPriceTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChronopostHomeDeliveryPriceTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = ChronopostHomeDeliveryPriceQuery::create()->mergeWith($criteria);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = $query->doInsert($con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+} // ChronopostHomeDeliveryPriceTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+ChronopostHomeDeliveryPriceTableMap::buildTableMap();
diff --git a/local/modules/ChronopostHomeDelivery/README.md b/local/modules/ChronopostHomeDelivery/README.md
new file mode 100644
index 00000000..98f3c34c
--- /dev/null
+++ b/local/modules/ChronopostHomeDelivery/README.md
@@ -0,0 +1,103 @@
+# ChronopostHomeDelivery
+
+Allows you to choose between differents delivery modes offered by Chronopost.
+Activating one or more of them will let your customers choose which one
+they want.
+
+Delivery types currently availables :
+
+- Chrono13
+- Chrono18
+- Chrono Classic (Delivery in Europe)
+- Chrono Express (Express delivery in Europe)
+- Fresh13
+- Others will be added in future versions
+
+NB1 : You need IDs provided by Chronopost to use this module.
+
+
+## Installation
+
+### Manually
+
+* Copy the module into ```| + + | ++ + | +||
|---|---|---|---|
| {intl l="Weight up to ... kg" d='chronopost.home.delivery.bo.default'} | +{intl l="Untaxed Price up to ... %symbol" symbol=$currencySymbol d='chronopost.home.delivery.bo.default'} | +{intl l="Price (%symbol)" symbol=$currencySymbol d='chronopost.home.delivery.bo.default'} | +{intl l="Actions" d='chronopost.home.delivery.bo.default'} | +
| + + | ++ + | ++ + | ++ + | +
| + + | ++ + | ++ + | ++ + + + | +
{if {$TITLE} == 9}{intl l="Dear Mr. "} + {else}{intl l="Dear Ms. "} + {/if} + {$FIRSTNAME} {$LASTNAME}, +
+ + {/loop} + +{intl l="We are pleased to inform you that your order number"} {$order_ref} {intl l="has been shipped on"} {format_date date=$update_date output="date"} {intl l="with the tracking number"} {$package}.
+ +{intl l='Click here to track your shipment.' package=$package}
+{intl l='Thank you for your shopping with us and hope to see you soon on www.yourshop.com'}
+{intl l="Your on-line store Manager"}
+ {intl l="Your shop"}