ColissimoLabel instance. If
+ * obj is an instance of ColissimoLabel, delegates to
+ * equals(ColissimoLabel). 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 ColissimoLabel 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 ColissimoLabel 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 [weight] column value.
+ *
+ * @return string
+ */
+ public function getWeight()
+ {
+
+ return $this->weight;
+ }
+
+ /**
+ * Get the [number] column value.
+ *
+ * @return string
+ */
+ public function getNumber()
+ {
+
+ return $this->number;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [created_at] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getCreatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->created_at;
+ } else {
+ return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [updated_at] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getUpdatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->updated_at;
+ } else {
+ return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \ColissimoLabel\Model\ColissimoLabel 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[ColissimoLabelTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [order_id] column.
+ *
+ * @param int $v new value
+ * @return \ColissimoLabel\Model\ColissimoLabel 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[ColissimoLabelTableMap::ORDER_ID] = true;
+ }
+
+ if ($this->aOrder !== null && $this->aOrder->getId() !== $v) {
+ $this->aOrder = null;
+ }
+
+
+ return $this;
+ } // setOrderId()
+
+ /**
+ * Set the value of [weight] column.
+ *
+ * @param string $v new value
+ * @return \ColissimoLabel\Model\ColissimoLabel The current object (for fluent API support)
+ */
+ public function setWeight($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->weight !== $v) {
+ $this->weight = $v;
+ $this->modifiedColumns[ColissimoLabelTableMap::WEIGHT] = true;
+ }
+
+
+ return $this;
+ } // setWeight()
+
+ /**
+ * Set the value of [number] column.
+ *
+ * @param string $v new value
+ * @return \ColissimoLabel\Model\ColissimoLabel The current object (for fluent API support)
+ */
+ public function setNumber($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->number !== $v) {
+ $this->number = $v;
+ $this->modifiedColumns[ColissimoLabelTableMap::NUMBER] = true;
+ }
+
+
+ return $this;
+ } // setNumber()
+
+ /**
+ * Sets the value of [created_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \ColissimoLabel\Model\ColissimoLabel The current object (for fluent API support)
+ */
+ public function setCreatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->created_at !== null || $dt !== null) {
+ if ($dt !== $this->created_at) {
+ $this->created_at = $dt;
+ $this->modifiedColumns[ColissimoLabelTableMap::CREATED_AT] = true;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setCreatedAt()
+
+ /**
+ * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \ColissimoLabel\Model\ColissimoLabel The current object (for fluent API support)
+ */
+ public function setUpdatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->updated_at !== null || $dt !== null) {
+ if ($dt !== $this->updated_at) {
+ $this->updated_at = $dt;
+ $this->modifiedColumns[ColissimoLabelTableMap::UPDATED_AT] = true;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setUpdatedAt()
+
+ /**
+ * 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->weight !== '0.00') {
+ 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 : ColissimoLabelTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ColissimoLabelTableMap::translateFieldName('OrderId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->order_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ColissimoLabelTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->weight = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ColissimoLabelTableMap::translateFieldName('Number', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->number = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ColissimoLabelTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ColissimoLabelTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = ColissimoLabelTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \ColissimoLabel\Model\ColissimoLabel 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(ColissimoLabelTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildColissimoLabelQuery::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 ColissimoLabel::setDeleted()
+ * @see ColissimoLabel::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(ColissimoLabelTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildColissimoLabelQuery::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(ColissimoLabelTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ // timestampable behavior
+ if (!$this->isColumnModified(ColissimoLabelTableMap::CREATED_AT)) {
+ $this->setCreatedAt(time());
+ }
+ if (!$this->isColumnModified(ColissimoLabelTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ // timestampable behavior
+ if ($this->isModified() && !$this->isColumnModified(ColissimoLabelTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ColissimoLabelTableMap::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[ColissimoLabelTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . ColissimoLabelTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ColissimoLabelTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(ColissimoLabelTableMap::ORDER_ID)) {
+ $modifiedColumns[':p' . $index++] = 'ORDER_ID';
+ }
+ if ($this->isColumnModified(ColissimoLabelTableMap::WEIGHT)) {
+ $modifiedColumns[':p' . $index++] = 'WEIGHT';
+ }
+ if ($this->isColumnModified(ColissimoLabelTableMap::NUMBER)) {
+ $modifiedColumns[':p' . $index++] = 'NUMBER';
+ }
+ if ($this->isColumnModified(ColissimoLabelTableMap::CREATED_AT)) {
+ $modifiedColumns[':p' . $index++] = 'CREATED_AT';
+ }
+ if ($this->isColumnModified(ColissimoLabelTableMap::UPDATED_AT)) {
+ $modifiedColumns[':p' . $index++] = 'UPDATED_AT';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO colissimo_label (%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 'WEIGHT':
+ $stmt->bindValue($identifier, $this->weight, PDO::PARAM_STR);
+ break;
+ case 'NUMBER':
+ $stmt->bindValue($identifier, $this->number, PDO::PARAM_STR);
+ break;
+ case 'CREATED_AT':
+ $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ break;
+ case 'UPDATED_AT':
+ $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, 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 = ColissimoLabelTableMap::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->getWeight();
+ break;
+ case 3:
+ return $this->getNumber();
+ break;
+ case 4:
+ return $this->getCreatedAt();
+ break;
+ case 5:
+ return $this->getUpdatedAt();
+ 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['ColissimoLabel'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ColissimoLabel'][$this->getPrimaryKey()] = true;
+ $keys = ColissimoLabelTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getOrderId(),
+ $keys[2] => $this->getWeight(),
+ $keys[3] => $this->getNumber(),
+ $keys[4] => $this->getCreatedAt(),
+ $keys[5] => $this->getUpdatedAt(),
+ );
+ $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 = ColissimoLabelTableMap::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->setWeight($value);
+ break;
+ case 3:
+ $this->setNumber($value);
+ break;
+ case 4:
+ $this->setCreatedAt($value);
+ break;
+ case 5:
+ $this->setUpdatedAt($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 = ColissimoLabelTableMap::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->setWeight($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setNumber($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
+ }
+
+ /**
+ * 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(ColissimoLabelTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(ColissimoLabelTableMap::ID)) $criteria->add(ColissimoLabelTableMap::ID, $this->id);
+ if ($this->isColumnModified(ColissimoLabelTableMap::ORDER_ID)) $criteria->add(ColissimoLabelTableMap::ORDER_ID, $this->order_id);
+ if ($this->isColumnModified(ColissimoLabelTableMap::WEIGHT)) $criteria->add(ColissimoLabelTableMap::WEIGHT, $this->weight);
+ if ($this->isColumnModified(ColissimoLabelTableMap::NUMBER)) $criteria->add(ColissimoLabelTableMap::NUMBER, $this->number);
+ if ($this->isColumnModified(ColissimoLabelTableMap::CREATED_AT)) $criteria->add(ColissimoLabelTableMap::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(ColissimoLabelTableMap::UPDATED_AT)) $criteria->add(ColissimoLabelTableMap::UPDATED_AT, $this->updated_at);
+
+ 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(ColissimoLabelTableMap::DATABASE_NAME);
+ $criteria->add(ColissimoLabelTableMap::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 \ColissimoLabel\Model\ColissimoLabel (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->setWeight($this->getWeight());
+ $copyObj->setNumber($this->getNumber());
+ $copyObj->setCreatedAt($this->getCreatedAt());
+ $copyObj->setUpdatedAt($this->getUpdatedAt());
+ 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 \ColissimoLabel\Model\ColissimoLabel 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 \ColissimoLabel\Model\ColissimoLabel 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->addColissimoLabel($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->addColissimoLabels($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->weight = null;
+ $this->number = null;
+ $this->created_at = null;
+ $this->updated_at = 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->aOrder = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ColissimoLabelTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ // timestampable behavior
+
+ /**
+ * Mark the current object so that the update date doesn't get updated during next save
+ *
+ * @return ChildColissimoLabel The current object (for fluent API support)
+ */
+ public function keepUpdateDateUnchanged()
+ {
+ $this->modifiedColumns[ColissimoLabelTableMap::UPDATED_AT] = true;
+
+ return $this;
+ }
+
+ /**
+ * 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/ColissimoLabel/Model/Base/ColissimoLabelQuery.php b/local/modules/ColissimoLabel/Model/Base/ColissimoLabelQuery.php
new file mode 100644
index 00000000..8a45d784
--- /dev/null
+++ b/local/modules/ColissimoLabel/Model/Base/ColissimoLabelQuery.php
@@ -0,0 +1,712 @@
+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 ChildColissimoLabel|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ColissimoLabelTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ColissimoLabelTableMap::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 ChildColissimoLabel A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, ORDER_ID, WEIGHT, NUMBER, CREATED_AT, UPDATED_AT FROM colissimo_label 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 ChildColissimoLabel();
+ $obj->hydrate($row);
+ ColissimoLabelTableMap::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 ChildColissimoLabel|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 ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(ColissimoLabelTableMap::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 ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(ColissimoLabelTableMap::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 ChildColissimoLabelQuery 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(ColissimoLabelTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(ColissimoLabelTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimoLabelTableMap::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 ChildColissimoLabelQuery 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(ColissimoLabelTableMap::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($orderId['max'])) {
+ $this->addUsingAlias(ColissimoLabelTableMap::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimoLabelTableMap::ORDER_ID, $orderId, $comparison);
+ }
+
+ /**
+ * Filter the query on the weight column
+ *
+ * Example usage:
+ *
+ * $query->filterByWeight(1234); // WHERE weight = 1234
+ * $query->filterByWeight(array(12, 34)); // WHERE weight IN (12, 34)
+ * $query->filterByWeight(array('min' => 12)); // WHERE weight > 12
+ *
+ *
+ * @param mixed $weight 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 ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function filterByWeight($weight = null, $comparison = null)
+ {
+ if (is_array($weight)) {
+ $useMinMax = false;
+ if (isset($weight['min'])) {
+ $this->addUsingAlias(ColissimoLabelTableMap::WEIGHT, $weight['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($weight['max'])) {
+ $this->addUsingAlias(ColissimoLabelTableMap::WEIGHT, $weight['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimoLabelTableMap::WEIGHT, $weight, $comparison);
+ }
+
+ /**
+ * Filter the query on the number column
+ *
+ * Example usage:
+ *
+ * $query->filterByNumber('fooValue'); // WHERE number = 'fooValue'
+ * $query->filterByNumber('%fooValue%'); // WHERE number LIKE '%fooValue%'
+ *
+ *
+ * @param string $number 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 ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function filterByNumber($number = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($number)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $number)) {
+ $number = str_replace('*', '%', $number);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimoLabelTableMap::NUMBER, $number, $comparison);
+ }
+
+ /**
+ * Filter the query on the created_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
+ * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
+ * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
+ *
+ *
+ * @param mixed $createdAt The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * 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 ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function filterByCreatedAt($createdAt = null, $comparison = null)
+ {
+ if (is_array($createdAt)) {
+ $useMinMax = false;
+ if (isset($createdAt['min'])) {
+ $this->addUsingAlias(ColissimoLabelTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($createdAt['max'])) {
+ $this->addUsingAlias(ColissimoLabelTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimoLabelTableMap::CREATED_AT, $createdAt, $comparison);
+ }
+
+ /**
+ * Filter the query on the updated_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
+ * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
+ * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
+ *
+ *
+ * @param mixed $updatedAt The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * 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 ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function filterByUpdatedAt($updatedAt = null, $comparison = null)
+ {
+ if (is_array($updatedAt)) {
+ $useMinMax = false;
+ if (isset($updatedAt['min'])) {
+ $this->addUsingAlias(ColissimoLabelTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($updatedAt['max'])) {
+ $this->addUsingAlias(ColissimoLabelTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimoLabelTableMap::UPDATED_AT, $updatedAt, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Order object
+ *
+ * @param \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 ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function filterByOrder($order, $comparison = null)
+ {
+ if ($order instanceof \Thelia\Model\Order) {
+ return $this
+ ->addUsingAlias(ColissimoLabelTableMap::ORDER_ID, $order->getId(), $comparison);
+ } elseif ($order instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ColissimoLabelTableMap::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByOrder() only accepts arguments of type \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 ChildColissimoLabelQuery 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 \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', '\Thelia\Model\OrderQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildColissimoLabel $colissimoLabel Object to remove from the list of results
+ *
+ * @return ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function prune($colissimoLabel = null)
+ {
+ if ($colissimoLabel) {
+ $this->addUsingAlias(ColissimoLabelTableMap::ID, $colissimoLabel->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the colissimo_label 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(ColissimoLabelTableMap::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).
+ ColissimoLabelTableMap::clearInstancePool();
+ ColissimoLabelTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildColissimoLabel or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildColissimoLabel 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(ColissimoLabelTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(ColissimoLabelTableMap::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();
+
+
+ ColissimoLabelTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ ColissimoLabelTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ // timestampable behavior
+
+ /**
+ * Filter by the latest updated
+ *
+ * @param int $nbDays Maximum age of the latest update in days
+ *
+ * @return ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function recentlyUpdated($nbDays = 7)
+ {
+ return $this->addUsingAlias(ColissimoLabelTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Filter by the latest created
+ *
+ * @param int $nbDays Maximum age of in days
+ *
+ * @return ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function recentlyCreated($nbDays = 7)
+ {
+ return $this->addUsingAlias(ColissimoLabelTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Order by update date desc
+ *
+ * @return ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function lastUpdatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(ColissimoLabelTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by update date asc
+ *
+ * @return ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function firstUpdatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(ColissimoLabelTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by create date desc
+ *
+ * @return ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function lastCreatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(ColissimoLabelTableMap::CREATED_AT);
+ }
+
+ /**
+ * Order by create date asc
+ *
+ * @return ChildColissimoLabelQuery The current query, for fluid interface
+ */
+ public function firstCreatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(ColissimoLabelTableMap::CREATED_AT);
+ }
+
+} // ColissimoLabelQuery
diff --git a/local/modules/ColissimoLabel/Model/ColissimoLabel.php b/local/modules/ColissimoLabel/Model/ColissimoLabel.php
new file mode 100644
index 00000000..704de5d2
--- /dev/null
+++ b/local/modules/ColissimoLabel/Model/ColissimoLabel.php
@@ -0,0 +1,10 @@
+ array('Id', 'OrderId', 'Weight', 'Number', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'weight', 'number', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(ColissimoLabelTableMap::ID, ColissimoLabelTableMap::ORDER_ID, ColissimoLabelTableMap::WEIGHT, ColissimoLabelTableMap::NUMBER, ColissimoLabelTableMap::CREATED_AT, ColissimoLabelTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'WEIGHT', 'NUMBER', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'order_id', 'weight', 'number', 'created_at', 'updated_at', ),
+ 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, 'Weight' => 2, 'Number' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'weight' => 2, 'number' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
+ self::TYPE_COLNAME => array(ColissimoLabelTableMap::ID => 0, ColissimoLabelTableMap::ORDER_ID => 1, ColissimoLabelTableMap::WEIGHT => 2, ColissimoLabelTableMap::NUMBER => 3, ColissimoLabelTableMap::CREATED_AT => 4, ColissimoLabelTableMap::UPDATED_AT => 5, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'WEIGHT' => 2, 'NUMBER' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'weight' => 2, 'number' => 3, 'created_at' => 4, 'updated_at' => 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('colissimo_label');
+ $this->setPhpName('ColissimoLabel');
+ $this->setClassName('\\ColissimoLabel\\Model\\ColissimoLabel');
+ $this->setPackage('ColissimoLabel.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('WEIGHT', 'Weight', 'DECIMAL', false, 6, 0);
+ $this->addColumn('NUMBER', 'Number', 'VARCHAR', false, 255, null);
+ $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
+ $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ } // buildRelations()
+
+ /**
+ *
+ * Gets the list of behaviors registered for this table
+ *
+ * @return array Associative array (name => parameters) of behaviors
+ */
+ public function getBehaviors()
+ {
+ return array(
+ 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
+ );
+ } // getBehaviors()
+
+ /**
+ * 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 ? ColissimoLabelTableMap::CLASS_DEFAULT : ColissimoLabelTableMap::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 (ColissimoLabel object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = ColissimoLabelTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = ColissimoLabelTableMap::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 + ColissimoLabelTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ColissimoLabelTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ ColissimoLabelTableMap::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 = ColissimoLabelTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = ColissimoLabelTableMap::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;
+ ColissimoLabelTableMap::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(ColissimoLabelTableMap::ID);
+ $criteria->addSelectColumn(ColissimoLabelTableMap::ORDER_ID);
+ $criteria->addSelectColumn(ColissimoLabelTableMap::WEIGHT);
+ $criteria->addSelectColumn(ColissimoLabelTableMap::NUMBER);
+ $criteria->addSelectColumn(ColissimoLabelTableMap::CREATED_AT);
+ $criteria->addSelectColumn(ColissimoLabelTableMap::UPDATED_AT);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.ORDER_ID');
+ $criteria->addSelectColumn($alias . '.WEIGHT');
+ $criteria->addSelectColumn($alias . '.NUMBER');
+ $criteria->addSelectColumn($alias . '.CREATED_AT');
+ $criteria->addSelectColumn($alias . '.UPDATED_AT');
+ }
+ }
+
+ /**
+ * 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(ColissimoLabelTableMap::DATABASE_NAME)->getTable(ColissimoLabelTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimoLabelTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(ColissimoLabelTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new ColissimoLabelTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ColissimoLabel or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ColissimoLabel 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(ColissimoLabelTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \ColissimoLabel\Model\ColissimoLabel) { // 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(ColissimoLabelTableMap::DATABASE_NAME);
+ $criteria->add(ColissimoLabelTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = ColissimoLabelQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { ColissimoLabelTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { ColissimoLabelTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the colissimo_label 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 ColissimoLabelQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ColissimoLabel or Criteria object.
+ *
+ * @param mixed $criteria Criteria or ColissimoLabel 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(ColissimoLabelTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from ColissimoLabel object
+ }
+
+ if ($criteria->containsKey(ColissimoLabelTableMap::ID) && $criteria->keyContainsValue(ColissimoLabelTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.ColissimoLabelTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = ColissimoLabelQuery::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;
+ }
+
+} // ColissimoLabelTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+ColissimoLabelTableMap::buildTableMap();
diff --git a/local/modules/ColissimoLabel/Readme.md b/local/modules/ColissimoLabel/Readme.md
new file mode 100644
index 00000000..43f07a69
--- /dev/null
+++ b/local/modules/ColissimoLabel/Readme.md
@@ -0,0 +1,22 @@
+# Colissimo Label
+
+## Installation
+
+### Manually
+
+* Copy the module into ```"; + echo 'XML Request: ' . htmlspecialchars($this->generate->getLastRequest()) . "\r\n"; + echo 'Headers Request: ' . htmlspecialchars($this->generate->getLastRequestHeaders()) . "\r\n"; + echo 'XML Response: ' . htmlspecialchars($this->generate->getLastResponse()) . "\r\n"; + echo 'Headers Response: ' . htmlspecialchars($this->generate->getLastResponseHeaders()) . "\r\n"; + echo ""; + */ + if ($this->generate->getLastResponse(true) instanceof \DOMDocument) { + $response = $this->generate->getLastResponse(); + Tlog::getInstance()->debug("Colissimo shipping label response: " . $response); + + echo $response; + + $domDocument = $this->generate->getLastResponse(true); + + $type = $domDocument->getElementsByTagName('type')->item(0)->nodeValue; + + if ($type !== 'ERROR') { + $pdfUrlElement = $domDocument->getElementsByTagName('pdfUrl'); + $includeElement = $domDocument->getElementsByTagName('Include'); + + if ($pdfUrlElement->length > 0) { + $urlPdf = $pdfUrlElement->item(0)->nodeValue; + + if (!empty($urlPdf)) { + $labelContent = file_get_contents($urlPdf); + } + } elseif ($includeElement->length > 0) { + $href = str_replace('cid:', '', $includeElement->item(0)->attributes['href']->value); + + $rawResponse = $this->generate->getRawResponse(); + + preg_match("/.*Content-ID: <$href>(.*)--uuid.*$/s", $rawResponse, $matches); + + if (isset($matches[1])) { + $labelContent = trim($matches[1]); + } + } + + $trackingNumber = $domDocument->getElementsByTagName('parcelNumber')->item(0)->nodeValue; + + // Update tracking number. + $order + ->setDeliveryRef($trackingNumber) + ->save(); + + $message = "L'étiquette a été générée correctement."; + } else { + $erreur = true; + $message = $domDocument->getElementsByTagName('messageContent')->item(0)->nodeValue; + } + } else { + $erreur = true; + $message = $this->generate->getLastErrorForMethod('ColissimoPostage\ServiceType\Generate::generateLabel')->getMessage(); + } + + if (null === $label = ColissimowsLabelQuery::create()->findOneByOrderId($order->getId())) { + $label = (new ColissimowsLabel()) + ->setOrderId($order->getId()) + ->setOrderRef($order->getRef()) + ; + } + + $label + ->setError($erreur) + ->setErrorMessage($message) + ->setTrackingNumber($trackingNumber) + ->setLabelData($labelContent) + ->setLabelType(ColissimoWs::getLabelFileType()) + ->setWeight($totalWeight) + ->setSigned($signed) + ; + + $label ->save(); + + ///** Compatibility with module SoColissimoLabel /!\ Do not use strict comparison */ + //if (ModuleQuery::create()->findOneByCode('ColissimoLabel')->getActivate() == true) + //{ + // if (null === $labelCompat = ColissimoLabelQuery::create()->findOneByOrderId($order->getId())) { + // /** @var $labelCompat */ + // $labelCompat = (new \ColissimoLabel\Model\ColissimoLabel()) + // ->setOrderId($order->getId()) + // ; + // } +// + // $labelCompat + // ->setWeight($totalWeight) + // ->setSigned($signed) + // ->setNumber($trackingNumber) + // ; +// + // $labelCompat->save(); + //} + + $event->setColissimoWsLabel($label); + } else { + throw new \InvalidArgumentException("Failed to find order ID " . $event->getOrderId()); + } + } + + protected function formatterTelephone($numero, $codePays) + { + $phoneUtil = PhoneNumberUtil::getInstance(); + + try { + $normalizedNumber = $phoneUtil->parse($numero, strtoupper($codePays)); + + return $phoneUtil->format($normalizedNumber, \libphonenumber\PhoneNumberFormat::E164); + } catch (NumberParseException $e) { + return ''; + } + } + + protected function corrigerLocalite($localite) + { + $localite = strtoupper($localite); + + $localite = str_replace(['SAINTE', 'SAINT', '/'], array('STE', 'ST', ''), $localite); + + return $localite; + } + + protected function cleanUpAddresse($str) + { + return preg_replace("/[^A-Za-z0-9]/", ' ', $this->removeAccents($str)); + } + + protected function cleanupUserEnteredString($str) + { + $str = preg_replace("/[0-9]+;/", '', $str); + $str = preg_replace("/[^A-Za-z0-9]/", ' ', $this->removeAccents($str)); + + return $str; + } + + protected function removeAccents($str) + { + return \Transliterator::create('NFD; [:Nonspacing Mark:] Remove; NFC')->transliterate($str); + } +} diff --git a/local/modules/ColissimoWs/EventListeners/ShippingNotificationSender.php b/local/modules/ColissimoWs/EventListeners/ShippingNotificationSender.php new file mode 100644 index 00000000..22596601 --- /dev/null +++ b/local/modules/ColissimoWs/EventListeners/ShippingNotificationSender.php @@ -0,0 +1,78 @@ + + * Date: 04/09/2019 14:34 + */ +namespace ColissimoWs\EventListeners; + +use ColissimoWs\ColissimoWs; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Thelia\Action\BaseAction; +use Thelia\Core\Event\Order\OrderEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Core\Template\ParserInterface; +use Thelia\Mailer\MailerFactory; +use Thelia\Model\ConfigQuery; + +class ShippingNotificationSender extends BaseAction implements EventSubscriberInterface +{ + /** @var MailerFactory */ + protected $mailer; + /** @var ParserInterface */ + protected $parser; + + public function __construct(ParserInterface $parser, MailerFactory $mailer) + { + $this->parser = $parser; + $this->mailer = $mailer; + } + + /** + * + * @inheritdoc + */ + public static function getSubscribedEvents() + { + return [ + TheliaEvents::ORDER_UPDATE_STATUS => ["sendShippingNotification", 128] + ]; + } + + /** + * @param OrderEvent $event + * @throws \Propel\Runtime\Exception\PropelException + */ + public function sendShippingNotification(OrderEvent $event) + { + if ($event->getOrder()->isSent()) { + $contact_email = ConfigQuery::getStoreEmail(); + + if ($contact_email) { + $order = $event->getOrder(); + $customer = $order->getCustomer(); + + $this->mailer->sendEmailToCustomer( + ColissimoWs::CONFIRMATION_MESSAGE_NAME, + $order->getCustomer(), + [ + 'order_id' => $order->getId(), + 'order_ref' => $order->getRef(), + 'customer_id' => $customer->getId(), + 'order_date' => $order->getCreatedAt(), + 'update_date' => $order->getUpdatedAt(), + 'package' => $order->getDeliveryRef() + ] + ); + } + } + } +} diff --git a/local/modules/ColissimoWs/Form/ConfigurationForm.php b/local/modules/ColissimoWs/Form/ConfigurationForm.php new file mode 100644 index 00000000..82096d92 --- /dev/null +++ b/local/modules/ColissimoWs/Form/ConfigurationForm.php @@ -0,0 +1,182 @@ + + * Date: 17/08/2019 12:26 + */ +namespace ColissimoWs\Form; + +use ColissimoWs\ColissimoWs; +use SimpleDhl\SimpleDhl; +use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Form\BaseForm; + +class ConfigurationForm extends BaseForm +{ + protected function buildForm() + { + $this->formBuilder + ->add( + ColissimoWs::COLISSIMO_USERNAME, + 'text', + [ + 'constraints' => [ + new NotBlank(), + ], + 'label' => $this->translator->trans('Colissimo username', [], ColissimoWs::DOMAIN_NAME), + 'label_attr' => [ + 'help' => $this->translator->trans( + 'Nom d\'utilisateur Colissimo. C\'est l\'identifiants qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise', + [], + ColissimoWs::DOMAIN_NAME + ) + ] + ] + ) + ->add( + ColissimoWs::COLISSIMO_PASSWORD, + 'text', + [ + 'constraints' => [ + new NotBlank(), + ], + 'label' => $this->translator->trans('Colissimo password', [], ColissimoWs::DOMAIN_NAME), + 'label_attr' => [ + 'help' => $this->translator->trans( + 'Le mot de passe qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise', + [], + ColissimoWs::DOMAIN_NAME + ) + ] + ] + )->add( + ColissimoWs::AFFRANCHISSEMENT_ENDPOINT_URL, + 'url', + [ + 'constraints' => [ + new NotBlank(), + ], + 'label' => $this->translator->trans('Endpoint du web service d\'affranchissement', [], ColissimoWs::DOMAIN_NAME), + 'label_attr' => [ + 'help' => $this->translator->trans( + 'Indiquez le endpoint de base à utiliser, par exemple https://domain.tld/transactionaldata/api/v1', + [], + ColissimoWs::DOMAIN_NAME + ) + ] + ] + )->add( + ColissimoWs::FORMAT_ETIQUETTE, + 'choice', + [ + 'constraints' => [ + new NotBlank(), + ], + 'choices' => [ + 'PDF_A4_300dpi' => 'Bureautique PDF, A4, résolution 300dpi', + 'PDF_10x15_300dpi' => 'Bureautique PDF, 10cm par 15cm, résolution 300dpi', + 'ZPL_10x15_203dpi' => 'Thermique en ZPL, de dimension 10cm par 15cm, et de résolution 203dpi', + 'ZPL_10x15_300dpi' => 'Thermique ZPL, 10cm par 15cm, résolution 300dpi', + 'DPL_10x15_203dpi' => 'Thermique DPL, 10cm par 15cm, résolution 203dpi', + 'DPL_10x15_300dpi' => 'Thermique DPL, 10cm par 15cm, résolution 300dpi', + ], + 'label' => $this->translator->trans('Format des étiquettes', [], ColissimoWs::DOMAIN_NAME), + 'label_attr' => [ + 'help' => $this->translator->trans( + 'Indiquez le format des étiquettes à générer, en fonction de l\'imprimante dont vous disposez.', + [], + ColissimoWs::DOMAIN_NAME + ) + ] + ] + )->add( + ColissimoWs::ACTIVATE_DETAILED_DEBUG, + 'checkbox', + [ + 'required' => false, + 'label' => $this->translator->trans('Activer les logs détaillés', [], ColissimoWs::DOMAIN_NAME), + 'label_attr' => [ + 'help' => $this->translator->trans( + 'Si cette case est cochée, le texte complet des requêtes et des réponses figurera dans le log Thelia', + [], + ColissimoWs::DOMAIN_NAME + ) + ] + ] + ) + ->add( + ColissimoWs::FROM_NAME, + 'text', + [ + 'constraints' => [ + new NotBlank(), + ], + 'label' => $this->translator->trans('Nom de société', [], ColissimoWs::DOMAIN_NAME), + ] + ) + ->add( + ColissimoWs::FROM_ADDRESS_1, + 'text', + [ + 'constraints' => [ new NotBlank() ], + 'label' => $this->translator->trans('Adresse', [], ColissimoWs::DOMAIN_NAME) + ] + ) + ->add( + ColissimoWs::FROM_ADDRESS_2, + 'text', + [ + 'constraints' => [ ], + 'required' => false, + 'label' => $this->translator->trans('Adresse (suite)', [], ColissimoWs::DOMAIN_NAME) + ] + ) + ->add( + ColissimoWs::FROM_CITY, + 'text', + [ + 'constraints' => [ new NotBlank() ], + 'label' => $this->translator->trans('Ville', [], ColissimoWs::DOMAIN_NAME) + ] + ) + ->add( + ColissimoWs::FROM_ZIPCODE, + 'text', + [ + 'constraints' => [ new NotBlank() ], + 'label' => $this->translator->trans('Code postal', [], ColissimoWs::DOMAIN_NAME) + ] + ) + ->add( + ColissimoWs::FROM_COUNTRY, + 'text', + [ + 'constraints' => [ new NotBlank() ], + 'label' => $this->translator->trans('Pays', [], ColissimoWs::DOMAIN_NAME) + ] + )->add( + ColissimoWs::FROM_CONTACT_EMAIL, + 'email', + [ + 'constraints' => [ new NotBlank() ], + 'label' => $this->translator->trans('Adresse e-mail de contact pour les expéditions', [], ColissimoWs::DOMAIN_NAME) + ] + )->add( + ColissimoWs::FROM_PHONE, + 'text', + [ + 'constraints' => [ new NotBlank() ], + 'label' => $this->translator->trans('Téléphone', [], ColissimoWs::DOMAIN_NAME) + ] + ) + ; + } +} diff --git a/local/modules/ColissimoWs/Form/FreeShippingForm.php b/local/modules/ColissimoWs/Form/FreeShippingForm.php new file mode 100644 index 00000000..57ff526c --- /dev/null +++ b/local/modules/ColissimoWs/Form/FreeShippingForm.php @@ -0,0 +1,69 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace ColissimoWs\Form; + +use Thelia\Core\Translation\Translator; +use Thelia\Form\BaseForm; + +class FreeShippingForm extends BaseForm +{ + /** + * + * in this function you add all the fields you need for your Form. + * Form this you have to call add method on $this->formBuilder attribute : + * + * $this->formBuilder->add("name", "text") + * ->add("email", "email", array( + * "attr" => array( + * "class" => "field" + * ), + * "label" => "email", + * "constraints" => array( + * new \Symfony\Component\Validator\Constraints\NotBlank() + * ) + * ) + * ) + * ->add('age', 'integer'); + * + * @return null + */ + protected function buildForm() + { + $this->formBuilder + ->add("delivery_mode", "integer") + ->add("freeshipping", "checkbox", array( + 'label'=>Translator::getInstance()->trans("Activate free shipping: ") + )) + ; + } + + /** + * @return string the name of you form. This name must be unique + */ + public function getName() + { + return "colissimowsfreeshipping"; + } + +} \ No newline at end of file diff --git a/local/modules/ColissimoWs/Form/LabelGenerationForm.php b/local/modules/ColissimoWs/Form/LabelGenerationForm.php new file mode 100644 index 00000000..4f1d5f83 --- /dev/null +++ b/local/modules/ColissimoWs/Form/LabelGenerationForm.php @@ -0,0 +1,71 @@ + + * Date: 17/08/2019 12:26 + */ +namespace ColissimoWs\Form; + +use ColissimoWs\ColissimoWs; +use Thelia\Core\Translation\Translator; +use Thelia\Form\BaseForm; + +class LabelGenerationForm extends BaseForm +{ + protected function buildForm() + { + $this->formBuilder + ->add( + 'new_status', + 'choice', [ + 'label' => Translator::getInstance()->trans('Order status after export'), + 'choices' => [ + "nochange" => Translator::getInstance()->trans("Do not change", [], ColissimoWs::DOMAIN_NAME), + "processing" => Translator::getInstance()->trans("Set orders status as processing", [], ColissimoWs::DOMAIN_NAME), + "sent" => Translator::getInstance()->trans("Set orders status as sent", [], ColissimoWs::DOMAIN_NAME) + ], + 'required' => 'true', + 'expanded' => true, + 'multiple' => false, + 'data' => ColissimoWs::getConfigValue("new_status", 'nochange') + ] + ) + ->add( + 'order_id', + 'collection', + [ + 'type' => 'integer', + 'allow_add' => true, + 'allow_delete' => true, + ] + ) + ->add( + "weight", + 'collection', + [ + 'type' => 'number', + 'allow_add' => true, + 'allow_delete' => true, + ] + ) + ->add( + "signed", + "collection", + [ + 'type' => 'checkbox', + 'label' => 'Signature', + 'allow_add' => true, + 'allow_delete' => true, + ]); + + ; + } +} diff --git a/local/modules/ColissimoWs/Hook/HookManager.php b/local/modules/ColissimoWs/Hook/HookManager.php new file mode 100644 index 00000000..e67fca93 --- /dev/null +++ b/local/modules/ColissimoWs/Hook/HookManager.php @@ -0,0 +1,65 @@ + + * Date: 17/08/2019 14:34 + */ +namespace ColissimoWs\Hook; + +use ColissimoWs\ColissimoWs; +use ColissimoWs\Model\ColissimowsLabelQuery; +use Thelia\Core\Event\Hook\HookRenderBlockEvent; +use Thelia\Core\Event\Hook\HookRenderEvent; +use Thelia\Core\Hook\BaseHook; +use Thelia\Model\ModuleConfig; +use Thelia\Model\ModuleConfigQuery; +use Thelia\Tools\URL; + +class HookManager extends BaseHook +{ + public function onModuleConfigure(HookRenderEvent $event) + { + $vars = [ ]; + + if (null !== $params = ModuleConfigQuery::create()->findByModuleId(ColissimoWs::getModuleId())) { + + /** @var ModuleConfig $param */ + foreach ($params as $param) { + $vars[ $param->getName() ] = $param->getValue(); + } + } + + $event->add( + $this->render( + 'colissimows/module_configuration.html', + $vars + ) + ); + } + + public function onMainTopMenuTools(HookRenderBlockEvent $event) + { + $event->add( + [ + 'id' => 'tools_menu_colissimows', + 'class' => '', + 'url' => URL::getInstance()->absoluteUrl('/admin/module/ColissimoWs'), + 'title' => $this->translator->trans("Colissimo labels (%num)", [ '%num' => ColissimowsLabelQuery::create()->count() ], ColissimoWs::DOMAIN_NAME) + ] + ); + } + + public function onModuleConfigJs(HookRenderEvent $event) + { + $event->add($this->render('colissimows/module-config-js.html')); + } + +} diff --git a/local/modules/ColissimoWs/I18n/backOffice/default/fr_FR.php b/local/modules/ColissimoWs/I18n/backOffice/default/fr_FR.php new file mode 100644 index 00000000..841b5db5 --- /dev/null +++ b/local/modules/ColissimoWs/I18n/backOffice/default/fr_FR.php @@ -0,0 +1,52 @@ + 'Actions', + 'Activate total free shipping ' => 'Activer la livraison gratuite totale', + 'Add this price slice' => 'Ajouter cette tranche de prix', + 'Area : ' => 'Zone :', + 'Change to "Processing"' => 'Statut "Traitement"', + 'Change to "Sent". If you choose this option, the delivery notification email is sent to the customer, and the processed order are removed from this page.' => 'Statut "Envoyé". Si vous choisissez cette option, la notification d\'expédition est envoyée au client, et la commande n\'apparaît plus dans cette page', + 'Clear label' => 'Supprimer l\'étiquette et le numéro de suivi de cette commande', + 'Colissimo Web service configuration' => 'Configuration Colissimo Affranchissement', + 'Configuration' => 'Configuration', + 'Configuration du service' => 'Configuration du service', + 'Coordonnées de d\'expéditeur' => 'Coordonnées de d\'expéditeur', + 'Customs invoice' => 'Facture douanes', + 'Delete this price slice' => 'Supprimer cette tranche de prix', + 'Destination' => 'Destination', + 'Do not change' => 'Inchangé', + 'Do you want to clear label and tracking number for this order ?' => 'Voulez-vous supprimer l\'étiquette et le numéro de suivi de cette commande ?', + 'Download and print Colissimo labels for not sent orders' => 'Télécharger et imprimer les étiquettes d\'affranchissement pour les commandes qui n\'ont pas encore été envoyées', + 'Download customs invoice (PDF)' => 'Télécharger la facture de douanes (PDF)', + 'Download label (%fmt)' => 'Télécharger l\'étiquette (%fmt)', + 'If a cart matches multiple slices, it will take the last slice following that order.' => 'Si un panier correspond à plusieurs tranches, la dernière tranche sera prise en compte selon cet ordre.', + 'If you don\'t specify a cart price in a slice, it will have priority over the other slices with the same weight.' => 'Si vous ne renseignez pas de prix de panier max dans une tranche, elle aura la priorité sur les autres tranches ayant le même poids.', + 'If you don\'t specify a cart weight in a slice, it will have priority over the slices with weight.' => 'Si vous ne renseignez pas de poids max dans une tranche, elle aura la priorité sur les tranches ayant un poids.', + 'If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice.' => 'Si vous renseignez les deux, le panier devra avoir à la fois un poids inférieur ET un prix inférieur pour correspondre à cette tranche.', + 'Label' => 'Etiquette', + 'Label cannot be created. Error is: ' => 'La création de l\'étiquette a échoué. L\'erreur est:', + 'Message' => 'Message', + 'Non disponible' => 'Non disponible', + 'Order date' => 'Date de commande', + 'Order status change after processing' => 'Statut des commandes après traitement', + 'Price slices (Dom)' => 'Tranches de prix (Domicile)', + 'Price slices for domicile delivery' => 'Tranches de prix pour la livraison à domicile', + 'Process selected orders' => 'Traiter les commandes sélectionnées', + 'REF' => 'Ref.', + 'Save this price slice' => 'Sauvegarder cette tranche de prix', + 'Sel.' => 'Sel.', + 'Shipping Price ($)' => 'Frais de livraison', + 'Shipping labels' => 'Étiquettes d\'affranchissement', + 'Signature' => 'Signature', + 'The slices are ordered by maximum cart weight then by maximum cart price.' => 'Les tranches sont triés pour poids de panier max puis par prix de panier max.', + 'There are currently no orders to ship with Colissimo' => 'Il n\'y a aucune commande à livrer avec Colissimo pour le moment.', + 'Tracking' => 'No. de suivi', + 'Untaxed Price up to ... ($)' => 'Prix (HT) jusqu\'à :', + 'Weight' => 'Poids (kg)', + 'Weight up to ... kg' => 'Poids (kg) jusqu\'à :', + 'You can create price slices by specifying a maximum cart weight and/or a maximum cart price.' => 'Vous pouvez créer des tranches de prix pour les frais de port en spécifiant un poids de panier maximum et/ou un prix de panier maximum.', + 'You should first attribute shipping zones to the modules: ' => 'Vous devez tout d\'abord ajouter des zones de livraisons au module', + 'kg' => 'kg', + 'manage shipping zones' => 'Gérer les zones de livraison', +); diff --git a/local/modules/ColissimoWs/I18n/email/default/fr_FR.php b/local/modules/ColissimoWs/I18n/email/default/fr_FR.php new file mode 100644 index 00000000..51739960 --- /dev/null +++ b/local/modules/ColissimoWs/I18n/email/default/fr_FR.php @@ -0,0 +1,15 @@ +Click here to track your shipment. You can also enter the tracking number on https://www.laposte.fr/outils/suivre-vos-envois' => 'Cliquez ici pour suivre l\'acheminement. Vous pouvez aussi entrer le numéro de suivi sur https://www.laposte.fr/outils/suivre-vos-envois', + 'Dear Mr. ' => 'Cher Mr', + 'Dear Ms. ' => 'Cher Mme', + 'Please display this message in HTML' => 'Afficher ce message en HTML', + 'Thank you for your shopping with us and hope to see you soon on www.yourshop.com' => 'Nous vous remercions pour votre achat et espérons vous revoir très vite sur www.votreboutique.com', + 'We are pleased to inform you that your order number' => 'Nous sommes heureux de vous informer que votre commande N°', + 'Your on-line store Manager' => 'Nom de personne chargé de la communication', + 'Your order confirmation Nº %ref' => 'Votre commande N° %ref', + 'Your shop' => 'Votre boutique', + 'has been shipped on' => 'a été envoyé le', + 'with the tracking number' => 'avec le numéro de suivi', +); diff --git a/local/modules/ColissimoWs/I18n/en_US.php b/local/modules/ColissimoWs/I18n/en_US.php new file mode 100644 index 00000000..0b4fa142 --- /dev/null +++ b/local/modules/ColissimoWs/I18n/en_US.php @@ -0,0 +1,4 @@ + 'The displayed english string', +); diff --git a/local/modules/ColissimoWs/I18n/fr_FR.php b/local/modules/ColissimoWs/I18n/fr_FR.php new file mode 100644 index 00000000..5fea67df --- /dev/null +++ b/local/modules/ColissimoWs/I18n/fr_FR.php @@ -0,0 +1,37 @@ + 'Activer les frais de ports gratuits', + 'Activer les logs détaillés' => 'Activer les logs détaillés', + 'Adresse' => 'Adresse', + 'Adresse (suite)' => 'Adresse (suite)', + 'Adresse e-mail de contact pour les expéditions' => 'Adresse e-mail de contact pour les expéditions', + 'Code postal' => 'Code postal', + 'Colissimo labels (%num)' => 'Etiquettes colissimo (%num)', + 'Colissimo password' => 'Mot de passe Colissimo', + 'Colissimo username' => 'Nom d\'utilisateur Colissimo', + 'ColissimoWs configuration' => 'Configuration Colissimo Affranchissement', + 'Do not change' => 'Inchangé', + 'Endpoint du web service d\'affranchissement' => 'Endpoint du web service d\'affranchissement', + 'Format des étiquettes' => 'Format des étiquettes', + 'Indiquez le endpoint de base à utiliser, par exemple https://domain.tld/transactionaldata/api/v1' => 'Indiquez le endpoint de base à utiliser, par exemple https://domain.tld/transactionaldata/api/v1', + 'Indiquez le format des étiquettes à générer, en fonction de l\'imprimante dont vous disposez.' => 'Indiquez le format des étiquettes à générer, en fonction de l\'imprimante dont vous disposez.', + 'Le mot de passe qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise' => 'Le mot de passe qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise', + 'Nom d\'utilisateur Colissimo. C\'est l\'identifiants qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise' => 'Nom d\'utilisateur Colissimo. C\'est l\'identifiants qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise', + 'Nom de société' => 'Nom de société', + 'Order status after export' => 'Statut de commande après le traitement', + 'Pays' => 'Pays', + 'Please enter a weight for every selected order' => 'Merci d\'indiquer un poids pour chacune des commandes sélectionnées', + 'Set orders status as processing' => 'Placer la commande en "Traitement"', + 'Set orders status as sent' => 'Placer la commande "Envoyée"', + 'Si cette case est cochée, le texte complet des requêtes et des réponses figurera dans le log Thelia' => 'Si cette case est cochée, le texte complet des requêtes et des réponses figurera dans le log Thelia', + 'The area is not valid' => 'La zone n\'est pas valide', + 'The price max value is not valid' => 'La valeur du prix max. n\'est pas valide', + 'The price value is not valid' => 'La valeur du prix n\'est pas valide', + 'The slice has not been deleted' => 'La tranche de prix n\'a pas été supprimée', + 'The weight max value is not valid' => 'La valeur du poids max. n\'est pas valide', + 'Téléphone' => 'Téléphone', + 'Ville' => 'Ville', + 'You must specify at least a price max or a weight max value.' => 'Vous devez spécifier au moins un prix max. ou un poids max.', + 'Your slice has been saved' => 'La tranche de prix a été sauvegardée', +); diff --git a/local/modules/ColissimoWs/I18n/pdf/default/fr_FR.php b/local/modules/ColissimoWs/I18n/pdf/default/fr_FR.php new file mode 100644 index 00000000..a96d4c25 --- /dev/null +++ b/local/modules/ColissimoWs/I18n/pdf/default/fr_FR.php @@ -0,0 +1,17 @@ + 'Pays', + 'Engraving ' => 'Gravure', + 'Font ' => 'Police de caractère', + 'Free samples ' => 'Échantillons gratuits ', + 'Full Description of Goods' => 'Description complète des biens', + 'Position ' => 'Position', + 'Quantity' => 'Quantité', + 'Style ' => 'Style', + 'Subtotal value' => 'Sous-total', + 'Unit net weight' => 'Poids net unitaire', + 'Unit value' => 'Valeur unitaire', + 'Your gift ' => 'Votre cadeau', + 'Your text ' => 'Votre texte', +); diff --git a/local/modules/ColissimoWs/Loop/ColissimoWsFreeShippingLoop.php b/local/modules/ColissimoWs/Loop/ColissimoWsFreeShippingLoop.php new file mode 100644 index 00000000..5fb5a15d --- /dev/null +++ b/local/modules/ColissimoWs/Loop/ColissimoWsFreeShippingLoop.php @@ -0,0 +1,49 @@ +findOneById(1)){ + $isFreeShippingActive = new ColissimowsFreeshipping(); + $isFreeShippingActive->setId(1); + $isFreeShippingActive->setActive(0); + $isFreeShippingActive->save(); + } + + return ColissimowsFreeshippingQuery::create()->filterById(1); + } + + public function parseResults(LoopResult $loopResult) + { + /** @var \ColissimoWs\Model\ColissimowsFreeshipping $freeshipping */ + foreach ($loopResult->getResultDataCollection() as $freeshipping) { + $loopResultRow = new LoopResultRow($freeshipping); + $loopResultRow->set("FREESHIPPING_ACTIVE", $freeshipping->getActive()); + $loopResult->addRow($loopResultRow); + } + return $loopResult; + } + +} \ No newline at end of file diff --git a/local/modules/ColissimoWs/Loop/ColissimoWsLabelInfo.php b/local/modules/ColissimoWs/Loop/ColissimoWsLabelInfo.php new file mode 100644 index 00000000..0fa74085 --- /dev/null +++ b/local/modules/ColissimoWs/Loop/ColissimoWsLabelInfo.php @@ -0,0 +1,102 @@ + + * Date: 04/09/2019 17:56 + */ +namespace ColissimoWs\Loop; + +use ColissimoWs\ColissimoWs; +use ColissimoWs\Model\ColissimowsLabel; +use ColissimoWs\Model\ColissimowsLabelQuery; +use Thelia\Core\Template\Element\BaseLoop; +use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; +use Thelia\Core\Template\Element\PropelSearchLoopInterface; +use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Model\OrderQuery; +use Thelia\Tools\URL; + +/** + * @package SimpleDhl\Loop + * @method int getOrderId() + */ +class ColissimoWsLabelInfo extends BaseLoop implements PropelSearchLoopInterface +{ + /** + * @return ArgumentCollection + */ + protected function getArgDefinitions() + { + return new ArgumentCollection( + Argument::createIntTypeArgument('order_id', null, true) + ); + } + + public function buildModelCriteria() + { + return ColissimowsLabelQuery::create() + ->filterByOrderId($this->getOrderId()); + } + + /** + * @param LoopResult $loopResult + * @return LoopResult + * @throws \Propel\Runtime\Exception\PropelException + */ + public function parseResults(LoopResult $loopResult) + { + if ($loopResult->getResultDataCollectionCount() === 0) { + if (null !== $order = OrderQuery::create()->findPk($this->getOrderId())) { + $loopResultRow = new LoopResultRow(); + + $loopResultRow + ->set("ORDER_ID", $this->getOrderId()) + ->set("HAS_ERROR", false) + ->set("ERROR_MESSAGE", null) + ->set("WEIGHT", $order->getWeight()) + ->set("SIGNED", true) + ->set("TRACKING_NUMBER", null) + ->set("HAS_LABEL", false) + ->set("LABEL_URL", URL::getInstance()->absoluteUrl("/admin/module/colissimows/label/" . $this->getOrderId())) + ->set("CLEAR_LABEL_URL", URL::getInstance()->absoluteUrl("/admin/module/colissimows/label/clear/" . $this->getOrderId())) + ->set("CAN_BE_NOT_SIGNED", ColissimoWs::canOrderBeNotSigned($order)); + + $loopResult->addRow($loopResultRow); + } + } else { + /** @var ColissimowsLabel $result */ + foreach ($loopResult->getResultDataCollection() as $result) { + $loopResultRow = new LoopResultRow(); + + $loopResultRow + ->set("ORDER_ID", $result->getOrderId()) + ->set("HAS_ERROR", $result->getError()) + ->set("ERROR_MESSAGE", $result->getErrorMessage()) + ->set("WEIGHT", empty($result->getWeight()) ? $result->getOrder()->getWeight() : $result->getWeight()) + ->set("SIGNED", $result->getSigned()) + ->set("TRACKING_NUMBER", $result->getTrackingNumber()) + ->set("HAS_LABEL", ! empty($result->getLabelData())) + ->set("LABEL_TYPE", $result->getLabelType()) + ->set("HAS_CUSTOMS_INVOICE", $result->getWithCustomsInvoice()) + ->set("LABEL_URL", URL::getInstance()->absoluteUrl("/admin/module/colissimows/label/" . $result->getOrderId())) + ->set("CUSTOMS_INVOICE_URL", URL::getInstance()->absoluteUrl("/admin/module/colissimows/customs-invoice/" . $result->getOrderId())) + ->set("CLEAR_LABEL_URL", URL::getInstance()->absoluteUrl("/admin/module/colissimows/label/clear/" . $result->getOrderId())) + ->set("CAN_BE_NOT_SIGNED", ColissimoWs::canOrderBeNotSigned($result->getOrder())); + + $loopResult->addRow($loopResultRow); + } + } + + return $loopResult; + } +} diff --git a/local/modules/ColissimoWs/Loop/OrdersNotYetSentLoop.php b/local/modules/ColissimoWs/Loop/OrdersNotYetSentLoop.php new file mode 100644 index 00000000..a332dff4 --- /dev/null +++ b/local/modules/ColissimoWs/Loop/OrdersNotYetSentLoop.php @@ -0,0 +1,61 @@ + + * Date: 04/09/2019 17:53 + */ +namespace ColissimoWs\Loop; + +use ColissimoWs\ColissimoWs; +use Propel\Runtime\ActiveQuery\Criteria; +use Thelia\Core\Template\Loop\Argument\Argument; +use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Core\Template\Loop\Order; +use Thelia\Model\OrderQuery; +use Thelia\Model\OrderStatus; +use Thelia\Model\OrderStatusQuery; + +class OrdersNotYetSentLoop extends Order +{ + public function getArgDefinitions() + { + return new ArgumentCollection(Argument::createBooleanTypeArgument('with_prev_next_info', false)); + } + + /** + * this method returns a Propel ModelCriteria + * + * @return \Propel\Runtime\ActiveQuery\ModelCriteria + */ + public function buildModelCriteria() + { + $status = OrderStatusQuery::create() + ->filterByCode( + array( + OrderStatus::CODE_PAID, + OrderStatus::CODE_PROCESSING, + ), + Criteria::IN + ) + ->find() + ->toArray("code"); + $query = OrderQuery::create() + ->filterByDeliveryModuleId(ColissimoWs::getModCode()) + ->filterByStatusId( + array( + $status[OrderStatus::CODE_PAID]['Id'], + $status[OrderStatus::CODE_PROCESSING]['Id']), + Criteria::IN + ); + + return $query; + } +} diff --git a/local/modules/ColissimoWs/Loop/PriceSlicesLoop.php b/local/modules/ColissimoWs/Loop/PriceSlicesLoop.php new file mode 100644 index 00000000..8f95da19 --- /dev/null +++ b/local/modules/ColissimoWs/Loop/PriceSlicesLoop.php @@ -0,0 +1,57 @@ +getAreaId(); + + $areaPrices = ColissimowsPriceSlicesQuery::create() + ->filterByAreaId($areaId) + ->orderByMaxWeight() + ->orderByMaxPrice() + ; + + return $areaPrices; + } + + public function parseResults(LoopResult $loopResult) + { + /** @var \ColissimoWs\Model\ColissimoWsPriceSlices $priceSlice */ + foreach ($loopResult->getResultDataCollection() as $priceSlice) { + $loopResultRow = new LoopResultRow($priceSlice); + $loopResultRow + ->set("SLICE_ID", $priceSlice->getId()) + ->set("MAX_WEIGHT", $priceSlice->getMaxWeight()) + ->set("MAX_PRICE", $priceSlice->getMaxPrice()) + ->set("SHIPPING", $priceSlice->getShipping()) + ->set("FRANCO", $priceSlice->getFrancoMinPrice()) + ; + $loopResult->addRow($loopResultRow); + } + return $loopResult; + } +} \ No newline at end of file diff --git a/local/modules/ColissimoWs/Model/Base/ColissimowsFreeshipping.php b/local/modules/ColissimoWs/Model/Base/ColissimowsFreeshipping.php new file mode 100644 index 00000000..f9faf9fa --- /dev/null +++ b/local/modules/ColissimoWs/Model/Base/ColissimowsFreeshipping.php @@ -0,0 +1,1126 @@ +active = false; + } + + /** + * Initializes internal state of ColissimoWs\Model\Base\ColissimowsFreeshipping object. + * @see applyDefaults() + */ + public function __construct() + { + $this->applyDefaultValues(); + } + + /** + * Returns whether the object has been modified. + * + * @return boolean True if the object has been modified. + */ + public function isModified() + { + return !!$this->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
ColissimowsFreeshipping instance. If
+ * obj is an instance of ColissimowsFreeshipping, delegates to
+ * equals(ColissimowsFreeshipping). 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 ColissimowsFreeshipping 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 ColissimowsFreeshipping 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 [active] column value.
+ *
+ * @return boolean
+ */
+ public function getActive()
+ {
+
+ return $this->active;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \ColissimoWs\Model\ColissimowsFreeshipping 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[ColissimowsFreeshippingTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Sets the value of the [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 \ColissimoWs\Model\ColissimowsFreeshipping The current object (for fluent API support)
+ */
+ public function setActive($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->active !== $v) {
+ $this->active = $v;
+ $this->modifiedColumns[ColissimowsFreeshippingTableMap::ACTIVE] = true;
+ }
+
+
+ return $this;
+ } // setActive()
+
+ /**
+ * 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->active !== false) {
+ 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 : ColissimowsFreeshippingTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ColissimowsFreeshippingTableMap::translateFieldName('Active', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->active = (null !== $col) ? (boolean) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 2; // 2 = ColissimowsFreeshippingTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \ColissimoWs\Model\ColissimowsFreeshipping 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildColissimowsFreeshippingQuery::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?
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see ColissimowsFreeshipping::setDeleted()
+ * @see ColissimowsFreeshipping::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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildColissimowsFreeshippingQuery::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(ColissimowsFreeshippingTableMap::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);
+ ColissimowsFreeshippingTableMap::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();
+ }
+
+ $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;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ColissimowsFreeshippingTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(ColissimowsFreeshippingTableMap::ACTIVE)) {
+ $modifiedColumns[':p' . $index++] = 'ACTIVE';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO colissimows_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 'ACTIVE':
+ $stmt->bindValue($identifier, (int) $this->active, PDO::PARAM_INT);
+ 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);
+ }
+
+ $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 = ColissimowsFreeshippingTableMap::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->getActive();
+ 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
+ *
+ * @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())
+ {
+ if (isset($alreadyDumpedObjects['ColissimowsFreeshipping'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ColissimowsFreeshipping'][$this->getPrimaryKey()] = true;
+ $keys = ColissimowsFreeshippingTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getActive(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ 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 = ColissimowsFreeshippingTableMap::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->setActive($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 = ColissimowsFreeshippingTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setActive($arr[$keys[1]]);
+ }
+
+ /**
+ * 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(ColissimowsFreeshippingTableMap::ID)) $criteria->add(ColissimowsFreeshippingTableMap::ID, $this->id);
+ if ($this->isColumnModified(ColissimowsFreeshippingTableMap::ACTIVE)) $criteria->add(ColissimowsFreeshippingTableMap::ACTIVE, $this->active);
+
+ 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
+ $criteria->add(ColissimowsFreeshippingTableMap::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 \ColissimoWs\Model\ColissimowsFreeshipping (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->setId($this->getId());
+ $copyObj->setActive($this->getActive());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * 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 \ColissimoWs\Model\ColissimowsFreeshipping 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;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->active = 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)
+
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ColissimowsFreeshippingTableMap::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/ColissimoWs/Model/Base/ColissimowsFreeshippingQuery.php b/local/modules/ColissimoWs/Model/Base/ColissimowsFreeshippingQuery.php
new file mode 100644
index 00000000..3bef861f
--- /dev/null
+++ b/local/modules/ColissimoWs/Model/Base/ColissimowsFreeshippingQuery.php
@@ -0,0 +1,375 @@
+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 ChildColissimowsFreeshipping|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ColissimowsFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ColissimowsFreeshippingTableMap::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 ChildColissimowsFreeshipping A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, ACTIVE FROM colissimows_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 ChildColissimowsFreeshipping();
+ $obj->hydrate($row);
+ ColissimowsFreeshippingTableMap::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 ChildColissimowsFreeshipping|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 ChildColissimowsFreeshippingQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(ColissimowsFreeshippingTableMap::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 ChildColissimowsFreeshippingQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(ColissimowsFreeshippingTableMap::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 ChildColissimowsFreeshippingQuery 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(ColissimowsFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(ColissimowsFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsFreeshippingTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the active column
+ *
+ * Example usage:
+ *
+ * $query->filterByActive(true); // WHERE active = true
+ * $query->filterByActive('yes'); // WHERE active = true
+ *
+ *
+ * @param boolean|string $active 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 ChildColissimowsFreeshippingQuery The current query, for fluid interface
+ */
+ public function filterByActive($active = null, $comparison = null)
+ {
+ if (is_string($active)) {
+ $active = in_array(strtolower($active), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(ColissimowsFreeshippingTableMap::ACTIVE, $active, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildColissimowsFreeshipping $colissimowsFreeshipping Object to remove from the list of results
+ *
+ * @return ChildColissimowsFreeshippingQuery The current query, for fluid interface
+ */
+ public function prune($colissimowsFreeshipping = null)
+ {
+ if ($colissimowsFreeshipping) {
+ $this->addUsingAlias(ColissimowsFreeshippingTableMap::ID, $colissimowsFreeshipping->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the colissimows_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(ColissimowsFreeshippingTableMap::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).
+ ColissimowsFreeshippingTableMap::clearInstancePool();
+ ColissimowsFreeshippingTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildColissimowsFreeshipping or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildColissimowsFreeshipping 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(ColissimowsFreeshippingTableMap::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();
+
+
+ ColissimowsFreeshippingTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ ColissimowsFreeshippingTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // ColissimowsFreeshippingQuery
diff --git a/local/modules/ColissimoWs/Model/Base/ColissimowsLabel.php b/local/modules/ColissimoWs/Model/Base/ColissimowsLabel.php
new file mode 100644
index 00000000..7a24663a
--- /dev/null
+++ b/local/modules/ColissimoWs/Model/Base/ColissimowsLabel.php
@@ -0,0 +1,1952 @@
+error = false;
+ $this->error_message = '';
+ $this->tracking_number = '';
+ $this->signed = false;
+ $this->with_customs_invoice = false;
+ }
+
+ /**
+ * Initializes internal state of ColissimoWs\Model\Base\ColissimowsLabel object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Returns whether the object has been modified.
+ *
+ * @return boolean True if the object has been modified.
+ */
+ public function isModified()
+ {
+ return !!$this->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 ColissimowsLabel instance. If
+ * obj is an instance of ColissimowsLabel, delegates to
+ * equals(ColissimowsLabel). 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 ColissimowsLabel 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 ColissimowsLabel 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 [order_ref] column value.
+ *
+ * @return string
+ */
+ public function getOrderRef()
+ {
+
+ return $this->order_ref;
+ }
+
+ /**
+ * Get the [error] column value.
+ *
+ * @return boolean
+ */
+ public function getError()
+ {
+
+ return $this->error;
+ }
+
+ /**
+ * Get the [error_message] column value.
+ *
+ * @return string
+ */
+ public function getErrorMessage()
+ {
+
+ return $this->error_message;
+ }
+
+ /**
+ * Get the [tracking_number] column value.
+ *
+ * @return string
+ */
+ public function getTrackingNumber()
+ {
+
+ return $this->tracking_number;
+ }
+
+ /**
+ * Get the [label_data] column value.
+ *
+ * @return string
+ */
+ public function getLabelData()
+ {
+
+ return $this->label_data;
+ }
+
+ /**
+ * Get the [label_type] column value.
+ *
+ * @return string
+ */
+ public function getLabelType()
+ {
+
+ return $this->label_type;
+ }
+
+ /**
+ * Get the [weight] column value.
+ *
+ * @return double
+ */
+ public function getWeight()
+ {
+
+ return $this->weight;
+ }
+
+ /**
+ * Get the [signed] column value.
+ *
+ * @return boolean
+ */
+ public function getSigned()
+ {
+
+ return $this->signed;
+ }
+
+ /**
+ * Get the [with_customs_invoice] column value.
+ *
+ * @return boolean
+ */
+ public function getWithCustomsInvoice()
+ {
+
+ return $this->with_customs_invoice;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [created_at] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getCreatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->created_at;
+ } else {
+ return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [updated_at] column value.
+ *
+ *
+ * @param string $format The date/time format string (either date()-style or strftime()-style).
+ * If format is NULL, then the raw \DateTime object will be returned.
+ *
+ * @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
+ *
+ * @throws PropelException - if unable to parse/validate the date/time value.
+ */
+ public function getUpdatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->updated_at;
+ } else {
+ return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \ColissimoWs\Model\ColissimowsLabel 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[ColissimowsLabelTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [order_id] column.
+ *
+ * @param int $v new value
+ * @return \ColissimoWs\Model\ColissimowsLabel 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[ColissimowsLabelTableMap::ORDER_ID] = true;
+ }
+
+ if ($this->aOrder !== null && $this->aOrder->getId() !== $v) {
+ $this->aOrder = null;
+ }
+
+
+ return $this;
+ } // setOrderId()
+
+ /**
+ * Set the value of [order_ref] column.
+ *
+ * @param string $v new value
+ * @return \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setOrderRef($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->order_ref !== $v) {
+ $this->order_ref = $v;
+ $this->modifiedColumns[ColissimowsLabelTableMap::ORDER_REF] = true;
+ }
+
+
+ return $this;
+ } // setOrderRef()
+
+ /**
+ * Sets the value of the [error] 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 \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setError($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->error !== $v) {
+ $this->error = $v;
+ $this->modifiedColumns[ColissimowsLabelTableMap::ERROR] = true;
+ }
+
+
+ return $this;
+ } // setError()
+
+ /**
+ * Set the value of [error_message] column.
+ *
+ * @param string $v new value
+ * @return \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setErrorMessage($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->error_message !== $v) {
+ $this->error_message = $v;
+ $this->modifiedColumns[ColissimowsLabelTableMap::ERROR_MESSAGE] = true;
+ }
+
+
+ return $this;
+ } // setErrorMessage()
+
+ /**
+ * Set the value of [tracking_number] column.
+ *
+ * @param string $v new value
+ * @return \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setTrackingNumber($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->tracking_number !== $v) {
+ $this->tracking_number = $v;
+ $this->modifiedColumns[ColissimowsLabelTableMap::TRACKING_NUMBER] = true;
+ }
+
+
+ return $this;
+ } // setTrackingNumber()
+
+ /**
+ * Set the value of [label_data] column.
+ *
+ * @param string $v new value
+ * @return \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setLabelData($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->label_data !== $v) {
+ $this->label_data = $v;
+ $this->modifiedColumns[ColissimowsLabelTableMap::LABEL_DATA] = true;
+ }
+
+
+ return $this;
+ } // setLabelData()
+
+ /**
+ * Set the value of [label_type] column.
+ *
+ * @param string $v new value
+ * @return \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setLabelType($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->label_type !== $v) {
+ $this->label_type = $v;
+ $this->modifiedColumns[ColissimowsLabelTableMap::LABEL_TYPE] = true;
+ }
+
+
+ return $this;
+ } // setLabelType()
+
+ /**
+ * Set the value of [weight] column.
+ *
+ * @param double $v new value
+ * @return \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setWeight($v)
+ {
+ if ($v !== null) {
+ $v = (double) $v;
+ }
+
+ if ($this->weight !== $v) {
+ $this->weight = $v;
+ $this->modifiedColumns[ColissimowsLabelTableMap::WEIGHT] = true;
+ }
+
+
+ return $this;
+ } // setWeight()
+
+ /**
+ * Sets the value of the [signed] 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 \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setSigned($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->signed !== $v) {
+ $this->signed = $v;
+ $this->modifiedColumns[ColissimowsLabelTableMap::SIGNED] = true;
+ }
+
+
+ return $this;
+ } // setSigned()
+
+ /**
+ * Sets the value of the [with_customs_invoice] 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 \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setWithCustomsInvoice($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->with_customs_invoice !== $v) {
+ $this->with_customs_invoice = $v;
+ $this->modifiedColumns[ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE] = true;
+ }
+
+
+ return $this;
+ } // setWithCustomsInvoice()
+
+ /**
+ * Sets the value of [created_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setCreatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->created_at !== null || $dt !== null) {
+ if ($dt !== $this->created_at) {
+ $this->created_at = $dt;
+ $this->modifiedColumns[ColissimowsLabelTableMap::CREATED_AT] = true;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setCreatedAt()
+
+ /**
+ * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \ColissimoWs\Model\ColissimowsLabel The current object (for fluent API support)
+ */
+ public function setUpdatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->updated_at !== null || $dt !== null) {
+ if ($dt !== $this->updated_at) {
+ $this->updated_at = $dt;
+ $this->modifiedColumns[ColissimowsLabelTableMap::UPDATED_AT] = true;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setUpdatedAt()
+
+ /**
+ * 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->error !== false) {
+ return false;
+ }
+
+ if ($this->error_message !== '') {
+ return false;
+ }
+
+ if ($this->tracking_number !== '') {
+ return false;
+ }
+
+ if ($this->signed !== false) {
+ return false;
+ }
+
+ if ($this->with_customs_invoice !== false) {
+ 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 : ColissimowsLabelTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ColissimowsLabelTableMap::translateFieldName('OrderId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->order_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ColissimowsLabelTableMap::translateFieldName('OrderRef', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->order_ref = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ColissimowsLabelTableMap::translateFieldName('Error', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->error = (null !== $col) ? (boolean) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ColissimowsLabelTableMap::translateFieldName('ErrorMessage', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->error_message = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ColissimowsLabelTableMap::translateFieldName('TrackingNumber', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->tracking_number = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ColissimowsLabelTableMap::translateFieldName('LabelData', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->label_data = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ColissimowsLabelTableMap::translateFieldName('LabelType', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->label_type = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ColissimowsLabelTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->weight = (null !== $col) ? (double) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ColissimowsLabelTableMap::translateFieldName('Signed', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->signed = (null !== $col) ? (boolean) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ColissimowsLabelTableMap::translateFieldName('WithCustomsInvoice', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->with_customs_invoice = (null !== $col) ? (boolean) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : ColissimowsLabelTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 12 + $startcol : ColissimowsLabelTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 13; // 13 = ColissimowsLabelTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \ColissimoWs\Model\ColissimowsLabel 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(ColissimowsLabelTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildColissimowsLabelQuery::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 ColissimowsLabel::setDeleted()
+ * @see ColissimowsLabel::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(ColissimowsLabelTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildColissimowsLabelQuery::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(ColissimowsLabelTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ // timestampable behavior
+ if (!$this->isColumnModified(ColissimowsLabelTableMap::CREATED_AT)) {
+ $this->setCreatedAt(time());
+ }
+ if (!$this->isColumnModified(ColissimowsLabelTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ // timestampable behavior
+ if ($this->isModified() && !$this->isColumnModified(ColissimowsLabelTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ColissimowsLabelTableMap::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[ColissimowsLabelTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . ColissimowsLabelTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ColissimowsLabelTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::ORDER_ID)) {
+ $modifiedColumns[':p' . $index++] = 'ORDER_ID';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::ORDER_REF)) {
+ $modifiedColumns[':p' . $index++] = 'ORDER_REF';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::ERROR)) {
+ $modifiedColumns[':p' . $index++] = 'ERROR';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::ERROR_MESSAGE)) {
+ $modifiedColumns[':p' . $index++] = 'ERROR_MESSAGE';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::TRACKING_NUMBER)) {
+ $modifiedColumns[':p' . $index++] = 'TRACKING_NUMBER';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::LABEL_DATA)) {
+ $modifiedColumns[':p' . $index++] = 'LABEL_DATA';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::LABEL_TYPE)) {
+ $modifiedColumns[':p' . $index++] = 'LABEL_TYPE';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::WEIGHT)) {
+ $modifiedColumns[':p' . $index++] = 'WEIGHT';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::SIGNED)) {
+ $modifiedColumns[':p' . $index++] = 'SIGNED';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE)) {
+ $modifiedColumns[':p' . $index++] = 'WITH_CUSTOMS_INVOICE';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::CREATED_AT)) {
+ $modifiedColumns[':p' . $index++] = 'CREATED_AT';
+ }
+ if ($this->isColumnModified(ColissimowsLabelTableMap::UPDATED_AT)) {
+ $modifiedColumns[':p' . $index++] = 'UPDATED_AT';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO colissimows_label (%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 'ORDER_REF':
+ $stmt->bindValue($identifier, $this->order_ref, PDO::PARAM_STR);
+ break;
+ case 'ERROR':
+ $stmt->bindValue($identifier, (int) $this->error, PDO::PARAM_INT);
+ break;
+ case 'ERROR_MESSAGE':
+ $stmt->bindValue($identifier, $this->error_message, PDO::PARAM_STR);
+ break;
+ case 'TRACKING_NUMBER':
+ $stmt->bindValue($identifier, $this->tracking_number, PDO::PARAM_STR);
+ break;
+ case 'LABEL_DATA':
+ $stmt->bindValue($identifier, $this->label_data, PDO::PARAM_STR);
+ break;
+ case 'LABEL_TYPE':
+ $stmt->bindValue($identifier, $this->label_type, PDO::PARAM_STR);
+ break;
+ case 'WEIGHT':
+ $stmt->bindValue($identifier, $this->weight, PDO::PARAM_STR);
+ break;
+ case 'SIGNED':
+ $stmt->bindValue($identifier, (int) $this->signed, PDO::PARAM_INT);
+ break;
+ case 'WITH_CUSTOMS_INVOICE':
+ $stmt->bindValue($identifier, (int) $this->with_customs_invoice, PDO::PARAM_INT);
+ break;
+ case 'CREATED_AT':
+ $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ break;
+ case 'UPDATED_AT':
+ $stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, 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 = ColissimowsLabelTableMap::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->getOrderRef();
+ break;
+ case 3:
+ return $this->getError();
+ break;
+ case 4:
+ return $this->getErrorMessage();
+ break;
+ case 5:
+ return $this->getTrackingNumber();
+ break;
+ case 6:
+ return $this->getLabelData();
+ break;
+ case 7:
+ return $this->getLabelType();
+ break;
+ case 8:
+ return $this->getWeight();
+ break;
+ case 9:
+ return $this->getSigned();
+ break;
+ case 10:
+ return $this->getWithCustomsInvoice();
+ break;
+ case 11:
+ return $this->getCreatedAt();
+ break;
+ case 12:
+ return $this->getUpdatedAt();
+ 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['ColissimowsLabel'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ColissimowsLabel'][$this->getPrimaryKey()] = true;
+ $keys = ColissimowsLabelTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getOrderId(),
+ $keys[2] => $this->getOrderRef(),
+ $keys[3] => $this->getError(),
+ $keys[4] => $this->getErrorMessage(),
+ $keys[5] => $this->getTrackingNumber(),
+ $keys[6] => $this->getLabelData(),
+ $keys[7] => $this->getLabelType(),
+ $keys[8] => $this->getWeight(),
+ $keys[9] => $this->getSigned(),
+ $keys[10] => $this->getWithCustomsInvoice(),
+ $keys[11] => $this->getCreatedAt(),
+ $keys[12] => $this->getUpdatedAt(),
+ );
+ $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 = ColissimowsLabelTableMap::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->setOrderRef($value);
+ break;
+ case 3:
+ $this->setError($value);
+ break;
+ case 4:
+ $this->setErrorMessage($value);
+ break;
+ case 5:
+ $this->setTrackingNumber($value);
+ break;
+ case 6:
+ $this->setLabelData($value);
+ break;
+ case 7:
+ $this->setLabelType($value);
+ break;
+ case 8:
+ $this->setWeight($value);
+ break;
+ case 9:
+ $this->setSigned($value);
+ break;
+ case 10:
+ $this->setWithCustomsInvoice($value);
+ break;
+ case 11:
+ $this->setCreatedAt($value);
+ break;
+ case 12:
+ $this->setUpdatedAt($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 = ColissimowsLabelTableMap::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->setOrderRef($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setError($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setErrorMessage($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setTrackingNumber($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setLabelData($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setLabelType($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setWeight($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setSigned($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setWithCustomsInvoice($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setCreatedAt($arr[$keys[11]]);
+ if (array_key_exists($keys[12], $arr)) $this->setUpdatedAt($arr[$keys[12]]);
+ }
+
+ /**
+ * 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(ColissimowsLabelTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(ColissimowsLabelTableMap::ID)) $criteria->add(ColissimowsLabelTableMap::ID, $this->id);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::ORDER_ID)) $criteria->add(ColissimowsLabelTableMap::ORDER_ID, $this->order_id);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::ORDER_REF)) $criteria->add(ColissimowsLabelTableMap::ORDER_REF, $this->order_ref);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::ERROR)) $criteria->add(ColissimowsLabelTableMap::ERROR, $this->error);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::ERROR_MESSAGE)) $criteria->add(ColissimowsLabelTableMap::ERROR_MESSAGE, $this->error_message);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::TRACKING_NUMBER)) $criteria->add(ColissimowsLabelTableMap::TRACKING_NUMBER, $this->tracking_number);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::LABEL_DATA)) $criteria->add(ColissimowsLabelTableMap::LABEL_DATA, $this->label_data);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::LABEL_TYPE)) $criteria->add(ColissimowsLabelTableMap::LABEL_TYPE, $this->label_type);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::WEIGHT)) $criteria->add(ColissimowsLabelTableMap::WEIGHT, $this->weight);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::SIGNED)) $criteria->add(ColissimowsLabelTableMap::SIGNED, $this->signed);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE)) $criteria->add(ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE, $this->with_customs_invoice);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::CREATED_AT)) $criteria->add(ColissimowsLabelTableMap::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(ColissimowsLabelTableMap::UPDATED_AT)) $criteria->add(ColissimowsLabelTableMap::UPDATED_AT, $this->updated_at);
+
+ 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(ColissimowsLabelTableMap::DATABASE_NAME);
+ $criteria->add(ColissimowsLabelTableMap::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 \ColissimoWs\Model\ColissimowsLabel (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->setOrderRef($this->getOrderRef());
+ $copyObj->setError($this->getError());
+ $copyObj->setErrorMessage($this->getErrorMessage());
+ $copyObj->setTrackingNumber($this->getTrackingNumber());
+ $copyObj->setLabelData($this->getLabelData());
+ $copyObj->setLabelType($this->getLabelType());
+ $copyObj->setWeight($this->getWeight());
+ $copyObj->setSigned($this->getSigned());
+ $copyObj->setWithCustomsInvoice($this->getWithCustomsInvoice());
+ $copyObj->setCreatedAt($this->getCreatedAt());
+ $copyObj->setUpdatedAt($this->getUpdatedAt());
+ 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 \ColissimoWs\Model\ColissimowsLabel 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 \ColissimoWs\Model\ColissimowsLabel 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->addColissimowsLabel($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->addColissimowsLabels($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->order_ref = null;
+ $this->error = null;
+ $this->error_message = null;
+ $this->tracking_number = null;
+ $this->label_data = null;
+ $this->label_type = null;
+ $this->weight = null;
+ $this->signed = null;
+ $this->with_customs_invoice = null;
+ $this->created_at = null;
+ $this->updated_at = 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->aOrder = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ColissimowsLabelTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ // timestampable behavior
+
+ /**
+ * Mark the current object so that the update date doesn't get updated during next save
+ *
+ * @return ChildColissimowsLabel The current object (for fluent API support)
+ */
+ public function keepUpdateDateUnchanged()
+ {
+ $this->modifiedColumns[ColissimowsLabelTableMap::UPDATED_AT] = true;
+
+ return $this;
+ }
+
+ /**
+ * 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/ColissimoWs/Model/Base/ColissimowsLabelQuery.php b/local/modules/ColissimoWs/Model/Base/ColissimowsLabelQuery.php
new file mode 100644
index 00000000..b6d69826
--- /dev/null
+++ b/local/modules/ColissimoWs/Model/Base/ColissimowsLabelQuery.php
@@ -0,0 +1,937 @@
+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 ChildColissimowsLabel|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ColissimowsLabelTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ColissimowsLabelTableMap::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 ChildColissimowsLabel A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, ORDER_ID, ORDER_REF, ERROR, ERROR_MESSAGE, TRACKING_NUMBER, LABEL_DATA, LABEL_TYPE, WEIGHT, SIGNED, WITH_CUSTOMS_INVOICE, CREATED_AT, UPDATED_AT FROM colissimows_label 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 ChildColissimowsLabel();
+ $obj->hydrate($row);
+ ColissimowsLabelTableMap::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 ChildColissimowsLabel|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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::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 ChildColissimowsLabelQuery 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(ColissimowsLabelTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(ColissimowsLabelTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::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 ChildColissimowsLabelQuery 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(ColissimowsLabelTableMap::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($orderId['max'])) {
+ $this->addUsingAlias(ColissimowsLabelTableMap::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::ORDER_ID, $orderId, $comparison);
+ }
+
+ /**
+ * Filter the query on the order_ref column
+ *
+ * Example usage:
+ *
+ * $query->filterByOrderRef('fooValue'); // WHERE order_ref = 'fooValue'
+ * $query->filterByOrderRef('%fooValue%'); // WHERE order_ref LIKE '%fooValue%'
+ *
+ *
+ * @param string $orderRef 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByOrderRef($orderRef = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($orderRef)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $orderRef)) {
+ $orderRef = str_replace('*', '%', $orderRef);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::ORDER_REF, $orderRef, $comparison);
+ }
+
+ /**
+ * Filter the query on the error column
+ *
+ * Example usage:
+ *
+ * $query->filterByError(true); // WHERE error = true
+ * $query->filterByError('yes'); // WHERE error = true
+ *
+ *
+ * @param boolean|string $error 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByError($error = null, $comparison = null)
+ {
+ if (is_string($error)) {
+ $error = in_array(strtolower($error), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::ERROR, $error, $comparison);
+ }
+
+ /**
+ * Filter the query on the error_message column
+ *
+ * Example usage:
+ *
+ * $query->filterByErrorMessage('fooValue'); // WHERE error_message = 'fooValue'
+ * $query->filterByErrorMessage('%fooValue%'); // WHERE error_message LIKE '%fooValue%'
+ *
+ *
+ * @param string $errorMessage 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByErrorMessage($errorMessage = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($errorMessage)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $errorMessage)) {
+ $errorMessage = str_replace('*', '%', $errorMessage);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::ERROR_MESSAGE, $errorMessage, $comparison);
+ }
+
+ /**
+ * Filter the query on the tracking_number column
+ *
+ * Example usage:
+ *
+ * $query->filterByTrackingNumber('fooValue'); // WHERE tracking_number = 'fooValue'
+ * $query->filterByTrackingNumber('%fooValue%'); // WHERE tracking_number LIKE '%fooValue%'
+ *
+ *
+ * @param string $trackingNumber 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByTrackingNumber($trackingNumber = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($trackingNumber)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $trackingNumber)) {
+ $trackingNumber = str_replace('*', '%', $trackingNumber);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::TRACKING_NUMBER, $trackingNumber, $comparison);
+ }
+
+ /**
+ * Filter the query on the label_data column
+ *
+ * Example usage:
+ *
+ * $query->filterByLabelData('fooValue'); // WHERE label_data = 'fooValue'
+ * $query->filterByLabelData('%fooValue%'); // WHERE label_data LIKE '%fooValue%'
+ *
+ *
+ * @param string $labelData 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByLabelData($labelData = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($labelData)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $labelData)) {
+ $labelData = str_replace('*', '%', $labelData);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::LABEL_DATA, $labelData, $comparison);
+ }
+
+ /**
+ * Filter the query on the label_type column
+ *
+ * Example usage:
+ *
+ * $query->filterByLabelType('fooValue'); // WHERE label_type = 'fooValue'
+ * $query->filterByLabelType('%fooValue%'); // WHERE label_type LIKE '%fooValue%'
+ *
+ *
+ * @param string $labelType 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByLabelType($labelType = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($labelType)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $labelType)) {
+ $labelType = str_replace('*', '%', $labelType);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::LABEL_TYPE, $labelType, $comparison);
+ }
+
+ /**
+ * Filter the query on the weight column
+ *
+ * Example usage:
+ *
+ * $query->filterByWeight(1234); // WHERE weight = 1234
+ * $query->filterByWeight(array(12, 34)); // WHERE weight IN (12, 34)
+ * $query->filterByWeight(array('min' => 12)); // WHERE weight > 12
+ *
+ *
+ * @param mixed $weight 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByWeight($weight = null, $comparison = null)
+ {
+ if (is_array($weight)) {
+ $useMinMax = false;
+ if (isset($weight['min'])) {
+ $this->addUsingAlias(ColissimowsLabelTableMap::WEIGHT, $weight['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($weight['max'])) {
+ $this->addUsingAlias(ColissimowsLabelTableMap::WEIGHT, $weight['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::WEIGHT, $weight, $comparison);
+ }
+
+ /**
+ * Filter the query on the signed column
+ *
+ * Example usage:
+ *
+ * $query->filterBySigned(true); // WHERE signed = true
+ * $query->filterBySigned('yes'); // WHERE signed = true
+ *
+ *
+ * @param boolean|string $signed 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterBySigned($signed = null, $comparison = null)
+ {
+ if (is_string($signed)) {
+ $signed = in_array(strtolower($signed), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::SIGNED, $signed, $comparison);
+ }
+
+ /**
+ * Filter the query on the with_customs_invoice column
+ *
+ * Example usage:
+ *
+ * $query->filterByWithCustomsInvoice(true); // WHERE with_customs_invoice = true
+ * $query->filterByWithCustomsInvoice('yes'); // WHERE with_customs_invoice = true
+ *
+ *
+ * @param boolean|string $withCustomsInvoice 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByWithCustomsInvoice($withCustomsInvoice = null, $comparison = null)
+ {
+ if (is_string($withCustomsInvoice)) {
+ $with_customs_invoice = in_array(strtolower($withCustomsInvoice), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE, $withCustomsInvoice, $comparison);
+ }
+
+ /**
+ * Filter the query on the created_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
+ * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
+ * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
+ *
+ *
+ * @param mixed $createdAt The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByCreatedAt($createdAt = null, $comparison = null)
+ {
+ if (is_array($createdAt)) {
+ $useMinMax = false;
+ if (isset($createdAt['min'])) {
+ $this->addUsingAlias(ColissimowsLabelTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($createdAt['max'])) {
+ $this->addUsingAlias(ColissimowsLabelTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::CREATED_AT, $createdAt, $comparison);
+ }
+
+ /**
+ * Filter the query on the updated_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
+ * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
+ * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
+ *
+ *
+ * @param mixed $updatedAt The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * 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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByUpdatedAt($updatedAt = null, $comparison = null)
+ {
+ if (is_array($updatedAt)) {
+ $useMinMax = false;
+ if (isset($updatedAt['min'])) {
+ $this->addUsingAlias(ColissimowsLabelTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($updatedAt['max'])) {
+ $this->addUsingAlias(ColissimowsLabelTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsLabelTableMap::UPDATED_AT, $updatedAt, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Order object
+ *
+ * @param \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 ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function filterByOrder($order, $comparison = null)
+ {
+ if ($order instanceof \Thelia\Model\Order) {
+ return $this
+ ->addUsingAlias(ColissimowsLabelTableMap::ORDER_ID, $order->getId(), $comparison);
+ } elseif ($order instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ColissimowsLabelTableMap::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByOrder() only accepts arguments of type \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 ChildColissimowsLabelQuery 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 \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', '\Thelia\Model\OrderQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildColissimowsLabel $colissimowsLabel Object to remove from the list of results
+ *
+ * @return ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function prune($colissimowsLabel = null)
+ {
+ if ($colissimowsLabel) {
+ $this->addUsingAlias(ColissimowsLabelTableMap::ID, $colissimowsLabel->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the colissimows_label 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(ColissimowsLabelTableMap::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).
+ ColissimowsLabelTableMap::clearInstancePool();
+ ColissimowsLabelTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildColissimowsLabel or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildColissimowsLabel 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(ColissimowsLabelTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(ColissimowsLabelTableMap::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();
+
+
+ ColissimowsLabelTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ ColissimowsLabelTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ // timestampable behavior
+
+ /**
+ * Filter by the latest updated
+ *
+ * @param int $nbDays Maximum age of the latest update in days
+ *
+ * @return ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function recentlyUpdated($nbDays = 7)
+ {
+ return $this->addUsingAlias(ColissimowsLabelTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Filter by the latest created
+ *
+ * @param int $nbDays Maximum age of in days
+ *
+ * @return ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function recentlyCreated($nbDays = 7)
+ {
+ return $this->addUsingAlias(ColissimowsLabelTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Order by update date desc
+ *
+ * @return ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function lastUpdatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(ColissimowsLabelTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by update date asc
+ *
+ * @return ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function firstUpdatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(ColissimowsLabelTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by create date desc
+ *
+ * @return ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function lastCreatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(ColissimowsLabelTableMap::CREATED_AT);
+ }
+
+ /**
+ * Order by create date asc
+ *
+ * @return ChildColissimowsLabelQuery The current query, for fluid interface
+ */
+ public function firstCreatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(ColissimowsLabelTableMap::CREATED_AT);
+ }
+
+} // ColissimowsLabelQuery
diff --git a/local/modules/ColissimoWs/Model/Base/ColissimowsPriceSlices.php b/local/modules/ColissimoWs/Model/Base/ColissimowsPriceSlices.php
new file mode 100644
index 00000000..a84d1adf
--- /dev/null
+++ b/local/modules/ColissimoWs/Model/Base/ColissimowsPriceSlices.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 ColissimowsPriceSlices instance. If
+ * obj is an instance of ColissimowsPriceSlices, delegates to
+ * equals(ColissimowsPriceSlices). 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 ColissimowsPriceSlices 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 ColissimowsPriceSlices 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 [max_weight] column value.
+ *
+ * @return double
+ */
+ public function getMaxWeight()
+ {
+
+ return $this->max_weight;
+ }
+
+ /**
+ * Get the [max_price] column value.
+ *
+ * @return double
+ */
+ public function getMaxPrice()
+ {
+
+ return $this->max_price;
+ }
+
+ /**
+ * Get the [shipping] column value.
+ *
+ * @return double
+ */
+ public function getShipping()
+ {
+
+ return $this->shipping;
+ }
+
+ /**
+ * Get the [franco_min_price] column value.
+ *
+ * @return double
+ */
+ public function getFrancoMinPrice()
+ {
+
+ return $this->franco_min_price;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \ColissimoWs\Model\ColissimowsPriceSlices 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[ColissimowsPriceSlicesTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [area_id] column.
+ *
+ * @param int $v new value
+ * @return \ColissimoWs\Model\ColissimowsPriceSlices 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[ColissimowsPriceSlicesTableMap::AREA_ID] = true;
+ }
+
+ if ($this->aArea !== null && $this->aArea->getId() !== $v) {
+ $this->aArea = null;
+ }
+
+
+ return $this;
+ } // setAreaId()
+
+ /**
+ * Set the value of [max_weight] column.
+ *
+ * @param double $v new value
+ * @return \ColissimoWs\Model\ColissimowsPriceSlices The current object (for fluent API support)
+ */
+ public function setMaxWeight($v)
+ {
+ if ($v !== null) {
+ $v = (double) $v;
+ }
+
+ if ($this->max_weight !== $v) {
+ $this->max_weight = $v;
+ $this->modifiedColumns[ColissimowsPriceSlicesTableMap::MAX_WEIGHT] = true;
+ }
+
+
+ return $this;
+ } // setMaxWeight()
+
+ /**
+ * Set the value of [max_price] column.
+ *
+ * @param double $v new value
+ * @return \ColissimoWs\Model\ColissimowsPriceSlices The current object (for fluent API support)
+ */
+ public function setMaxPrice($v)
+ {
+ if ($v !== null) {
+ $v = (double) $v;
+ }
+
+ if ($this->max_price !== $v) {
+ $this->max_price = $v;
+ $this->modifiedColumns[ColissimowsPriceSlicesTableMap::MAX_PRICE] = true;
+ }
+
+
+ return $this;
+ } // setMaxPrice()
+
+ /**
+ * Set the value of [shipping] column.
+ *
+ * @param double $v new value
+ * @return \ColissimoWs\Model\ColissimowsPriceSlices The current object (for fluent API support)
+ */
+ public function setShipping($v)
+ {
+ if ($v !== null) {
+ $v = (double) $v;
+ }
+
+ if ($this->shipping !== $v) {
+ $this->shipping = $v;
+ $this->modifiedColumns[ColissimowsPriceSlicesTableMap::SHIPPING] = true;
+ }
+
+
+ return $this;
+ } // setShipping()
+
+ /**
+ * Set the value of [franco_min_price] column.
+ *
+ * @param double $v new value
+ * @return \ColissimoWs\Model\ColissimowsPriceSlices 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[ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE] = true;
+ }
+
+
+ return $this;
+ } // setFrancoMinPrice()
+
+ /**
+ * 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 : ColissimowsPriceSlicesTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ColissimowsPriceSlicesTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->area_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ColissimowsPriceSlicesTableMap::translateFieldName('MaxWeight', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->max_weight = (null !== $col) ? (double) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ColissimowsPriceSlicesTableMap::translateFieldName('MaxPrice', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->max_price = (null !== $col) ? (double) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ColissimowsPriceSlicesTableMap::translateFieldName('Shipping', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->shipping = (null !== $col) ? (double) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ColissimowsPriceSlicesTableMap::translateFieldName('FrancoMinPrice', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->franco_min_price = (null !== $col) ? (double) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = ColissimowsPriceSlicesTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \ColissimoWs\Model\ColissimowsPriceSlices 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;
+ }
+ } // 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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildColissimowsPriceSlicesQuery::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;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see ColissimowsPriceSlices::setDeleted()
+ * @see ColissimowsPriceSlices::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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildColissimowsPriceSlicesQuery::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(ColissimowsPriceSlicesTableMap::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);
+ ColissimowsPriceSlicesTableMap::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->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[ColissimowsPriceSlicesTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . ColissimowsPriceSlicesTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = 'ID';
+ }
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::AREA_ID)) {
+ $modifiedColumns[':p' . $index++] = 'AREA_ID';
+ }
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::MAX_WEIGHT)) {
+ $modifiedColumns[':p' . $index++] = 'MAX_WEIGHT';
+ }
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::MAX_PRICE)) {
+ $modifiedColumns[':p' . $index++] = 'MAX_PRICE';
+ }
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::SHIPPING)) {
+ $modifiedColumns[':p' . $index++] = 'SHIPPING';
+ }
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE)) {
+ $modifiedColumns[':p' . $index++] = 'FRANCO_MIN_PRICE';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO colissimows_price_slices (%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 'MAX_WEIGHT':
+ $stmt->bindValue($identifier, $this->max_weight, PDO::PARAM_STR);
+ break;
+ case 'MAX_PRICE':
+ $stmt->bindValue($identifier, $this->max_price, PDO::PARAM_STR);
+ break;
+ case 'SHIPPING':
+ $stmt->bindValue($identifier, $this->shipping, PDO::PARAM_STR);
+ break;
+ case 'FRANCO_MIN_PRICE':
+ $stmt->bindValue($identifier, $this->franco_min_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 = ColissimowsPriceSlicesTableMap::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->getMaxWeight();
+ break;
+ case 3:
+ return $this->getMaxPrice();
+ break;
+ case 4:
+ return $this->getShipping();
+ break;
+ case 5:
+ return $this->getFrancoMinPrice();
+ 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['ColissimowsPriceSlices'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ColissimowsPriceSlices'][$this->getPrimaryKey()] = true;
+ $keys = ColissimowsPriceSlicesTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getAreaId(),
+ $keys[2] => $this->getMaxWeight(),
+ $keys[3] => $this->getMaxPrice(),
+ $keys[4] => $this->getShipping(),
+ $keys[5] => $this->getFrancoMinPrice(),
+ );
+ $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);
+ }
+ }
+
+ 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 = ColissimowsPriceSlicesTableMap::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->setMaxWeight($value);
+ break;
+ case 3:
+ $this->setMaxPrice($value);
+ break;
+ case 4:
+ $this->setShipping($value);
+ break;
+ case 5:
+ $this->setFrancoMinPrice($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 = ColissimowsPriceSlicesTableMap::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->setMaxWeight($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setMaxPrice($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setShipping($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setFrancoMinPrice($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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::ID)) $criteria->add(ColissimowsPriceSlicesTableMap::ID, $this->id);
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::AREA_ID)) $criteria->add(ColissimowsPriceSlicesTableMap::AREA_ID, $this->area_id);
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::MAX_WEIGHT)) $criteria->add(ColissimowsPriceSlicesTableMap::MAX_WEIGHT, $this->max_weight);
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::MAX_PRICE)) $criteria->add(ColissimowsPriceSlicesTableMap::MAX_PRICE, $this->max_price);
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::SHIPPING)) $criteria->add(ColissimowsPriceSlicesTableMap::SHIPPING, $this->shipping);
+ if ($this->isColumnModified(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE)) $criteria->add(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE, $this->franco_min_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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
+ $criteria->add(ColissimowsPriceSlicesTableMap::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 \ColissimoWs\Model\ColissimowsPriceSlices (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->setMaxWeight($this->getMaxWeight());
+ $copyObj->setMaxPrice($this->getMaxPrice());
+ $copyObj->setShipping($this->getShipping());
+ $copyObj->setFrancoMinPrice($this->getFrancoMinPrice());
+ 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 \ColissimoWs\Model\ColissimowsPriceSlices 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 \ColissimoWs\Model\ColissimowsPriceSlices 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->addColissimowsPriceSlices($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->addColissimowsPriceSlicess($this);
+ */
+ }
+
+ return $this->aArea;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->area_id = null;
+ $this->max_weight = null;
+ $this->max_price = null;
+ $this->shipping = null;
+ $this->franco_min_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;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ColissimowsPriceSlicesTableMap::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/ColissimoWs/Model/Base/ColissimowsPriceSlicesQuery.php b/local/modules/ColissimoWs/Model/Base/ColissimowsPriceSlicesQuery.php
new file mode 100644
index 00000000..1b24937a
--- /dev/null
+++ b/local/modules/ColissimoWs/Model/Base/ColissimowsPriceSlicesQuery.php
@@ -0,0 +1,654 @@
+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 ChildColissimowsPriceSlices|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ColissimowsPriceSlicesTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(ColissimowsPriceSlicesTableMap::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 ChildColissimowsPriceSlices A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT ID, AREA_ID, MAX_WEIGHT, MAX_PRICE, SHIPPING, FRANCO_MIN_PRICE FROM colissimows_price_slices 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 ChildColissimowsPriceSlices();
+ $obj->hydrate($row);
+ ColissimowsPriceSlicesTableMap::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 ChildColissimowsPriceSlices|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 ChildColissimowsPriceSlicesQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::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 ChildColissimowsPriceSlicesQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::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 ChildColissimowsPriceSlicesQuery 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(ColissimowsPriceSlicesTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(ColissimowsPriceSlicesTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::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 ChildColissimowsPriceSlicesQuery 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(ColissimowsPriceSlicesTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($areaId['max'])) {
+ $this->addUsingAlias(ColissimowsPriceSlicesTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::AREA_ID, $areaId, $comparison);
+ }
+
+ /**
+ * Filter the query on the max_weight column
+ *
+ * Example usage:
+ *
+ * $query->filterByMaxWeight(1234); // WHERE max_weight = 1234
+ * $query->filterByMaxWeight(array(12, 34)); // WHERE max_weight IN (12, 34)
+ * $query->filterByMaxWeight(array('min' => 12)); // WHERE max_weight > 12
+ *
+ *
+ * @param mixed $maxWeight 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 ChildColissimowsPriceSlicesQuery The current query, for fluid interface
+ */
+ public function filterByMaxWeight($maxWeight = null, $comparison = null)
+ {
+ if (is_array($maxWeight)) {
+ $useMinMax = false;
+ if (isset($maxWeight['min'])) {
+ $this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_WEIGHT, $maxWeight['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($maxWeight['max'])) {
+ $this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_WEIGHT, $maxWeight['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_WEIGHT, $maxWeight, $comparison);
+ }
+
+ /**
+ * Filter the query on the max_price column
+ *
+ * Example usage:
+ *
+ * $query->filterByMaxPrice(1234); // WHERE max_price = 1234
+ * $query->filterByMaxPrice(array(12, 34)); // WHERE max_price IN (12, 34)
+ * $query->filterByMaxPrice(array('min' => 12)); // WHERE max_price > 12
+ *
+ *
+ * @param mixed $maxPrice 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 ChildColissimowsPriceSlicesQuery The current query, for fluid interface
+ */
+ public function filterByMaxPrice($maxPrice = null, $comparison = null)
+ {
+ if (is_array($maxPrice)) {
+ $useMinMax = false;
+ if (isset($maxPrice['min'])) {
+ $this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_PRICE, $maxPrice['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($maxPrice['max'])) {
+ $this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_PRICE, $maxPrice['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_PRICE, $maxPrice, $comparison);
+ }
+
+ /**
+ * Filter the query on the shipping column
+ *
+ * Example usage:
+ *
+ * $query->filterByShipping(1234); // WHERE shipping = 1234
+ * $query->filterByShipping(array(12, 34)); // WHERE shipping IN (12, 34)
+ * $query->filterByShipping(array('min' => 12)); // WHERE shipping > 12
+ *
+ *
+ * @param mixed $shipping 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 ChildColissimowsPriceSlicesQuery The current query, for fluid interface
+ */
+ public function filterByShipping($shipping = null, $comparison = null)
+ {
+ if (is_array($shipping)) {
+ $useMinMax = false;
+ if (isset($shipping['min'])) {
+ $this->addUsingAlias(ColissimowsPriceSlicesTableMap::SHIPPING, $shipping['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($shipping['max'])) {
+ $this->addUsingAlias(ColissimowsPriceSlicesTableMap::SHIPPING, $shipping['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::SHIPPING, $shipping, $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 ChildColissimowsPriceSlicesQuery 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(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($francoMinPrice['max'])) {
+ $this->addUsingAlias(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Area object
+ *
+ * @param \Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildColissimowsPriceSlicesQuery The current query, for fluid interface
+ */
+ public function filterByArea($area, $comparison = null)
+ {
+ if ($area instanceof \Thelia\Model\Area) {
+ return $this
+ ->addUsingAlias(ColissimowsPriceSlicesTableMap::AREA_ID, $area->getId(), $comparison);
+ } elseif ($area instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ColissimowsPriceSlicesTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByArea() only accepts arguments of type \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 ChildColissimowsPriceSlicesQuery 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 \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', '\Thelia\Model\AreaQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildColissimowsPriceSlices $colissimowsPriceSlices Object to remove from the list of results
+ *
+ * @return ChildColissimowsPriceSlicesQuery The current query, for fluid interface
+ */
+ public function prune($colissimowsPriceSlices = null)
+ {
+ if ($colissimowsPriceSlices) {
+ $this->addUsingAlias(ColissimowsPriceSlicesTableMap::ID, $colissimowsPriceSlices->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the colissimows_price_slices 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(ColissimowsPriceSlicesTableMap::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).
+ ColissimowsPriceSlicesTableMap::clearInstancePool();
+ ColissimowsPriceSlicesTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildColissimowsPriceSlices or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildColissimowsPriceSlices 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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(ColissimowsPriceSlicesTableMap::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();
+
+
+ ColissimowsPriceSlicesTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ ColissimowsPriceSlicesTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // ColissimowsPriceSlicesQuery
diff --git a/local/modules/ColissimoWs/Model/ColissimowsFreeshipping.php b/local/modules/ColissimoWs/Model/ColissimowsFreeshipping.php
new file mode 100644
index 00000000..815fce87
--- /dev/null
+++ b/local/modules/ColissimoWs/Model/ColissimowsFreeshipping.php
@@ -0,0 +1,20 @@
+ array('Id', 'Active', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'active', ),
+ self::TYPE_COLNAME => array(ColissimowsFreeshippingTableMap::ID, ColissimowsFreeshippingTableMap::ACTIVE, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'ACTIVE', ),
+ self::TYPE_FIELDNAME => array('id', 'active', ),
+ self::TYPE_NUM => array(0, 1, )
+ );
+
+ /**
+ * 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, 'Active' => 1, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'active' => 1, ),
+ self::TYPE_COLNAME => array(ColissimowsFreeshippingTableMap::ID => 0, ColissimowsFreeshippingTableMap::ACTIVE => 1, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'ACTIVE' => 1, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'active' => 1, ),
+ self::TYPE_NUM => array(0, 1, )
+ );
+
+ /**
+ * 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('colissimows_freeshipping');
+ $this->setPhpName('ColissimowsFreeshipping');
+ $this->setClassName('\\ColissimoWs\\Model\\ColissimowsFreeshipping');
+ $this->setPackage('ColissimoWs.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('ACTIVE', 'Active', 'BOOLEAN', false, 1, false);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // 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 ? ColissimowsFreeshippingTableMap::CLASS_DEFAULT : ColissimowsFreeshippingTableMap::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 (ColissimowsFreeshipping object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = ColissimowsFreeshippingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = ColissimowsFreeshippingTableMap::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 + ColissimowsFreeshippingTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ColissimowsFreeshippingTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ ColissimowsFreeshippingTableMap::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 = ColissimowsFreeshippingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = ColissimowsFreeshippingTableMap::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;
+ ColissimowsFreeshippingTableMap::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(ColissimowsFreeshippingTableMap::ID);
+ $criteria->addSelectColumn(ColissimowsFreeshippingTableMap::ACTIVE);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.ACTIVE');
+ }
+ }
+
+ /**
+ * 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(ColissimowsFreeshippingTableMap::DATABASE_NAME)->getTable(ColissimowsFreeshippingTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimowsFreeshippingTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(ColissimowsFreeshippingTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new ColissimowsFreeshippingTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ColissimowsFreeshipping or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ColissimowsFreeshipping 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \ColissimoWs\Model\ColissimowsFreeshipping) { // 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
+ $criteria->add(ColissimowsFreeshippingTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = ColissimowsFreeshippingQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { ColissimowsFreeshippingTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { ColissimowsFreeshippingTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the colissimows_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 ColissimowsFreeshippingQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ColissimowsFreeshipping or Criteria object.
+ *
+ * @param mixed $criteria Criteria or ColissimowsFreeshipping 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from ColissimowsFreeshipping object
+ }
+
+
+ // Set the correct dbName
+ $query = ColissimowsFreeshippingQuery::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;
+ }
+
+} // ColissimowsFreeshippingTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+ColissimowsFreeshippingTableMap::buildTableMap();
diff --git a/local/modules/ColissimoWs/Model/Map/ColissimowsLabelTableMap.php b/local/modules/ColissimoWs/Model/Map/ColissimowsLabelTableMap.php
new file mode 100644
index 00000000..dbde6a00
--- /dev/null
+++ b/local/modules/ColissimoWs/Model/Map/ColissimowsLabelTableMap.php
@@ -0,0 +1,512 @@
+ array('Id', 'OrderId', 'OrderRef', 'Error', 'ErrorMessage', 'TrackingNumber', 'LabelData', 'LabelType', 'Weight', 'Signed', 'WithCustomsInvoice', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'orderRef', 'error', 'errorMessage', 'trackingNumber', 'labelData', 'labelType', 'weight', 'signed', 'withCustomsInvoice', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(ColissimowsLabelTableMap::ID, ColissimowsLabelTableMap::ORDER_ID, ColissimowsLabelTableMap::ORDER_REF, ColissimowsLabelTableMap::ERROR, ColissimowsLabelTableMap::ERROR_MESSAGE, ColissimowsLabelTableMap::TRACKING_NUMBER, ColissimowsLabelTableMap::LABEL_DATA, ColissimowsLabelTableMap::LABEL_TYPE, ColissimowsLabelTableMap::WEIGHT, ColissimowsLabelTableMap::SIGNED, ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE, ColissimowsLabelTableMap::CREATED_AT, ColissimowsLabelTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'ORDER_REF', 'ERROR', 'ERROR_MESSAGE', 'TRACKING_NUMBER', 'LABEL_DATA', 'LABEL_TYPE', 'WEIGHT', 'SIGNED', 'WITH_CUSTOMS_INVOICE', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'order_id', 'order_ref', 'error', 'error_message', 'tracking_number', 'label_data', 'label_type', 'weight', 'signed', 'with_customs_invoice', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
+ );
+
+ /**
+ * 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, 'OrderRef' => 2, 'Error' => 3, 'ErrorMessage' => 4, 'TrackingNumber' => 5, 'LabelData' => 6, 'LabelType' => 7, 'Weight' => 8, 'Signed' => 9, 'WithCustomsInvoice' => 10, 'CreatedAt' => 11, 'UpdatedAt' => 12, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'orderRef' => 2, 'error' => 3, 'errorMessage' => 4, 'trackingNumber' => 5, 'labelData' => 6, 'labelType' => 7, 'weight' => 8, 'signed' => 9, 'withCustomsInvoice' => 10, 'createdAt' => 11, 'updatedAt' => 12, ),
+ self::TYPE_COLNAME => array(ColissimowsLabelTableMap::ID => 0, ColissimowsLabelTableMap::ORDER_ID => 1, ColissimowsLabelTableMap::ORDER_REF => 2, ColissimowsLabelTableMap::ERROR => 3, ColissimowsLabelTableMap::ERROR_MESSAGE => 4, ColissimowsLabelTableMap::TRACKING_NUMBER => 5, ColissimowsLabelTableMap::LABEL_DATA => 6, ColissimowsLabelTableMap::LABEL_TYPE => 7, ColissimowsLabelTableMap::WEIGHT => 8, ColissimowsLabelTableMap::SIGNED => 9, ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE => 10, ColissimowsLabelTableMap::CREATED_AT => 11, ColissimowsLabelTableMap::UPDATED_AT => 12, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'ORDER_REF' => 2, 'ERROR' => 3, 'ERROR_MESSAGE' => 4, 'TRACKING_NUMBER' => 5, 'LABEL_DATA' => 6, 'LABEL_TYPE' => 7, 'WEIGHT' => 8, 'SIGNED' => 9, 'WITH_CUSTOMS_INVOICE' => 10, 'CREATED_AT' => 11, 'UPDATED_AT' => 12, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'order_ref' => 2, 'error' => 3, 'error_message' => 4, 'tracking_number' => 5, 'label_data' => 6, 'label_type' => 7, 'weight' => 8, 'signed' => 9, 'with_customs_invoice' => 10, 'created_at' => 11, 'updated_at' => 12, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
+ );
+
+ /**
+ * 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('colissimows_label');
+ $this->setPhpName('ColissimowsLabel');
+ $this->setClassName('\\ColissimoWs\\Model\\ColissimowsLabel');
+ $this->setPackage('ColissimoWs.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('ORDER_REF', 'OrderRef', 'VARCHAR', true, 255, null);
+ $this->addColumn('ERROR', 'Error', 'BOOLEAN', true, 1, false);
+ $this->addColumn('ERROR_MESSAGE', 'ErrorMessage', 'VARCHAR', false, 255, '');
+ $this->addColumn('TRACKING_NUMBER', 'TrackingNumber', 'VARCHAR', false, 64, '');
+ $this->addColumn('LABEL_DATA', 'LabelData', 'CLOB', false, null, null);
+ $this->addColumn('LABEL_TYPE', 'LabelType', 'VARCHAR', false, 4, null);
+ $this->addColumn('WEIGHT', 'Weight', 'FLOAT', true, null, null);
+ $this->addColumn('SIGNED', 'Signed', 'BOOLEAN', false, 1, false);
+ $this->addColumn('WITH_CUSTOMS_INVOICE', 'WithCustomsInvoice', 'BOOLEAN', true, 1, false);
+ $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
+ $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ } // buildRelations()
+
+ /**
+ *
+ * Gets the list of behaviors registered for this table
+ *
+ * @return array Associative array (name => parameters) of behaviors
+ */
+ public function getBehaviors()
+ {
+ return array(
+ 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
+ );
+ } // getBehaviors()
+
+ /**
+ * 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 ? ColissimowsLabelTableMap::CLASS_DEFAULT : ColissimowsLabelTableMap::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 (ColissimowsLabel object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = ColissimowsLabelTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = ColissimowsLabelTableMap::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 + ColissimowsLabelTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ColissimowsLabelTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ ColissimowsLabelTableMap::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 = ColissimowsLabelTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = ColissimowsLabelTableMap::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;
+ ColissimowsLabelTableMap::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(ColissimowsLabelTableMap::ID);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::ORDER_ID);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::ORDER_REF);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::ERROR);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::ERROR_MESSAGE);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::TRACKING_NUMBER);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::LABEL_DATA);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::LABEL_TYPE);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::WEIGHT);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::SIGNED);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::CREATED_AT);
+ $criteria->addSelectColumn(ColissimowsLabelTableMap::UPDATED_AT);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.ORDER_ID');
+ $criteria->addSelectColumn($alias . '.ORDER_REF');
+ $criteria->addSelectColumn($alias . '.ERROR');
+ $criteria->addSelectColumn($alias . '.ERROR_MESSAGE');
+ $criteria->addSelectColumn($alias . '.TRACKING_NUMBER');
+ $criteria->addSelectColumn($alias . '.LABEL_DATA');
+ $criteria->addSelectColumn($alias . '.LABEL_TYPE');
+ $criteria->addSelectColumn($alias . '.WEIGHT');
+ $criteria->addSelectColumn($alias . '.SIGNED');
+ $criteria->addSelectColumn($alias . '.WITH_CUSTOMS_INVOICE');
+ $criteria->addSelectColumn($alias . '.CREATED_AT');
+ $criteria->addSelectColumn($alias . '.UPDATED_AT');
+ }
+ }
+
+ /**
+ * 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(ColissimowsLabelTableMap::DATABASE_NAME)->getTable(ColissimowsLabelTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimowsLabelTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(ColissimowsLabelTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new ColissimowsLabelTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ColissimowsLabel or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ColissimowsLabel 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(ColissimowsLabelTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \ColissimoWs\Model\ColissimowsLabel) { // 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(ColissimowsLabelTableMap::DATABASE_NAME);
+ $criteria->add(ColissimowsLabelTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = ColissimowsLabelQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { ColissimowsLabelTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { ColissimowsLabelTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the colissimows_label 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 ColissimowsLabelQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ColissimowsLabel or Criteria object.
+ *
+ * @param mixed $criteria Criteria or ColissimowsLabel 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(ColissimowsLabelTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from ColissimowsLabel object
+ }
+
+ if ($criteria->containsKey(ColissimowsLabelTableMap::ID) && $criteria->keyContainsValue(ColissimowsLabelTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.ColissimowsLabelTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = ColissimowsLabelQuery::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;
+ }
+
+} // ColissimowsLabelTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+ColissimowsLabelTableMap::buildTableMap();
diff --git a/local/modules/ColissimoWs/Model/Map/ColissimowsPriceSlicesTableMap.php b/local/modules/ColissimoWs/Model/Map/ColissimowsPriceSlicesTableMap.php
new file mode 100644
index 00000000..d31758c2
--- /dev/null
+++ b/local/modules/ColissimoWs/Model/Map/ColissimowsPriceSlicesTableMap.php
@@ -0,0 +1,443 @@
+ array('Id', 'AreaId', 'MaxWeight', 'MaxPrice', 'Shipping', 'FrancoMinPrice', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'maxWeight', 'maxPrice', 'shipping', 'francoMinPrice', ),
+ self::TYPE_COLNAME => array(ColissimowsPriceSlicesTableMap::ID, ColissimowsPriceSlicesTableMap::AREA_ID, ColissimowsPriceSlicesTableMap::MAX_WEIGHT, ColissimowsPriceSlicesTableMap::MAX_PRICE, ColissimowsPriceSlicesTableMap::SHIPPING, ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'MAX_WEIGHT', 'MAX_PRICE', 'SHIPPING', 'FRANCO_MIN_PRICE', ),
+ self::TYPE_FIELDNAME => array('id', 'area_id', 'max_weight', 'max_price', 'shipping', 'franco_min_price', ),
+ 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, 'AreaId' => 1, 'MaxWeight' => 2, 'MaxPrice' => 3, 'Shipping' => 4, 'FrancoMinPrice' => 5, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'maxWeight' => 2, 'maxPrice' => 3, 'shipping' => 4, 'francoMinPrice' => 5, ),
+ self::TYPE_COLNAME => array(ColissimowsPriceSlicesTableMap::ID => 0, ColissimowsPriceSlicesTableMap::AREA_ID => 1, ColissimowsPriceSlicesTableMap::MAX_WEIGHT => 2, ColissimowsPriceSlicesTableMap::MAX_PRICE => 3, ColissimowsPriceSlicesTableMap::SHIPPING => 4, ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE => 5, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'MAX_WEIGHT' => 2, 'MAX_PRICE' => 3, 'SHIPPING' => 4, 'FRANCO_MIN_PRICE' => 5, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'max_weight' => 2, 'max_price' => 3, 'shipping' => 4, 'franco_min_price' => 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('colissimows_price_slices');
+ $this->setPhpName('ColissimowsPriceSlices');
+ $this->setClassName('\\ColissimoWs\\Model\\ColissimowsPriceSlices');
+ $this->setPackage('ColissimoWs.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->addColumn('MAX_WEIGHT', 'MaxWeight', 'FLOAT', false, null, null);
+ $this->addColumn('MAX_PRICE', 'MaxPrice', 'FLOAT', false, null, null);
+ $this->addColumn('SHIPPING', 'Shipping', 'FLOAT', true, null, null);
+ $this->addColumn('FRANCO_MIN_PRICE', 'FrancoMinPrice', 'FLOAT', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_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 ? ColissimowsPriceSlicesTableMap::CLASS_DEFAULT : ColissimowsPriceSlicesTableMap::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 (ColissimowsPriceSlices object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = ColissimowsPriceSlicesTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = ColissimowsPriceSlicesTableMap::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 + ColissimowsPriceSlicesTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ColissimowsPriceSlicesTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ ColissimowsPriceSlicesTableMap::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 = ColissimowsPriceSlicesTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = ColissimowsPriceSlicesTableMap::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;
+ ColissimowsPriceSlicesTableMap::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(ColissimowsPriceSlicesTableMap::ID);
+ $criteria->addSelectColumn(ColissimowsPriceSlicesTableMap::AREA_ID);
+ $criteria->addSelectColumn(ColissimowsPriceSlicesTableMap::MAX_WEIGHT);
+ $criteria->addSelectColumn(ColissimowsPriceSlicesTableMap::MAX_PRICE);
+ $criteria->addSelectColumn(ColissimowsPriceSlicesTableMap::SHIPPING);
+ $criteria->addSelectColumn(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.AREA_ID');
+ $criteria->addSelectColumn($alias . '.MAX_WEIGHT');
+ $criteria->addSelectColumn($alias . '.MAX_PRICE');
+ $criteria->addSelectColumn($alias . '.SHIPPING');
+ $criteria->addSelectColumn($alias . '.FRANCO_MIN_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(ColissimowsPriceSlicesTableMap::DATABASE_NAME)->getTable(ColissimowsPriceSlicesTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(ColissimowsPriceSlicesTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new ColissimowsPriceSlicesTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ColissimowsPriceSlices or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ColissimowsPriceSlices 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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \ColissimoWs\Model\ColissimowsPriceSlices) { // 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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
+ $criteria->add(ColissimowsPriceSlicesTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = ColissimowsPriceSlicesQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { ColissimowsPriceSlicesTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { ColissimowsPriceSlicesTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the colissimows_price_slices 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 ColissimowsPriceSlicesQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ColissimowsPriceSlices or Criteria object.
+ *
+ * @param mixed $criteria Criteria or ColissimowsPriceSlices 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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from ColissimowsPriceSlices object
+ }
+
+ if ($criteria->containsKey(ColissimowsPriceSlicesTableMap::ID) && $criteria->keyContainsValue(ColissimowsPriceSlicesTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.ColissimowsPriceSlicesTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = ColissimowsPriceSlicesQuery::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;
+ }
+
+} // ColissimowsPriceSlicesTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+ColissimowsPriceSlicesTableMap::buildTableMap();
diff --git a/local/modules/ColissimoWs/Readme.md b/local/modules/ColissimoWs/Readme.md
new file mode 100644
index 00000000..34bc95b5
--- /dev/null
+++ b/local/modules/ColissimoWs/Readme.md
@@ -0,0 +1,30 @@
+# Colissimo Ws
+
+Module de livraison Colissimo avec génération des étiquettes d'expédition
+et récupération des numéros de suivi via les Web Services Colissimo.
+
+Bien veiller à régénérer l'auto-loader en production :
+
+`composer dump-autoload -o `
+
+La facture pour les douanes doit se trouver dans le fichier
+
+templates/pdf/votre-site/customs-invoice.html
+
+Si vous utilisez la facture par défaut, pensez-bien à faire les "traductions" de la facture adaptées
+à vos envois.
+
+## Installation
+
+### Manually
+
+* Copy the module into ```| + + | +|||
|---|---|---|---|
| {intl l="Weight up to ... kg" d='colissimows.bo.default'} | +{intl l="Untaxed Price up to ... ($)" d='colissimows.bo.default'} | +{intl l="Shipping Price ($)" d='colissimows.bo.default'} | +{intl l="Actions" d='colissimows.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. You can also enter the tracking number on https://www.laposte.fr/outils/suivre-vos-envois' 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"}
| + | + +
+
|
+
+
|
+
+
+
|
+
| {intl l="Full Description of Goods"} | +{intl l="Quantity"} | +{intl l="Unit value"} | +{intl l="Subtotal value"} | +{intl l="Unit net weight"} | +{intl l="Country"} | +{intl l="Comm. code"} | +
|
+
+ {$itemCount = $itemCount + $QUANTITY}
+
+ {$TITLE}
+ {ifloop rel="combinations"}
+ + {loop type="order_product_attribute_combination" name="combinations" order_product=$ID} + - {$ATTRIBUTE_TITLE} - {$ATTRIBUTE_AVAILABILITY_TITLE} + + {/loop} + {/ifloop} + + {loop type="marquage.orderproduct" name="gravures" order_product_id=$ID} + {loop type="marquage.police" name="police" id=$POLICE} + {$nomPolice = $NOM} + {/loop} + + {intl l='Engraving '}: + + - {intl l='Font '}: {$nomPolice} + + - {intl l='Position '}: {$POSITION} + + - {intl l='Style '}: {$TYPE} + + - {intl l='Your text '}: {$TEXTE} + {/loop} + + |
+ {$QUANTITY} | +{format_money number=$realTaxedPrice symbol=$orderCurrencySymbol} | +{format_money number={$realTaxedPrice * $QUANTITY} symbol=$orderCurrencySymbol} | +{$WEIGHT} | +France | ++ |
| + |
+ Total declared value : {format_money number={$totalValue} symbol=$orderCurrency} +Total units: {$itemCount} + |
+
+ Total Net Weight: {$WEIGHT} kg(s) + {* Mettre une estimation du poids brut *} +Total Gross Weight: {$WEIGHT + 0} kg(s) + |
+
|
+ Type of Export: permanent +Reason for Export: + |
+
+ Currency Code: {$orderCurrency} +Terms of Trade: DAP +City Name of liability: + |
+
|
+ Signature: {intl l=""} +Airwaybill Number: + |
+
+ Company Stamp: {$store_name} +{$store_zipcode} {$store_city} + |
+