Brand instance. If
+ * obj is an instance of Brand, delegates to
+ * equals(Brand). 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 Brand 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 Brand 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 [visible] column value.
+ *
+ * @return int
+ */
+ public function getVisible()
+ {
+
+ return $this->visible;
+ }
+
+ /**
+ * Get the [position] column value.
+ *
+ * @return int
+ */
+ public function getPosition()
+ {
+
+ return $this->position;
+ }
+
+ /**
+ * Get the [logo_image_id] column value.
+ *
+ * @return int
+ */
+ public function getLogoImageId()
+ {
+
+ return $this->logo_image_id;
+ }
+
+ /**
+ * 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 \Thelia\Model\Brand 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[BrandTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [visible] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\Brand The current object (for fluent API support)
+ */
+ public function setVisible($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->visible !== $v) {
+ $this->visible = $v;
+ $this->modifiedColumns[BrandTableMap::VISIBLE] = true;
+ }
+
+
+ return $this;
+ } // setVisible()
+
+ /**
+ * Set the value of [position] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\Brand The current object (for fluent API support)
+ */
+ public function setPosition($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[BrandTableMap::POSITION] = true;
+ }
+
+
+ return $this;
+ } // setPosition()
+
+ /**
+ * Set the value of [logo_image_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\Brand The current object (for fluent API support)
+ */
+ public function setLogoImageId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->logo_image_id !== $v) {
+ $this->logo_image_id = $v;
+ $this->modifiedColumns[BrandTableMap::LOGO_IMAGE_ID] = true;
+ }
+
+ if ($this->aBrandImageRelatedByLogoImageId !== null && $this->aBrandImageRelatedByLogoImageId->getId() !== $v) {
+ $this->aBrandImageRelatedByLogoImageId = null;
+ }
+
+
+ return $this;
+ } // setLogoImageId()
+
+ /**
+ * Sets the value of [created_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\Brand 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[BrandTableMap::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 \Thelia\Model\Brand 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[BrandTableMap::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()
+ {
+ // 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 : BrandTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : BrandTableMap::translateFieldName('Visible', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->visible = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : BrandTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->position = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : BrandTableMap::translateFieldName('LogoImageId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->logo_image_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : BrandTableMap::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 : BrandTableMap::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 = BrandTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \Thelia\Model\Brand 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->aBrandImageRelatedByLogoImageId !== null && $this->logo_image_id !== $this->aBrandImageRelatedByLogoImageId->getId()) {
+ $this->aBrandImageRelatedByLogoImageId = 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(BrandTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildBrandQuery::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->aBrandImageRelatedByLogoImageId = null;
+ $this->collProducts = null;
+
+ $this->collBrandDocuments = null;
+
+ $this->collBrandImagesRelatedByBrandId = null;
+
+ $this->collBrandI18ns = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see Brand::setDeleted()
+ * @see Brand::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(BrandTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildBrandQuery::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(BrandTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ // timestampable behavior
+ if (!$this->isColumnModified(BrandTableMap::CREATED_AT)) {
+ $this->setCreatedAt(time());
+ }
+ if (!$this->isColumnModified(BrandTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ // timestampable behavior
+ if ($this->isModified() && !$this->isColumnModified(BrandTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ BrandTableMap::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->aBrandImageRelatedByLogoImageId !== null) {
+ if ($this->aBrandImageRelatedByLogoImageId->isModified() || $this->aBrandImageRelatedByLogoImageId->isNew()) {
+ $affectedRows += $this->aBrandImageRelatedByLogoImageId->save($con);
+ }
+ $this->setBrandImageRelatedByLogoImageId($this->aBrandImageRelatedByLogoImageId);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->productsScheduledForDeletion !== null) {
+ if (!$this->productsScheduledForDeletion->isEmpty()) {
+ foreach ($this->productsScheduledForDeletion as $product) {
+ // need to save related object because we set the relation to null
+ $product->save($con);
+ }
+ $this->productsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collProducts !== null) {
+ foreach ($this->collProducts as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->brandDocumentsScheduledForDeletion !== null) {
+ if (!$this->brandDocumentsScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\BrandDocumentQuery::create()
+ ->filterByPrimaryKeys($this->brandDocumentsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->brandDocumentsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collBrandDocuments !== null) {
+ foreach ($this->collBrandDocuments as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->brandImagesRelatedByBrandIdScheduledForDeletion !== null) {
+ if (!$this->brandImagesRelatedByBrandIdScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\BrandImageQuery::create()
+ ->filterByPrimaryKeys($this->brandImagesRelatedByBrandIdScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->brandImagesRelatedByBrandIdScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collBrandImagesRelatedByBrandId !== null) {
+ foreach ($this->collBrandImagesRelatedByBrandId as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->brandI18nsScheduledForDeletion !== null) {
+ if (!$this->brandI18nsScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\BrandI18nQuery::create()
+ ->filterByPrimaryKeys($this->brandI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->brandI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collBrandI18ns !== null) {
+ foreach ($this->collBrandI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[BrandTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . BrandTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(BrandTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(BrandTableMap::VISIBLE)) {
+ $modifiedColumns[':p' . $index++] = '`VISIBLE`';
+ }
+ if ($this->isColumnModified(BrandTableMap::POSITION)) {
+ $modifiedColumns[':p' . $index++] = '`POSITION`';
+ }
+ if ($this->isColumnModified(BrandTableMap::LOGO_IMAGE_ID)) {
+ $modifiedColumns[':p' . $index++] = '`LOGO_IMAGE_ID`';
+ }
+ if ($this->isColumnModified(BrandTableMap::CREATED_AT)) {
+ $modifiedColumns[':p' . $index++] = '`CREATED_AT`';
+ }
+ if ($this->isColumnModified(BrandTableMap::UPDATED_AT)) {
+ $modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `brand` (%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 '`VISIBLE`':
+ $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT);
+ break;
+ case '`POSITION`':
+ $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
+ break;
+ case '`LOGO_IMAGE_ID`':
+ $stmt->bindValue($identifier, $this->logo_image_id, PDO::PARAM_INT);
+ break;
+ case '`CREATED_AT`':
+ $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ 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 = BrandTableMap::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->getVisible();
+ break;
+ case 2:
+ return $this->getPosition();
+ break;
+ case 3:
+ return $this->getLogoImageId();
+ 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['Brand'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['Brand'][$this->getPrimaryKey()] = true;
+ $keys = BrandTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getVisible(),
+ $keys[2] => $this->getPosition(),
+ $keys[3] => $this->getLogoImageId(),
+ $keys[4] => $this->getCreatedAt(),
+ $keys[5] => $this->getUpdatedAt(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aBrandImageRelatedByLogoImageId) {
+ $result['BrandImageRelatedByLogoImageId'] = $this->aBrandImageRelatedByLogoImageId->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->collProducts) {
+ $result['Products'] = $this->collProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collBrandDocuments) {
+ $result['BrandDocuments'] = $this->collBrandDocuments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collBrandImagesRelatedByBrandId) {
+ $result['BrandImagesRelatedByBrandId'] = $this->collBrandImagesRelatedByBrandId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collBrandI18ns) {
+ $result['BrandI18ns'] = $this->collBrandI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = BrandTableMap::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->setVisible($value);
+ break;
+ case 2:
+ $this->setPosition($value);
+ break;
+ case 3:
+ $this->setLogoImageId($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 = BrandTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setVisible($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setPosition($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setLogoImageId($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(BrandTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(BrandTableMap::ID)) $criteria->add(BrandTableMap::ID, $this->id);
+ if ($this->isColumnModified(BrandTableMap::VISIBLE)) $criteria->add(BrandTableMap::VISIBLE, $this->visible);
+ if ($this->isColumnModified(BrandTableMap::POSITION)) $criteria->add(BrandTableMap::POSITION, $this->position);
+ if ($this->isColumnModified(BrandTableMap::LOGO_IMAGE_ID)) $criteria->add(BrandTableMap::LOGO_IMAGE_ID, $this->logo_image_id);
+ if ($this->isColumnModified(BrandTableMap::CREATED_AT)) $criteria->add(BrandTableMap::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(BrandTableMap::UPDATED_AT)) $criteria->add(BrandTableMap::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(BrandTableMap::DATABASE_NAME);
+ $criteria->add(BrandTableMap::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 \Thelia\Model\Brand (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->setVisible($this->getVisible());
+ $copyObj->setPosition($this->getPosition());
+ $copyObj->setLogoImageId($this->getLogoImageId());
+ $copyObj->setCreatedAt($this->getCreatedAt());
+ $copyObj->setUpdatedAt($this->getUpdatedAt());
+
+ if ($deepCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+
+ foreach ($this->getProducts() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addProduct($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getBrandDocuments() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addBrandDocument($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getBrandImagesRelatedByBrandId() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addBrandImageRelatedByBrandId($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getBrandI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addBrandI18n($relObj->copy($deepCopy));
+ }
+ }
+
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \Thelia\Model\Brand 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 ChildBrandImage object.
+ *
+ * @param ChildBrandImage $v
+ * @return \Thelia\Model\Brand The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setBrandImageRelatedByLogoImageId(ChildBrandImage $v = null)
+ {
+ if ($v === null) {
+ $this->setLogoImageId(NULL);
+ } else {
+ $this->setLogoImageId($v->getId());
+ }
+
+ $this->aBrandImageRelatedByLogoImageId = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildBrandImage object, it will not be re-added.
+ if ($v !== null) {
+ $v->addBrandRelatedByLogoImageId($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildBrandImage object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildBrandImage The associated ChildBrandImage object.
+ * @throws PropelException
+ */
+ public function getBrandImageRelatedByLogoImageId(ConnectionInterface $con = null)
+ {
+ if ($this->aBrandImageRelatedByLogoImageId === null && ($this->logo_image_id !== null)) {
+ $this->aBrandImageRelatedByLogoImageId = ChildBrandImageQuery::create()->findPk($this->logo_image_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->aBrandImageRelatedByLogoImageId->addBrandsRelatedByLogoImageId($this);
+ */
+ }
+
+ return $this->aBrandImageRelatedByLogoImageId;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('Product' == $relationName) {
+ return $this->initProducts();
+ }
+ if ('BrandDocument' == $relationName) {
+ return $this->initBrandDocuments();
+ }
+ if ('BrandImageRelatedByBrandId' == $relationName) {
+ return $this->initBrandImagesRelatedByBrandId();
+ }
+ if ('BrandI18n' == $relationName) {
+ return $this->initBrandI18ns();
+ }
+ }
+
+ /**
+ * Clears out the collProducts collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addProducts()
+ */
+ public function clearProducts()
+ {
+ $this->collProducts = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collProducts collection loaded partially.
+ */
+ public function resetPartialProducts($v = true)
+ {
+ $this->collProductsPartial = $v;
+ }
+
+ /**
+ * Initializes the collProducts collection.
+ *
+ * By default this just sets the collProducts collection to an empty array (like clearcollProducts());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initProducts($overrideExisting = true)
+ {
+ if (null !== $this->collProducts && !$overrideExisting) {
+ return;
+ }
+ $this->collProducts = new ObjectCollection();
+ $this->collProducts->setModel('\Thelia\Model\Product');
+ }
+
+ /**
+ * Gets an array of ChildProduct objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this ChildBrand is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @return Collection|ChildProduct[] List of ChildProduct objects
+ * @throws PropelException
+ */
+ public function getProducts($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collProductsPartial && !$this->isNew();
+ if (null === $this->collProducts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collProducts) {
+ // return empty collection
+ $this->initProducts();
+ } else {
+ $collProducts = ChildProductQuery::create(null, $criteria)
+ ->filterByBrand($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collProductsPartial && count($collProducts)) {
+ $this->initProducts(false);
+
+ foreach ($collProducts as $obj) {
+ if (false == $this->collProducts->contains($obj)) {
+ $this->collProducts->append($obj);
+ }
+ }
+
+ $this->collProductsPartial = true;
+ }
+
+ reset($collProducts);
+
+ return $collProducts;
+ }
+
+ if ($partial && $this->collProducts) {
+ foreach ($this->collProducts as $obj) {
+ if ($obj->isNew()) {
+ $collProducts[] = $obj;
+ }
+ }
+ }
+
+ $this->collProducts = $collProducts;
+ $this->collProductsPartial = false;
+ }
+ }
+
+ return $this->collProducts;
+ }
+
+ /**
+ * Sets a collection of Product objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param Collection $products A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function setProducts(Collection $products, ConnectionInterface $con = null)
+ {
+ $productsToDelete = $this->getProducts(new Criteria(), $con)->diff($products);
+
+
+ $this->productsScheduledForDeletion = $productsToDelete;
+
+ foreach ($productsToDelete as $productRemoved) {
+ $productRemoved->setBrand(null);
+ }
+
+ $this->collProducts = null;
+ foreach ($products as $product) {
+ $this->addProduct($product);
+ }
+
+ $this->collProducts = $products;
+ $this->collProductsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related Product objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related Product objects.
+ * @throws PropelException
+ */
+ public function countProducts(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collProductsPartial && !$this->isNew();
+ if (null === $this->collProducts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collProducts) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getProducts());
+ }
+
+ $query = ChildProductQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByBrand($this)
+ ->count($con);
+ }
+
+ return count($this->collProducts);
+ }
+
+ /**
+ * Method called to associate a ChildProduct object to this object
+ * through the ChildProduct foreign key attribute.
+ *
+ * @param ChildProduct $l ChildProduct
+ * @return \Thelia\Model\Brand The current object (for fluent API support)
+ */
+ public function addProduct(ChildProduct $l)
+ {
+ if ($this->collProducts === null) {
+ $this->initProducts();
+ $this->collProductsPartial = true;
+ }
+
+ if (!in_array($l, $this->collProducts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddProduct($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param Product $product The product object to add.
+ */
+ protected function doAddProduct($product)
+ {
+ $this->collProducts[]= $product;
+ $product->setBrand($this);
+ }
+
+ /**
+ * @param Product $product The product object to remove.
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function removeProduct($product)
+ {
+ if ($this->getProducts()->contains($product)) {
+ $this->collProducts->remove($this->collProducts->search($product));
+ if (null === $this->productsScheduledForDeletion) {
+ $this->productsScheduledForDeletion = clone $this->collProducts;
+ $this->productsScheduledForDeletion->clear();
+ }
+ $this->productsScheduledForDeletion[]= $product;
+ $product->setBrand(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this Brand is new, it will return
+ * an empty collection; or if this Brand has previously
+ * been saved, it will retrieve related Products from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in Brand.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildProduct[] List of ChildProduct objects
+ */
+ public function getProductsJoinTaxRule($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildProductQuery::create(null, $criteria);
+ $query->joinWith('TaxRule', $joinBehavior);
+
+ return $this->getProducts($query, $con);
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this Brand is new, it will return
+ * an empty collection; or if this Brand has previously
+ * been saved, it will retrieve related Products from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in Brand.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildProduct[] List of ChildProduct objects
+ */
+ public function getProductsJoinTemplate($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildProductQuery::create(null, $criteria);
+ $query->joinWith('Template', $joinBehavior);
+
+ return $this->getProducts($query, $con);
+ }
+
+ /**
+ * Clears out the collBrandDocuments collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addBrandDocuments()
+ */
+ public function clearBrandDocuments()
+ {
+ $this->collBrandDocuments = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collBrandDocuments collection loaded partially.
+ */
+ public function resetPartialBrandDocuments($v = true)
+ {
+ $this->collBrandDocumentsPartial = $v;
+ }
+
+ /**
+ * Initializes the collBrandDocuments collection.
+ *
+ * By default this just sets the collBrandDocuments collection to an empty array (like clearcollBrandDocuments());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initBrandDocuments($overrideExisting = true)
+ {
+ if (null !== $this->collBrandDocuments && !$overrideExisting) {
+ return;
+ }
+ $this->collBrandDocuments = new ObjectCollection();
+ $this->collBrandDocuments->setModel('\Thelia\Model\BrandDocument');
+ }
+
+ /**
+ * Gets an array of ChildBrandDocument objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this ChildBrand is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @return Collection|ChildBrandDocument[] List of ChildBrandDocument objects
+ * @throws PropelException
+ */
+ public function getBrandDocuments($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandDocumentsPartial && !$this->isNew();
+ if (null === $this->collBrandDocuments || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandDocuments) {
+ // return empty collection
+ $this->initBrandDocuments();
+ } else {
+ $collBrandDocuments = ChildBrandDocumentQuery::create(null, $criteria)
+ ->filterByBrand($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collBrandDocumentsPartial && count($collBrandDocuments)) {
+ $this->initBrandDocuments(false);
+
+ foreach ($collBrandDocuments as $obj) {
+ if (false == $this->collBrandDocuments->contains($obj)) {
+ $this->collBrandDocuments->append($obj);
+ }
+ }
+
+ $this->collBrandDocumentsPartial = true;
+ }
+
+ reset($collBrandDocuments);
+
+ return $collBrandDocuments;
+ }
+
+ if ($partial && $this->collBrandDocuments) {
+ foreach ($this->collBrandDocuments as $obj) {
+ if ($obj->isNew()) {
+ $collBrandDocuments[] = $obj;
+ }
+ }
+ }
+
+ $this->collBrandDocuments = $collBrandDocuments;
+ $this->collBrandDocumentsPartial = false;
+ }
+ }
+
+ return $this->collBrandDocuments;
+ }
+
+ /**
+ * Sets a collection of BrandDocument objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param Collection $brandDocuments A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function setBrandDocuments(Collection $brandDocuments, ConnectionInterface $con = null)
+ {
+ $brandDocumentsToDelete = $this->getBrandDocuments(new Criteria(), $con)->diff($brandDocuments);
+
+
+ $this->brandDocumentsScheduledForDeletion = $brandDocumentsToDelete;
+
+ foreach ($brandDocumentsToDelete as $brandDocumentRemoved) {
+ $brandDocumentRemoved->setBrand(null);
+ }
+
+ $this->collBrandDocuments = null;
+ foreach ($brandDocuments as $brandDocument) {
+ $this->addBrandDocument($brandDocument);
+ }
+
+ $this->collBrandDocuments = $brandDocuments;
+ $this->collBrandDocumentsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related BrandDocument objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related BrandDocument objects.
+ * @throws PropelException
+ */
+ public function countBrandDocuments(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandDocumentsPartial && !$this->isNew();
+ if (null === $this->collBrandDocuments || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandDocuments) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getBrandDocuments());
+ }
+
+ $query = ChildBrandDocumentQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByBrand($this)
+ ->count($con);
+ }
+
+ return count($this->collBrandDocuments);
+ }
+
+ /**
+ * Method called to associate a ChildBrandDocument object to this object
+ * through the ChildBrandDocument foreign key attribute.
+ *
+ * @param ChildBrandDocument $l ChildBrandDocument
+ * @return \Thelia\Model\Brand The current object (for fluent API support)
+ */
+ public function addBrandDocument(ChildBrandDocument $l)
+ {
+ if ($this->collBrandDocuments === null) {
+ $this->initBrandDocuments();
+ $this->collBrandDocumentsPartial = true;
+ }
+
+ if (!in_array($l, $this->collBrandDocuments->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddBrandDocument($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param BrandDocument $brandDocument The brandDocument object to add.
+ */
+ protected function doAddBrandDocument($brandDocument)
+ {
+ $this->collBrandDocuments[]= $brandDocument;
+ $brandDocument->setBrand($this);
+ }
+
+ /**
+ * @param BrandDocument $brandDocument The brandDocument object to remove.
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function removeBrandDocument($brandDocument)
+ {
+ if ($this->getBrandDocuments()->contains($brandDocument)) {
+ $this->collBrandDocuments->remove($this->collBrandDocuments->search($brandDocument));
+ if (null === $this->brandDocumentsScheduledForDeletion) {
+ $this->brandDocumentsScheduledForDeletion = clone $this->collBrandDocuments;
+ $this->brandDocumentsScheduledForDeletion->clear();
+ }
+ $this->brandDocumentsScheduledForDeletion[]= clone $brandDocument;
+ $brandDocument->setBrand(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears out the collBrandImagesRelatedByBrandId collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addBrandImagesRelatedByBrandId()
+ */
+ public function clearBrandImagesRelatedByBrandId()
+ {
+ $this->collBrandImagesRelatedByBrandId = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collBrandImagesRelatedByBrandId collection loaded partially.
+ */
+ public function resetPartialBrandImagesRelatedByBrandId($v = true)
+ {
+ $this->collBrandImagesRelatedByBrandIdPartial = $v;
+ }
+
+ /**
+ * Initializes the collBrandImagesRelatedByBrandId collection.
+ *
+ * By default this just sets the collBrandImagesRelatedByBrandId collection to an empty array (like clearcollBrandImagesRelatedByBrandId());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initBrandImagesRelatedByBrandId($overrideExisting = true)
+ {
+ if (null !== $this->collBrandImagesRelatedByBrandId && !$overrideExisting) {
+ return;
+ }
+ $this->collBrandImagesRelatedByBrandId = new ObjectCollection();
+ $this->collBrandImagesRelatedByBrandId->setModel('\Thelia\Model\BrandImage');
+ }
+
+ /**
+ * Gets an array of ChildBrandImage objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this ChildBrand is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @return Collection|ChildBrandImage[] List of ChildBrandImage objects
+ * @throws PropelException
+ */
+ public function getBrandImagesRelatedByBrandId($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandImagesRelatedByBrandIdPartial && !$this->isNew();
+ if (null === $this->collBrandImagesRelatedByBrandId || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandImagesRelatedByBrandId) {
+ // return empty collection
+ $this->initBrandImagesRelatedByBrandId();
+ } else {
+ $collBrandImagesRelatedByBrandId = ChildBrandImageQuery::create(null, $criteria)
+ ->filterByBrandRelatedByBrandId($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collBrandImagesRelatedByBrandIdPartial && count($collBrandImagesRelatedByBrandId)) {
+ $this->initBrandImagesRelatedByBrandId(false);
+
+ foreach ($collBrandImagesRelatedByBrandId as $obj) {
+ if (false == $this->collBrandImagesRelatedByBrandId->contains($obj)) {
+ $this->collBrandImagesRelatedByBrandId->append($obj);
+ }
+ }
+
+ $this->collBrandImagesRelatedByBrandIdPartial = true;
+ }
+
+ reset($collBrandImagesRelatedByBrandId);
+
+ return $collBrandImagesRelatedByBrandId;
+ }
+
+ if ($partial && $this->collBrandImagesRelatedByBrandId) {
+ foreach ($this->collBrandImagesRelatedByBrandId as $obj) {
+ if ($obj->isNew()) {
+ $collBrandImagesRelatedByBrandId[] = $obj;
+ }
+ }
+ }
+
+ $this->collBrandImagesRelatedByBrandId = $collBrandImagesRelatedByBrandId;
+ $this->collBrandImagesRelatedByBrandIdPartial = false;
+ }
+ }
+
+ return $this->collBrandImagesRelatedByBrandId;
+ }
+
+ /**
+ * Sets a collection of BrandImageRelatedByBrandId objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param Collection $brandImagesRelatedByBrandId A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function setBrandImagesRelatedByBrandId(Collection $brandImagesRelatedByBrandId, ConnectionInterface $con = null)
+ {
+ $brandImagesRelatedByBrandIdToDelete = $this->getBrandImagesRelatedByBrandId(new Criteria(), $con)->diff($brandImagesRelatedByBrandId);
+
+
+ $this->brandImagesRelatedByBrandIdScheduledForDeletion = $brandImagesRelatedByBrandIdToDelete;
+
+ foreach ($brandImagesRelatedByBrandIdToDelete as $brandImageRelatedByBrandIdRemoved) {
+ $brandImageRelatedByBrandIdRemoved->setBrandRelatedByBrandId(null);
+ }
+
+ $this->collBrandImagesRelatedByBrandId = null;
+ foreach ($brandImagesRelatedByBrandId as $brandImageRelatedByBrandId) {
+ $this->addBrandImageRelatedByBrandId($brandImageRelatedByBrandId);
+ }
+
+ $this->collBrandImagesRelatedByBrandId = $brandImagesRelatedByBrandId;
+ $this->collBrandImagesRelatedByBrandIdPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related BrandImage objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related BrandImage objects.
+ * @throws PropelException
+ */
+ public function countBrandImagesRelatedByBrandId(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandImagesRelatedByBrandIdPartial && !$this->isNew();
+ if (null === $this->collBrandImagesRelatedByBrandId || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandImagesRelatedByBrandId) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getBrandImagesRelatedByBrandId());
+ }
+
+ $query = ChildBrandImageQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByBrandRelatedByBrandId($this)
+ ->count($con);
+ }
+
+ return count($this->collBrandImagesRelatedByBrandId);
+ }
+
+ /**
+ * Method called to associate a ChildBrandImage object to this object
+ * through the ChildBrandImage foreign key attribute.
+ *
+ * @param ChildBrandImage $l ChildBrandImage
+ * @return \Thelia\Model\Brand The current object (for fluent API support)
+ */
+ public function addBrandImageRelatedByBrandId(ChildBrandImage $l)
+ {
+ if ($this->collBrandImagesRelatedByBrandId === null) {
+ $this->initBrandImagesRelatedByBrandId();
+ $this->collBrandImagesRelatedByBrandIdPartial = true;
+ }
+
+ if (!in_array($l, $this->collBrandImagesRelatedByBrandId->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddBrandImageRelatedByBrandId($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param BrandImageRelatedByBrandId $brandImageRelatedByBrandId The brandImageRelatedByBrandId object to add.
+ */
+ protected function doAddBrandImageRelatedByBrandId($brandImageRelatedByBrandId)
+ {
+ $this->collBrandImagesRelatedByBrandId[]= $brandImageRelatedByBrandId;
+ $brandImageRelatedByBrandId->setBrandRelatedByBrandId($this);
+ }
+
+ /**
+ * @param BrandImageRelatedByBrandId $brandImageRelatedByBrandId The brandImageRelatedByBrandId object to remove.
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function removeBrandImageRelatedByBrandId($brandImageRelatedByBrandId)
+ {
+ if ($this->getBrandImagesRelatedByBrandId()->contains($brandImageRelatedByBrandId)) {
+ $this->collBrandImagesRelatedByBrandId->remove($this->collBrandImagesRelatedByBrandId->search($brandImageRelatedByBrandId));
+ if (null === $this->brandImagesRelatedByBrandIdScheduledForDeletion) {
+ $this->brandImagesRelatedByBrandIdScheduledForDeletion = clone $this->collBrandImagesRelatedByBrandId;
+ $this->brandImagesRelatedByBrandIdScheduledForDeletion->clear();
+ }
+ $this->brandImagesRelatedByBrandIdScheduledForDeletion[]= clone $brandImageRelatedByBrandId;
+ $brandImageRelatedByBrandId->setBrandRelatedByBrandId(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears out the collBrandI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addBrandI18ns()
+ */
+ public function clearBrandI18ns()
+ {
+ $this->collBrandI18ns = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collBrandI18ns collection loaded partially.
+ */
+ public function resetPartialBrandI18ns($v = true)
+ {
+ $this->collBrandI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collBrandI18ns collection.
+ *
+ * By default this just sets the collBrandI18ns collection to an empty array (like clearcollBrandI18ns());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initBrandI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collBrandI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collBrandI18ns = new ObjectCollection();
+ $this->collBrandI18ns->setModel('\Thelia\Model\BrandI18n');
+ }
+
+ /**
+ * Gets an array of ChildBrandI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this ChildBrand is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @return Collection|ChildBrandI18n[] List of ChildBrandI18n objects
+ * @throws PropelException
+ */
+ public function getBrandI18ns($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandI18nsPartial && !$this->isNew();
+ if (null === $this->collBrandI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandI18ns) {
+ // return empty collection
+ $this->initBrandI18ns();
+ } else {
+ $collBrandI18ns = ChildBrandI18nQuery::create(null, $criteria)
+ ->filterByBrand($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collBrandI18nsPartial && count($collBrandI18ns)) {
+ $this->initBrandI18ns(false);
+
+ foreach ($collBrandI18ns as $obj) {
+ if (false == $this->collBrandI18ns->contains($obj)) {
+ $this->collBrandI18ns->append($obj);
+ }
+ }
+
+ $this->collBrandI18nsPartial = true;
+ }
+
+ reset($collBrandI18ns);
+
+ return $collBrandI18ns;
+ }
+
+ if ($partial && $this->collBrandI18ns) {
+ foreach ($this->collBrandI18ns as $obj) {
+ if ($obj->isNew()) {
+ $collBrandI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collBrandI18ns = $collBrandI18ns;
+ $this->collBrandI18nsPartial = false;
+ }
+ }
+
+ return $this->collBrandI18ns;
+ }
+
+ /**
+ * Sets a collection of BrandI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param Collection $brandI18ns A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function setBrandI18ns(Collection $brandI18ns, ConnectionInterface $con = null)
+ {
+ $brandI18nsToDelete = $this->getBrandI18ns(new Criteria(), $con)->diff($brandI18ns);
+
+
+ //since at least one column in the foreign key is at the same time a PK
+ //we can not just set a PK to NULL in the lines below. We have to store
+ //a backup of all values, so we are able to manipulate these items based on the onDelete value later.
+ $this->brandI18nsScheduledForDeletion = clone $brandI18nsToDelete;
+
+ foreach ($brandI18nsToDelete as $brandI18nRemoved) {
+ $brandI18nRemoved->setBrand(null);
+ }
+
+ $this->collBrandI18ns = null;
+ foreach ($brandI18ns as $brandI18n) {
+ $this->addBrandI18n($brandI18n);
+ }
+
+ $this->collBrandI18ns = $brandI18ns;
+ $this->collBrandI18nsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related BrandI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related BrandI18n objects.
+ * @throws PropelException
+ */
+ public function countBrandI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandI18nsPartial && !$this->isNew();
+ if (null === $this->collBrandI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandI18ns) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getBrandI18ns());
+ }
+
+ $query = ChildBrandI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByBrand($this)
+ ->count($con);
+ }
+
+ return count($this->collBrandI18ns);
+ }
+
+ /**
+ * Method called to associate a ChildBrandI18n object to this object
+ * through the ChildBrandI18n foreign key attribute.
+ *
+ * @param ChildBrandI18n $l ChildBrandI18n
+ * @return \Thelia\Model\Brand The current object (for fluent API support)
+ */
+ public function addBrandI18n(ChildBrandI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collBrandI18ns === null) {
+ $this->initBrandI18ns();
+ $this->collBrandI18nsPartial = true;
+ }
+
+ if (!in_array($l, $this->collBrandI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddBrandI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param BrandI18n $brandI18n The brandI18n object to add.
+ */
+ protected function doAddBrandI18n($brandI18n)
+ {
+ $this->collBrandI18ns[]= $brandI18n;
+ $brandI18n->setBrand($this);
+ }
+
+ /**
+ * @param BrandI18n $brandI18n The brandI18n object to remove.
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function removeBrandI18n($brandI18n)
+ {
+ if ($this->getBrandI18ns()->contains($brandI18n)) {
+ $this->collBrandI18ns->remove($this->collBrandI18ns->search($brandI18n));
+ if (null === $this->brandI18nsScheduledForDeletion) {
+ $this->brandI18nsScheduledForDeletion = clone $this->collBrandI18ns;
+ $this->brandI18nsScheduledForDeletion->clear();
+ }
+ $this->brandI18nsScheduledForDeletion[]= clone $brandI18n;
+ $brandI18n->setBrand(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->visible = null;
+ $this->position = null;
+ $this->logo_image_id = null;
+ $this->created_at = null;
+ $this->updated_at = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ if ($this->collProducts) {
+ foreach ($this->collProducts as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collBrandDocuments) {
+ foreach ($this->collBrandDocuments as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collBrandImagesRelatedByBrandId) {
+ foreach ($this->collBrandImagesRelatedByBrandId as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collBrandI18ns) {
+ foreach ($this->collBrandI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ } // if ($deep)
+
+ // i18n behavior
+ $this->currentLocale = 'en_US';
+ $this->currentTranslations = null;
+
+ $this->collProducts = null;
+ $this->collBrandDocuments = null;
+ $this->collBrandImagesRelatedByBrandId = null;
+ $this->collBrandI18ns = null;
+ $this->aBrandImageRelatedByLogoImageId = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(BrandTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ // timestampable behavior
+
+ /**
+ * Mark the current object so that the update date doesn't get updated during next save
+ *
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function keepUpdateDateUnchanged()
+ {
+ $this->modifiedColumns[BrandTableMap::UPDATED_AT] = true;
+
+ return $this;
+ }
+
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_US')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandI18n */
+ public function getTranslation($locale = 'en_US', ConnectionInterface $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collBrandI18ns) {
+ foreach ($this->collBrandI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new ChildBrandI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = ChildBrandI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addBrandI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrand The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null)
+ {
+ if (!$this->isNew()) {
+ ChildBrandI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collBrandI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collBrandI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandI18n */
+ public function getCurrentTranslation(ConnectionInterface $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [meta_title] column value.
+ *
+ * @return string
+ */
+ public function getMetaTitle()
+ {
+ return $this->getCurrentTranslation()->getMetaTitle();
+ }
+
+
+ /**
+ * Set the value of [meta_title] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setMetaTitle($v)
+ { $this->getCurrentTranslation()->setMetaTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [meta_description] column value.
+ *
+ * @return string
+ */
+ public function getMetaDescription()
+ {
+ return $this->getCurrentTranslation()->getMetaDescription();
+ }
+
+
+ /**
+ * Set the value of [meta_description] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setMetaDescription($v)
+ { $this->getCurrentTranslation()->setMetaDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [meta_keywords] column value.
+ *
+ * @return string
+ */
+ public function getMetaKeywords()
+ {
+ return $this->getCurrentTranslation()->getMetaKeywords();
+ }
+
+
+ /**
+ * Set the value of [meta_keywords] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setMetaKeywords($v)
+ { $this->getCurrentTranslation()->setMetaKeywords($v);
+
+ 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/core/lib/Thelia/Model/Base/BrandDocument.php b/core/lib/Thelia/Model/Base/BrandDocument.php
new file mode 100644
index 000000000..3e68952ac
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandDocument.php
@@ -0,0 +1,1990 @@
+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 BrandDocument instance. If
+ * obj is an instance of BrandDocument, delegates to
+ * equals(BrandDocument). 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 BrandDocument 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 BrandDocument 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 [brand_id] column value.
+ *
+ * @return int
+ */
+ public function getBrandId()
+ {
+
+ return $this->brand_id;
+ }
+
+ /**
+ * Get the [file] column value.
+ *
+ * @return string
+ */
+ public function getFile()
+ {
+
+ return $this->file;
+ }
+
+ /**
+ * Get the [position] column value.
+ *
+ * @return int
+ */
+ public function getPosition()
+ {
+
+ return $this->position;
+ }
+
+ /**
+ * 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 \Thelia\Model\BrandDocument 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[BrandDocumentTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [brand_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\BrandDocument The current object (for fluent API support)
+ */
+ public function setBrandId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->brand_id !== $v) {
+ $this->brand_id = $v;
+ $this->modifiedColumns[BrandDocumentTableMap::BRAND_ID] = true;
+ }
+
+ if ($this->aBrand !== null && $this->aBrand->getId() !== $v) {
+ $this->aBrand = null;
+ }
+
+
+ return $this;
+ } // setBrandId()
+
+ /**
+ * Set the value of [file] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandDocument The current object (for fluent API support)
+ */
+ public function setFile($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->file !== $v) {
+ $this->file = $v;
+ $this->modifiedColumns[BrandDocumentTableMap::FILE] = true;
+ }
+
+
+ return $this;
+ } // setFile()
+
+ /**
+ * Set the value of [position] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\BrandDocument The current object (for fluent API support)
+ */
+ public function setPosition($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[BrandDocumentTableMap::POSITION] = true;
+ }
+
+
+ return $this;
+ } // setPosition()
+
+ /**
+ * Sets the value of [created_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\BrandDocument 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[BrandDocumentTableMap::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 \Thelia\Model\BrandDocument 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[BrandDocumentTableMap::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()
+ {
+ // 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 : BrandDocumentTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : BrandDocumentTableMap::translateFieldName('BrandId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->brand_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : BrandDocumentTableMap::translateFieldName('File', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->file = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : BrandDocumentTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->position = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : BrandDocumentTableMap::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 : BrandDocumentTableMap::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 = BrandDocumentTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \Thelia\Model\BrandDocument 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->aBrand !== null && $this->brand_id !== $this->aBrand->getId()) {
+ $this->aBrand = 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(BrandDocumentTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildBrandDocumentQuery::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->aBrand = null;
+ $this->collBrandDocumentI18ns = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see BrandDocument::setDeleted()
+ * @see BrandDocument::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(BrandDocumentTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildBrandDocumentQuery::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(BrandDocumentTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ // timestampable behavior
+ if (!$this->isColumnModified(BrandDocumentTableMap::CREATED_AT)) {
+ $this->setCreatedAt(time());
+ }
+ if (!$this->isColumnModified(BrandDocumentTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ // timestampable behavior
+ if ($this->isModified() && !$this->isColumnModified(BrandDocumentTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ BrandDocumentTableMap::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->aBrand !== null) {
+ if ($this->aBrand->isModified() || $this->aBrand->isNew()) {
+ $affectedRows += $this->aBrand->save($con);
+ }
+ $this->setBrand($this->aBrand);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->brandDocumentI18nsScheduledForDeletion !== null) {
+ if (!$this->brandDocumentI18nsScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\BrandDocumentI18nQuery::create()
+ ->filterByPrimaryKeys($this->brandDocumentI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->brandDocumentI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collBrandDocumentI18ns !== null) {
+ foreach ($this->collBrandDocumentI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[BrandDocumentTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . BrandDocumentTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(BrandDocumentTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(BrandDocumentTableMap::BRAND_ID)) {
+ $modifiedColumns[':p' . $index++] = '`BRAND_ID`';
+ }
+ if ($this->isColumnModified(BrandDocumentTableMap::FILE)) {
+ $modifiedColumns[':p' . $index++] = '`FILE`';
+ }
+ if ($this->isColumnModified(BrandDocumentTableMap::POSITION)) {
+ $modifiedColumns[':p' . $index++] = '`POSITION`';
+ }
+ if ($this->isColumnModified(BrandDocumentTableMap::CREATED_AT)) {
+ $modifiedColumns[':p' . $index++] = '`CREATED_AT`';
+ }
+ if ($this->isColumnModified(BrandDocumentTableMap::UPDATED_AT)) {
+ $modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `brand_document` (%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 '`BRAND_ID`':
+ $stmt->bindValue($identifier, $this->brand_id, PDO::PARAM_INT);
+ break;
+ case '`FILE`':
+ $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR);
+ break;
+ case '`POSITION`':
+ $stmt->bindValue($identifier, $this->position, 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 = BrandDocumentTableMap::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->getBrandId();
+ break;
+ case 2:
+ return $this->getFile();
+ break;
+ case 3:
+ return $this->getPosition();
+ 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['BrandDocument'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['BrandDocument'][$this->getPrimaryKey()] = true;
+ $keys = BrandDocumentTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getBrandId(),
+ $keys[2] => $this->getFile(),
+ $keys[3] => $this->getPosition(),
+ $keys[4] => $this->getCreatedAt(),
+ $keys[5] => $this->getUpdatedAt(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aBrand) {
+ $result['Brand'] = $this->aBrand->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->collBrandDocumentI18ns) {
+ $result['BrandDocumentI18ns'] = $this->collBrandDocumentI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = BrandDocumentTableMap::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->setBrandId($value);
+ break;
+ case 2:
+ $this->setFile($value);
+ break;
+ case 3:
+ $this->setPosition($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 = BrandDocumentTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setBrandId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setFile($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setPosition($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(BrandDocumentTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(BrandDocumentTableMap::ID)) $criteria->add(BrandDocumentTableMap::ID, $this->id);
+ if ($this->isColumnModified(BrandDocumentTableMap::BRAND_ID)) $criteria->add(BrandDocumentTableMap::BRAND_ID, $this->brand_id);
+ if ($this->isColumnModified(BrandDocumentTableMap::FILE)) $criteria->add(BrandDocumentTableMap::FILE, $this->file);
+ if ($this->isColumnModified(BrandDocumentTableMap::POSITION)) $criteria->add(BrandDocumentTableMap::POSITION, $this->position);
+ if ($this->isColumnModified(BrandDocumentTableMap::CREATED_AT)) $criteria->add(BrandDocumentTableMap::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(BrandDocumentTableMap::UPDATED_AT)) $criteria->add(BrandDocumentTableMap::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(BrandDocumentTableMap::DATABASE_NAME);
+ $criteria->add(BrandDocumentTableMap::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 \Thelia\Model\BrandDocument (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->setBrandId($this->getBrandId());
+ $copyObj->setFile($this->getFile());
+ $copyObj->setPosition($this->getPosition());
+ $copyObj->setCreatedAt($this->getCreatedAt());
+ $copyObj->setUpdatedAt($this->getUpdatedAt());
+
+ if ($deepCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+
+ foreach ($this->getBrandDocumentI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addBrandDocumentI18n($relObj->copy($deepCopy));
+ }
+ }
+
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \Thelia\Model\BrandDocument 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 ChildBrand object.
+ *
+ * @param ChildBrand $v
+ * @return \Thelia\Model\BrandDocument The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setBrand(ChildBrand $v = null)
+ {
+ if ($v === null) {
+ $this->setBrandId(NULL);
+ } else {
+ $this->setBrandId($v->getId());
+ }
+
+ $this->aBrand = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildBrand object, it will not be re-added.
+ if ($v !== null) {
+ $v->addBrandDocument($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildBrand object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildBrand The associated ChildBrand object.
+ * @throws PropelException
+ */
+ public function getBrand(ConnectionInterface $con = null)
+ {
+ if ($this->aBrand === null && ($this->brand_id !== null)) {
+ $this->aBrand = ChildBrandQuery::create()->findPk($this->brand_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->aBrand->addBrandDocuments($this);
+ */
+ }
+
+ return $this->aBrand;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('BrandDocumentI18n' == $relationName) {
+ return $this->initBrandDocumentI18ns();
+ }
+ }
+
+ /**
+ * Clears out the collBrandDocumentI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addBrandDocumentI18ns()
+ */
+ public function clearBrandDocumentI18ns()
+ {
+ $this->collBrandDocumentI18ns = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collBrandDocumentI18ns collection loaded partially.
+ */
+ public function resetPartialBrandDocumentI18ns($v = true)
+ {
+ $this->collBrandDocumentI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collBrandDocumentI18ns collection.
+ *
+ * By default this just sets the collBrandDocumentI18ns collection to an empty array (like clearcollBrandDocumentI18ns());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initBrandDocumentI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collBrandDocumentI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collBrandDocumentI18ns = new ObjectCollection();
+ $this->collBrandDocumentI18ns->setModel('\Thelia\Model\BrandDocumentI18n');
+ }
+
+ /**
+ * Gets an array of ChildBrandDocumentI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this ChildBrandDocument is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @return Collection|ChildBrandDocumentI18n[] List of ChildBrandDocumentI18n objects
+ * @throws PropelException
+ */
+ public function getBrandDocumentI18ns($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandDocumentI18nsPartial && !$this->isNew();
+ if (null === $this->collBrandDocumentI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandDocumentI18ns) {
+ // return empty collection
+ $this->initBrandDocumentI18ns();
+ } else {
+ $collBrandDocumentI18ns = ChildBrandDocumentI18nQuery::create(null, $criteria)
+ ->filterByBrandDocument($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collBrandDocumentI18nsPartial && count($collBrandDocumentI18ns)) {
+ $this->initBrandDocumentI18ns(false);
+
+ foreach ($collBrandDocumentI18ns as $obj) {
+ if (false == $this->collBrandDocumentI18ns->contains($obj)) {
+ $this->collBrandDocumentI18ns->append($obj);
+ }
+ }
+
+ $this->collBrandDocumentI18nsPartial = true;
+ }
+
+ reset($collBrandDocumentI18ns);
+
+ return $collBrandDocumentI18ns;
+ }
+
+ if ($partial && $this->collBrandDocumentI18ns) {
+ foreach ($this->collBrandDocumentI18ns as $obj) {
+ if ($obj->isNew()) {
+ $collBrandDocumentI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collBrandDocumentI18ns = $collBrandDocumentI18ns;
+ $this->collBrandDocumentI18nsPartial = false;
+ }
+ }
+
+ return $this->collBrandDocumentI18ns;
+ }
+
+ /**
+ * Sets a collection of BrandDocumentI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param Collection $brandDocumentI18ns A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildBrandDocument The current object (for fluent API support)
+ */
+ public function setBrandDocumentI18ns(Collection $brandDocumentI18ns, ConnectionInterface $con = null)
+ {
+ $brandDocumentI18nsToDelete = $this->getBrandDocumentI18ns(new Criteria(), $con)->diff($brandDocumentI18ns);
+
+
+ //since at least one column in the foreign key is at the same time a PK
+ //we can not just set a PK to NULL in the lines below. We have to store
+ //a backup of all values, so we are able to manipulate these items based on the onDelete value later.
+ $this->brandDocumentI18nsScheduledForDeletion = clone $brandDocumentI18nsToDelete;
+
+ foreach ($brandDocumentI18nsToDelete as $brandDocumentI18nRemoved) {
+ $brandDocumentI18nRemoved->setBrandDocument(null);
+ }
+
+ $this->collBrandDocumentI18ns = null;
+ foreach ($brandDocumentI18ns as $brandDocumentI18n) {
+ $this->addBrandDocumentI18n($brandDocumentI18n);
+ }
+
+ $this->collBrandDocumentI18ns = $brandDocumentI18ns;
+ $this->collBrandDocumentI18nsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related BrandDocumentI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related BrandDocumentI18n objects.
+ * @throws PropelException
+ */
+ public function countBrandDocumentI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandDocumentI18nsPartial && !$this->isNew();
+ if (null === $this->collBrandDocumentI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandDocumentI18ns) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getBrandDocumentI18ns());
+ }
+
+ $query = ChildBrandDocumentI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByBrandDocument($this)
+ ->count($con);
+ }
+
+ return count($this->collBrandDocumentI18ns);
+ }
+
+ /**
+ * Method called to associate a ChildBrandDocumentI18n object to this object
+ * through the ChildBrandDocumentI18n foreign key attribute.
+ *
+ * @param ChildBrandDocumentI18n $l ChildBrandDocumentI18n
+ * @return \Thelia\Model\BrandDocument The current object (for fluent API support)
+ */
+ public function addBrandDocumentI18n(ChildBrandDocumentI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collBrandDocumentI18ns === null) {
+ $this->initBrandDocumentI18ns();
+ $this->collBrandDocumentI18nsPartial = true;
+ }
+
+ if (!in_array($l, $this->collBrandDocumentI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddBrandDocumentI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param BrandDocumentI18n $brandDocumentI18n The brandDocumentI18n object to add.
+ */
+ protected function doAddBrandDocumentI18n($brandDocumentI18n)
+ {
+ $this->collBrandDocumentI18ns[]= $brandDocumentI18n;
+ $brandDocumentI18n->setBrandDocument($this);
+ }
+
+ /**
+ * @param BrandDocumentI18n $brandDocumentI18n The brandDocumentI18n object to remove.
+ * @return ChildBrandDocument The current object (for fluent API support)
+ */
+ public function removeBrandDocumentI18n($brandDocumentI18n)
+ {
+ if ($this->getBrandDocumentI18ns()->contains($brandDocumentI18n)) {
+ $this->collBrandDocumentI18ns->remove($this->collBrandDocumentI18ns->search($brandDocumentI18n));
+ if (null === $this->brandDocumentI18nsScheduledForDeletion) {
+ $this->brandDocumentI18nsScheduledForDeletion = clone $this->collBrandDocumentI18ns;
+ $this->brandDocumentI18nsScheduledForDeletion->clear();
+ }
+ $this->brandDocumentI18nsScheduledForDeletion[]= clone $brandDocumentI18n;
+ $brandDocumentI18n->setBrandDocument(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->brand_id = null;
+ $this->file = null;
+ $this->position = null;
+ $this->created_at = null;
+ $this->updated_at = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ if ($this->collBrandDocumentI18ns) {
+ foreach ($this->collBrandDocumentI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ } // if ($deep)
+
+ // i18n behavior
+ $this->currentLocale = 'en_US';
+ $this->currentTranslations = null;
+
+ $this->collBrandDocumentI18ns = null;
+ $this->aBrand = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(BrandDocumentTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ // timestampable behavior
+
+ /**
+ * Mark the current object so that the update date doesn't get updated during next save
+ *
+ * @return ChildBrandDocument The current object (for fluent API support)
+ */
+ public function keepUpdateDateUnchanged()
+ {
+ $this->modifiedColumns[BrandDocumentTableMap::UPDATED_AT] = true;
+
+ return $this;
+ }
+
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return ChildBrandDocument The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_US')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandDocumentI18n */
+ public function getTranslation($locale = 'en_US', ConnectionInterface $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collBrandDocumentI18ns) {
+ foreach ($this->collBrandDocumentI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new ChildBrandDocumentI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = ChildBrandDocumentI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addBrandDocumentI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandDocument The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null)
+ {
+ if (!$this->isNew()) {
+ ChildBrandDocumentI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collBrandDocumentI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collBrandDocumentI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandDocumentI18n */
+ public function getCurrentTranslation(ConnectionInterface $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandDocumentI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandDocumentI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandDocumentI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandDocumentI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ 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/core/lib/Thelia/Model/Base/BrandDocumentI18n.php b/core/lib/Thelia/Model/Base/BrandDocumentI18n.php
new file mode 100644
index 000000000..82eb9a675
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandDocumentI18n.php
@@ -0,0 +1,1442 @@
+locale = 'en_US';
+ }
+
+ /**
+ * Initializes internal state of Thelia\Model\Base\BrandDocumentI18n 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 BrandDocumentI18n instance. If
+ * obj is an instance of BrandDocumentI18n, delegates to
+ * equals(BrandDocumentI18n). 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 BrandDocumentI18n 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 BrandDocumentI18n 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 [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\BrandDocumentI18n 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[BrandDocumentI18nTableMap::ID] = true;
+ }
+
+ if ($this->aBrandDocument !== null && $this->aBrandDocument->getId() !== $v) {
+ $this->aBrandDocument = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandDocumentI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[BrandDocumentI18nTableMap::LOCALE] = true;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandDocumentI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[BrandDocumentI18nTableMap::TITLE] = true;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandDocumentI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[BrandDocumentI18nTableMap::DESCRIPTION] = true;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandDocumentI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[BrandDocumentI18nTableMap::CHAPO] = true;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandDocumentI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[BrandDocumentI18nTableMap::POSTSCRIPTUM] = true;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * 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->locale !== 'en_US') {
+ 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 : BrandDocumentI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : BrandDocumentI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->locale = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : BrandDocumentI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->title = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : BrandDocumentI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->description = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : BrandDocumentI18nTableMap::translateFieldName('Chapo', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->chapo = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : BrandDocumentI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->postscriptum = (null !== $col) ? (string) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = BrandDocumentI18nTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \Thelia\Model\BrandDocumentI18n 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->aBrandDocument !== null && $this->id !== $this->aBrandDocument->getId()) {
+ $this->aBrandDocument = 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(BrandDocumentI18nTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildBrandDocumentI18nQuery::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->aBrandDocument = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see BrandDocumentI18n::setDeleted()
+ * @see BrandDocumentI18n::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(BrandDocumentI18nTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildBrandDocumentI18nQuery::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(BrandDocumentI18nTableMap::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);
+ BrandDocumentI18nTableMap::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->aBrandDocument !== null) {
+ if ($this->aBrandDocument->isModified() || $this->aBrandDocument->isNew()) {
+ $affectedRows += $this->aBrandDocument->save($con);
+ }
+ $this->setBrandDocument($this->aBrandDocument);
+ }
+
+ 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(BrandDocumentI18nTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `brand_document_i18n` (%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 '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, 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);
+ }
+
+ $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 = BrandDocumentI18nTableMap::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->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ 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['BrandDocumentI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['BrandDocumentI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = BrandDocumentI18nTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aBrandDocument) {
+ $result['BrandDocument'] = $this->aBrandDocument->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 = BrandDocumentI18nTableMap::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->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($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 = BrandDocumentI18nTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($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(BrandDocumentI18nTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::ID)) $criteria->add(BrandDocumentI18nTableMap::ID, $this->id);
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::LOCALE)) $criteria->add(BrandDocumentI18nTableMap::LOCALE, $this->locale);
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::TITLE)) $criteria->add(BrandDocumentI18nTableMap::TITLE, $this->title);
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::DESCRIPTION)) $criteria->add(BrandDocumentI18nTableMap::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::CHAPO)) $criteria->add(BrandDocumentI18nTableMap::CHAPO, $this->chapo);
+ if ($this->isColumnModified(BrandDocumentI18nTableMap::POSTSCRIPTUM)) $criteria->add(BrandDocumentI18nTableMap::POSTSCRIPTUM, $this->postscriptum);
+
+ 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(BrandDocumentI18nTableMap::DATABASE_NAME);
+ $criteria->add(BrandDocumentI18nTableMap::ID, $this->id);
+ $criteria->add(BrandDocumentI18nTableMap::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the composite primary key for this object.
+ * The array elements will be in same order as specified in XML.
+ * @return array
+ */
+ public function getPrimaryKey()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * 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 \Thelia\Model\BrandDocumentI18n (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->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+ 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 \Thelia\Model\BrandDocumentI18n 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 ChildBrandDocument object.
+ *
+ * @param ChildBrandDocument $v
+ * @return \Thelia\Model\BrandDocumentI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setBrandDocument(ChildBrandDocument $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aBrandDocument = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildBrandDocument object, it will not be re-added.
+ if ($v !== null) {
+ $v->addBrandDocumentI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildBrandDocument object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildBrandDocument The associated ChildBrandDocument object.
+ * @throws PropelException
+ */
+ public function getBrandDocument(ConnectionInterface $con = null)
+ {
+ if ($this->aBrandDocument === null && ($this->id !== null)) {
+ $this->aBrandDocument = ChildBrandDocumentQuery::create()->findPk($this->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->aBrandDocument->addBrandDocumentI18ns($this);
+ */
+ }
+
+ return $this->aBrandDocument;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = 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->aBrandDocument = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(BrandDocumentI18nTableMap::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/core/lib/Thelia/Model/Base/BrandDocumentI18nQuery.php b/core/lib/Thelia/Model/Base/BrandDocumentI18nQuery.php
new file mode 100644
index 000000000..54d40e962
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandDocumentI18nQuery.php
@@ -0,0 +1,607 @@
+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(array(12, 34), $con);
+ *
+ *
+ * @param array[$id, $locale] $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandDocumentI18n|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = BrandDocumentI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(BrandDocumentI18nTableMap::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 ChildBrandDocumentI18n A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `brand_document_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $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 ChildBrandDocumentI18n();
+ $obj->hydrate($row);
+ BrandDocumentI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $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 ChildBrandDocumentI18n|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(array(12, 56), array(832, 123), array(123, 456)), $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 ChildBrandDocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(BrandDocumentI18nTableMap::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(BrandDocumentI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ChildBrandDocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(BrandDocumentI18nTableMap::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(BrandDocumentI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * 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
+ *
+ *
+ * @see filterByBrandDocument()
+ *
+ * @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 ChildBrandDocumentI18nQuery 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(BrandDocumentI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(BrandDocumentI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentI18nTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale 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 ChildBrandDocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentI18nTableMap::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandDocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentI18nTableMap::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description 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 ChildBrandDocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentI18nTableMap::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo 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 ChildBrandDocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentI18nTableMap::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum 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 ChildBrandDocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\BrandDocument object
+ *
+ * @param \Thelia\Model\BrandDocument|ObjectCollection $brandDocument The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandDocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByBrandDocument($brandDocument, $comparison = null)
+ {
+ if ($brandDocument instanceof \Thelia\Model\BrandDocument) {
+ return $this
+ ->addUsingAlias(BrandDocumentI18nTableMap::ID, $brandDocument->getId(), $comparison);
+ } elseif ($brandDocument instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(BrandDocumentI18nTableMap::ID, $brandDocument->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByBrandDocument() only accepts arguments of type \Thelia\Model\BrandDocument or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the BrandDocument relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandDocumentI18nQuery The current query, for fluid interface
+ */
+ public function joinBrandDocument($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('BrandDocument');
+
+ // 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, 'BrandDocument');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the BrandDocument relation BrandDocument 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\BrandDocumentQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandDocumentQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinBrandDocument($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandDocument', '\Thelia\Model\BrandDocumentQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildBrandDocumentI18n $brandDocumentI18n Object to remove from the list of results
+ *
+ * @return ChildBrandDocumentI18nQuery The current query, for fluid interface
+ */
+ public function prune($brandDocumentI18n = null)
+ {
+ if ($brandDocumentI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(BrandDocumentI18nTableMap::ID), $brandDocumentI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(BrandDocumentI18nTableMap::LOCALE), $brandDocumentI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the brand_document_i18n 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(BrandDocumentI18nTableMap::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).
+ BrandDocumentI18nTableMap::clearInstancePool();
+ BrandDocumentI18nTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildBrandDocumentI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildBrandDocumentI18n 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(BrandDocumentI18nTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(BrandDocumentI18nTableMap::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();
+
+
+ BrandDocumentI18nTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ BrandDocumentI18nTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // BrandDocumentI18nQuery
diff --git a/core/lib/Thelia/Model/Base/BrandDocumentQuery.php b/core/lib/Thelia/Model/Base/BrandDocumentQuery.php
new file mode 100644
index 000000000..4338c2dc2
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandDocumentQuery.php
@@ -0,0 +1,846 @@
+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 ChildBrandDocument|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = BrandDocumentTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(BrandDocumentTableMap::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 ChildBrandDocument A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `BRAND_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `brand_document` 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 ChildBrandDocument();
+ $obj->hydrate($row);
+ BrandDocumentTableMap::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 ChildBrandDocument|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 ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(BrandDocumentTableMap::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 ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(BrandDocumentTableMap::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 ChildBrandDocumentQuery 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(BrandDocumentTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(BrandDocumentTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the brand_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByBrandId(1234); // WHERE brand_id = 1234
+ * $query->filterByBrandId(array(12, 34)); // WHERE brand_id IN (12, 34)
+ * $query->filterByBrandId(array('min' => 12)); // WHERE brand_id > 12
+ *
+ *
+ * @see filterByBrand()
+ *
+ * @param mixed $brandId 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 ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function filterByBrandId($brandId = null, $comparison = null)
+ {
+ if (is_array($brandId)) {
+ $useMinMax = false;
+ if (isset($brandId['min'])) {
+ $this->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brandId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($brandId['max'])) {
+ $this->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brandId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brandId, $comparison);
+ }
+
+ /**
+ * Filter the query on the file column
+ *
+ * Example usage:
+ *
+ * $query->filterByFile('fooValue'); // WHERE file = 'fooValue'
+ * $query->filterByFile('%fooValue%'); // WHERE file LIKE '%fooValue%'
+ *
+ *
+ * @param string $file 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 ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function filterByFile($file = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($file)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $file)) {
+ $file = str_replace('*', '%', $file);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentTableMap::FILE, $file, $comparison);
+ }
+
+ /**
+ * Filter the query on the position column
+ *
+ * Example usage:
+ *
+ * $query->filterByPosition(1234); // WHERE position = 1234
+ * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
+ * $query->filterByPosition(array('min' => 12)); // WHERE position > 12
+ *
+ *
+ * @param mixed $position 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 ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function filterByPosition($position = null, $comparison = null)
+ {
+ if (is_array($position)) {
+ $useMinMax = false;
+ if (isset($position['min'])) {
+ $this->addUsingAlias(BrandDocumentTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($position['max'])) {
+ $this->addUsingAlias(BrandDocumentTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentTableMap::POSITION, $position, $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 ChildBrandDocumentQuery 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(BrandDocumentTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($createdAt['max'])) {
+ $this->addUsingAlias(BrandDocumentTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentTableMap::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 ChildBrandDocumentQuery 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(BrandDocumentTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($updatedAt['max'])) {
+ $this->addUsingAlias(BrandDocumentTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandDocumentTableMap::UPDATED_AT, $updatedAt, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Brand object
+ *
+ * @param \Thelia\Model\Brand|ObjectCollection $brand The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function filterByBrand($brand, $comparison = null)
+ {
+ if ($brand instanceof \Thelia\Model\Brand) {
+ return $this
+ ->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brand->getId(), $comparison);
+ } elseif ($brand instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(BrandDocumentTableMap::BRAND_ID, $brand->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByBrand() only accepts arguments of type \Thelia\Model\Brand or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Brand relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function joinBrand($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Brand');
+
+ // 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, 'Brand');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Brand relation Brand 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\BrandQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinBrand($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Brand', '\Thelia\Model\BrandQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\BrandDocumentI18n object
+ *
+ * @param \Thelia\Model\BrandDocumentI18n|ObjectCollection $brandDocumentI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function filterByBrandDocumentI18n($brandDocumentI18n, $comparison = null)
+ {
+ if ($brandDocumentI18n instanceof \Thelia\Model\BrandDocumentI18n) {
+ return $this
+ ->addUsingAlias(BrandDocumentTableMap::ID, $brandDocumentI18n->getId(), $comparison);
+ } elseif ($brandDocumentI18n instanceof ObjectCollection) {
+ return $this
+ ->useBrandDocumentI18nQuery()
+ ->filterByPrimaryKeys($brandDocumentI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByBrandDocumentI18n() only accepts arguments of type \Thelia\Model\BrandDocumentI18n or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the BrandDocumentI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function joinBrandDocumentI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('BrandDocumentI18n');
+
+ // 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, 'BrandDocumentI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the BrandDocumentI18n relation BrandDocumentI18n 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\BrandDocumentI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandDocumentI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinBrandDocumentI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandDocumentI18n', '\Thelia\Model\BrandDocumentI18nQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildBrandDocument $brandDocument Object to remove from the list of results
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function prune($brandDocument = null)
+ {
+ if ($brandDocument) {
+ $this->addUsingAlias(BrandDocumentTableMap::ID, $brandDocument->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the brand_document 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(BrandDocumentTableMap::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).
+ BrandDocumentTableMap::clearInstancePool();
+ BrandDocumentTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildBrandDocument or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildBrandDocument 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(BrandDocumentTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(BrandDocumentTableMap::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();
+
+
+ BrandDocumentTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ BrandDocumentTableMap::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 ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function recentlyUpdated($nbDays = 7)
+ {
+ return $this->addUsingAlias(BrandDocumentTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Filter by the latest created
+ *
+ * @param int $nbDays Maximum age of in days
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function recentlyCreated($nbDays = 7)
+ {
+ return $this->addUsingAlias(BrandDocumentTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Order by update date desc
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function lastUpdatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(BrandDocumentTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by update date asc
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function firstUpdatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(BrandDocumentTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by create date desc
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function lastCreatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(BrandDocumentTableMap::CREATED_AT);
+ }
+
+ /**
+ * Order by create date asc
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function firstCreatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(BrandDocumentTableMap::CREATED_AT);
+ }
+
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'BrandDocumentI18n';
+
+ return $this
+ ->joinBrandDocumentI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ChildBrandDocumentQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('BrandDocumentI18n');
+ $this->with['BrandDocumentI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ChildBrandDocumentI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandDocumentI18n', '\Thelia\Model\BrandDocumentI18nQuery');
+ }
+
+} // BrandDocumentQuery
diff --git a/core/lib/Thelia/Model/Base/BrandI18n.php b/core/lib/Thelia/Model/Base/BrandI18n.php
new file mode 100644
index 000000000..736d62a9c
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandI18n.php
@@ -0,0 +1,1616 @@
+locale = 'en_US';
+ }
+
+ /**
+ * Initializes internal state of Thelia\Model\Base\BrandI18n 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 BrandI18n instance. If
+ * obj is an instance of BrandI18n, delegates to
+ * equals(BrandI18n). 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 BrandI18n 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 BrandI18n 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 [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+
+ return $this->postscriptum;
+ }
+
+ /**
+ * Get the [meta_title] column value.
+ *
+ * @return string
+ */
+ public function getMetaTitle()
+ {
+
+ return $this->meta_title;
+ }
+
+ /**
+ * Get the [meta_description] column value.
+ *
+ * @return string
+ */
+ public function getMetaDescription()
+ {
+
+ return $this->meta_description;
+ }
+
+ /**
+ * Get the [meta_keywords] column value.
+ *
+ * @return string
+ */
+ public function getMetaKeywords()
+ {
+
+ return $this->meta_keywords;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\BrandI18n 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[BrandI18nTableMap::ID] = true;
+ }
+
+ if ($this->aBrand !== null && $this->aBrand->getId() !== $v) {
+ $this->aBrand = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[BrandI18nTableMap::LOCALE] = true;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[BrandI18nTableMap::TITLE] = true;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[BrandI18nTableMap::DESCRIPTION] = true;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[BrandI18nTableMap::CHAPO] = true;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[BrandI18nTableMap::POSTSCRIPTUM] = true;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Set the value of [meta_title] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setMetaTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->meta_title !== $v) {
+ $this->meta_title = $v;
+ $this->modifiedColumns[BrandI18nTableMap::META_TITLE] = true;
+ }
+
+
+ return $this;
+ } // setMetaTitle()
+
+ /**
+ * Set the value of [meta_description] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setMetaDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->meta_description !== $v) {
+ $this->meta_description = $v;
+ $this->modifiedColumns[BrandI18nTableMap::META_DESCRIPTION] = true;
+ }
+
+
+ return $this;
+ } // setMetaDescription()
+
+ /**
+ * Set the value of [meta_keywords] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ */
+ public function setMetaKeywords($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->meta_keywords !== $v) {
+ $this->meta_keywords = $v;
+ $this->modifiedColumns[BrandI18nTableMap::META_KEYWORDS] = true;
+ }
+
+
+ return $this;
+ } // setMetaKeywords()
+
+ /**
+ * 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->locale !== 'en_US') {
+ 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 : BrandI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : BrandI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->locale = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : BrandI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->title = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : BrandI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->description = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : BrandI18nTableMap::translateFieldName('Chapo', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->chapo = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : BrandI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->postscriptum = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : BrandI18nTableMap::translateFieldName('MetaTitle', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->meta_title = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : BrandI18nTableMap::translateFieldName('MetaDescription', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->meta_description = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : BrandI18nTableMap::translateFieldName('MetaKeywords', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->meta_keywords = (null !== $col) ? (string) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 9; // 9 = BrandI18nTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \Thelia\Model\BrandI18n 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->aBrand !== null && $this->id !== $this->aBrand->getId()) {
+ $this->aBrand = 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(BrandI18nTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildBrandI18nQuery::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->aBrand = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see BrandI18n::setDeleted()
+ * @see BrandI18n::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(BrandI18nTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildBrandI18nQuery::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(BrandI18nTableMap::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);
+ BrandI18nTableMap::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->aBrand !== null) {
+ if ($this->aBrand->isModified() || $this->aBrand->isNew()) {
+ $affectedRows += $this->aBrand->save($con);
+ }
+ $this->setBrand($this->aBrand);
+ }
+
+ 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(BrandI18nTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(BrandI18nTableMap::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(BrandI18nTableMap::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(BrandI18nTableMap::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(BrandI18nTableMap::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(BrandI18nTableMap::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+ if ($this->isColumnModified(BrandI18nTableMap::META_TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`META_TITLE`';
+ }
+ if ($this->isColumnModified(BrandI18nTableMap::META_DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`META_DESCRIPTION`';
+ }
+ if ($this->isColumnModified(BrandI18nTableMap::META_KEYWORDS)) {
+ $modifiedColumns[':p' . $index++] = '`META_KEYWORDS`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `brand_i18n` (%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 '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ case '`META_TITLE`':
+ $stmt->bindValue($identifier, $this->meta_title, PDO::PARAM_STR);
+ break;
+ case '`META_DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR);
+ break;
+ case '`META_KEYWORDS`':
+ $stmt->bindValue($identifier, $this->meta_keywords, 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);
+ }
+
+ $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 = BrandI18nTableMap::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->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ case 6:
+ return $this->getMetaTitle();
+ break;
+ case 7:
+ return $this->getMetaDescription();
+ break;
+ case 8:
+ return $this->getMetaKeywords();
+ 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['BrandI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['BrandI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = BrandI18nTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ $keys[6] => $this->getMetaTitle(),
+ $keys[7] => $this->getMetaDescription(),
+ $keys[8] => $this->getMetaKeywords(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aBrand) {
+ $result['Brand'] = $this->aBrand->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 = BrandI18nTableMap::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->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ case 6:
+ $this->setMetaTitle($value);
+ break;
+ case 7:
+ $this->setMetaDescription($value);
+ break;
+ case 8:
+ $this->setMetaKeywords($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 = BrandI18nTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setMetaTitle($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setMetaDescription($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setMetaKeywords($arr[$keys[8]]);
+ }
+
+ /**
+ * 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(BrandI18nTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(BrandI18nTableMap::ID)) $criteria->add(BrandI18nTableMap::ID, $this->id);
+ if ($this->isColumnModified(BrandI18nTableMap::LOCALE)) $criteria->add(BrandI18nTableMap::LOCALE, $this->locale);
+ if ($this->isColumnModified(BrandI18nTableMap::TITLE)) $criteria->add(BrandI18nTableMap::TITLE, $this->title);
+ if ($this->isColumnModified(BrandI18nTableMap::DESCRIPTION)) $criteria->add(BrandI18nTableMap::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(BrandI18nTableMap::CHAPO)) $criteria->add(BrandI18nTableMap::CHAPO, $this->chapo);
+ if ($this->isColumnModified(BrandI18nTableMap::POSTSCRIPTUM)) $criteria->add(BrandI18nTableMap::POSTSCRIPTUM, $this->postscriptum);
+ if ($this->isColumnModified(BrandI18nTableMap::META_TITLE)) $criteria->add(BrandI18nTableMap::META_TITLE, $this->meta_title);
+ if ($this->isColumnModified(BrandI18nTableMap::META_DESCRIPTION)) $criteria->add(BrandI18nTableMap::META_DESCRIPTION, $this->meta_description);
+ if ($this->isColumnModified(BrandI18nTableMap::META_KEYWORDS)) $criteria->add(BrandI18nTableMap::META_KEYWORDS, $this->meta_keywords);
+
+ 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(BrandI18nTableMap::DATABASE_NAME);
+ $criteria->add(BrandI18nTableMap::ID, $this->id);
+ $criteria->add(BrandI18nTableMap::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the composite primary key for this object.
+ * The array elements will be in same order as specified in XML.
+ * @return array
+ */
+ public function getPrimaryKey()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * 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 \Thelia\Model\BrandI18n (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->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+ $copyObj->setMetaTitle($this->getMetaTitle());
+ $copyObj->setMetaDescription($this->getMetaDescription());
+ $copyObj->setMetaKeywords($this->getMetaKeywords());
+ 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 \Thelia\Model\BrandI18n 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 ChildBrand object.
+ *
+ * @param ChildBrand $v
+ * @return \Thelia\Model\BrandI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setBrand(ChildBrand $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aBrand = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildBrand object, it will not be re-added.
+ if ($v !== null) {
+ $v->addBrandI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildBrand object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildBrand The associated ChildBrand object.
+ * @throws PropelException
+ */
+ public function getBrand(ConnectionInterface $con = null)
+ {
+ if ($this->aBrand === null && ($this->id !== null)) {
+ $this->aBrand = ChildBrandQuery::create()->findPk($this->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->aBrand->addBrandI18ns($this);
+ */
+ }
+
+ return $this->aBrand;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->meta_title = null;
+ $this->meta_description = null;
+ $this->meta_keywords = 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->aBrand = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(BrandI18nTableMap::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/core/lib/Thelia/Model/Base/BrandI18nQuery.php b/core/lib/Thelia/Model/Base/BrandI18nQuery.php
new file mode 100644
index 000000000..86248a84c
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandI18nQuery.php
@@ -0,0 +1,706 @@
+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(array(12, 34), $con);
+ *
+ *
+ * @param array[$id, $locale] $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandI18n|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = BrandI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(BrandI18nTableMap::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 ChildBrandI18n A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM`, `META_TITLE`, `META_DESCRIPTION`, `META_KEYWORDS` FROM `brand_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $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 ChildBrandI18n();
+ $obj->hydrate($row);
+ BrandI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $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 ChildBrandI18n|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(array(12, 56), array(832, 123), array(123, 456)), $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 ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(BrandI18nTableMap::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(BrandI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(BrandI18nTableMap::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(BrandI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * 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
+ *
+ *
+ * @see filterByBrand()
+ *
+ * @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 ChildBrandI18nQuery 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(BrandI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(BrandI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandI18nTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale 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 ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandI18nTableMap::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandI18nTableMap::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description 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 ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandI18nTableMap::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo 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 ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandI18nTableMap::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum 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 ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query on the meta_title column
+ *
+ * Example usage:
+ *
+ * $query->filterByMetaTitle('fooValue'); // WHERE meta_title = 'fooValue'
+ * $query->filterByMetaTitle('%fooValue%'); // WHERE meta_title LIKE '%fooValue%'
+ *
+ *
+ * @param string $metaTitle 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 ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByMetaTitle($metaTitle = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($metaTitle)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $metaTitle)) {
+ $metaTitle = str_replace('*', '%', $metaTitle);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandI18nTableMap::META_TITLE, $metaTitle, $comparison);
+ }
+
+ /**
+ * Filter the query on the meta_description column
+ *
+ * Example usage:
+ *
+ * $query->filterByMetaDescription('fooValue'); // WHERE meta_description = 'fooValue'
+ * $query->filterByMetaDescription('%fooValue%'); // WHERE meta_description LIKE '%fooValue%'
+ *
+ *
+ * @param string $metaDescription 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 ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByMetaDescription($metaDescription = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($metaDescription)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $metaDescription)) {
+ $metaDescription = str_replace('*', '%', $metaDescription);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandI18nTableMap::META_DESCRIPTION, $metaDescription, $comparison);
+ }
+
+ /**
+ * Filter the query on the meta_keywords column
+ *
+ * Example usage:
+ *
+ * $query->filterByMetaKeywords('fooValue'); // WHERE meta_keywords = 'fooValue'
+ * $query->filterByMetaKeywords('%fooValue%'); // WHERE meta_keywords LIKE '%fooValue%'
+ *
+ *
+ * @param string $metaKeywords 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 ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByMetaKeywords($metaKeywords = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($metaKeywords)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $metaKeywords)) {
+ $metaKeywords = str_replace('*', '%', $metaKeywords);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandI18nTableMap::META_KEYWORDS, $metaKeywords, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Brand object
+ *
+ * @param \Thelia\Model\Brand|ObjectCollection $brand The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function filterByBrand($brand, $comparison = null)
+ {
+ if ($brand instanceof \Thelia\Model\Brand) {
+ return $this
+ ->addUsingAlias(BrandI18nTableMap::ID, $brand->getId(), $comparison);
+ } elseif ($brand instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(BrandI18nTableMap::ID, $brand->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByBrand() only accepts arguments of type \Thelia\Model\Brand or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Brand relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function joinBrand($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Brand');
+
+ // 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, 'Brand');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Brand relation Brand 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\BrandQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinBrand($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Brand', '\Thelia\Model\BrandQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildBrandI18n $brandI18n Object to remove from the list of results
+ *
+ * @return ChildBrandI18nQuery The current query, for fluid interface
+ */
+ public function prune($brandI18n = null)
+ {
+ if ($brandI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(BrandI18nTableMap::ID), $brandI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(BrandI18nTableMap::LOCALE), $brandI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the brand_i18n 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(BrandI18nTableMap::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).
+ BrandI18nTableMap::clearInstancePool();
+ BrandI18nTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildBrandI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildBrandI18n 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(BrandI18nTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(BrandI18nTableMap::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();
+
+
+ BrandI18nTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ BrandI18nTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // BrandI18nQuery
diff --git a/core/lib/Thelia/Model/Base/BrandImage.php b/core/lib/Thelia/Model/Base/BrandImage.php
new file mode 100644
index 000000000..48c3d9196
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandImage.php
@@ -0,0 +1,2258 @@
+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 BrandImage instance. If
+ * obj is an instance of BrandImage, delegates to
+ * equals(BrandImage). 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 BrandImage 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 BrandImage 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 [brand_id] column value.
+ *
+ * @return int
+ */
+ public function getBrandId()
+ {
+
+ return $this->brand_id;
+ }
+
+ /**
+ * Get the [file] column value.
+ *
+ * @return string
+ */
+ public function getFile()
+ {
+
+ return $this->file;
+ }
+
+ /**
+ * Get the [position] column value.
+ *
+ * @return int
+ */
+ public function getPosition()
+ {
+
+ return $this->position;
+ }
+
+ /**
+ * 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 \Thelia\Model\BrandImage 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[BrandImageTableMap::ID] = true;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [brand_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\BrandImage The current object (for fluent API support)
+ */
+ public function setBrandId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->brand_id !== $v) {
+ $this->brand_id = $v;
+ $this->modifiedColumns[BrandImageTableMap::BRAND_ID] = true;
+ }
+
+ if ($this->aBrandRelatedByBrandId !== null && $this->aBrandRelatedByBrandId->getId() !== $v) {
+ $this->aBrandRelatedByBrandId = null;
+ }
+
+
+ return $this;
+ } // setBrandId()
+
+ /**
+ * Set the value of [file] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandImage The current object (for fluent API support)
+ */
+ public function setFile($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->file !== $v) {
+ $this->file = $v;
+ $this->modifiedColumns[BrandImageTableMap::FILE] = true;
+ }
+
+
+ return $this;
+ } // setFile()
+
+ /**
+ * Set the value of [position] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\BrandImage The current object (for fluent API support)
+ */
+ public function setPosition($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[BrandImageTableMap::POSITION] = true;
+ }
+
+
+ return $this;
+ } // setPosition()
+
+ /**
+ * Sets the value of [created_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\BrandImage 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[BrandImageTableMap::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 \Thelia\Model\BrandImage 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[BrandImageTableMap::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()
+ {
+ // 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 : BrandImageTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : BrandImageTableMap::translateFieldName('BrandId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->brand_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : BrandImageTableMap::translateFieldName('File', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->file = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : BrandImageTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->position = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : BrandImageTableMap::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 : BrandImageTableMap::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 = BrandImageTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \Thelia\Model\BrandImage 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->aBrandRelatedByBrandId !== null && $this->brand_id !== $this->aBrandRelatedByBrandId->getId()) {
+ $this->aBrandRelatedByBrandId = 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(BrandImageTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildBrandImageQuery::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->aBrandRelatedByBrandId = null;
+ $this->collBrandsRelatedByLogoImageId = null;
+
+ $this->collBrandImageI18ns = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see BrandImage::setDeleted()
+ * @see BrandImage::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(BrandImageTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildBrandImageQuery::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(BrandImageTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ // timestampable behavior
+ if (!$this->isColumnModified(BrandImageTableMap::CREATED_AT)) {
+ $this->setCreatedAt(time());
+ }
+ if (!$this->isColumnModified(BrandImageTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ // timestampable behavior
+ if ($this->isModified() && !$this->isColumnModified(BrandImageTableMap::UPDATED_AT)) {
+ $this->setUpdatedAt(time());
+ }
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ BrandImageTableMap::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->aBrandRelatedByBrandId !== null) {
+ if ($this->aBrandRelatedByBrandId->isModified() || $this->aBrandRelatedByBrandId->isNew()) {
+ $affectedRows += $this->aBrandRelatedByBrandId->save($con);
+ }
+ $this->setBrandRelatedByBrandId($this->aBrandRelatedByBrandId);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->brandsRelatedByLogoImageIdScheduledForDeletion !== null) {
+ if (!$this->brandsRelatedByLogoImageIdScheduledForDeletion->isEmpty()) {
+ foreach ($this->brandsRelatedByLogoImageIdScheduledForDeletion as $brandRelatedByLogoImageId) {
+ // need to save related object because we set the relation to null
+ $brandRelatedByLogoImageId->save($con);
+ }
+ $this->brandsRelatedByLogoImageIdScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collBrandsRelatedByLogoImageId !== null) {
+ foreach ($this->collBrandsRelatedByLogoImageId as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->brandImageI18nsScheduledForDeletion !== null) {
+ if (!$this->brandImageI18nsScheduledForDeletion->isEmpty()) {
+ \Thelia\Model\BrandImageI18nQuery::create()
+ ->filterByPrimaryKeys($this->brandImageI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->brandImageI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collBrandImageI18ns !== null) {
+ foreach ($this->collBrandImageI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param ConnectionInterface $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(ConnectionInterface $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[BrandImageTableMap::ID] = true;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . BrandImageTableMap::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(BrandImageTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(BrandImageTableMap::BRAND_ID)) {
+ $modifiedColumns[':p' . $index++] = '`BRAND_ID`';
+ }
+ if ($this->isColumnModified(BrandImageTableMap::FILE)) {
+ $modifiedColumns[':p' . $index++] = '`FILE`';
+ }
+ if ($this->isColumnModified(BrandImageTableMap::POSITION)) {
+ $modifiedColumns[':p' . $index++] = '`POSITION`';
+ }
+ if ($this->isColumnModified(BrandImageTableMap::CREATED_AT)) {
+ $modifiedColumns[':p' . $index++] = '`CREATED_AT`';
+ }
+ if ($this->isColumnModified(BrandImageTableMap::UPDATED_AT)) {
+ $modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `brand_image` (%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 '`BRAND_ID`':
+ $stmt->bindValue($identifier, $this->brand_id, PDO::PARAM_INT);
+ break;
+ case '`FILE`':
+ $stmt->bindValue($identifier, $this->file, PDO::PARAM_STR);
+ break;
+ case '`POSITION`':
+ $stmt->bindValue($identifier, $this->position, 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 = BrandImageTableMap::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->getBrandId();
+ break;
+ case 2:
+ return $this->getFile();
+ break;
+ case 3:
+ return $this->getPosition();
+ 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['BrandImage'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['BrandImage'][$this->getPrimaryKey()] = true;
+ $keys = BrandImageTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getBrandId(),
+ $keys[2] => $this->getFile(),
+ $keys[3] => $this->getPosition(),
+ $keys[4] => $this->getCreatedAt(),
+ $keys[5] => $this->getUpdatedAt(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aBrandRelatedByBrandId) {
+ $result['BrandRelatedByBrandId'] = $this->aBrandRelatedByBrandId->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->collBrandsRelatedByLogoImageId) {
+ $result['BrandsRelatedByLogoImageId'] = $this->collBrandsRelatedByLogoImageId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collBrandImageI18ns) {
+ $result['BrandImageI18ns'] = $this->collBrandImageI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
+ * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
+ * Defaults to TableMap::TYPE_PHPNAME.
+ * @return void
+ */
+ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
+ {
+ $pos = BrandImageTableMap::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->setBrandId($value);
+ break;
+ case 2:
+ $this->setFile($value);
+ break;
+ case 3:
+ $this->setPosition($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 = BrandImageTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setBrandId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setFile($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setPosition($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(BrandImageTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(BrandImageTableMap::ID)) $criteria->add(BrandImageTableMap::ID, $this->id);
+ if ($this->isColumnModified(BrandImageTableMap::BRAND_ID)) $criteria->add(BrandImageTableMap::BRAND_ID, $this->brand_id);
+ if ($this->isColumnModified(BrandImageTableMap::FILE)) $criteria->add(BrandImageTableMap::FILE, $this->file);
+ if ($this->isColumnModified(BrandImageTableMap::POSITION)) $criteria->add(BrandImageTableMap::POSITION, $this->position);
+ if ($this->isColumnModified(BrandImageTableMap::CREATED_AT)) $criteria->add(BrandImageTableMap::CREATED_AT, $this->created_at);
+ if ($this->isColumnModified(BrandImageTableMap::UPDATED_AT)) $criteria->add(BrandImageTableMap::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(BrandImageTableMap::DATABASE_NAME);
+ $criteria->add(BrandImageTableMap::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 \Thelia\Model\BrandImage (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->setBrandId($this->getBrandId());
+ $copyObj->setFile($this->getFile());
+ $copyObj->setPosition($this->getPosition());
+ $copyObj->setCreatedAt($this->getCreatedAt());
+ $copyObj->setUpdatedAt($this->getUpdatedAt());
+
+ if ($deepCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+
+ foreach ($this->getBrandsRelatedByLogoImageId() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addBrandRelatedByLogoImageId($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getBrandImageI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addBrandImageI18n($relObj->copy($deepCopy));
+ }
+ }
+
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return \Thelia\Model\BrandImage 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 ChildBrand object.
+ *
+ * @param ChildBrand $v
+ * @return \Thelia\Model\BrandImage The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setBrandRelatedByBrandId(ChildBrand $v = null)
+ {
+ if ($v === null) {
+ $this->setBrandId(NULL);
+ } else {
+ $this->setBrandId($v->getId());
+ }
+
+ $this->aBrandRelatedByBrandId = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildBrand object, it will not be re-added.
+ if ($v !== null) {
+ $v->addBrandImageRelatedByBrandId($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildBrand object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildBrand The associated ChildBrand object.
+ * @throws PropelException
+ */
+ public function getBrandRelatedByBrandId(ConnectionInterface $con = null)
+ {
+ if ($this->aBrandRelatedByBrandId === null && ($this->brand_id !== null)) {
+ $this->aBrandRelatedByBrandId = ChildBrandQuery::create()->findPk($this->brand_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->aBrandRelatedByBrandId->addBrandImagesRelatedByBrandId($this);
+ */
+ }
+
+ return $this->aBrandRelatedByBrandId;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('BrandRelatedByLogoImageId' == $relationName) {
+ return $this->initBrandsRelatedByLogoImageId();
+ }
+ if ('BrandImageI18n' == $relationName) {
+ return $this->initBrandImageI18ns();
+ }
+ }
+
+ /**
+ * Clears out the collBrandsRelatedByLogoImageId collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addBrandsRelatedByLogoImageId()
+ */
+ public function clearBrandsRelatedByLogoImageId()
+ {
+ $this->collBrandsRelatedByLogoImageId = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collBrandsRelatedByLogoImageId collection loaded partially.
+ */
+ public function resetPartialBrandsRelatedByLogoImageId($v = true)
+ {
+ $this->collBrandsRelatedByLogoImageIdPartial = $v;
+ }
+
+ /**
+ * Initializes the collBrandsRelatedByLogoImageId collection.
+ *
+ * By default this just sets the collBrandsRelatedByLogoImageId collection to an empty array (like clearcollBrandsRelatedByLogoImageId());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initBrandsRelatedByLogoImageId($overrideExisting = true)
+ {
+ if (null !== $this->collBrandsRelatedByLogoImageId && !$overrideExisting) {
+ return;
+ }
+ $this->collBrandsRelatedByLogoImageId = new ObjectCollection();
+ $this->collBrandsRelatedByLogoImageId->setModel('\Thelia\Model\Brand');
+ }
+
+ /**
+ * Gets an array of ChildBrand objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this ChildBrandImage is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @return Collection|ChildBrand[] List of ChildBrand objects
+ * @throws PropelException
+ */
+ public function getBrandsRelatedByLogoImageId($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandsRelatedByLogoImageIdPartial && !$this->isNew();
+ if (null === $this->collBrandsRelatedByLogoImageId || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandsRelatedByLogoImageId) {
+ // return empty collection
+ $this->initBrandsRelatedByLogoImageId();
+ } else {
+ $collBrandsRelatedByLogoImageId = ChildBrandQuery::create(null, $criteria)
+ ->filterByBrandImageRelatedByLogoImageId($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collBrandsRelatedByLogoImageIdPartial && count($collBrandsRelatedByLogoImageId)) {
+ $this->initBrandsRelatedByLogoImageId(false);
+
+ foreach ($collBrandsRelatedByLogoImageId as $obj) {
+ if (false == $this->collBrandsRelatedByLogoImageId->contains($obj)) {
+ $this->collBrandsRelatedByLogoImageId->append($obj);
+ }
+ }
+
+ $this->collBrandsRelatedByLogoImageIdPartial = true;
+ }
+
+ reset($collBrandsRelatedByLogoImageId);
+
+ return $collBrandsRelatedByLogoImageId;
+ }
+
+ if ($partial && $this->collBrandsRelatedByLogoImageId) {
+ foreach ($this->collBrandsRelatedByLogoImageId as $obj) {
+ if ($obj->isNew()) {
+ $collBrandsRelatedByLogoImageId[] = $obj;
+ }
+ }
+ }
+
+ $this->collBrandsRelatedByLogoImageId = $collBrandsRelatedByLogoImageId;
+ $this->collBrandsRelatedByLogoImageIdPartial = false;
+ }
+ }
+
+ return $this->collBrandsRelatedByLogoImageId;
+ }
+
+ /**
+ * Sets a collection of BrandRelatedByLogoImageId objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param Collection $brandsRelatedByLogoImageId A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildBrandImage The current object (for fluent API support)
+ */
+ public function setBrandsRelatedByLogoImageId(Collection $brandsRelatedByLogoImageId, ConnectionInterface $con = null)
+ {
+ $brandsRelatedByLogoImageIdToDelete = $this->getBrandsRelatedByLogoImageId(new Criteria(), $con)->diff($brandsRelatedByLogoImageId);
+
+
+ $this->brandsRelatedByLogoImageIdScheduledForDeletion = $brandsRelatedByLogoImageIdToDelete;
+
+ foreach ($brandsRelatedByLogoImageIdToDelete as $brandRelatedByLogoImageIdRemoved) {
+ $brandRelatedByLogoImageIdRemoved->setBrandImageRelatedByLogoImageId(null);
+ }
+
+ $this->collBrandsRelatedByLogoImageId = null;
+ foreach ($brandsRelatedByLogoImageId as $brandRelatedByLogoImageId) {
+ $this->addBrandRelatedByLogoImageId($brandRelatedByLogoImageId);
+ }
+
+ $this->collBrandsRelatedByLogoImageId = $brandsRelatedByLogoImageId;
+ $this->collBrandsRelatedByLogoImageIdPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related Brand objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related Brand objects.
+ * @throws PropelException
+ */
+ public function countBrandsRelatedByLogoImageId(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandsRelatedByLogoImageIdPartial && !$this->isNew();
+ if (null === $this->collBrandsRelatedByLogoImageId || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandsRelatedByLogoImageId) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getBrandsRelatedByLogoImageId());
+ }
+
+ $query = ChildBrandQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByBrandImageRelatedByLogoImageId($this)
+ ->count($con);
+ }
+
+ return count($this->collBrandsRelatedByLogoImageId);
+ }
+
+ /**
+ * Method called to associate a ChildBrand object to this object
+ * through the ChildBrand foreign key attribute.
+ *
+ * @param ChildBrand $l ChildBrand
+ * @return \Thelia\Model\BrandImage The current object (for fluent API support)
+ */
+ public function addBrandRelatedByLogoImageId(ChildBrand $l)
+ {
+ if ($this->collBrandsRelatedByLogoImageId === null) {
+ $this->initBrandsRelatedByLogoImageId();
+ $this->collBrandsRelatedByLogoImageIdPartial = true;
+ }
+
+ if (!in_array($l, $this->collBrandsRelatedByLogoImageId->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddBrandRelatedByLogoImageId($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param BrandRelatedByLogoImageId $brandRelatedByLogoImageId The brandRelatedByLogoImageId object to add.
+ */
+ protected function doAddBrandRelatedByLogoImageId($brandRelatedByLogoImageId)
+ {
+ $this->collBrandsRelatedByLogoImageId[]= $brandRelatedByLogoImageId;
+ $brandRelatedByLogoImageId->setBrandImageRelatedByLogoImageId($this);
+ }
+
+ /**
+ * @param BrandRelatedByLogoImageId $brandRelatedByLogoImageId The brandRelatedByLogoImageId object to remove.
+ * @return ChildBrandImage The current object (for fluent API support)
+ */
+ public function removeBrandRelatedByLogoImageId($brandRelatedByLogoImageId)
+ {
+ if ($this->getBrandsRelatedByLogoImageId()->contains($brandRelatedByLogoImageId)) {
+ $this->collBrandsRelatedByLogoImageId->remove($this->collBrandsRelatedByLogoImageId->search($brandRelatedByLogoImageId));
+ if (null === $this->brandsRelatedByLogoImageIdScheduledForDeletion) {
+ $this->brandsRelatedByLogoImageIdScheduledForDeletion = clone $this->collBrandsRelatedByLogoImageId;
+ $this->brandsRelatedByLogoImageIdScheduledForDeletion->clear();
+ }
+ $this->brandsRelatedByLogoImageIdScheduledForDeletion[]= $brandRelatedByLogoImageId;
+ $brandRelatedByLogoImageId->setBrandImageRelatedByLogoImageId(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears out the collBrandImageI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addBrandImageI18ns()
+ */
+ public function clearBrandImageI18ns()
+ {
+ $this->collBrandImageI18ns = null; // important to set this to NULL since that means it is uninitialized
+ }
+
+ /**
+ * Reset is the collBrandImageI18ns collection loaded partially.
+ */
+ public function resetPartialBrandImageI18ns($v = true)
+ {
+ $this->collBrandImageI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collBrandImageI18ns collection.
+ *
+ * By default this just sets the collBrandImageI18ns collection to an empty array (like clearcollBrandImageI18ns());
+ * however, you may wish to override this method in your stub class to provide setting appropriate
+ * to your application -- for example, setting the initial array to the values stored in database.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initBrandImageI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collBrandImageI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collBrandImageI18ns = new ObjectCollection();
+ $this->collBrandImageI18ns->setModel('\Thelia\Model\BrandImageI18n');
+ }
+
+ /**
+ * Gets an array of ChildBrandImageI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this ChildBrandImage is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @return Collection|ChildBrandImageI18n[] List of ChildBrandImageI18n objects
+ * @throws PropelException
+ */
+ public function getBrandImageI18ns($criteria = null, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandImageI18nsPartial && !$this->isNew();
+ if (null === $this->collBrandImageI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandImageI18ns) {
+ // return empty collection
+ $this->initBrandImageI18ns();
+ } else {
+ $collBrandImageI18ns = ChildBrandImageI18nQuery::create(null, $criteria)
+ ->filterByBrandImage($this)
+ ->find($con);
+
+ if (null !== $criteria) {
+ if (false !== $this->collBrandImageI18nsPartial && count($collBrandImageI18ns)) {
+ $this->initBrandImageI18ns(false);
+
+ foreach ($collBrandImageI18ns as $obj) {
+ if (false == $this->collBrandImageI18ns->contains($obj)) {
+ $this->collBrandImageI18ns->append($obj);
+ }
+ }
+
+ $this->collBrandImageI18nsPartial = true;
+ }
+
+ reset($collBrandImageI18ns);
+
+ return $collBrandImageI18ns;
+ }
+
+ if ($partial && $this->collBrandImageI18ns) {
+ foreach ($this->collBrandImageI18ns as $obj) {
+ if ($obj->isNew()) {
+ $collBrandImageI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collBrandImageI18ns = $collBrandImageI18ns;
+ $this->collBrandImageI18nsPartial = false;
+ }
+ }
+
+ return $this->collBrandImageI18ns;
+ }
+
+ /**
+ * Sets a collection of BrandImageI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param Collection $brandImageI18ns A Propel collection.
+ * @param ConnectionInterface $con Optional connection object
+ * @return ChildBrandImage The current object (for fluent API support)
+ */
+ public function setBrandImageI18ns(Collection $brandImageI18ns, ConnectionInterface $con = null)
+ {
+ $brandImageI18nsToDelete = $this->getBrandImageI18ns(new Criteria(), $con)->diff($brandImageI18ns);
+
+
+ //since at least one column in the foreign key is at the same time a PK
+ //we can not just set a PK to NULL in the lines below. We have to store
+ //a backup of all values, so we are able to manipulate these items based on the onDelete value later.
+ $this->brandImageI18nsScheduledForDeletion = clone $brandImageI18nsToDelete;
+
+ foreach ($brandImageI18nsToDelete as $brandImageI18nRemoved) {
+ $brandImageI18nRemoved->setBrandImage(null);
+ }
+
+ $this->collBrandImageI18ns = null;
+ foreach ($brandImageI18ns as $brandImageI18n) {
+ $this->addBrandImageI18n($brandImageI18n);
+ }
+
+ $this->collBrandImageI18ns = $brandImageI18ns;
+ $this->collBrandImageI18nsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related BrandImageI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param ConnectionInterface $con
+ * @return int Count of related BrandImageI18n objects.
+ * @throws PropelException
+ */
+ public function countBrandImageI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
+ {
+ $partial = $this->collBrandImageI18nsPartial && !$this->isNew();
+ if (null === $this->collBrandImageI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collBrandImageI18ns) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getBrandImageI18ns());
+ }
+
+ $query = ChildBrandImageI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByBrandImage($this)
+ ->count($con);
+ }
+
+ return count($this->collBrandImageI18ns);
+ }
+
+ /**
+ * Method called to associate a ChildBrandImageI18n object to this object
+ * through the ChildBrandImageI18n foreign key attribute.
+ *
+ * @param ChildBrandImageI18n $l ChildBrandImageI18n
+ * @return \Thelia\Model\BrandImage The current object (for fluent API support)
+ */
+ public function addBrandImageI18n(ChildBrandImageI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collBrandImageI18ns === null) {
+ $this->initBrandImageI18ns();
+ $this->collBrandImageI18nsPartial = true;
+ }
+
+ if (!in_array($l, $this->collBrandImageI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddBrandImageI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param BrandImageI18n $brandImageI18n The brandImageI18n object to add.
+ */
+ protected function doAddBrandImageI18n($brandImageI18n)
+ {
+ $this->collBrandImageI18ns[]= $brandImageI18n;
+ $brandImageI18n->setBrandImage($this);
+ }
+
+ /**
+ * @param BrandImageI18n $brandImageI18n The brandImageI18n object to remove.
+ * @return ChildBrandImage The current object (for fluent API support)
+ */
+ public function removeBrandImageI18n($brandImageI18n)
+ {
+ if ($this->getBrandImageI18ns()->contains($brandImageI18n)) {
+ $this->collBrandImageI18ns->remove($this->collBrandImageI18ns->search($brandImageI18n));
+ if (null === $this->brandImageI18nsScheduledForDeletion) {
+ $this->brandImageI18nsScheduledForDeletion = clone $this->collBrandImageI18ns;
+ $this->brandImageI18nsScheduledForDeletion->clear();
+ }
+ $this->brandImageI18nsScheduledForDeletion[]= clone $brandImageI18n;
+ $brandImageI18n->setBrandImage(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->brand_id = null;
+ $this->file = null;
+ $this->position = null;
+ $this->created_at = null;
+ $this->updated_at = null;
+ $this->alreadyInSave = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ if ($this->collBrandsRelatedByLogoImageId) {
+ foreach ($this->collBrandsRelatedByLogoImageId as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collBrandImageI18ns) {
+ foreach ($this->collBrandImageI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ } // if ($deep)
+
+ // i18n behavior
+ $this->currentLocale = 'en_US';
+ $this->currentTranslations = null;
+
+ $this->collBrandsRelatedByLogoImageId = null;
+ $this->collBrandImageI18ns = null;
+ $this->aBrandRelatedByBrandId = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(BrandImageTableMap::DEFAULT_STRING_FORMAT);
+ }
+
+ // timestampable behavior
+
+ /**
+ * Mark the current object so that the update date doesn't get updated during next save
+ *
+ * @return ChildBrandImage The current object (for fluent API support)
+ */
+ public function keepUpdateDateUnchanged()
+ {
+ $this->modifiedColumns[BrandImageTableMap::UPDATED_AT] = true;
+
+ return $this;
+ }
+
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return ChildBrandImage The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_US')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandImageI18n */
+ public function getTranslation($locale = 'en_US', ConnectionInterface $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collBrandImageI18ns) {
+ foreach ($this->collBrandImageI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new ChildBrandImageI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = ChildBrandImageI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addBrandImageI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandImage The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null)
+ {
+ if (!$this->isNew()) {
+ ChildBrandImageI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collBrandImageI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collBrandImageI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandImageI18n */
+ public function getCurrentTranslation(ConnectionInterface $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandImageI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandImageI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandImageI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandImageI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ 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/core/lib/Thelia/Model/Base/BrandImageI18n.php b/core/lib/Thelia/Model/Base/BrandImageI18n.php
new file mode 100644
index 000000000..a72990f72
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandImageI18n.php
@@ -0,0 +1,1442 @@
+locale = 'en_US';
+ }
+
+ /**
+ * Initializes internal state of Thelia\Model\Base\BrandImageI18n 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 BrandImageI18n instance. If
+ * obj is an instance of BrandImageI18n, delegates to
+ * equals(BrandImageI18n). 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 BrandImageI18n 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 BrandImageI18n 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 [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\BrandImageI18n 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[BrandImageI18nTableMap::ID] = true;
+ }
+
+ if ($this->aBrandImage !== null && $this->aBrandImage->getId() !== $v) {
+ $this->aBrandImage = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandImageI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[BrandImageI18nTableMap::LOCALE] = true;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandImageI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[BrandImageI18nTableMap::TITLE] = true;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandImageI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[BrandImageI18nTableMap::DESCRIPTION] = true;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandImageI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[BrandImageI18nTableMap::CHAPO] = true;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\BrandImageI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[BrandImageI18nTableMap::POSTSCRIPTUM] = true;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * 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->locale !== 'en_US') {
+ 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 : BrandImageI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : BrandImageI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->locale = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : BrandImageI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->title = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : BrandImageI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->description = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : BrandImageI18nTableMap::translateFieldName('Chapo', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->chapo = (null !== $col) ? (string) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : BrandImageI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->postscriptum = (null !== $col) ? (string) $col : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = BrandImageI18nTableMap::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating \Thelia\Model\BrandImageI18n 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->aBrandImage !== null && $this->id !== $this->aBrandImage->getId()) {
+ $this->aBrandImage = 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(BrandImageI18nTableMap::DATABASE_NAME);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $dataFetcher = ChildBrandImageI18nQuery::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->aBrandImage = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param ConnectionInterface $con
+ * @return void
+ * @throws PropelException
+ * @see BrandImageI18n::setDeleted()
+ * @see BrandImageI18n::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(BrandImageI18nTableMap::DATABASE_NAME);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ChildBrandImageI18nQuery::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(BrandImageI18nTableMap::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);
+ BrandImageI18nTableMap::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->aBrandImage !== null) {
+ if ($this->aBrandImage->isModified() || $this->aBrandImage->isNew()) {
+ $affectedRows += $this->aBrandImage->save($con);
+ }
+ $this->setBrandImage($this->aBrandImage);
+ }
+
+ 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(BrandImageI18nTableMap::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(BrandImageI18nTableMap::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(BrandImageI18nTableMap::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(BrandImageI18nTableMap::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(BrandImageI18nTableMap::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(BrandImageI18nTableMap::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `brand_image_i18n` (%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 '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, 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);
+ }
+
+ $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 = BrandImageI18nTableMap::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->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ 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['BrandImageI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['BrandImageI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = BrandImageI18nTableMap::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aBrandImage) {
+ $result['BrandImage'] = $this->aBrandImage->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 = BrandImageI18nTableMap::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->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($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 = BrandImageI18nTableMap::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($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(BrandImageI18nTableMap::DATABASE_NAME);
+
+ if ($this->isColumnModified(BrandImageI18nTableMap::ID)) $criteria->add(BrandImageI18nTableMap::ID, $this->id);
+ if ($this->isColumnModified(BrandImageI18nTableMap::LOCALE)) $criteria->add(BrandImageI18nTableMap::LOCALE, $this->locale);
+ if ($this->isColumnModified(BrandImageI18nTableMap::TITLE)) $criteria->add(BrandImageI18nTableMap::TITLE, $this->title);
+ if ($this->isColumnModified(BrandImageI18nTableMap::DESCRIPTION)) $criteria->add(BrandImageI18nTableMap::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(BrandImageI18nTableMap::CHAPO)) $criteria->add(BrandImageI18nTableMap::CHAPO, $this->chapo);
+ if ($this->isColumnModified(BrandImageI18nTableMap::POSTSCRIPTUM)) $criteria->add(BrandImageI18nTableMap::POSTSCRIPTUM, $this->postscriptum);
+
+ 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(BrandImageI18nTableMap::DATABASE_NAME);
+ $criteria->add(BrandImageI18nTableMap::ID, $this->id);
+ $criteria->add(BrandImageI18nTableMap::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the composite primary key for this object.
+ * The array elements will be in same order as specified in XML.
+ * @return array
+ */
+ public function getPrimaryKey()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * 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 \Thelia\Model\BrandImageI18n (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->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+ 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 \Thelia\Model\BrandImageI18n 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 ChildBrandImage object.
+ *
+ * @param ChildBrandImage $v
+ * @return \Thelia\Model\BrandImageI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setBrandImage(ChildBrandImage $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aBrandImage = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildBrandImage object, it will not be re-added.
+ if ($v !== null) {
+ $v->addBrandImageI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildBrandImage object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildBrandImage The associated ChildBrandImage object.
+ * @throws PropelException
+ */
+ public function getBrandImage(ConnectionInterface $con = null)
+ {
+ if ($this->aBrandImage === null && ($this->id !== null)) {
+ $this->aBrandImage = ChildBrandImageQuery::create()->findPk($this->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->aBrandImage->addBrandImageI18ns($this);
+ */
+ }
+
+ return $this->aBrandImage;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = 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->aBrandImage = null;
+ }
+
+ /**
+ * Return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(BrandImageI18nTableMap::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/core/lib/Thelia/Model/Base/BrandImageI18nQuery.php b/core/lib/Thelia/Model/Base/BrandImageI18nQuery.php
new file mode 100644
index 000000000..e59af9820
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandImageI18nQuery.php
@@ -0,0 +1,607 @@
+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(array(12, 34), $con);
+ *
+ *
+ * @param array[$id, $locale] $key Primary key to use for the query
+ * @param ConnectionInterface $con an optional connection object
+ *
+ * @return ChildBrandImageI18n|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = BrandImageI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(BrandImageI18nTableMap::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 ChildBrandImageI18n A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `brand_image_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $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 ChildBrandImageI18n();
+ $obj->hydrate($row);
+ BrandImageI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $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 ChildBrandImageI18n|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(array(12, 56), array(832, 123), array(123, 456)), $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 ChildBrandImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(BrandImageI18nTableMap::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(BrandImageI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ChildBrandImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(BrandImageI18nTableMap::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(BrandImageI18nTableMap::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * 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
+ *
+ *
+ * @see filterByBrandImage()
+ *
+ * @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 ChildBrandImageI18nQuery 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(BrandImageI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(BrandImageI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageI18nTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale 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 ChildBrandImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageI18nTableMap::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageI18nTableMap::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description 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 ChildBrandImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageI18nTableMap::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo 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 ChildBrandImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageI18nTableMap::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum 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 ChildBrandImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\BrandImage object
+ *
+ * @param \Thelia\Model\BrandImage|ObjectCollection $brandImage The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByBrandImage($brandImage, $comparison = null)
+ {
+ if ($brandImage instanceof \Thelia\Model\BrandImage) {
+ return $this
+ ->addUsingAlias(BrandImageI18nTableMap::ID, $brandImage->getId(), $comparison);
+ } elseif ($brandImage instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(BrandImageI18nTableMap::ID, $brandImage->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByBrandImage() only accepts arguments of type \Thelia\Model\BrandImage or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the BrandImage relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandImageI18nQuery The current query, for fluid interface
+ */
+ public function joinBrandImage($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('BrandImage');
+
+ // 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, 'BrandImage');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the BrandImage relation BrandImage 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\BrandImageQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandImageQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinBrandImage($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandImage', '\Thelia\Model\BrandImageQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildBrandImageI18n $brandImageI18n Object to remove from the list of results
+ *
+ * @return ChildBrandImageI18nQuery The current query, for fluid interface
+ */
+ public function prune($brandImageI18n = null)
+ {
+ if ($brandImageI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(BrandImageI18nTableMap::ID), $brandImageI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(BrandImageI18nTableMap::LOCALE), $brandImageI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the brand_image_i18n 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(BrandImageI18nTableMap::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).
+ BrandImageI18nTableMap::clearInstancePool();
+ BrandImageI18nTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildBrandImageI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildBrandImageI18n 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(BrandImageI18nTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(BrandImageI18nTableMap::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();
+
+
+ BrandImageI18nTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ BrandImageI18nTableMap::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+} // BrandImageI18nQuery
diff --git a/core/lib/Thelia/Model/Base/BrandImageQuery.php b/core/lib/Thelia/Model/Base/BrandImageQuery.php
new file mode 100644
index 000000000..c48983b54
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandImageQuery.php
@@ -0,0 +1,923 @@
+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 ChildBrandImage|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = BrandImageTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(BrandImageTableMap::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 ChildBrandImage A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `BRAND_ID`, `FILE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `brand_image` 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 ChildBrandImage();
+ $obj->hydrate($row);
+ BrandImageTableMap::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 ChildBrandImage|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 ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(BrandImageTableMap::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 ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(BrandImageTableMap::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 ChildBrandImageQuery 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(BrandImageTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(BrandImageTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the brand_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByBrandId(1234); // WHERE brand_id = 1234
+ * $query->filterByBrandId(array(12, 34)); // WHERE brand_id IN (12, 34)
+ * $query->filterByBrandId(array('min' => 12)); // WHERE brand_id > 12
+ *
+ *
+ * @see filterByBrandRelatedByBrandId()
+ *
+ * @param mixed $brandId 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 ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function filterByBrandId($brandId = null, $comparison = null)
+ {
+ if (is_array($brandId)) {
+ $useMinMax = false;
+ if (isset($brandId['min'])) {
+ $this->addUsingAlias(BrandImageTableMap::BRAND_ID, $brandId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($brandId['max'])) {
+ $this->addUsingAlias(BrandImageTableMap::BRAND_ID, $brandId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageTableMap::BRAND_ID, $brandId, $comparison);
+ }
+
+ /**
+ * Filter the query on the file column
+ *
+ * Example usage:
+ *
+ * $query->filterByFile('fooValue'); // WHERE file = 'fooValue'
+ * $query->filterByFile('%fooValue%'); // WHERE file LIKE '%fooValue%'
+ *
+ *
+ * @param string $file 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 ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function filterByFile($file = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($file)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $file)) {
+ $file = str_replace('*', '%', $file);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageTableMap::FILE, $file, $comparison);
+ }
+
+ /**
+ * Filter the query on the position column
+ *
+ * Example usage:
+ *
+ * $query->filterByPosition(1234); // WHERE position = 1234
+ * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
+ * $query->filterByPosition(array('min' => 12)); // WHERE position > 12
+ *
+ *
+ * @param mixed $position 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 ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function filterByPosition($position = null, $comparison = null)
+ {
+ if (is_array($position)) {
+ $useMinMax = false;
+ if (isset($position['min'])) {
+ $this->addUsingAlias(BrandImageTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($position['max'])) {
+ $this->addUsingAlias(BrandImageTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageTableMap::POSITION, $position, $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 ChildBrandImageQuery 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(BrandImageTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($createdAt['max'])) {
+ $this->addUsingAlias(BrandImageTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageTableMap::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 ChildBrandImageQuery 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(BrandImageTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($updatedAt['max'])) {
+ $this->addUsingAlias(BrandImageTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandImageTableMap::UPDATED_AT, $updatedAt, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Brand object
+ *
+ * @param \Thelia\Model\Brand|ObjectCollection $brand The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function filterByBrandRelatedByBrandId($brand, $comparison = null)
+ {
+ if ($brand instanceof \Thelia\Model\Brand) {
+ return $this
+ ->addUsingAlias(BrandImageTableMap::BRAND_ID, $brand->getId(), $comparison);
+ } elseif ($brand instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(BrandImageTableMap::BRAND_ID, $brand->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByBrandRelatedByBrandId() only accepts arguments of type \Thelia\Model\Brand or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the BrandRelatedByBrandId relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function joinBrandRelatedByBrandId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('BrandRelatedByBrandId');
+
+ // 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, 'BrandRelatedByBrandId');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the BrandRelatedByBrandId relation Brand 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\BrandQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandRelatedByBrandIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinBrandRelatedByBrandId($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandRelatedByBrandId', '\Thelia\Model\BrandQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Brand object
+ *
+ * @param \Thelia\Model\Brand|ObjectCollection $brand the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function filterByBrandRelatedByLogoImageId($brand, $comparison = null)
+ {
+ if ($brand instanceof \Thelia\Model\Brand) {
+ return $this
+ ->addUsingAlias(BrandImageTableMap::ID, $brand->getLogoImageId(), $comparison);
+ } elseif ($brand instanceof ObjectCollection) {
+ return $this
+ ->useBrandRelatedByLogoImageIdQuery()
+ ->filterByPrimaryKeys($brand->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByBrandRelatedByLogoImageId() only accepts arguments of type \Thelia\Model\Brand or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the BrandRelatedByLogoImageId relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function joinBrandRelatedByLogoImageId($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('BrandRelatedByLogoImageId');
+
+ // 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, 'BrandRelatedByLogoImageId');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the BrandRelatedByLogoImageId relation Brand 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\BrandQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandRelatedByLogoImageIdQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinBrandRelatedByLogoImageId($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandRelatedByLogoImageId', '\Thelia\Model\BrandQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\BrandImageI18n object
+ *
+ * @param \Thelia\Model\BrandImageI18n|ObjectCollection $brandImageI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function filterByBrandImageI18n($brandImageI18n, $comparison = null)
+ {
+ if ($brandImageI18n instanceof \Thelia\Model\BrandImageI18n) {
+ return $this
+ ->addUsingAlias(BrandImageTableMap::ID, $brandImageI18n->getId(), $comparison);
+ } elseif ($brandImageI18n instanceof ObjectCollection) {
+ return $this
+ ->useBrandImageI18nQuery()
+ ->filterByPrimaryKeys($brandImageI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByBrandImageI18n() only accepts arguments of type \Thelia\Model\BrandImageI18n or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the BrandImageI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function joinBrandImageI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('BrandImageI18n');
+
+ // 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, 'BrandImageI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the BrandImageI18n relation BrandImageI18n 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\BrandImageI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandImageI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinBrandImageI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandImageI18n', '\Thelia\Model\BrandImageI18nQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildBrandImage $brandImage Object to remove from the list of results
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function prune($brandImage = null)
+ {
+ if ($brandImage) {
+ $this->addUsingAlias(BrandImageTableMap::ID, $brandImage->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the brand_image 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(BrandImageTableMap::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).
+ BrandImageTableMap::clearInstancePool();
+ BrandImageTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildBrandImage or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildBrandImage 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(BrandImageTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(BrandImageTableMap::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();
+
+
+ BrandImageTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ BrandImageTableMap::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 ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function recentlyUpdated($nbDays = 7)
+ {
+ return $this->addUsingAlias(BrandImageTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Filter by the latest created
+ *
+ * @param int $nbDays Maximum age of in days
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function recentlyCreated($nbDays = 7)
+ {
+ return $this->addUsingAlias(BrandImageTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Order by update date desc
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function lastUpdatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(BrandImageTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by update date asc
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function firstUpdatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(BrandImageTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by create date desc
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function lastCreatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(BrandImageTableMap::CREATED_AT);
+ }
+
+ /**
+ * Order by create date asc
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function firstCreatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(BrandImageTableMap::CREATED_AT);
+ }
+
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'BrandImageI18n';
+
+ return $this
+ ->joinBrandImageI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ChildBrandImageQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('BrandImageI18n');
+ $this->with['BrandImageI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ChildBrandImageI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandImageI18n', '\Thelia\Model\BrandImageI18nQuery');
+ }
+
+} // BrandImageQuery
diff --git a/core/lib/Thelia/Model/Base/BrandQuery.php b/core/lib/Thelia/Model/Base/BrandQuery.php
new file mode 100644
index 000000000..e9eede241
--- /dev/null
+++ b/core/lib/Thelia/Model/Base/BrandQuery.php
@@ -0,0 +1,1089 @@
+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 ChildBrand|array|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = BrandTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getServiceContainer()->getReadConnection(BrandTableMap::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 ChildBrand A model object, or null if the key is not found
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `VISIBLE`, `POSITION`, `LOGO_IMAGE_ID`, `CREATED_AT`, `UPDATED_AT` FROM `brand` 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 ChildBrand();
+ $obj->hydrate($row);
+ BrandTableMap::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 ChildBrand|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 ChildBrandQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(BrandTableMap::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 ChildBrandQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(BrandTableMap::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 ChildBrandQuery 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(BrandTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(BrandTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandTableMap::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the visible column
+ *
+ * Example usage:
+ *
+ * $query->filterByVisible(1234); // WHERE visible = 1234
+ * $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
+ * $query->filterByVisible(array('min' => 12)); // WHERE visible > 12
+ *
+ *
+ * @param mixed $visible 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 ChildBrandQuery The current query, for fluid interface
+ */
+ public function filterByVisible($visible = null, $comparison = null)
+ {
+ if (is_array($visible)) {
+ $useMinMax = false;
+ if (isset($visible['min'])) {
+ $this->addUsingAlias(BrandTableMap::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($visible['max'])) {
+ $this->addUsingAlias(BrandTableMap::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandTableMap::VISIBLE, $visible, $comparison);
+ }
+
+ /**
+ * Filter the query on the position column
+ *
+ * Example usage:
+ *
+ * $query->filterByPosition(1234); // WHERE position = 1234
+ * $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
+ * $query->filterByPosition(array('min' => 12)); // WHERE position > 12
+ *
+ *
+ * @param mixed $position 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 ChildBrandQuery The current query, for fluid interface
+ */
+ public function filterByPosition($position = null, $comparison = null)
+ {
+ if (is_array($position)) {
+ $useMinMax = false;
+ if (isset($position['min'])) {
+ $this->addUsingAlias(BrandTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($position['max'])) {
+ $this->addUsingAlias(BrandTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandTableMap::POSITION, $position, $comparison);
+ }
+
+ /**
+ * Filter the query on the logo_image_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByLogoImageId(1234); // WHERE logo_image_id = 1234
+ * $query->filterByLogoImageId(array(12, 34)); // WHERE logo_image_id IN (12, 34)
+ * $query->filterByLogoImageId(array('min' => 12)); // WHERE logo_image_id > 12
+ *
+ *
+ * @see filterByBrandImageRelatedByLogoImageId()
+ *
+ * @param mixed $logoImageId 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 ChildBrandQuery The current query, for fluid interface
+ */
+ public function filterByLogoImageId($logoImageId = null, $comparison = null)
+ {
+ if (is_array($logoImageId)) {
+ $useMinMax = false;
+ if (isset($logoImageId['min'])) {
+ $this->addUsingAlias(BrandTableMap::LOGO_IMAGE_ID, $logoImageId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($logoImageId['max'])) {
+ $this->addUsingAlias(BrandTableMap::LOGO_IMAGE_ID, $logoImageId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandTableMap::LOGO_IMAGE_ID, $logoImageId, $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 ChildBrandQuery 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(BrandTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($createdAt['max'])) {
+ $this->addUsingAlias(BrandTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandTableMap::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 ChildBrandQuery 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(BrandTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($updatedAt['max'])) {
+ $this->addUsingAlias(BrandTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(BrandTableMap::UPDATED_AT, $updatedAt, $comparison);
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\BrandImage object
+ *
+ * @param \Thelia\Model\BrandImage|ObjectCollection $brandImage The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function filterByBrandImageRelatedByLogoImageId($brandImage, $comparison = null)
+ {
+ if ($brandImage instanceof \Thelia\Model\BrandImage) {
+ return $this
+ ->addUsingAlias(BrandTableMap::LOGO_IMAGE_ID, $brandImage->getId(), $comparison);
+ } elseif ($brandImage instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(BrandTableMap::LOGO_IMAGE_ID, $brandImage->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByBrandImageRelatedByLogoImageId() only accepts arguments of type \Thelia\Model\BrandImage or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the BrandImageRelatedByLogoImageId relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function joinBrandImageRelatedByLogoImageId($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('BrandImageRelatedByLogoImageId');
+
+ // 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, 'BrandImageRelatedByLogoImageId');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the BrandImageRelatedByLogoImageId relation BrandImage 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\BrandImageQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandImageRelatedByLogoImageIdQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinBrandImageRelatedByLogoImageId($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandImageRelatedByLogoImageId', '\Thelia\Model\BrandImageQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\Product object
+ *
+ * @param \Thelia\Model\Product|ObjectCollection $product the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function filterByProduct($product, $comparison = null)
+ {
+ if ($product instanceof \Thelia\Model\Product) {
+ return $this
+ ->addUsingAlias(BrandTableMap::ID, $product->getBrandId(), $comparison);
+ } elseif ($product instanceof ObjectCollection) {
+ return $this
+ ->useProductQuery()
+ ->filterByPrimaryKeys($product->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByProduct() only accepts arguments of type \Thelia\Model\Product or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Product relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function joinProduct($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Product');
+
+ // 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, 'Product');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Product relation Product 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\ProductQuery A secondary query class using the current class as primary query
+ */
+ public function useProductQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinProduct($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\BrandDocument object
+ *
+ * @param \Thelia\Model\BrandDocument|ObjectCollection $brandDocument the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function filterByBrandDocument($brandDocument, $comparison = null)
+ {
+ if ($brandDocument instanceof \Thelia\Model\BrandDocument) {
+ return $this
+ ->addUsingAlias(BrandTableMap::ID, $brandDocument->getBrandId(), $comparison);
+ } elseif ($brandDocument instanceof ObjectCollection) {
+ return $this
+ ->useBrandDocumentQuery()
+ ->filterByPrimaryKeys($brandDocument->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByBrandDocument() only accepts arguments of type \Thelia\Model\BrandDocument or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the BrandDocument relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function joinBrandDocument($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('BrandDocument');
+
+ // 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, 'BrandDocument');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the BrandDocument relation BrandDocument 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\BrandDocumentQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandDocumentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinBrandDocument($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandDocument', '\Thelia\Model\BrandDocumentQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\BrandImage object
+ *
+ * @param \Thelia\Model\BrandImage|ObjectCollection $brandImage the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function filterByBrandImageRelatedByBrandId($brandImage, $comparison = null)
+ {
+ if ($brandImage instanceof \Thelia\Model\BrandImage) {
+ return $this
+ ->addUsingAlias(BrandTableMap::ID, $brandImage->getBrandId(), $comparison);
+ } elseif ($brandImage instanceof ObjectCollection) {
+ return $this
+ ->useBrandImageRelatedByBrandIdQuery()
+ ->filterByPrimaryKeys($brandImage->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByBrandImageRelatedByBrandId() only accepts arguments of type \Thelia\Model\BrandImage or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the BrandImageRelatedByBrandId relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function joinBrandImageRelatedByBrandId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('BrandImageRelatedByBrandId');
+
+ // 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, 'BrandImageRelatedByBrandId');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the BrandImageRelatedByBrandId relation BrandImage 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\BrandImageQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandImageRelatedByBrandIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinBrandImageRelatedByBrandId($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandImageRelatedByBrandId', '\Thelia\Model\BrandImageQuery');
+ }
+
+ /**
+ * Filter the query by a related \Thelia\Model\BrandI18n object
+ *
+ * @param \Thelia\Model\BrandI18n|ObjectCollection $brandI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function filterByBrandI18n($brandI18n, $comparison = null)
+ {
+ if ($brandI18n instanceof \Thelia\Model\BrandI18n) {
+ return $this
+ ->addUsingAlias(BrandTableMap::ID, $brandI18n->getId(), $comparison);
+ } elseif ($brandI18n instanceof ObjectCollection) {
+ return $this
+ ->useBrandI18nQuery()
+ ->filterByPrimaryKeys($brandI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByBrandI18n() only accepts arguments of type \Thelia\Model\BrandI18n or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the BrandI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function joinBrandI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('BrandI18n');
+
+ // 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, 'BrandI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the BrandI18n relation BrandI18n 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\BrandI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinBrandI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandI18n', '\Thelia\Model\BrandI18nQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ChildBrand $brand Object to remove from the list of results
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function prune($brand = null)
+ {
+ if ($brand) {
+ $this->addUsingAlias(BrandTableMap::ID, $brand->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Deletes all rows from the brand 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(BrandTableMap::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).
+ BrandTableMap::clearInstancePool();
+ BrandTableMap::clearRelatedInstancePool();
+
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $affectedRows;
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ChildBrand or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ChildBrand 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(BrandTableMap::DATABASE_NAME);
+ }
+
+ $criteria = $this;
+
+ // Set the correct dbName
+ $criteria->setDbName(BrandTableMap::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();
+
+
+ BrandTableMap::removeInstanceFromPool($criteria);
+
+ $affectedRows += ModelCriteria::delete($con);
+ BrandTableMap::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 ChildBrandQuery The current query, for fluid interface
+ */
+ public function recentlyUpdated($nbDays = 7)
+ {
+ return $this->addUsingAlias(BrandTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Filter by the latest created
+ *
+ * @param int $nbDays Maximum age of in days
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function recentlyCreated($nbDays = 7)
+ {
+ return $this->addUsingAlias(BrandTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
+ }
+
+ /**
+ * Order by update date desc
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function lastUpdatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(BrandTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by update date asc
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function firstUpdatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(BrandTableMap::UPDATED_AT);
+ }
+
+ /**
+ * Order by create date desc
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function lastCreatedFirst()
+ {
+ return $this->addDescendingOrderByColumn(BrandTableMap::CREATED_AT);
+ }
+
+ /**
+ * Order by create date asc
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function firstCreatedFirst()
+ {
+ return $this->addAscendingOrderByColumn(BrandTableMap::CREATED_AT);
+ }
+
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'BrandI18n';
+
+ return $this
+ ->joinBrandI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ChildBrandQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('BrandI18n');
+ $this->with['BrandI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ChildBrandI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'BrandI18n', '\Thelia\Model\BrandI18nQuery');
+ }
+
+} // BrandQuery
diff --git a/core/lib/Thelia/Model/Base/Coupon.php b/core/lib/Thelia/Model/Base/Coupon.php
index e66d7d16f..a9351ece2 100644
--- a/core/lib/Thelia/Model/Base/Coupon.php
+++ b/core/lib/Thelia/Model/Base/Coupon.php
@@ -169,6 +169,18 @@ abstract class Coupon implements ActiveRecordInterface
*/
protected $version;
+ /**
+ * The value for the version_created_at field.
+ * @var string
+ */
+ protected $version_created_at;
+
+ /**
+ * The value for the version_created_by field.
+ * @var string
+ */
+ protected $version_created_by;
+
/**
* @var ObjectCollection|ChildCouponCountry[] Collection to store aggregation of ChildCouponCountry objects.
*/
@@ -766,6 +778,37 @@ abstract class Coupon implements ActiveRecordInterface
return $this->version;
}
+ /**
+ * Get the [optionally formatted] temporal [version_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 getVersionCreatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->version_created_at;
+ } else {
+ return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Get the [version_created_by] column value.
+ *
+ * @return string
+ */
+ public function getVersionCreatedBy()
+ {
+
+ return $this->version_created_by;
+ }
+
/**
* Set the value of [id] column.
*
@@ -1150,6 +1193,48 @@ abstract class Coupon implements ActiveRecordInterface
return $this;
} // setVersion()
+ /**
+ * Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\Coupon The current object (for fluent API support)
+ */
+ public function setVersionCreatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->version_created_at !== null || $dt !== null) {
+ if ($dt !== $this->version_created_at) {
+ $this->version_created_at = $dt;
+ $this->modifiedColumns[CouponTableMap::VERSION_CREATED_AT] = true;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setVersionCreatedAt()
+
+ /**
+ * Set the value of [version_created_by] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\Coupon The current object (for fluent API support)
+ */
+ public function setVersionCreatedBy($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->version_created_by !== $v) {
+ $this->version_created_by = $v;
+ $this->modifiedColumns[CouponTableMap::VERSION_CREATED_BY] = true;
+ }
+
+
+ return $this;
+ } // setVersionCreatedBy()
+
/**
* Indicates whether the columns in this object are only set to default values.
*
@@ -1247,6 +1332,15 @@ abstract class Coupon implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : CouponTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CouponTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified();
$this->setNew(false);
@@ -1255,7 +1349,7 @@ abstract class Coupon implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 16; // 16 = CouponTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 18; // 18 = CouponTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Coupon object", 0, $e);
@@ -1400,6 +1494,9 @@ abstract class Coupon implements ActiveRecordInterface
// versionable behavior
if ($this->isVersioningNecessary()) {
$this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1);
+ if (!$this->isColumnModified(CouponTableMap::VERSION_CREATED_AT)) {
+ $this->setVersionCreatedAt(time());
+ }
$createVersion = true; // for postSave hook
}
if ($isInsert) {
@@ -1711,6 +1808,12 @@ abstract class Coupon implements ActiveRecordInterface
if ($this->isColumnModified(CouponTableMap::VERSION)) {
$modifiedColumns[':p' . $index++] = '`VERSION`';
}
+ if ($this->isColumnModified(CouponTableMap::VERSION_CREATED_AT)) {
+ $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
+ }
+ if ($this->isColumnModified(CouponTableMap::VERSION_CREATED_BY)) {
+ $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
+ }
$sql = sprintf(
'INSERT INTO `coupon` (%s) VALUES (%s)',
@@ -1770,6 +1873,12 @@ abstract class Coupon implements ActiveRecordInterface
case '`VERSION`':
$stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
break;
+ case '`VERSION_CREATED_AT`':
+ $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ break;
+ case '`VERSION_CREATED_BY`':
+ $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
+ break;
}
}
$stmt->execute();
@@ -1880,6 +1989,12 @@ abstract class Coupon implements ActiveRecordInterface
case 15:
return $this->getVersion();
break;
+ case 16:
+ return $this->getVersionCreatedAt();
+ break;
+ case 17:
+ return $this->getVersionCreatedBy();
+ break;
default:
return null;
break;
@@ -1925,6 +2040,8 @@ abstract class Coupon implements ActiveRecordInterface
$keys[13] => $this->getCreatedAt(),
$keys[14] => $this->getUpdatedAt(),
$keys[15] => $this->getVersion(),
+ $keys[16] => $this->getVersionCreatedAt(),
+ $keys[17] => $this->getVersionCreatedBy(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -2029,6 +2146,12 @@ abstract class Coupon implements ActiveRecordInterface
case 15:
$this->setVersion($value);
break;
+ case 16:
+ $this->setVersionCreatedAt($value);
+ break;
+ case 17:
+ $this->setVersionCreatedBy($value);
+ break;
} // switch()
}
@@ -2069,6 +2192,8 @@ abstract class Coupon implements ActiveRecordInterface
if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setVersion($arr[$keys[15]]);
+ if (array_key_exists($keys[16], $arr)) $this->setVersionCreatedAt($arr[$keys[16]]);
+ if (array_key_exists($keys[17], $arr)) $this->setVersionCreatedBy($arr[$keys[17]]);
}
/**
@@ -2096,6 +2221,8 @@ abstract class Coupon implements ActiveRecordInterface
if ($this->isColumnModified(CouponTableMap::CREATED_AT)) $criteria->add(CouponTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(CouponTableMap::UPDATED_AT)) $criteria->add(CouponTableMap::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(CouponTableMap::VERSION)) $criteria->add(CouponTableMap::VERSION, $this->version);
+ if ($this->isColumnModified(CouponTableMap::VERSION_CREATED_AT)) $criteria->add(CouponTableMap::VERSION_CREATED_AT, $this->version_created_at);
+ if ($this->isColumnModified(CouponTableMap::VERSION_CREATED_BY)) $criteria->add(CouponTableMap::VERSION_CREATED_BY, $this->version_created_by);
return $criteria;
}
@@ -2174,6 +2301,8 @@ abstract class Coupon implements ActiveRecordInterface
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion());
+ $copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
+ $copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of
@@ -4019,6 +4148,8 @@ abstract class Coupon implements ActiveRecordInterface
$this->created_at = null;
$this->updated_at = null;
$this->version = null;
+ $this->version_created_at = null;
+ $this->version_created_by = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
$this->applyDefaultValues();
@@ -4354,6 +4485,8 @@ abstract class Coupon implements ActiveRecordInterface
$version->setCreatedAt($this->getCreatedAt());
$version->setUpdatedAt($this->getUpdatedAt());
$version->setVersion($this->getVersion());
+ $version->setVersionCreatedAt($this->getVersionCreatedAt());
+ $version->setVersionCreatedBy($this->getVersionCreatedBy());
$version->setCoupon($this);
$version->save($con);
@@ -4407,6 +4540,8 @@ abstract class Coupon implements ActiveRecordInterface
$this->setCreatedAt($version->getCreatedAt());
$this->setUpdatedAt($version->getUpdatedAt());
$this->setVersion($version->getVersion());
+ $this->setVersionCreatedAt($version->getVersionCreatedAt());
+ $this->setVersionCreatedBy($version->getVersionCreatedBy());
return $this;
}
@@ -4548,6 +4683,8 @@ abstract class Coupon implements ActiveRecordInterface
$toVersionNumber = $toVersion['Version'];
$ignoredColumns = array_merge(array(
'Version',
+ 'VersionCreatedAt',
+ 'VersionCreatedBy',
), $ignoredColumns);
$diff = array();
foreach ($fromVersion as $key => $value) {
diff --git a/core/lib/Thelia/Model/Base/CouponQuery.php b/core/lib/Thelia/Model/Base/CouponQuery.php
index 9e2a4a8a7..54a6466de 100644
--- a/core/lib/Thelia/Model/Base/CouponQuery.php
+++ b/core/lib/Thelia/Model/Base/CouponQuery.php
@@ -38,6 +38,8 @@ use Thelia\Model\Map\CouponTableMap;
* @method ChildCouponQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCouponQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildCouponQuery orderByVersion($order = Criteria::ASC) Order by the version column
+ * @method ChildCouponQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
+ * @method ChildCouponQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
*
* @method ChildCouponQuery groupById() Group by the id column
* @method ChildCouponQuery groupByCode() Group by the code column
@@ -55,6 +57,8 @@ use Thelia\Model\Map\CouponTableMap;
* @method ChildCouponQuery groupByCreatedAt() Group by the created_at column
* @method ChildCouponQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildCouponQuery groupByVersion() Group by the version column
+ * @method ChildCouponQuery groupByVersionCreatedAt() Group by the version_created_at column
+ * @method ChildCouponQuery groupByVersionCreatedBy() Group by the version_created_by column
*
* @method ChildCouponQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCouponQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -99,6 +103,8 @@ use Thelia\Model\Map\CouponTableMap;
* @method ChildCoupon findOneByCreatedAt(string $created_at) Return the first ChildCoupon filtered by the created_at column
* @method ChildCoupon findOneByUpdatedAt(string $updated_at) Return the first ChildCoupon filtered by the updated_at column
* @method ChildCoupon findOneByVersion(int $version) Return the first ChildCoupon filtered by the version column
+ * @method ChildCoupon findOneByVersionCreatedAt(string $version_created_at) Return the first ChildCoupon filtered by the version_created_at column
+ * @method ChildCoupon findOneByVersionCreatedBy(string $version_created_by) Return the first ChildCoupon filtered by the version_created_by column
*
* @method array findById(int $id) Return ChildCoupon objects filtered by the id column
* @method array findByCode(string $code) Return ChildCoupon objects filtered by the code column
@@ -116,6 +122,8 @@ use Thelia\Model\Map\CouponTableMap;
* @method array findByCreatedAt(string $created_at) Return ChildCoupon objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCoupon objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildCoupon objects filtered by the version column
+ * @method array findByVersionCreatedAt(string $version_created_at) Return ChildCoupon objects filtered by the version_created_at column
+ * @method array findByVersionCreatedBy(string $version_created_by) Return ChildCoupon objects filtered by the version_created_by column
*
*/
abstract class CouponQuery extends ModelCriteria
@@ -211,7 +219,7 @@ abstract class CouponQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon` WHERE `ID` = :p0';
+ $sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `coupon` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -830,6 +838,78 @@ abstract class CouponQuery extends ModelCriteria
return $this->addUsingAlias(CouponTableMap::VERSION, $version, $comparison);
}
+ /**
+ * Filter the query on the version_created_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
+ * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
+ * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
+ *
+ *
+ * @param mixed $versionCreatedAt 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 ChildCouponQuery The current query, for fluid interface
+ */
+ public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
+ {
+ if (is_array($versionCreatedAt)) {
+ $useMinMax = false;
+ if (isset($versionCreatedAt['min'])) {
+ $this->addUsingAlias(CouponTableMap::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($versionCreatedAt['max'])) {
+ $this->addUsingAlias(CouponTableMap::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CouponTableMap::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
+ }
+
+ /**
+ * Filter the query on the version_created_by column
+ *
+ * Example usage:
+ *
+ * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
+ * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
+ *
+ *
+ * @param string $versionCreatedBy 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 ChildCouponQuery The current query, for fluid interface
+ */
+ public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($versionCreatedBy)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
+ $versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CouponTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
+ }
+
/**
* Filter the query by a related \Thelia\Model\CouponCountry object
*
diff --git a/core/lib/Thelia/Model/Base/CouponVersion.php b/core/lib/Thelia/Model/Base/CouponVersion.php
index 7b26f06ba..cb98a50f8 100644
--- a/core/lib/Thelia/Model/Base/CouponVersion.php
+++ b/core/lib/Thelia/Model/Base/CouponVersion.php
@@ -152,6 +152,18 @@ abstract class CouponVersion implements ActiveRecordInterface
*/
protected $version;
+ /**
+ * The value for the version_created_at field.
+ * @var string
+ */
+ protected $version_created_at;
+
+ /**
+ * The value for the version_created_by field.
+ * @var string
+ */
+ protected $version_created_by;
+
/**
* @var Coupon
*/
@@ -639,6 +651,37 @@ abstract class CouponVersion implements ActiveRecordInterface
return $this->version;
}
+ /**
+ * Get the [optionally formatted] temporal [version_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 getVersionCreatedAt($format = NULL)
+ {
+ if ($format === null) {
+ return $this->version_created_at;
+ } else {
+ return $this->version_created_at instanceof \DateTime ? $this->version_created_at->format($format) : null;
+ }
+ }
+
+ /**
+ * Get the [version_created_by] column value.
+ *
+ * @return string
+ */
+ public function getVersionCreatedBy()
+ {
+
+ return $this->version_created_by;
+ }
+
/**
* Set the value of [id] column.
*
@@ -1027,6 +1070,48 @@ abstract class CouponVersion implements ActiveRecordInterface
return $this;
} // setVersion()
+ /**
+ * Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or \DateTime value.
+ * Empty strings are treated as NULL.
+ * @return \Thelia\Model\CouponVersion The current object (for fluent API support)
+ */
+ public function setVersionCreatedAt($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, '\DateTime');
+ if ($this->version_created_at !== null || $dt !== null) {
+ if ($dt !== $this->version_created_at) {
+ $this->version_created_at = $dt;
+ $this->modifiedColumns[CouponVersionTableMap::VERSION_CREATED_AT] = true;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setVersionCreatedAt()
+
+ /**
+ * Set the value of [version_created_by] column.
+ *
+ * @param string $v new value
+ * @return \Thelia\Model\CouponVersion The current object (for fluent API support)
+ */
+ public function setVersionCreatedBy($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->version_created_by !== $v) {
+ $this->version_created_by = $v;
+ $this->modifiedColumns[CouponVersionTableMap::VERSION_CREATED_BY] = true;
+ }
+
+
+ return $this;
+ } // setVersionCreatedBy()
+
/**
* Indicates whether the columns in this object are only set to default values.
*
@@ -1124,6 +1209,15 @@ abstract class CouponVersion implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : CouponVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : CouponVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ if ($col === '0000-00-00 00:00:00') {
+ $col = null;
+ }
+ $this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 17 + $startcol : CouponVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified();
$this->setNew(false);
@@ -1132,7 +1226,7 @@ abstract class CouponVersion implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 16; // 16 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 18; // 18 = CouponVersionTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\CouponVersion object", 0, $e);
@@ -1401,6 +1495,12 @@ abstract class CouponVersion implements ActiveRecordInterface
if ($this->isColumnModified(CouponVersionTableMap::VERSION)) {
$modifiedColumns[':p' . $index++] = '`VERSION`';
}
+ if ($this->isColumnModified(CouponVersionTableMap::VERSION_CREATED_AT)) {
+ $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
+ }
+ if ($this->isColumnModified(CouponVersionTableMap::VERSION_CREATED_BY)) {
+ $modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
+ }
$sql = sprintf(
'INSERT INTO `coupon_version` (%s) VALUES (%s)',
@@ -1460,6 +1560,12 @@ abstract class CouponVersion implements ActiveRecordInterface
case '`VERSION`':
$stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
break;
+ case '`VERSION_CREATED_AT`':
+ $stmt->bindValue($identifier, $this->version_created_at ? $this->version_created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
+ break;
+ case '`VERSION_CREATED_BY`':
+ $stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
+ break;
}
}
$stmt->execute();
@@ -1563,6 +1669,12 @@ abstract class CouponVersion implements ActiveRecordInterface
case 15:
return $this->getVersion();
break;
+ case 16:
+ return $this->getVersionCreatedAt();
+ break;
+ case 17:
+ return $this->getVersionCreatedBy();
+ break;
default:
return null;
break;
@@ -1608,6 +1720,8 @@ abstract class CouponVersion implements ActiveRecordInterface
$keys[13] => $this->getCreatedAt(),
$keys[14] => $this->getUpdatedAt(),
$keys[15] => $this->getVersion(),
+ $keys[16] => $this->getVersionCreatedAt(),
+ $keys[17] => $this->getVersionCreatedBy(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1700,6 +1814,12 @@ abstract class CouponVersion implements ActiveRecordInterface
case 15:
$this->setVersion($value);
break;
+ case 16:
+ $this->setVersionCreatedAt($value);
+ break;
+ case 17:
+ $this->setVersionCreatedBy($value);
+ break;
} // switch()
}
@@ -1740,6 +1860,8 @@ abstract class CouponVersion implements ActiveRecordInterface
if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
if (array_key_exists($keys[15], $arr)) $this->setVersion($arr[$keys[15]]);
+ if (array_key_exists($keys[16], $arr)) $this->setVersionCreatedAt($arr[$keys[16]]);
+ if (array_key_exists($keys[17], $arr)) $this->setVersionCreatedBy($arr[$keys[17]]);
}
/**
@@ -1767,6 +1889,8 @@ abstract class CouponVersion implements ActiveRecordInterface
if ($this->isColumnModified(CouponVersionTableMap::CREATED_AT)) $criteria->add(CouponVersionTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(CouponVersionTableMap::UPDATED_AT)) $criteria->add(CouponVersionTableMap::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(CouponVersionTableMap::VERSION)) $criteria->add(CouponVersionTableMap::VERSION, $this->version);
+ if ($this->isColumnModified(CouponVersionTableMap::VERSION_CREATED_AT)) $criteria->add(CouponVersionTableMap::VERSION_CREATED_AT, $this->version_created_at);
+ if ($this->isColumnModified(CouponVersionTableMap::VERSION_CREATED_BY)) $criteria->add(CouponVersionTableMap::VERSION_CREATED_BY, $this->version_created_by);
return $criteria;
}
@@ -1853,6 +1977,8 @@ abstract class CouponVersion implements ActiveRecordInterface
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion());
+ $copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
+ $copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
if ($makeNew) {
$copyObj->setNew(true);
}
@@ -1952,6 +2078,8 @@ abstract class CouponVersion implements ActiveRecordInterface
$this->created_at = null;
$this->updated_at = null;
$this->version = null;
+ $this->version_created_at = null;
+ $this->version_created_by = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
$this->applyDefaultValues();
diff --git a/core/lib/Thelia/Model/Base/CouponVersionQuery.php b/core/lib/Thelia/Model/Base/CouponVersionQuery.php
index 081b8f04a..3dba632aa 100644
--- a/core/lib/Thelia/Model/Base/CouponVersionQuery.php
+++ b/core/lib/Thelia/Model/Base/CouponVersionQuery.php
@@ -37,6 +37,8 @@ use Thelia\Model\Map\CouponVersionTableMap;
* @method ChildCouponVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildCouponVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildCouponVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
+ * @method ChildCouponVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
+ * @method ChildCouponVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
*
* @method ChildCouponVersionQuery groupById() Group by the id column
* @method ChildCouponVersionQuery groupByCode() Group by the code column
@@ -54,6 +56,8 @@ use Thelia\Model\Map\CouponVersionTableMap;
* @method ChildCouponVersionQuery groupByCreatedAt() Group by the created_at column
* @method ChildCouponVersionQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildCouponVersionQuery groupByVersion() Group by the version column
+ * @method ChildCouponVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
+ * @method ChildCouponVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
*
* @method ChildCouponVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildCouponVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -82,6 +86,8 @@ use Thelia\Model\Map\CouponVersionTableMap;
* @method ChildCouponVersion findOneByCreatedAt(string $created_at) Return the first ChildCouponVersion filtered by the created_at column
* @method ChildCouponVersion findOneByUpdatedAt(string $updated_at) Return the first ChildCouponVersion filtered by the updated_at column
* @method ChildCouponVersion findOneByVersion(int $version) Return the first ChildCouponVersion filtered by the version column
+ * @method ChildCouponVersion findOneByVersionCreatedAt(string $version_created_at) Return the first ChildCouponVersion filtered by the version_created_at column
+ * @method ChildCouponVersion findOneByVersionCreatedBy(string $version_created_by) Return the first ChildCouponVersion filtered by the version_created_by column
*
* @method array findById(int $id) Return ChildCouponVersion objects filtered by the id column
* @method array findByCode(string $code) Return ChildCouponVersion objects filtered by the code column
@@ -99,6 +105,8 @@ use Thelia\Model\Map\CouponVersionTableMap;
* @method array findByCreatedAt(string $created_at) Return ChildCouponVersion objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildCouponVersion objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildCouponVersion objects filtered by the version column
+ * @method array findByVersionCreatedAt(string $version_created_at) Return ChildCouponVersion objects filtered by the version_created_at column
+ * @method array findByVersionCreatedBy(string $version_created_by) Return ChildCouponVersion objects filtered by the version_created_by column
*
*/
abstract class CouponVersionQuery extends ModelCriteria
@@ -187,7 +195,7 @@ abstract class CouponVersionQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION` FROM `coupon_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
+ $sql = 'SELECT `ID`, `CODE`, `TYPE`, `SERIALIZED_EFFECTS`, `IS_ENABLED`, `EXPIRATION_DATE`, `MAX_USAGE`, `IS_CUMULATIVE`, `IS_REMOVING_POSTAGE`, `IS_AVAILABLE_ON_SPECIAL_OFFERS`, `IS_USED`, `SERIALIZED_CONDITIONS`, `PER_CUSTOMER_USAGE_COUNT`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `coupon_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -820,6 +828,78 @@ abstract class CouponVersionQuery extends ModelCriteria
return $this->addUsingAlias(CouponVersionTableMap::VERSION, $version, $comparison);
}
+ /**
+ * Filter the query on the version_created_at column
+ *
+ * Example usage:
+ *
+ * $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
+ * $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
+ * $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
+ *
+ *
+ * @param mixed $versionCreatedAt 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 ChildCouponVersionQuery The current query, for fluid interface
+ */
+ public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
+ {
+ if (is_array($versionCreatedAt)) {
+ $useMinMax = false;
+ if (isset($versionCreatedAt['min'])) {
+ $this->addUsingAlias(CouponVersionTableMap::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($versionCreatedAt['max'])) {
+ $this->addUsingAlias(CouponVersionTableMap::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CouponVersionTableMap::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
+ }
+
+ /**
+ * Filter the query on the version_created_by column
+ *
+ * Example usage:
+ *
+ * $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
+ * $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
+ *
+ *
+ * @param string $versionCreatedBy 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 ChildCouponVersionQuery The current query, for fluid interface
+ */
+ public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($versionCreatedBy)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
+ $versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CouponVersionTableMap::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
+ }
+
/**
* Filter the query by a related \Thelia\Model\Coupon object
*
diff --git a/core/lib/Thelia/Model/Base/Product.php b/core/lib/Thelia/Model/Base/Product.php
index 9f93f3f3b..c6efc04b0 100644
--- a/core/lib/Thelia/Model/Base/Product.php
+++ b/core/lib/Thelia/Model/Base/Product.php
@@ -19,6 +19,8 @@ use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Accessory as ChildAccessory;
use Thelia\Model\AccessoryQuery as ChildAccessoryQuery;
+use Thelia\Model\Brand as ChildBrand;
+use Thelia\Model\BrandQuery as ChildBrandQuery;
use Thelia\Model\CartItem as ChildCartItem;
use Thelia\Model\CartItemQuery as ChildCartItemQuery;
use Thelia\Model\Category as ChildCategory;
@@ -120,6 +122,12 @@ abstract class Product implements ActiveRecordInterface
*/
protected $template_id;
+ /**
+ * The value for the brand_id field.
+ * @var int
+ */
+ protected $brand_id;
+
/**
* The value for the created_at field.
* @var string
@@ -161,6 +169,11 @@ abstract class Product implements ActiveRecordInterface
*/
protected $aTemplate;
+ /**
+ * @var Brand
+ */
+ protected $aBrand;
+
/**
* @var ObjectCollection|ChildProductCategory[] Collection to store aggregation of ChildProductCategory objects.
*/
@@ -695,6 +708,17 @@ abstract class Product implements ActiveRecordInterface
return $this->template_id;
}
+ /**
+ * Get the [brand_id] column value.
+ *
+ * @return int
+ */
+ public function getBrandId()
+ {
+
+ return $this->brand_id;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -911,6 +935,31 @@ abstract class Product implements ActiveRecordInterface
return $this;
} // setTemplateId()
+ /**
+ * Set the value of [brand_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\Product The current object (for fluent API support)
+ */
+ public function setBrandId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->brand_id !== $v) {
+ $this->brand_id = $v;
+ $this->modifiedColumns[ProductTableMap::BRAND_ID] = true;
+ }
+
+ if ($this->aBrand !== null && $this->aBrand->getId() !== $v) {
+ $this->aBrand = null;
+ }
+
+
+ return $this;
+ } // setBrandId()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -1083,28 +1132,31 @@ abstract class Product implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
$this->template_id = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductTableMap::translateFieldName('BrandId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->brand_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductTableMap::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 ? 7 + $startcol : ProductTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductTableMap::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;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : ProductTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified();
@@ -1114,7 +1166,7 @@ abstract class Product implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 11; // 11 = ProductTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 12; // 12 = ProductTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Product object", 0, $e);
@@ -1142,6 +1194,9 @@ abstract class Product implements ActiveRecordInterface
if ($this->aTemplate !== null && $this->template_id !== $this->aTemplate->getId()) {
$this->aTemplate = null;
}
+ if ($this->aBrand !== null && $this->brand_id !== $this->aBrand->getId()) {
+ $this->aBrand = null;
+ }
} // ensureConsistency
/**
@@ -1183,6 +1238,7 @@ abstract class Product implements ActiveRecordInterface
$this->aTaxRule = null;
$this->aTemplate = null;
+ $this->aBrand = null;
$this->collProductCategories = null;
$this->collFeatureProducts = null;
@@ -1361,6 +1417,13 @@ abstract class Product implements ActiveRecordInterface
$this->setTemplate($this->aTemplate);
}
+ if ($this->aBrand !== null) {
+ if ($this->aBrand->isModified() || $this->aBrand->isNew()) {
+ $affectedRows += $this->aBrand->save($con);
+ }
+ $this->setBrand($this->aBrand);
+ }
+
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
@@ -1684,6 +1747,9 @@ abstract class Product implements ActiveRecordInterface
if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) {
$modifiedColumns[':p' . $index++] = '`TEMPLATE_ID`';
}
+ if ($this->isColumnModified(ProductTableMap::BRAND_ID)) {
+ $modifiedColumns[':p' . $index++] = '`BRAND_ID`';
+ }
if ($this->isColumnModified(ProductTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = '`CREATED_AT`';
}
@@ -1728,6 +1794,9 @@ abstract class Product implements ActiveRecordInterface
case '`TEMPLATE_ID`':
$stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
break;
+ case '`BRAND_ID`':
+ $stmt->bindValue($identifier, $this->brand_id, PDO::PARAM_INT);
+ break;
case '`CREATED_AT`':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1824,18 +1893,21 @@ abstract class Product implements ActiveRecordInterface
return $this->getTemplateId();
break;
case 6:
- return $this->getCreatedAt();
+ return $this->getBrandId();
break;
case 7:
- return $this->getUpdatedAt();
+ return $this->getCreatedAt();
break;
case 8:
- return $this->getVersion();
+ return $this->getUpdatedAt();
break;
case 9:
- return $this->getVersionCreatedAt();
+ return $this->getVersion();
break;
case 10:
+ return $this->getVersionCreatedAt();
+ break;
+ case 11:
return $this->getVersionCreatedBy();
break;
default:
@@ -1873,11 +1945,12 @@ abstract class Product implements ActiveRecordInterface
$keys[3] => $this->getVisible(),
$keys[4] => $this->getPosition(),
$keys[5] => $this->getTemplateId(),
- $keys[6] => $this->getCreatedAt(),
- $keys[7] => $this->getUpdatedAt(),
- $keys[8] => $this->getVersion(),
- $keys[9] => $this->getVersionCreatedAt(),
- $keys[10] => $this->getVersionCreatedBy(),
+ $keys[6] => $this->getBrandId(),
+ $keys[7] => $this->getCreatedAt(),
+ $keys[8] => $this->getUpdatedAt(),
+ $keys[9] => $this->getVersion(),
+ $keys[10] => $this->getVersionCreatedAt(),
+ $keys[11] => $this->getVersionCreatedBy(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1891,6 +1964,9 @@ abstract class Product implements ActiveRecordInterface
if (null !== $this->aTemplate) {
$result['Template'] = $this->aTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
+ if (null !== $this->aBrand) {
+ $result['Brand'] = $this->aBrand->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
if (null !== $this->collProductCategories) {
$result['ProductCategories'] = $this->collProductCategories->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1977,18 +2053,21 @@ abstract class Product implements ActiveRecordInterface
$this->setTemplateId($value);
break;
case 6:
- $this->setCreatedAt($value);
+ $this->setBrandId($value);
break;
case 7:
- $this->setUpdatedAt($value);
+ $this->setCreatedAt($value);
break;
case 8:
- $this->setVersion($value);
+ $this->setUpdatedAt($value);
break;
case 9:
- $this->setVersionCreatedAt($value);
+ $this->setVersion($value);
break;
case 10:
+ $this->setVersionCreatedAt($value);
+ break;
+ case 11:
$this->setVersionCreatedBy($value);
break;
} // switch()
@@ -2021,11 +2100,12 @@ abstract class Product implements ActiveRecordInterface
if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setTemplateId($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]);
- if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]);
+ if (array_key_exists($keys[6], $arr)) $this->setBrandId($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setVersion($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedAt($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setVersionCreatedBy($arr[$keys[11]]);
}
/**
@@ -2043,6 +2123,7 @@ abstract class Product implements ActiveRecordInterface
if ($this->isColumnModified(ProductTableMap::VISIBLE)) $criteria->add(ProductTableMap::VISIBLE, $this->visible);
if ($this->isColumnModified(ProductTableMap::POSITION)) $criteria->add(ProductTableMap::POSITION, $this->position);
if ($this->isColumnModified(ProductTableMap::TEMPLATE_ID)) $criteria->add(ProductTableMap::TEMPLATE_ID, $this->template_id);
+ if ($this->isColumnModified(ProductTableMap::BRAND_ID)) $criteria->add(ProductTableMap::BRAND_ID, $this->brand_id);
if ($this->isColumnModified(ProductTableMap::CREATED_AT)) $criteria->add(ProductTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductTableMap::UPDATED_AT)) $criteria->add(ProductTableMap::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(ProductTableMap::VERSION)) $criteria->add(ProductTableMap::VERSION, $this->version);
@@ -2116,6 +2197,7 @@ abstract class Product implements ActiveRecordInterface
$copyObj->setVisible($this->getVisible());
$copyObj->setPosition($this->getPosition());
$copyObj->setTemplateId($this->getTemplateId());
+ $copyObj->setBrandId($this->getBrandId());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion());
@@ -2325,6 +2407,57 @@ abstract class Product implements ActiveRecordInterface
return $this->aTemplate;
}
+ /**
+ * Declares an association between this object and a ChildBrand object.
+ *
+ * @param ChildBrand $v
+ * @return \Thelia\Model\Product The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setBrand(ChildBrand $v = null)
+ {
+ if ($v === null) {
+ $this->setBrandId(NULL);
+ } else {
+ $this->setBrandId($v->getId());
+ }
+
+ $this->aBrand = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the ChildBrand object, it will not be re-added.
+ if ($v !== null) {
+ $v->addProduct($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated ChildBrand object
+ *
+ * @param ConnectionInterface $con Optional Connection object.
+ * @return ChildBrand The associated ChildBrand object.
+ * @throws PropelException
+ */
+ public function getBrand(ConnectionInterface $con = null)
+ {
+ if ($this->aBrand === null && ($this->brand_id !== null)) {
+ $this->aBrand = ChildBrandQuery::create()->findPk($this->brand_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->aBrand->addProducts($this);
+ */
+ }
+
+ return $this->aBrand;
+ }
+
/**
* Initializes a collection based on the name of a relation.
@@ -5492,6 +5625,7 @@ abstract class Product implements ActiveRecordInterface
$this->visible = null;
$this->position = null;
$this->template_id = null;
+ $this->brand_id = null;
$this->created_at = null;
$this->updated_at = null;
$this->version = null;
@@ -5609,6 +5743,7 @@ abstract class Product implements ActiveRecordInterface
$this->collProductsRelatedByProductId = null;
$this->aTaxRule = null;
$this->aTemplate = null;
+ $this->aBrand = null;
}
/**
@@ -5956,6 +6091,7 @@ abstract class Product implements ActiveRecordInterface
$version->setVisible($this->getVisible());
$version->setPosition($this->getPosition());
$version->setTemplateId($this->getTemplateId());
+ $version->setBrandId($this->getBrandId());
$version->setCreatedAt($this->getCreatedAt());
$version->setUpdatedAt($this->getUpdatedAt());
$version->setVersion($this->getVersion());
@@ -6004,6 +6140,7 @@ abstract class Product implements ActiveRecordInterface
$this->setVisible($version->getVisible());
$this->setPosition($version->getPosition());
$this->setTemplateId($version->getTemplateId());
+ $this->setBrandId($version->getBrandId());
$this->setCreatedAt($version->getCreatedAt());
$this->setUpdatedAt($version->getUpdatedAt());
$this->setVersion($version->getVersion());
diff --git a/core/lib/Thelia/Model/Base/ProductQuery.php b/core/lib/Thelia/Model/Base/ProductQuery.php
index 352b5cc68..0c9a195e1 100644
--- a/core/lib/Thelia/Model/Base/ProductQuery.php
+++ b/core/lib/Thelia/Model/Base/ProductQuery.php
@@ -28,6 +28,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery orderByVisible($order = Criteria::ASC) Order by the visible column
* @method ChildProductQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildProductQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
+ * @method ChildProductQuery orderByBrandId($order = Criteria::ASC) Order by the brand_id column
* @method ChildProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildProductQuery orderByVersion($order = Criteria::ASC) Order by the version column
@@ -40,6 +41,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery groupByVisible() Group by the visible column
* @method ChildProductQuery groupByPosition() Group by the position column
* @method ChildProductQuery groupByTemplateId() Group by the template_id column
+ * @method ChildProductQuery groupByBrandId() Group by the brand_id column
* @method ChildProductQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildProductQuery groupByVersion() Group by the version column
@@ -58,6 +60,10 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProductQuery rightJoinTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Template relation
* @method ChildProductQuery innerJoinTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the Template relation
*
+ * @method ChildProductQuery leftJoinBrand($relationAlias = null) Adds a LEFT JOIN clause to the query using the Brand relation
+ * @method ChildProductQuery rightJoinBrand($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Brand relation
+ * @method ChildProductQuery innerJoinBrand($relationAlias = null) Adds a INNER JOIN clause to the query using the Brand relation
+ *
* @method ChildProductQuery leftJoinProductCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductCategory relation
* @method ChildProductQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation
* @method ChildProductQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
@@ -111,6 +117,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method ChildProduct findOneByVisible(int $visible) Return the first ChildProduct filtered by the visible column
* @method ChildProduct findOneByPosition(int $position) Return the first ChildProduct filtered by the position column
* @method ChildProduct findOneByTemplateId(int $template_id) Return the first ChildProduct filtered by the template_id column
+ * @method ChildProduct findOneByBrandId(int $brand_id) Return the first ChildProduct filtered by the brand_id column
* @method ChildProduct findOneByCreatedAt(string $created_at) Return the first ChildProduct filtered by the created_at column
* @method ChildProduct findOneByUpdatedAt(string $updated_at) Return the first ChildProduct filtered by the updated_at column
* @method ChildProduct findOneByVersion(int $version) Return the first ChildProduct filtered by the version column
@@ -123,6 +130,7 @@ use Thelia\Model\Map\ProductTableMap;
* @method array findByVisible(int $visible) Return ChildProduct objects filtered by the visible column
* @method array findByPosition(int $position) Return ChildProduct objects filtered by the position column
* @method array findByTemplateId(int $template_id) Return ChildProduct objects filtered by the template_id column
+ * @method array findByBrandId(int $brand_id) Return ChildProduct objects filtered by the brand_id column
* @method array findByCreatedAt(string $created_at) Return ChildProduct objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProduct objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildProduct objects filtered by the version column
@@ -223,7 +231,7 @@ abstract class ProductQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product` WHERE `ID` = :p0';
+ $sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `BRAND_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -550,6 +558,49 @@ abstract class ProductQuery extends ModelCriteria
return $this->addUsingAlias(ProductTableMap::TEMPLATE_ID, $templateId, $comparison);
}
+ /**
+ * Filter the query on the brand_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByBrandId(1234); // WHERE brand_id = 1234
+ * $query->filterByBrandId(array(12, 34)); // WHERE brand_id IN (12, 34)
+ * $query->filterByBrandId(array('min' => 12)); // WHERE brand_id > 12
+ *
+ *
+ * @see filterByBrand()
+ *
+ * @param mixed $brandId 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 ChildProductQuery The current query, for fluid interface
+ */
+ public function filterByBrandId($brandId = null, $comparison = null)
+ {
+ if (is_array($brandId)) {
+ $useMinMax = false;
+ if (isset($brandId['min'])) {
+ $this->addUsingAlias(ProductTableMap::BRAND_ID, $brandId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($brandId['max'])) {
+ $this->addUsingAlias(ProductTableMap::BRAND_ID, $brandId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ProductTableMap::BRAND_ID, $brandId, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
@@ -899,6 +950,81 @@ abstract class ProductQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'Template', '\Thelia\Model\TemplateQuery');
}
+ /**
+ * Filter the query by a related \Thelia\Model\Brand object
+ *
+ * @param \Thelia\Model\Brand|ObjectCollection $brand The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildProductQuery The current query, for fluid interface
+ */
+ public function filterByBrand($brand, $comparison = null)
+ {
+ if ($brand instanceof \Thelia\Model\Brand) {
+ return $this
+ ->addUsingAlias(ProductTableMap::BRAND_ID, $brand->getId(), $comparison);
+ } elseif ($brand instanceof ObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ProductTableMap::BRAND_ID, $brand->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByBrand() only accepts arguments of type \Thelia\Model\Brand or Collection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Brand relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ChildProductQuery The current query, for fluid interface
+ */
+ public function joinBrand($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Brand');
+
+ // 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, 'Brand');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Brand relation Brand 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\BrandQuery A secondary query class using the current class as primary query
+ */
+ public function useBrandQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinBrand($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Brand', '\Thelia\Model\BrandQuery');
+ }
+
/**
* Filter the query by a related \Thelia\Model\ProductCategory object
*
diff --git a/core/lib/Thelia/Model/Base/ProductVersion.php b/core/lib/Thelia/Model/Base/ProductVersion.php
index cf5ea8af9..95ac86eab 100644
--- a/core/lib/Thelia/Model/Base/ProductVersion.php
+++ b/core/lib/Thelia/Model/Base/ProductVersion.php
@@ -93,6 +93,12 @@ abstract class ProductVersion implements ActiveRecordInterface
*/
protected $template_id;
+ /**
+ * The value for the brand_id field.
+ * @var int
+ */
+ protected $brand_id;
+
/**
* The value for the created_at field.
* @var string
@@ -476,6 +482,17 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this->template_id;
}
+ /**
+ * Get the [brand_id] column value.
+ *
+ * @return int
+ */
+ public function getBrandId()
+ {
+
+ return $this->brand_id;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -688,6 +705,27 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this;
} // setTemplateId()
+ /**
+ * Set the value of [brand_id] column.
+ *
+ * @param int $v new value
+ * @return \Thelia\Model\ProductVersion The current object (for fluent API support)
+ */
+ public function setBrandId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->brand_id !== $v) {
+ $this->brand_id = $v;
+ $this->modifiedColumns[ProductVersionTableMap::BRAND_ID] = true;
+ }
+
+
+ return $this;
+ } // setBrandId()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -860,28 +898,31 @@ abstract class ProductVersion implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductVersionTableMap::translateFieldName('TemplateId', TableMap::TYPE_PHPNAME, $indexType)];
$this->template_id = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductVersionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductVersionTableMap::translateFieldName('BrandId', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->brand_id = (null !== $col) ? (int) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductVersionTableMap::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 ? 7 + $startcol : ProductVersionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductVersionTableMap::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;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductVersionTableMap::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)];
$this->version = (null !== $col) ? (int) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 9 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->version_created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 10 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 11 + $startcol : ProductVersionTableMap::translateFieldName('VersionCreatedBy', TableMap::TYPE_PHPNAME, $indexType)];
$this->version_created_by = (null !== $col) ? (string) $col : null;
$this->resetModified();
@@ -891,7 +932,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 11; // 11 = ProductVersionTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 12; // 12 = ProductVersionTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductVersion object", 0, $e);
@@ -1130,6 +1171,9 @@ abstract class ProductVersion implements ActiveRecordInterface
if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) {
$modifiedColumns[':p' . $index++] = '`TEMPLATE_ID`';
}
+ if ($this->isColumnModified(ProductVersionTableMap::BRAND_ID)) {
+ $modifiedColumns[':p' . $index++] = '`BRAND_ID`';
+ }
if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = '`CREATED_AT`';
}
@@ -1174,6 +1218,9 @@ abstract class ProductVersion implements ActiveRecordInterface
case '`TEMPLATE_ID`':
$stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
break;
+ case '`BRAND_ID`':
+ $stmt->bindValue($identifier, $this->brand_id, PDO::PARAM_INT);
+ break;
case '`CREATED_AT`':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1263,18 +1310,21 @@ abstract class ProductVersion implements ActiveRecordInterface
return $this->getTemplateId();
break;
case 6:
- return $this->getCreatedAt();
+ return $this->getBrandId();
break;
case 7:
- return $this->getUpdatedAt();
+ return $this->getCreatedAt();
break;
case 8:
- return $this->getVersion();
+ return $this->getUpdatedAt();
break;
case 9:
- return $this->getVersionCreatedAt();
+ return $this->getVersion();
break;
case 10:
+ return $this->getVersionCreatedAt();
+ break;
+ case 11:
return $this->getVersionCreatedBy();
break;
default:
@@ -1312,11 +1362,12 @@ abstract class ProductVersion implements ActiveRecordInterface
$keys[3] => $this->getVisible(),
$keys[4] => $this->getPosition(),
$keys[5] => $this->getTemplateId(),
- $keys[6] => $this->getCreatedAt(),
- $keys[7] => $this->getUpdatedAt(),
- $keys[8] => $this->getVersion(),
- $keys[9] => $this->getVersionCreatedAt(),
- $keys[10] => $this->getVersionCreatedBy(),
+ $keys[6] => $this->getBrandId(),
+ $keys[7] => $this->getCreatedAt(),
+ $keys[8] => $this->getUpdatedAt(),
+ $keys[9] => $this->getVersion(),
+ $keys[10] => $this->getVersionCreatedAt(),
+ $keys[11] => $this->getVersionCreatedBy(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1380,18 +1431,21 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->setTemplateId($value);
break;
case 6:
- $this->setCreatedAt($value);
+ $this->setBrandId($value);
break;
case 7:
- $this->setUpdatedAt($value);
+ $this->setCreatedAt($value);
break;
case 8:
- $this->setVersion($value);
+ $this->setUpdatedAt($value);
break;
case 9:
- $this->setVersionCreatedAt($value);
+ $this->setVersion($value);
break;
case 10:
+ $this->setVersionCreatedAt($value);
+ break;
+ case 11:
$this->setVersionCreatedBy($value);
break;
} // switch()
@@ -1424,11 +1478,12 @@ abstract class ProductVersion implements ActiveRecordInterface
if (array_key_exists($keys[3], $arr)) $this->setVisible($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setTemplateId($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setVersion($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedAt($arr[$keys[9]]);
- if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedBy($arr[$keys[10]]);
+ if (array_key_exists($keys[6], $arr)) $this->setBrandId($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setCreatedAt($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setUpdatedAt($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setVersion($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setVersionCreatedAt($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setVersionCreatedBy($arr[$keys[11]]);
}
/**
@@ -1446,6 +1501,7 @@ abstract class ProductVersion implements ActiveRecordInterface
if ($this->isColumnModified(ProductVersionTableMap::VISIBLE)) $criteria->add(ProductVersionTableMap::VISIBLE, $this->visible);
if ($this->isColumnModified(ProductVersionTableMap::POSITION)) $criteria->add(ProductVersionTableMap::POSITION, $this->position);
if ($this->isColumnModified(ProductVersionTableMap::TEMPLATE_ID)) $criteria->add(ProductVersionTableMap::TEMPLATE_ID, $this->template_id);
+ if ($this->isColumnModified(ProductVersionTableMap::BRAND_ID)) $criteria->add(ProductVersionTableMap::BRAND_ID, $this->brand_id);
if ($this->isColumnModified(ProductVersionTableMap::CREATED_AT)) $criteria->add(ProductVersionTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductVersionTableMap::UPDATED_AT)) $criteria->add(ProductVersionTableMap::UPDATED_AT, $this->updated_at);
if ($this->isColumnModified(ProductVersionTableMap::VERSION)) $criteria->add(ProductVersionTableMap::VERSION, $this->version);
@@ -1527,6 +1583,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$copyObj->setVisible($this->getVisible());
$copyObj->setPosition($this->getPosition());
$copyObj->setTemplateId($this->getTemplateId());
+ $copyObj->setBrandId($this->getBrandId());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
$copyObj->setVersion($this->getVersion());
@@ -1621,6 +1678,7 @@ abstract class ProductVersion implements ActiveRecordInterface
$this->visible = null;
$this->position = null;
$this->template_id = null;
+ $this->brand_id = null;
$this->created_at = null;
$this->updated_at = null;
$this->version = null;
diff --git a/core/lib/Thelia/Model/Base/ProductVersionQuery.php b/core/lib/Thelia/Model/Base/ProductVersionQuery.php
index cf017b048..d56f1055c 100644
--- a/core/lib/Thelia/Model/Base/ProductVersionQuery.php
+++ b/core/lib/Thelia/Model/Base/ProductVersionQuery.php
@@ -27,6 +27,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column
* @method ChildProductVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column
* @method ChildProductVersionQuery orderByTemplateId($order = Criteria::ASC) Order by the template_id column
+ * @method ChildProductVersionQuery orderByBrandId($order = Criteria::ASC) Order by the brand_id column
* @method ChildProductVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
* @method ChildProductVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
@@ -39,6 +40,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersionQuery groupByVisible() Group by the visible column
* @method ChildProductVersionQuery groupByPosition() Group by the position column
* @method ChildProductVersionQuery groupByTemplateId() Group by the template_id column
+ * @method ChildProductVersionQuery groupByBrandId() Group by the brand_id column
* @method ChildProductVersionQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductVersionQuery groupByUpdatedAt() Group by the updated_at column
* @method ChildProductVersionQuery groupByVersion() Group by the version column
@@ -62,6 +64,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method ChildProductVersion findOneByVisible(int $visible) Return the first ChildProductVersion filtered by the visible column
* @method ChildProductVersion findOneByPosition(int $position) Return the first ChildProductVersion filtered by the position column
* @method ChildProductVersion findOneByTemplateId(int $template_id) Return the first ChildProductVersion filtered by the template_id column
+ * @method ChildProductVersion findOneByBrandId(int $brand_id) Return the first ChildProductVersion filtered by the brand_id column
* @method ChildProductVersion findOneByCreatedAt(string $created_at) Return the first ChildProductVersion filtered by the created_at column
* @method ChildProductVersion findOneByUpdatedAt(string $updated_at) Return the first ChildProductVersion filtered by the updated_at column
* @method ChildProductVersion findOneByVersion(int $version) Return the first ChildProductVersion filtered by the version column
@@ -74,6 +77,7 @@ use Thelia\Model\Map\ProductVersionTableMap;
* @method array findByVisible(int $visible) Return ChildProductVersion objects filtered by the visible column
* @method array findByPosition(int $position) Return ChildProductVersion objects filtered by the position column
* @method array findByTemplateId(int $template_id) Return ChildProductVersion objects filtered by the template_id column
+ * @method array findByBrandId(int $brand_id) Return ChildProductVersion objects filtered by the brand_id column
* @method array findByCreatedAt(string $created_at) Return ChildProductVersion objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProductVersion objects filtered by the updated_at column
* @method array findByVersion(int $version) Return ChildProductVersion objects filtered by the version column
@@ -167,7 +171,7 @@ abstract class ProductVersionQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
+ $sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `VISIBLE`, `POSITION`, `TEMPLATE_ID`, `BRAND_ID`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -504,6 +508,47 @@ abstract class ProductVersionQuery extends ModelCriteria
return $this->addUsingAlias(ProductVersionTableMap::TEMPLATE_ID, $templateId, $comparison);
}
+ /**
+ * Filter the query on the brand_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByBrandId(1234); // WHERE brand_id = 1234
+ * $query->filterByBrandId(array(12, 34)); // WHERE brand_id IN (12, 34)
+ * $query->filterByBrandId(array('min' => 12)); // WHERE brand_id > 12
+ *
+ *
+ * @param mixed $brandId 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 ChildProductVersionQuery The current query, for fluid interface
+ */
+ public function filterByBrandId($brandId = null, $comparison = null)
+ {
+ if (is_array($brandId)) {
+ $useMinMax = false;
+ if (isset($brandId['min'])) {
+ $this->addUsingAlias(ProductVersionTableMap::BRAND_ID, $brandId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($brandId['max'])) {
+ $this->addUsingAlias(ProductVersionTableMap::BRAND_ID, $brandId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(ProductVersionTableMap::BRAND_ID, $brandId, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Base/TaxRule.php b/core/lib/Thelia/Model/Base/TaxRule.php
index 971a8192f..1f837cd33 100644
--- a/core/lib/Thelia/Model/Base/TaxRule.php
+++ b/core/lib/Thelia/Model/Base/TaxRule.php
@@ -1545,6 +1545,31 @@ abstract class TaxRule implements ActiveRecordInterface
return $this->getProducts($query, $con);
}
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this TaxRule is new, it will return
+ * an empty collection; or if this TaxRule has previously
+ * been saved, it will retrieve related Products from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in TaxRule.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildProduct[] List of ChildProduct objects
+ */
+ public function getProductsJoinBrand($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildProductQuery::create(null, $criteria);
+ $query->joinWith('Brand', $joinBehavior);
+
+ return $this->getProducts($query, $con);
+ }
+
/**
* Clears out the collTaxRuleCountries collection
*
diff --git a/core/lib/Thelia/Model/Base/Template.php b/core/lib/Thelia/Model/Base/Template.php
index 88b44a7a2..c5f8ccbb7 100644
--- a/core/lib/Thelia/Model/Base/Template.php
+++ b/core/lib/Thelia/Model/Base/Template.php
@@ -1589,6 +1589,31 @@ abstract class Template implements ActiveRecordInterface
return $this->getProducts($query, $con);
}
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this Template is new, it will return
+ * an empty collection; or if this Template has previously
+ * been saved, it will retrieve related Products from storage.
+ *
+ * This method is protected by default in order to keep the public
+ * api reasonable. You can provide public methods for those you
+ * actually need in Template.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param ConnectionInterface $con optional connection object
+ * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
+ * @return Collection|ChildProduct[] List of ChildProduct objects
+ */
+ public function getProductsJoinBrand($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN)
+ {
+ $query = ChildProductQuery::create(null, $criteria);
+ $query->joinWith('Brand', $joinBehavior);
+
+ return $this->getProducts($query, $con);
+ }
+
/**
* Clears out the collFeatureTemplates collection
*
diff --git a/core/lib/Thelia/Model/Brand.php b/core/lib/Thelia/Model/Brand.php
new file mode 100644
index 000000000..a153e1bc7
--- /dev/null
+++ b/core/lib/Thelia/Model/Brand.php
@@ -0,0 +1,88 @@
+dispatchEvent(TheliaEvents::BEFORE_CREATEBRAND, new BrandEvent($this));
+
+ // Set the current position for the new object
+ $this->setPosition($this->getNextPosition());
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function postInsert(ConnectionInterface $con = null)
+ {
+ $this->dispatchEvent(TheliaEvents::AFTER_CREATEBRAND, new BrandEvent($this));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function preUpdate(ConnectionInterface $con = null)
+ {
+ $this->dispatchEvent(TheliaEvents::BEFORE_UPDATEBRAND, new BrandEvent($this));
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function postUpdate(ConnectionInterface $con = null)
+ {
+ $this->dispatchEvent(TheliaEvents::AFTER_UPDATEBRAND, new BrandEvent($this));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ $this->dispatchEvent(TheliaEvents::BEFORE_DELETEBRAND, new BrandEvent($this));
+
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function postDelete(ConnectionInterface $con = null)
+ {
+ $this->markRewritenUrlObsolete();
+
+ $this->dispatchEvent(TheliaEvents::AFTER_DELETEBRAND, new BrandEvent($this));
+ }
+}
diff --git a/core/lib/Thelia/Model/BrandDocument.php b/core/lib/Thelia/Model/BrandDocument.php
new file mode 100644
index 000000000..432ad69f3
--- /dev/null
+++ b/core/lib/Thelia/Model/BrandDocument.php
@@ -0,0 +1,130 @@
+filterByBrandId($this->getBrandId());
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ $this->setPosition($this->getNextPosition());
+
+ return true;
+ }
+
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ $this->reorderBeforeDelete(
+ array(
+ "brand_id" => $this->getBrandId(),
+ )
+ );
+
+ return true;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function setParentId($parentId)
+ {
+ $this->setBrandId($parentId);
+
+ return $this;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getParentId()
+ {
+ return $this->getBrandId();
+ }
+
+ /**
+ * @return FileModelParentInterface the parent file model
+ */
+ public function getParentFileModel()
+ {
+ return new Brand();
+ }
+
+ /**
+ * Get the ID of the form used to change this object information
+ *
+ * @return BaseForm the form
+ */
+ public function getUpdateFormId()
+ {
+ return 'thelia.admin.brand.document.modification';
+ }
+
+ /**
+ * Get the form instance used to change this object information
+ *
+ * @param \Thelia\Core\HttpFoundation\Request $request
+ *
+ * @return BaseForm the form
+ */
+ public function getUpdateFormInstance(Request $request)
+ {
+ return new BrandDocumentModification($request);
+ }
+
+ /**
+ * @return string the path to the upload directory where files are stored, without final slash
+ */
+ public function getUploadDir()
+ {
+ return THELIA_LOCAL_DIR . 'media'.DS.'documents'.DS.'brand';
+ }
+
+ /**
+ * @param int $objectId the ID of the object
+ *
+ * @return string the URL to redirect to after update from the back-office
+ */
+ public function getRedirectionUrl($objectId)
+ {
+ return '/admin/brand/update/' . $objectId . '?current_tab=document';
+ }
+
+ /**
+ * Get the Query instance for this object
+ *
+ * @return ModelCriteria
+ */
+ public function getQueryInstance()
+ {
+ return BrandDocumentQuery::create();
+ }
+}
diff --git a/core/lib/Thelia/Model/BrandDocumentI18n.php b/core/lib/Thelia/Model/BrandDocumentI18n.php
new file mode 100644
index 000000000..a7bfe0599
--- /dev/null
+++ b/core/lib/Thelia/Model/BrandDocumentI18n.php
@@ -0,0 +1,10 @@
+getBrand();
+
+ $content->generateRewrittenUrl($this->getLocale());
+ }
+}
diff --git a/core/lib/Thelia/Model/BrandI18nQuery.php b/core/lib/Thelia/Model/BrandI18nQuery.php
new file mode 100644
index 000000000..ea172aaa0
--- /dev/null
+++ b/core/lib/Thelia/Model/BrandI18nQuery.php
@@ -0,0 +1,20 @@
+filterByBrandId($this->getBrandId());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function preInsert(ConnectionInterface $con = null)
+ {
+ $this->setPosition($this->getNextPosition());
+
+ return true;
+ }
+
+ public function preDelete(ConnectionInterface $con = null)
+ {
+ $this->reorderBeforeDelete(
+ array(
+ "brand_id" => $this->getBrandId(),
+ )
+ );
+
+ return true;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setParentId($parentId)
+ {
+ $this->setBrandId($parentId);
+
+ return $this;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getParentId()
+ {
+ return $this->getBrandId();
+ }
+
+ /**
+ * @return FileModelParentInterface the parent file model
+ */
+ public function getParentFileModel()
+ {
+ return new Brand();
+ }
+
+ /**
+ * Get the ID of the form used to change this object information
+ *
+ * @return BaseForm the form
+ */
+ public function getUpdateFormId()
+ {
+ return 'thelia.admin.brand.image.modification';
+ }
+
+ /**
+ * Get the form instance used to change this object information
+ *
+ * @param \Thelia\Core\HttpFoundation\Request $request
+ *
+ * @return BaseForm the form
+ */
+ public function getUpdateFormInstance(Request $request)
+ {
+ return new BrandImageModification($request);
+ }
+
+ /**
+ * @return string the path to the upload directory where files are stored, without final slash
+ */
+ public function getUploadDir()
+ {
+ return THELIA_LOCAL_DIR . 'media'.DS.'images'.DS.'brand';
+ }
+
+ /**
+ * @param int $objectId the ID of the object
+ *
+ * @return string the URL to redirect to after update from the back-office
+ */
+ public function getRedirectionUrl($objectId)
+ {
+ return '/admin/brand/update/' . $objectId . '?current_tab=image';
+ }
+
+ /**
+ * Get the Query instance for this object
+ *
+ * @return ModelCriteria
+ */
+ public function getQueryInstance()
+ {
+ return BrandImageQuery::create();
+ }
+}
diff --git a/core/lib/Thelia/Model/BrandImageI18n.php b/core/lib/Thelia/Model/BrandImageI18n.php
new file mode 100644
index 000000000..647129768
--- /dev/null
+++ b/core/lib/Thelia/Model/BrandImageI18n.php
@@ -0,0 +1,10 @@
+trans('Home') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL),
+ Translator::getInstance()->trans('Brand') => $router->generate('admin.brand.default', [], Router::ABSOLUTE_URL)
+ ];
+
+ if (null !== $brand = BrandQuery::create()->findPk($this->getBrandId())) {
+
+ $breadcrumb[$brand->setLocale($locale)->getTitle()] = sprintf(
+ "%s?current_tab=%s",
+ $router->generate('admin.brand.update', ['brand_id' => $brand->getId()], Router::ABSOLUTE_URL),
+ $tab
+ );
+ }
+
+ return $breadcrumb;
+ }
+}
\ No newline at end of file
diff --git a/core/lib/Thelia/Model/Breadcrumb/BreadcrumbInterface.php b/core/lib/Thelia/Model/Breadcrumb/BreadcrumbInterface.php
index dcb928c78..c78193682 100644
--- a/core/lib/Thelia/Model/Breadcrumb/BreadcrumbInterface.php
+++ b/core/lib/Thelia/Model/Breadcrumb/BreadcrumbInterface.php
@@ -19,10 +19,14 @@ interface BreadcrumbInterface
{
/**
+ * Create a breadcrumb from the current object, that will be displayed to the file management UI
*
- * return the complete breadcrumb for a given resource.
+ * @param Router $router the router where to find routes
+ * @param ContainerInterface $container the container
+ * @param string $tab the tab to return to (probably 'image' or 'document')
+ * @param string $locale the current locale
*
- * @return array
+ * @return array an array of (label => URL)
*/
- public function getBreadcrumb(Router $router, ContainerInterface $container, $tab);
+ public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale);
}
\ No newline at end of file
diff --git a/core/lib/Thelia/Model/Breadcrumb/CatalogBreadcrumbTrait.php b/core/lib/Thelia/Model/Breadcrumb/CatalogBreadcrumbTrait.php
index 6c9bbb328..f5d2a2cae 100644
--- a/core/lib/Thelia/Model/Breadcrumb/CatalogBreadcrumbTrait.php
+++ b/core/lib/Thelia/Model/Breadcrumb/CatalogBreadcrumbTrait.php
@@ -17,17 +17,19 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\Template\Loop\CategoryPath;
use Thelia\Core\Translation\Translator;
+use Thelia\Model\Category;
+use Thelia\Model\Product;
trait CatalogBreadcrumbTrait
{
- public function getBaseBreadcrumb(Router $router, ContainerInterface $container, $categoryId, &$locale)
+ public function getBaseBreadcrumb(Router $router, ContainerInterface $container, $categoryId)
{
$translator = Translator::getInstance();
$catalogUrl = $router->generate('admin.catalog', [], Router::ABSOLUTE_URL);
$breadcrumb = [
- $translator->trans('Home', [], 'bo.default') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL),
- $translator->trans('Catalog', [], 'bo.default') => $catalogUrl,
+ $translator->trans('Home') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL),
+ $translator->trans('Catalog') => $catalogUrl,
];
$categoryPath = new CategoryPath($container);
@@ -42,15 +44,13 @@ trait CatalogBreadcrumbTrait
$breadcrumb[$result['TITLE']] = sprintf("%s?category_id=%d",$catalogUrl, $result['ID']);
}
- $locale = $result['LOCALE'];
-
return $breadcrumb;
}
- public function getProductBreadcrumb(Router $router, ContainerInterface $container, $tab)
+ public function getProductBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
+ /** @var Product $product */
$product = $this->getProduct();
- $locale = null;
$breadcrumb = $this->getBaseBreadcrumb($router, $container, $product->getDefaultCategoryId(), $locale);
@@ -65,11 +65,11 @@ trait CatalogBreadcrumbTrait
return $breadcrumb;
}
- public function getCategoryBreadcrumb(Router $router, ContainerInterface $container, $tab)
+ public function getCategoryBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
- $locale = null;
+ /** @var Category $category */
$category = $this->getCategory();
- $breadcrumb = $this->getBaseBreadcrumb($router, $container, $this->getParentId(), $locale);
+ $breadcrumb = $this->getBaseBreadcrumb($router, $container, $this->getParentId());
$category->setLocale($locale);
diff --git a/core/lib/Thelia/Model/Breadcrumb/FolderBreadcrumbTrait.php b/core/lib/Thelia/Model/Breadcrumb/FolderBreadcrumbTrait.php
index 3711002c3..78c0dffe9 100644
--- a/core/lib/Thelia/Model/Breadcrumb/FolderBreadcrumbTrait.php
+++ b/core/lib/Thelia/Model/Breadcrumb/FolderBreadcrumbTrait.php
@@ -17,17 +17,19 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\Template\Loop\FolderPath;
use Thelia\Core\Translation\Translator;
+use Thelia\Model\Content;
+use Thelia\Model\Folder;
trait FolderBreadcrumbTrait
{
- public function getBaseBreadcrumb(Router $router, ContainerInterface $container, $folderId, &$locale)
+ public function getBaseBreadcrumb(Router $router, ContainerInterface $container, $folderId)
{
$translator = Translator::getInstance();
$catalogUrl = $router->generate('admin.catalog', [], Router::ABSOLUTE_URL);
$breadcrumb = [
- $translator->trans('Home', [], 'bo.default') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL),
- $translator->trans('Folder', [], 'bo.default') => $catalogUrl,
+ $translator->trans('Home') => $router->generate('admin.home.view', [], Router::ABSOLUTE_URL),
+ $translator->trans('Folder') => $catalogUrl,
];
$folderPath = new FolderPath($container);
@@ -45,16 +47,14 @@ trait FolderBreadcrumbTrait
);
}
- $locale = $result['LOCALE'];
-
return $breadcrumb;
}
- public function getFolderBreadcrumb($router, $container, $tab)
+ public function getFolderBreadcrumb(Router $router, $container, $tab, $locale)
{
- $locale = null;
+ /** @var Folder $folder */
$folder = $this->getFolder();
- $breadcrumb = $this->getBaseBreadcrumb($router, $container, $this->getParentId(), $locale);
+ $breadcrumb = $this->getBaseBreadcrumb($router, $container, $this->getParentId());
$folder->setLocale($locale);
@@ -66,12 +66,12 @@ trait FolderBreadcrumbTrait
return $breadcrumb;
}
- public function getContentBreadcrumb(Router $router, ContainerInterface $container, $tab)
+ public function getContentBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
+ /** @var Content $content */
$content = $this->getContent();
- $locale = null;
- $breadcrumb = $this->getBaseBreadcrumb($router, $container, $content->getDefaultFolderId(), $locale);
+ $breadcrumb = $this->getBaseBreadcrumb($router, $container, $content->getDefaultFolderId());
$content->setLocale($locale);
diff --git a/core/lib/Thelia/Model/Map/BrandDocumentI18nTableMap.php b/core/lib/Thelia/Model/Map/BrandDocumentI18nTableMap.php
new file mode 100644
index 000000000..fae8621cb
--- /dev/null
+++ b/core/lib/Thelia/Model/Map/BrandDocumentI18nTableMap.php
@@ -0,0 +1,498 @@
+ array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ self::TYPE_COLNAME => array(BrandDocumentI18nTableMap::ID, BrandDocumentI18nTableMap::LOCALE, BrandDocumentI18nTableMap::TITLE, BrandDocumentI18nTableMap::DESCRIPTION, BrandDocumentI18nTableMap::CHAPO, BrandDocumentI18nTableMap::POSTSCRIPTUM, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ 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, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ self::TYPE_COLNAME => array(BrandDocumentI18nTableMap::ID => 0, BrandDocumentI18nTableMap::LOCALE => 1, BrandDocumentI18nTableMap::TITLE => 2, BrandDocumentI18nTableMap::DESCRIPTION => 3, BrandDocumentI18nTableMap::CHAPO => 4, BrandDocumentI18nTableMap::POSTSCRIPTUM => 5, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 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('brand_document_i18n');
+ $this->setPhpName('BrandDocumentI18n');
+ $this->setClassName('\\Thelia\\Model\\BrandDocumentI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'brand_document', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('BrandDocument', '\\Thelia\\Model\\BrandDocument', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by find*()
+ * and findPk*() calls.
+ *
+ * @param \Thelia\Model\BrandDocumentI18n $obj A \Thelia\Model\BrandDocumentI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (null === $key) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A \Thelia\Model\BrandDocumentI18n object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && null !== $value) {
+ if (is_object($value) && $value instanceof \Thelia\Model\BrandDocumentI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key";
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } elseif ($value instanceof Criteria) {
+ self::$instances = [];
+
+ return;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\BrandDocumentI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ }
+
+ /**
+ * 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 && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', 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 $pks;
+ }
+
+ /**
+ * 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 ? BrandDocumentI18nTableMap::CLASS_DEFAULT : BrandDocumentI18nTableMap::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 (BrandDocumentI18n object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = BrandDocumentI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = BrandDocumentI18nTableMap::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 + BrandDocumentI18nTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = BrandDocumentI18nTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ BrandDocumentI18nTableMap::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 = BrandDocumentI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = BrandDocumentI18nTableMap::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;
+ BrandDocumentI18nTableMap::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(BrandDocumentI18nTableMap::ID);
+ $criteria->addSelectColumn(BrandDocumentI18nTableMap::LOCALE);
+ $criteria->addSelectColumn(BrandDocumentI18nTableMap::TITLE);
+ $criteria->addSelectColumn(BrandDocumentI18nTableMap::DESCRIPTION);
+ $criteria->addSelectColumn(BrandDocumentI18nTableMap::CHAPO);
+ $criteria->addSelectColumn(BrandDocumentI18nTableMap::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * 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(BrandDocumentI18nTableMap::DATABASE_NAME)->getTable(BrandDocumentI18nTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandDocumentI18nTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(BrandDocumentI18nTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new BrandDocumentI18nTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a BrandDocumentI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or BrandDocumentI18n 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(BrandDocumentI18nTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \Thelia\Model\BrandDocumentI18n) { // 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(BrandDocumentI18nTableMap::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(BrandDocumentI18nTableMap::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(BrandDocumentI18nTableMap::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ }
+ }
+
+ $query = BrandDocumentI18nQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { BrandDocumentI18nTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { BrandDocumentI18nTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the brand_document_i18n 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 BrandDocumentI18nQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a BrandDocumentI18n or Criteria object.
+ *
+ * @param mixed $criteria Criteria or BrandDocumentI18n 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(BrandDocumentI18nTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from BrandDocumentI18n object
+ }
+
+
+ // Set the correct dbName
+ $query = BrandDocumentI18nQuery::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;
+ }
+
+} // BrandDocumentI18nTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BrandDocumentI18nTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Map/BrandDocumentTableMap.php b/core/lib/Thelia/Model/Map/BrandDocumentTableMap.php
new file mode 100644
index 000000000..18eb5d29f
--- /dev/null
+++ b/core/lib/Thelia/Model/Map/BrandDocumentTableMap.php
@@ -0,0 +1,476 @@
+ array('Id', 'BrandId', 'File', 'Position', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'brandId', 'file', 'position', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(BrandDocumentTableMap::ID, BrandDocumentTableMap::BRAND_ID, BrandDocumentTableMap::FILE, BrandDocumentTableMap::POSITION, BrandDocumentTableMap::CREATED_AT, BrandDocumentTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'BRAND_ID', 'FILE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'brand_id', 'file', 'position', '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, 'BrandId' => 1, 'File' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'brandId' => 1, 'file' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
+ self::TYPE_COLNAME => array(BrandDocumentTableMap::ID => 0, BrandDocumentTableMap::BRAND_ID => 1, BrandDocumentTableMap::FILE => 2, BrandDocumentTableMap::POSITION => 3, BrandDocumentTableMap::CREATED_AT => 4, BrandDocumentTableMap::UPDATED_AT => 5, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'BRAND_ID' => 1, 'FILE' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'brand_id' => 1, 'file' => 2, 'position' => 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('brand_document');
+ $this->setPhpName('BrandDocument');
+ $this->setClassName('\\Thelia\\Model\\BrandDocument');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addForeignKey('BRAND_ID', 'BrandId', 'INTEGER', 'brand', 'ID', true, null, null);
+ $this->addColumn('FILE', 'File', 'VARCHAR', true, 255, null);
+ $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, 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('Brand', '\\Thelia\\Model\\Brand', RelationMap::MANY_TO_ONE, array('brand_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ $this->addRelation('BrandDocumentI18n', '\\Thelia\\Model\\BrandDocumentI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'BrandDocumentI18ns');
+ } // 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', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
+ );
+ } // getBehaviors()
+ /**
+ * Method to invalidate the instance pool of all tables related to brand_document * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ BrandDocumentI18nTableMap::clearInstancePool();
+ }
+
+ /**
+ * 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 ? BrandDocumentTableMap::CLASS_DEFAULT : BrandDocumentTableMap::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 (BrandDocument object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = BrandDocumentTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = BrandDocumentTableMap::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 + BrandDocumentTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = BrandDocumentTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ BrandDocumentTableMap::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 = BrandDocumentTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = BrandDocumentTableMap::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;
+ BrandDocumentTableMap::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(BrandDocumentTableMap::ID);
+ $criteria->addSelectColumn(BrandDocumentTableMap::BRAND_ID);
+ $criteria->addSelectColumn(BrandDocumentTableMap::FILE);
+ $criteria->addSelectColumn(BrandDocumentTableMap::POSITION);
+ $criteria->addSelectColumn(BrandDocumentTableMap::CREATED_AT);
+ $criteria->addSelectColumn(BrandDocumentTableMap::UPDATED_AT);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.BRAND_ID');
+ $criteria->addSelectColumn($alias . '.FILE');
+ $criteria->addSelectColumn($alias . '.POSITION');
+ $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(BrandDocumentTableMap::DATABASE_NAME)->getTable(BrandDocumentTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandDocumentTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(BrandDocumentTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new BrandDocumentTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a BrandDocument or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or BrandDocument 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(BrandDocumentTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \Thelia\Model\BrandDocument) { // 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(BrandDocumentTableMap::DATABASE_NAME);
+ $criteria->add(BrandDocumentTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = BrandDocumentQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { BrandDocumentTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { BrandDocumentTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the brand_document 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 BrandDocumentQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a BrandDocument or Criteria object.
+ *
+ * @param mixed $criteria Criteria or BrandDocument 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(BrandDocumentTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from BrandDocument object
+ }
+
+ if ($criteria->containsKey(BrandDocumentTableMap::ID) && $criteria->keyContainsValue(BrandDocumentTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.BrandDocumentTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = BrandDocumentQuery::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;
+ }
+
+} // BrandDocumentTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BrandDocumentTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Map/BrandI18nTableMap.php b/core/lib/Thelia/Model/Map/BrandI18nTableMap.php
new file mode 100644
index 000000000..965445812
--- /dev/null
+++ b/core/lib/Thelia/Model/Map/BrandI18nTableMap.php
@@ -0,0 +1,522 @@
+ array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', 'MetaTitle', 'MetaDescription', 'MetaKeywords', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'metaTitle', 'metaDescription', 'metaKeywords', ),
+ self::TYPE_COLNAME => array(BrandI18nTableMap::ID, BrandI18nTableMap::LOCALE, BrandI18nTableMap::TITLE, BrandI18nTableMap::DESCRIPTION, BrandI18nTableMap::CHAPO, BrandI18nTableMap::POSTSCRIPTUM, BrandI18nTableMap::META_TITLE, BrandI18nTableMap::META_DESCRIPTION, BrandI18nTableMap::META_KEYWORDS, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS', ),
+ self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', 'meta_title', 'meta_description', 'meta_keywords', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ );
+
+ /**
+ * 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, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, 'MetaTitle' => 6, 'MetaDescription' => 7, 'MetaKeywords' => 8, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'metaTitle' => 6, 'metaDescription' => 7, 'metaKeywords' => 8, ),
+ self::TYPE_COLNAME => array(BrandI18nTableMap::ID => 0, BrandI18nTableMap::LOCALE => 1, BrandI18nTableMap::TITLE => 2, BrandI18nTableMap::DESCRIPTION => 3, BrandI18nTableMap::CHAPO => 4, BrandI18nTableMap::POSTSCRIPTUM => 5, BrandI18nTableMap::META_TITLE => 6, BrandI18nTableMap::META_DESCRIPTION => 7, BrandI18nTableMap::META_KEYWORDS => 8, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, 'META_TITLE' => 6, 'META_DESCRIPTION' => 7, 'META_KEYWORDS' => 8, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, 'meta_title' => 6, 'meta_description' => 7, 'meta_keywords' => 8, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ );
+
+ /**
+ * 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('brand_i18n');
+ $this->setPhpName('BrandI18n');
+ $this->setClassName('\\Thelia\\Model\\BrandI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'brand', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('META_TITLE', 'MetaTitle', 'VARCHAR', false, 255, null);
+ $this->addColumn('META_DESCRIPTION', 'MetaDescription', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('META_KEYWORDS', 'MetaKeywords', 'LONGVARCHAR', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Brand', '\\Thelia\\Model\\Brand', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by find*()
+ * and findPk*() calls.
+ *
+ * @param \Thelia\Model\BrandI18n $obj A \Thelia\Model\BrandI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (null === $key) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A \Thelia\Model\BrandI18n object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && null !== $value) {
+ if (is_object($value) && $value instanceof \Thelia\Model\BrandI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key";
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } elseif ($value instanceof Criteria) {
+ self::$instances = [];
+
+ return;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\BrandI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ }
+
+ /**
+ * 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 && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', 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 $pks;
+ }
+
+ /**
+ * 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 ? BrandI18nTableMap::CLASS_DEFAULT : BrandI18nTableMap::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 (BrandI18n object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = BrandI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = BrandI18nTableMap::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 + BrandI18nTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = BrandI18nTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ BrandI18nTableMap::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 = BrandI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = BrandI18nTableMap::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;
+ BrandI18nTableMap::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(BrandI18nTableMap::ID);
+ $criteria->addSelectColumn(BrandI18nTableMap::LOCALE);
+ $criteria->addSelectColumn(BrandI18nTableMap::TITLE);
+ $criteria->addSelectColumn(BrandI18nTableMap::DESCRIPTION);
+ $criteria->addSelectColumn(BrandI18nTableMap::CHAPO);
+ $criteria->addSelectColumn(BrandI18nTableMap::POSTSCRIPTUM);
+ $criteria->addSelectColumn(BrandI18nTableMap::META_TITLE);
+ $criteria->addSelectColumn(BrandI18nTableMap::META_DESCRIPTION);
+ $criteria->addSelectColumn(BrandI18nTableMap::META_KEYWORDS);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ $criteria->addSelectColumn($alias . '.META_TITLE');
+ $criteria->addSelectColumn($alias . '.META_DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.META_KEYWORDS');
+ }
+ }
+
+ /**
+ * 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(BrandI18nTableMap::DATABASE_NAME)->getTable(BrandI18nTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandI18nTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(BrandI18nTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new BrandI18nTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a BrandI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or BrandI18n 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(BrandI18nTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \Thelia\Model\BrandI18n) { // 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(BrandI18nTableMap::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(BrandI18nTableMap::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(BrandI18nTableMap::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ }
+ }
+
+ $query = BrandI18nQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { BrandI18nTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { BrandI18nTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the brand_i18n 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 BrandI18nQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a BrandI18n or Criteria object.
+ *
+ * @param mixed $criteria Criteria or BrandI18n 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(BrandI18nTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from BrandI18n object
+ }
+
+
+ // Set the correct dbName
+ $query = BrandI18nQuery::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;
+ }
+
+} // BrandI18nTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BrandI18nTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Map/BrandImageI18nTableMap.php b/core/lib/Thelia/Model/Map/BrandImageI18nTableMap.php
new file mode 100644
index 000000000..a561e352d
--- /dev/null
+++ b/core/lib/Thelia/Model/Map/BrandImageI18nTableMap.php
@@ -0,0 +1,498 @@
+ array('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ self::TYPE_COLNAME => array(BrandImageI18nTableMap::ID, BrandImageI18nTableMap::LOCALE, BrandImageI18nTableMap::TITLE, BrandImageI18nTableMap::DESCRIPTION, BrandImageI18nTableMap::CHAPO, BrandImageI18nTableMap::POSTSCRIPTUM, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ 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, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ self::TYPE_COLNAME => array(BrandImageI18nTableMap::ID => 0, BrandImageI18nTableMap::LOCALE => 1, BrandImageI18nTableMap::TITLE => 2, BrandImageI18nTableMap::DESCRIPTION => 3, BrandImageI18nTableMap::CHAPO => 4, BrandImageI18nTableMap::POSTSCRIPTUM => 5, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 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('brand_image_i18n');
+ $this->setPhpName('BrandImageI18n');
+ $this->setClassName('\\Thelia\\Model\\BrandImageI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'brand_image', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('BrandImage', '\\Thelia\\Model\\BrandImage', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by find*()
+ * and findPk*() calls.
+ *
+ * @param \Thelia\Model\BrandImageI18n $obj A \Thelia\Model\BrandImageI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (null === $key) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ self::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A \Thelia\Model\BrandImageI18n object or a primary key value.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && null !== $value) {
+ if (is_object($value) && $value instanceof \Thelia\Model\BrandImageI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key";
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } elseif ($value instanceof Criteria) {
+ self::$instances = [];
+
+ return;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\BrandImageI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
+ throw $e;
+ }
+
+ unset(self::$instances[$key]);
+ }
+ }
+
+ /**
+ * 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 && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('Locale', 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 $pks;
+ }
+
+ /**
+ * 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 ? BrandImageI18nTableMap::CLASS_DEFAULT : BrandImageI18nTableMap::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 (BrandImageI18n object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = BrandImageI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = BrandImageI18nTableMap::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 + BrandImageI18nTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = BrandImageI18nTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ BrandImageI18nTableMap::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 = BrandImageI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = BrandImageI18nTableMap::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;
+ BrandImageI18nTableMap::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(BrandImageI18nTableMap::ID);
+ $criteria->addSelectColumn(BrandImageI18nTableMap::LOCALE);
+ $criteria->addSelectColumn(BrandImageI18nTableMap::TITLE);
+ $criteria->addSelectColumn(BrandImageI18nTableMap::DESCRIPTION);
+ $criteria->addSelectColumn(BrandImageI18nTableMap::CHAPO);
+ $criteria->addSelectColumn(BrandImageI18nTableMap::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * 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(BrandImageI18nTableMap::DATABASE_NAME)->getTable(BrandImageI18nTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandImageI18nTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(BrandImageI18nTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new BrandImageI18nTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a BrandImageI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or BrandImageI18n 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(BrandImageI18nTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \Thelia\Model\BrandImageI18n) { // 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(BrandImageI18nTableMap::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(BrandImageI18nTableMap::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(BrandImageI18nTableMap::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ }
+ }
+
+ $query = BrandImageI18nQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { BrandImageI18nTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { BrandImageI18nTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the brand_image_i18n 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 BrandImageI18nQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a BrandImageI18n or Criteria object.
+ *
+ * @param mixed $criteria Criteria or BrandImageI18n 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(BrandImageI18nTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from BrandImageI18n object
+ }
+
+
+ // Set the correct dbName
+ $query = BrandImageI18nQuery::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;
+ }
+
+} // BrandImageI18nTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BrandImageI18nTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Map/BrandImageTableMap.php b/core/lib/Thelia/Model/Map/BrandImageTableMap.php
new file mode 100644
index 000000000..9fee0b2df
--- /dev/null
+++ b/core/lib/Thelia/Model/Map/BrandImageTableMap.php
@@ -0,0 +1,478 @@
+ array('Id', 'BrandId', 'File', 'Position', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'brandId', 'file', 'position', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(BrandImageTableMap::ID, BrandImageTableMap::BRAND_ID, BrandImageTableMap::FILE, BrandImageTableMap::POSITION, BrandImageTableMap::CREATED_AT, BrandImageTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'BRAND_ID', 'FILE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'brand_id', 'file', 'position', '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, 'BrandId' => 1, 'File' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'brandId' => 1, 'file' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
+ self::TYPE_COLNAME => array(BrandImageTableMap::ID => 0, BrandImageTableMap::BRAND_ID => 1, BrandImageTableMap::FILE => 2, BrandImageTableMap::POSITION => 3, BrandImageTableMap::CREATED_AT => 4, BrandImageTableMap::UPDATED_AT => 5, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'BRAND_ID' => 1, 'FILE' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'brand_id' => 1, 'file' => 2, 'position' => 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('brand_image');
+ $this->setPhpName('BrandImage');
+ $this->setClassName('\\Thelia\\Model\\BrandImage');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addForeignKey('BRAND_ID', 'BrandId', 'INTEGER', 'brand', 'ID', true, null, null);
+ $this->addColumn('FILE', 'File', 'VARCHAR', true, 255, null);
+ $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, 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('BrandRelatedByBrandId', '\\Thelia\\Model\\Brand', RelationMap::MANY_TO_ONE, array('brand_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ $this->addRelation('BrandRelatedByLogoImageId', '\\Thelia\\Model\\Brand', RelationMap::ONE_TO_MANY, array('id' => 'logo_image_id', ), 'SET NULL', 'RESTRICT', 'BrandsRelatedByLogoImageId');
+ $this->addRelation('BrandImageI18n', '\\Thelia\\Model\\BrandImageI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'BrandImageI18ns');
+ } // 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', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
+ );
+ } // getBehaviors()
+ /**
+ * Method to invalidate the instance pool of all tables related to brand_image * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ BrandTableMap::clearInstancePool();
+ BrandImageI18nTableMap::clearInstancePool();
+ }
+
+ /**
+ * 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 ? BrandImageTableMap::CLASS_DEFAULT : BrandImageTableMap::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 (BrandImage object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = BrandImageTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = BrandImageTableMap::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 + BrandImageTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = BrandImageTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ BrandImageTableMap::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 = BrandImageTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = BrandImageTableMap::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;
+ BrandImageTableMap::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(BrandImageTableMap::ID);
+ $criteria->addSelectColumn(BrandImageTableMap::BRAND_ID);
+ $criteria->addSelectColumn(BrandImageTableMap::FILE);
+ $criteria->addSelectColumn(BrandImageTableMap::POSITION);
+ $criteria->addSelectColumn(BrandImageTableMap::CREATED_AT);
+ $criteria->addSelectColumn(BrandImageTableMap::UPDATED_AT);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.BRAND_ID');
+ $criteria->addSelectColumn($alias . '.FILE');
+ $criteria->addSelectColumn($alias . '.POSITION');
+ $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(BrandImageTableMap::DATABASE_NAME)->getTable(BrandImageTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandImageTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(BrandImageTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new BrandImageTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a BrandImage or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or BrandImage 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(BrandImageTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \Thelia\Model\BrandImage) { // 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(BrandImageTableMap::DATABASE_NAME);
+ $criteria->add(BrandImageTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = BrandImageQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { BrandImageTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { BrandImageTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the brand_image 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 BrandImageQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a BrandImage or Criteria object.
+ *
+ * @param mixed $criteria Criteria or BrandImage 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(BrandImageTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from BrandImage object
+ }
+
+ if ($criteria->containsKey(BrandImageTableMap::ID) && $criteria->keyContainsValue(BrandImageTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.BrandImageTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = BrandImageQuery::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;
+ }
+
+} // BrandImageTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BrandImageTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Map/BrandTableMap.php b/core/lib/Thelia/Model/Map/BrandTableMap.php
new file mode 100644
index 000000000..b069e9bbf
--- /dev/null
+++ b/core/lib/Thelia/Model/Map/BrandTableMap.php
@@ -0,0 +1,482 @@
+ array('Id', 'Visible', 'Position', 'LogoImageId', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'visible', 'position', 'logoImageId', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(BrandTableMap::ID, BrandTableMap::VISIBLE, BrandTableMap::POSITION, BrandTableMap::LOGO_IMAGE_ID, BrandTableMap::CREATED_AT, BrandTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'VISIBLE', 'POSITION', 'LOGO_IMAGE_ID', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'visible', 'position', 'logo_image_id', '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, 'Visible' => 1, 'Position' => 2, 'LogoImageId' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'logoImageId' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
+ self::TYPE_COLNAME => array(BrandTableMap::ID => 0, BrandTableMap::VISIBLE => 1, BrandTableMap::POSITION => 2, BrandTableMap::LOGO_IMAGE_ID => 3, BrandTableMap::CREATED_AT => 4, BrandTableMap::UPDATED_AT => 5, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'LOGO_IMAGE_ID' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'logo_image_id' => 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('brand');
+ $this->setPhpName('Brand');
+ $this->setClassName('\\Thelia\\Model\\Brand');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('VISIBLE', 'Visible', 'TINYINT', false, null, null);
+ $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
+ $this->addForeignKey('LOGO_IMAGE_ID', 'LogoImageId', 'INTEGER', 'brand_image', 'ID', false, null, 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('BrandImageRelatedByLogoImageId', '\\Thelia\\Model\\BrandImage', RelationMap::MANY_TO_ONE, array('logo_image_id' => 'id', ), 'SET NULL', 'RESTRICT');
+ $this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::ONE_TO_MANY, array('id' => 'brand_id', ), 'SET NULL', null, 'Products');
+ $this->addRelation('BrandDocument', '\\Thelia\\Model\\BrandDocument', RelationMap::ONE_TO_MANY, array('id' => 'brand_id', ), 'CASCADE', 'RESTRICT', 'BrandDocuments');
+ $this->addRelation('BrandImageRelatedByBrandId', '\\Thelia\\Model\\BrandImage', RelationMap::ONE_TO_MANY, array('id' => 'brand_id', ), 'CASCADE', 'RESTRICT', 'BrandImagesRelatedByBrandId');
+ $this->addRelation('BrandI18n', '\\Thelia\\Model\\BrandI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'BrandI18ns');
+ } // 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', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum, meta_title, meta_description, meta_keywords', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
+ );
+ } // getBehaviors()
+ /**
+ * Method to invalidate the instance pool of all tables related to brand * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ ProductTableMap::clearInstancePool();
+ BrandDocumentTableMap::clearInstancePool();
+ BrandImageTableMap::clearInstancePool();
+ BrandI18nTableMap::clearInstancePool();
+ }
+
+ /**
+ * 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 ? BrandTableMap::CLASS_DEFAULT : BrandTableMap::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 (Brand object, last column rank)
+ */
+ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
+ {
+ $key = BrandTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
+ if (null !== ($obj = BrandTableMap::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 + BrandTableMap::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = BrandTableMap::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $offset, false, $indexType);
+ BrandTableMap::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 = BrandTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
+ if (null !== ($obj = BrandTableMap::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;
+ BrandTableMap::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(BrandTableMap::ID);
+ $criteria->addSelectColumn(BrandTableMap::VISIBLE);
+ $criteria->addSelectColumn(BrandTableMap::POSITION);
+ $criteria->addSelectColumn(BrandTableMap::LOGO_IMAGE_ID);
+ $criteria->addSelectColumn(BrandTableMap::CREATED_AT);
+ $criteria->addSelectColumn(BrandTableMap::UPDATED_AT);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.VISIBLE');
+ $criteria->addSelectColumn($alias . '.POSITION');
+ $criteria->addSelectColumn($alias . '.LOGO_IMAGE_ID');
+ $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(BrandTableMap::DATABASE_NAME)->getTable(BrandTableMap::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this tableMap class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getServiceContainer()->getDatabaseMap(BrandTableMap::DATABASE_NAME);
+ if (!$dbMap->hasTable(BrandTableMap::TABLE_NAME)) {
+ $dbMap->addTableObject(new BrandTableMap());
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a Brand or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or Brand 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(BrandTableMap::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ // rename for clarity
+ $criteria = $values;
+ } elseif ($values instanceof \Thelia\Model\Brand) { // 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(BrandTableMap::DATABASE_NAME);
+ $criteria->add(BrandTableMap::ID, (array) $values, Criteria::IN);
+ }
+
+ $query = BrandQuery::create()->mergeWith($criteria);
+
+ if ($values instanceof Criteria) { BrandTableMap::clearInstancePool();
+ } elseif (!is_object($values)) { // it's a primary key, or an array of pks
+ foreach ((array) $values as $singleval) { BrandTableMap::removeInstanceFromPool($singleval);
+ }
+ }
+
+ return $query->delete($con);
+ }
+
+ /**
+ * Deletes all rows from the brand 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 BrandQuery::create()->doDeleteAll($con);
+ }
+
+ /**
+ * Performs an INSERT on the database, given a Brand or Criteria object.
+ *
+ * @param mixed $criteria Criteria or Brand 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(BrandTableMap::DATABASE_NAME);
+ }
+
+ if ($criteria instanceof Criteria) {
+ $criteria = clone $criteria; // rename for clarity
+ } else {
+ $criteria = $criteria->buildCriteria(); // build Criteria from Brand object
+ }
+
+ if ($criteria->containsKey(BrandTableMap::ID) && $criteria->keyContainsValue(BrandTableMap::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.BrandTableMap::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $query = BrandQuery::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;
+ }
+
+} // BrandTableMap
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BrandTableMap::buildTableMap();
diff --git a/core/lib/Thelia/Model/Map/CouponCustomerCountTableMap.php b/core/lib/Thelia/Model/Map/CouponCustomerCountTableMap.php
index cbed11f68..380852cff 100644
--- a/core/lib/Thelia/Model/Map/CouponCustomerCountTableMap.php
+++ b/core/lib/Thelia/Model/Map/CouponCustomerCountTableMap.php
@@ -147,8 +147,8 @@ class CouponCustomerCountTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', null);
- $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', 'RESTRICT');
+ $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', 'RESTRICT');
} // buildRelations()
/**
diff --git a/core/lib/Thelia/Model/Map/CouponTableMap.php b/core/lib/Thelia/Model/Map/CouponTableMap.php
index 72c03b526..3a32501d9 100644
--- a/core/lib/Thelia/Model/Map/CouponTableMap.php
+++ b/core/lib/Thelia/Model/Map/CouponTableMap.php
@@ -58,7 +58,7 @@ class CouponTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 16;
+ const NUM_COLUMNS = 18;
/**
* The number of lazy-loaded columns
@@ -68,7 +68,7 @@ class CouponTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 16;
+ const NUM_HYDRATE_COLUMNS = 18;
/**
* the column name for the ID field
@@ -150,6 +150,16 @@ class CouponTableMap extends TableMap
*/
const VERSION = 'coupon.VERSION';
+ /**
+ * the column name for the VERSION_CREATED_AT field
+ */
+ const VERSION_CREATED_AT = 'coupon.VERSION_CREATED_AT';
+
+ /**
+ * the column name for the VERSION_CREATED_BY field
+ */
+ const VERSION_CREATED_BY = 'coupon.VERSION_CREATED_BY';
+
/**
* The default string format for model objects of the related table
*/
@@ -171,12 +181,12 @@ class CouponTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', 'Version', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', 'version', ),
- self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::SERIALIZED_EFFECTS, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::IS_USED, CouponTableMap::SERIALIZED_CONDITIONS, CouponTableMap::PER_CUSTOMER_USAGE_COUNT, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, ),
- self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
- self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', 'version', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
+ self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
+ self::TYPE_COLNAME => array(CouponTableMap::ID, CouponTableMap::CODE, CouponTableMap::TYPE, CouponTableMap::SERIALIZED_EFFECTS, CouponTableMap::IS_ENABLED, CouponTableMap::EXPIRATION_DATE, CouponTableMap::MAX_USAGE, CouponTableMap::IS_CUMULATIVE, CouponTableMap::IS_REMOVING_POSTAGE, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponTableMap::IS_USED, CouponTableMap::SERIALIZED_CONDITIONS, CouponTableMap::PER_CUSTOMER_USAGE_COUNT, CouponTableMap::CREATED_AT, CouponTableMap::UPDATED_AT, CouponTableMap::VERSION, CouponTableMap::VERSION_CREATED_AT, CouponTableMap::VERSION_CREATED_BY, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
+ self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
@@ -186,12 +196,12 @@ class CouponTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'PerCustomerUsageCount' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, 'Version' => 15, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'perCustomerUsageCount' => 12, 'createdAt' => 13, 'updatedAt' => 14, 'version' => 15, ),
- self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::SERIALIZED_EFFECTS => 3, CouponTableMap::IS_ENABLED => 4, CouponTableMap::EXPIRATION_DATE => 5, CouponTableMap::MAX_USAGE => 6, CouponTableMap::IS_CUMULATIVE => 7, CouponTableMap::IS_REMOVING_POSTAGE => 8, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponTableMap::IS_USED => 10, CouponTableMap::SERIALIZED_CONDITIONS => 11, CouponTableMap::PER_CUSTOMER_USAGE_COUNT => 12, CouponTableMap::CREATED_AT => 13, CouponTableMap::UPDATED_AT => 14, CouponTableMap::VERSION => 15, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'PER_CUSTOMER_USAGE_COUNT' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, 'VERSION' => 15, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'per_customer_usage_count' => 12, 'created_at' => 13, 'updated_at' => 14, 'version' => 15, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'PerCustomerUsageCount' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, 'Version' => 15, 'VersionCreatedAt' => 16, 'VersionCreatedBy' => 17, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'perCustomerUsageCount' => 12, 'createdAt' => 13, 'updatedAt' => 14, 'version' => 15, 'versionCreatedAt' => 16, 'versionCreatedBy' => 17, ),
+ self::TYPE_COLNAME => array(CouponTableMap::ID => 0, CouponTableMap::CODE => 1, CouponTableMap::TYPE => 2, CouponTableMap::SERIALIZED_EFFECTS => 3, CouponTableMap::IS_ENABLED => 4, CouponTableMap::EXPIRATION_DATE => 5, CouponTableMap::MAX_USAGE => 6, CouponTableMap::IS_CUMULATIVE => 7, CouponTableMap::IS_REMOVING_POSTAGE => 8, CouponTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponTableMap::IS_USED => 10, CouponTableMap::SERIALIZED_CONDITIONS => 11, CouponTableMap::PER_CUSTOMER_USAGE_COUNT => 12, CouponTableMap::CREATED_AT => 13, CouponTableMap::UPDATED_AT => 14, CouponTableMap::VERSION => 15, CouponTableMap::VERSION_CREATED_AT => 16, CouponTableMap::VERSION_CREATED_BY => 17, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'PER_CUSTOMER_USAGE_COUNT' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, 'VERSION' => 15, 'VERSION_CREATED_AT' => 16, 'VERSION_CREATED_BY' => 17, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'per_customer_usage_count' => 12, 'created_at' => 13, 'updated_at' => 14, 'version' => 15, 'version_created_at' => 16, 'version_created_by' => 17, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
@@ -226,6 +236,8 @@ class CouponTableMap extends TableMap
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
+ $this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
+ $this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
} // initialize()
/**
@@ -235,12 +247,12 @@ class CouponTableMap extends TableMap
{
$this->addRelation('CouponCountry', '\\Thelia\\Model\\CouponCountry', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponCountries');
$this->addRelation('CouponModule', '\\Thelia\\Model\\CouponModule', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponModules');
- $this->addRelation('CouponCustomerCount', '\\Thelia\\Model\\CouponCustomerCount', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponCustomerCounts');
+ $this->addRelation('CouponCustomerCount', '\\Thelia\\Model\\CouponCustomerCount', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', 'RESTRICT', 'CouponCustomerCounts');
$this->addRelation('CouponI18n', '\\Thelia\\Model\\CouponI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponI18ns');
$this->addRelation('CouponVersion', '\\Thelia\\Model\\CouponVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CouponVersions');
$this->addRelation('Country', '\\Thelia\\Model\\Country', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Countries');
$this->addRelation('Module', '\\Thelia\\Model\\Module', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Modules');
- $this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Customers');
+ $this->addRelation('Customer', '\\Thelia\\Model\\Customer', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Customers');
} // buildRelations()
/**
@@ -254,7 +266,7 @@ class CouponTableMap extends TableMap
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, short_description, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
- 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'false', 'log_created_by' => 'false', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
+ 'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
);
} // getBehaviors()
/**
@@ -425,6 +437,8 @@ class CouponTableMap extends TableMap
$criteria->addSelectColumn(CouponTableMap::CREATED_AT);
$criteria->addSelectColumn(CouponTableMap::UPDATED_AT);
$criteria->addSelectColumn(CouponTableMap::VERSION);
+ $criteria->addSelectColumn(CouponTableMap::VERSION_CREATED_AT);
+ $criteria->addSelectColumn(CouponTableMap::VERSION_CREATED_BY);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CODE');
@@ -442,6 +456,8 @@ class CouponTableMap extends TableMap
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION');
+ $criteria->addSelectColumn($alias . '.VERSION_CREATED_AT');
+ $criteria->addSelectColumn($alias . '.VERSION_CREATED_BY');
}
}
diff --git a/core/lib/Thelia/Model/Map/CouponVersionTableMap.php b/core/lib/Thelia/Model/Map/CouponVersionTableMap.php
index fccda1064..9b4e8994e 100644
--- a/core/lib/Thelia/Model/Map/CouponVersionTableMap.php
+++ b/core/lib/Thelia/Model/Map/CouponVersionTableMap.php
@@ -58,7 +58,7 @@ class CouponVersionTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 16;
+ const NUM_COLUMNS = 18;
/**
* The number of lazy-loaded columns
@@ -68,7 +68,7 @@ class CouponVersionTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 16;
+ const NUM_HYDRATE_COLUMNS = 18;
/**
* the column name for the ID field
@@ -150,6 +150,16 @@ class CouponVersionTableMap extends TableMap
*/
const VERSION = 'coupon_version.VERSION';
+ /**
+ * the column name for the VERSION_CREATED_AT field
+ */
+ const VERSION_CREATED_AT = 'coupon_version.VERSION_CREATED_AT';
+
+ /**
+ * the column name for the VERSION_CREATED_BY field
+ */
+ const VERSION_CREATED_BY = 'coupon_version.VERSION_CREATED_BY';
+
/**
* The default string format for model objects of the related table
*/
@@ -162,12 +172,12 @@ class CouponVersionTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', 'Version', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', 'version', ),
- self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::SERIALIZED_EFFECTS, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::IS_USED, CouponVersionTableMap::SERIALIZED_CONDITIONS, CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, ),
- self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', 'VERSION', ),
- self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', 'version', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
+ self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'SerializedEffects', 'IsEnabled', 'ExpirationDate', 'MaxUsage', 'IsCumulative', 'IsRemovingPostage', 'IsAvailableOnSpecialOffers', 'IsUsed', 'SerializedConditions', 'PerCustomerUsageCount', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'serializedEffects', 'isEnabled', 'expirationDate', 'maxUsage', 'isCumulative', 'isRemovingPostage', 'isAvailableOnSpecialOffers', 'isUsed', 'serializedConditions', 'perCustomerUsageCount', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
+ self::TYPE_COLNAME => array(CouponVersionTableMap::ID, CouponVersionTableMap::CODE, CouponVersionTableMap::TYPE, CouponVersionTableMap::SERIALIZED_EFFECTS, CouponVersionTableMap::IS_ENABLED, CouponVersionTableMap::EXPIRATION_DATE, CouponVersionTableMap::MAX_USAGE, CouponVersionTableMap::IS_CUMULATIVE, CouponVersionTableMap::IS_REMOVING_POSTAGE, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS, CouponVersionTableMap::IS_USED, CouponVersionTableMap::SERIALIZED_CONDITIONS, CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT, CouponVersionTableMap::CREATED_AT, CouponVersionTableMap::UPDATED_AT, CouponVersionTableMap::VERSION, CouponVersionTableMap::VERSION_CREATED_AT, CouponVersionTableMap::VERSION_CREATED_BY, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'SERIALIZED_EFFECTS', 'IS_ENABLED', 'EXPIRATION_DATE', 'MAX_USAGE', 'IS_CUMULATIVE', 'IS_REMOVING_POSTAGE', 'IS_AVAILABLE_ON_SPECIAL_OFFERS', 'IS_USED', 'SERIALIZED_CONDITIONS', 'PER_CUSTOMER_USAGE_COUNT', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
+ self::TYPE_FIELDNAME => array('id', 'code', 'type', 'serialized_effects', 'is_enabled', 'expiration_date', 'max_usage', 'is_cumulative', 'is_removing_postage', 'is_available_on_special_offers', 'is_used', 'serialized_conditions', 'per_customer_usage_count', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
@@ -177,12 +187,12 @@ class CouponVersionTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'PerCustomerUsageCount' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, 'Version' => 15, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'perCustomerUsageCount' => 12, 'createdAt' => 13, 'updatedAt' => 14, 'version' => 15, ),
- self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::SERIALIZED_EFFECTS => 3, CouponVersionTableMap::IS_ENABLED => 4, CouponVersionTableMap::EXPIRATION_DATE => 5, CouponVersionTableMap::MAX_USAGE => 6, CouponVersionTableMap::IS_CUMULATIVE => 7, CouponVersionTableMap::IS_REMOVING_POSTAGE => 8, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponVersionTableMap::IS_USED => 10, CouponVersionTableMap::SERIALIZED_CONDITIONS => 11, CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT => 12, CouponVersionTableMap::CREATED_AT => 13, CouponVersionTableMap::UPDATED_AT => 14, CouponVersionTableMap::VERSION => 15, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'PER_CUSTOMER_USAGE_COUNT' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, 'VERSION' => 15, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'per_customer_usage_count' => 12, 'created_at' => 13, 'updated_at' => 14, 'version' => 15, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'SerializedEffects' => 3, 'IsEnabled' => 4, 'ExpirationDate' => 5, 'MaxUsage' => 6, 'IsCumulative' => 7, 'IsRemovingPostage' => 8, 'IsAvailableOnSpecialOffers' => 9, 'IsUsed' => 10, 'SerializedConditions' => 11, 'PerCustomerUsageCount' => 12, 'CreatedAt' => 13, 'UpdatedAt' => 14, 'Version' => 15, 'VersionCreatedAt' => 16, 'VersionCreatedBy' => 17, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serializedEffects' => 3, 'isEnabled' => 4, 'expirationDate' => 5, 'maxUsage' => 6, 'isCumulative' => 7, 'isRemovingPostage' => 8, 'isAvailableOnSpecialOffers' => 9, 'isUsed' => 10, 'serializedConditions' => 11, 'perCustomerUsageCount' => 12, 'createdAt' => 13, 'updatedAt' => 14, 'version' => 15, 'versionCreatedAt' => 16, 'versionCreatedBy' => 17, ),
+ self::TYPE_COLNAME => array(CouponVersionTableMap::ID => 0, CouponVersionTableMap::CODE => 1, CouponVersionTableMap::TYPE => 2, CouponVersionTableMap::SERIALIZED_EFFECTS => 3, CouponVersionTableMap::IS_ENABLED => 4, CouponVersionTableMap::EXPIRATION_DATE => 5, CouponVersionTableMap::MAX_USAGE => 6, CouponVersionTableMap::IS_CUMULATIVE => 7, CouponVersionTableMap::IS_REMOVING_POSTAGE => 8, CouponVersionTableMap::IS_AVAILABLE_ON_SPECIAL_OFFERS => 9, CouponVersionTableMap::IS_USED => 10, CouponVersionTableMap::SERIALIZED_CONDITIONS => 11, CouponVersionTableMap::PER_CUSTOMER_USAGE_COUNT => 12, CouponVersionTableMap::CREATED_AT => 13, CouponVersionTableMap::UPDATED_AT => 14, CouponVersionTableMap::VERSION => 15, CouponVersionTableMap::VERSION_CREATED_AT => 16, CouponVersionTableMap::VERSION_CREATED_BY => 17, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'SERIALIZED_EFFECTS' => 3, 'IS_ENABLED' => 4, 'EXPIRATION_DATE' => 5, 'MAX_USAGE' => 6, 'IS_CUMULATIVE' => 7, 'IS_REMOVING_POSTAGE' => 8, 'IS_AVAILABLE_ON_SPECIAL_OFFERS' => 9, 'IS_USED' => 10, 'SERIALIZED_CONDITIONS' => 11, 'PER_CUSTOMER_USAGE_COUNT' => 12, 'CREATED_AT' => 13, 'UPDATED_AT' => 14, 'VERSION' => 15, 'VERSION_CREATED_AT' => 16, 'VERSION_CREATED_BY' => 17, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'serialized_effects' => 3, 'is_enabled' => 4, 'expiration_date' => 5, 'max_usage' => 6, 'is_cumulative' => 7, 'is_removing_postage' => 8, 'is_available_on_special_offers' => 9, 'is_used' => 10, 'serialized_conditions' => 11, 'per_customer_usage_count' => 12, 'created_at' => 13, 'updated_at' => 14, 'version' => 15, 'version_created_at' => 16, 'version_created_by' => 17, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
@@ -217,6 +227,8 @@ class CouponVersionTableMap extends TableMap
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
+ $this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
+ $this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
} // initialize()
/**
@@ -430,6 +442,8 @@ class CouponVersionTableMap extends TableMap
$criteria->addSelectColumn(CouponVersionTableMap::CREATED_AT);
$criteria->addSelectColumn(CouponVersionTableMap::UPDATED_AT);
$criteria->addSelectColumn(CouponVersionTableMap::VERSION);
+ $criteria->addSelectColumn(CouponVersionTableMap::VERSION_CREATED_AT);
+ $criteria->addSelectColumn(CouponVersionTableMap::VERSION_CREATED_BY);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CODE');
@@ -447,6 +461,8 @@ class CouponVersionTableMap extends TableMap
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION');
+ $criteria->addSelectColumn($alias . '.VERSION_CREATED_AT');
+ $criteria->addSelectColumn($alias . '.VERSION_CREATED_BY');
}
}
diff --git a/core/lib/Thelia/Model/Map/CustomerTableMap.php b/core/lib/Thelia/Model/Map/CustomerTableMap.php
index 794de006f..ca96ddaca 100644
--- a/core/lib/Thelia/Model/Map/CustomerTableMap.php
+++ b/core/lib/Thelia/Model/Map/CustomerTableMap.php
@@ -228,8 +228,8 @@ class CustomerTableMap extends TableMap
$this->addRelation('Address', '\\Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Addresses');
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'RESTRICT', 'RESTRICT', 'Orders');
$this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'Carts');
- $this->addRelation('CouponCustomerCount', '\\Thelia\\Model\\CouponCustomerCount', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', null, 'CouponCustomerCounts');
- $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_MANY, array(), 'CASCADE', null, 'Coupons');
+ $this->addRelation('CouponCustomerCount', '\\Thelia\\Model\\CouponCustomerCount', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT', 'CouponCustomerCounts');
+ $this->addRelation('Coupon', '\\Thelia\\Model\\Coupon', RelationMap::MANY_TO_MANY, array(), 'CASCADE', 'RESTRICT', 'Coupons');
} // buildRelations()
/**
diff --git a/core/lib/Thelia/Model/Map/ProductTableMap.php b/core/lib/Thelia/Model/Map/ProductTableMap.php
index daba44213..3675ab7e0 100644
--- a/core/lib/Thelia/Model/Map/ProductTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductTableMap.php
@@ -58,7 +58,7 @@ class ProductTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 11;
+ const NUM_COLUMNS = 12;
/**
* The number of lazy-loaded columns
@@ -68,7 +68,7 @@ class ProductTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 11;
+ const NUM_HYDRATE_COLUMNS = 12;
/**
* the column name for the ID field
@@ -100,6 +100,11 @@ class ProductTableMap extends TableMap
*/
const TEMPLATE_ID = 'product.TEMPLATE_ID';
+ /**
+ * the column name for the BRAND_ID field
+ */
+ const BRAND_ID = 'product.BRAND_ID';
+
/**
* the column name for the CREATED_AT field
*/
@@ -146,12 +151,12 @@ class ProductTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
- self::TYPE_COLNAME => array(ProductTableMap::ID, ProductTableMap::TAX_RULE_ID, ProductTableMap::REF, ProductTableMap::VISIBLE, ProductTableMap::POSITION, ProductTableMap::TEMPLATE_ID, ProductTableMap::CREATED_AT, ProductTableMap::UPDATED_AT, ProductTableMap::VERSION, ProductTableMap::VERSION_CREATED_AT, ProductTableMap::VERSION_CREATED_BY, ),
- self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
- self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'BrandId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', 'brandId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
+ self::TYPE_COLNAME => array(ProductTableMap::ID, ProductTableMap::TAX_RULE_ID, ProductTableMap::REF, ProductTableMap::VISIBLE, ProductTableMap::POSITION, ProductTableMap::TEMPLATE_ID, ProductTableMap::BRAND_ID, ProductTableMap::CREATED_AT, ProductTableMap::UPDATED_AT, ProductTableMap::VERSION, ProductTableMap::VERSION_CREATED_AT, ProductTableMap::VERSION_CREATED_BY, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'TEMPLATE_ID', 'BRAND_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
+ self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_id', 'brand_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -161,12 +166,12 @@ class ProductTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'TemplateId' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, 'Version' => 8, 'VersionCreatedAt' => 9, 'VersionCreatedBy' => 10, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'templateId' => 5, 'createdAt' => 6, 'updatedAt' => 7, 'version' => 8, 'versionCreatedAt' => 9, 'versionCreatedBy' => 10, ),
- self::TYPE_COLNAME => array(ProductTableMap::ID => 0, ProductTableMap::TAX_RULE_ID => 1, ProductTableMap::REF => 2, ProductTableMap::VISIBLE => 3, ProductTableMap::POSITION => 4, ProductTableMap::TEMPLATE_ID => 5, ProductTableMap::CREATED_AT => 6, ProductTableMap::UPDATED_AT => 7, ProductTableMap::VERSION => 8, ProductTableMap::VERSION_CREATED_AT => 9, ProductTableMap::VERSION_CREATED_BY => 10, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'TEMPLATE_ID' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, 'VERSION' => 8, 'VERSION_CREATED_AT' => 9, 'VERSION_CREATED_BY' => 10, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'template_id' => 5, 'created_at' => 6, 'updated_at' => 7, 'version' => 8, 'version_created_at' => 9, 'version_created_by' => 10, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'TemplateId' => 5, 'BrandId' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, 'Version' => 9, 'VersionCreatedAt' => 10, 'VersionCreatedBy' => 11, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'templateId' => 5, 'brandId' => 6, 'createdAt' => 7, 'updatedAt' => 8, 'version' => 9, 'versionCreatedAt' => 10, 'versionCreatedBy' => 11, ),
+ self::TYPE_COLNAME => array(ProductTableMap::ID => 0, ProductTableMap::TAX_RULE_ID => 1, ProductTableMap::REF => 2, ProductTableMap::VISIBLE => 3, ProductTableMap::POSITION => 4, ProductTableMap::TEMPLATE_ID => 5, ProductTableMap::BRAND_ID => 6, ProductTableMap::CREATED_AT => 7, ProductTableMap::UPDATED_AT => 8, ProductTableMap::VERSION => 9, ProductTableMap::VERSION_CREATED_AT => 10, ProductTableMap::VERSION_CREATED_BY => 11, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'TEMPLATE_ID' => 5, 'BRAND_ID' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, 'VERSION' => 9, 'VERSION_CREATED_AT' => 10, 'VERSION_CREATED_BY' => 11, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'template_id' => 5, 'brand_id' => 6, 'created_at' => 7, 'updated_at' => 8, 'version' => 9, 'version_created_at' => 10, 'version_created_by' => 11, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -191,6 +196,7 @@ class ProductTableMap extends TableMap
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, 0);
$this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', false, null, null);
+ $this->addForeignKey('BRAND_ID', 'BrandId', 'INTEGER', 'brand', 'ID', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
@@ -205,6 +211,7 @@ class ProductTableMap extends TableMap
{
$this->addRelation('TaxRule', '\\Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'RESTRICT', 'RESTRICT');
$this->addRelation('Template', '\\Thelia\\Model\\Template', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), null, null);
+ $this->addRelation('Brand', '\\Thelia\\Model\\Brand', RelationMap::MANY_TO_ONE, array('brand_id' => 'id', ), 'SET NULL', null);
$this->addRelation('ProductCategory', '\\Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategories');
$this->addRelation('FeatureProduct', '\\Thelia\\Model\\FeatureProduct', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProducts');
$this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductSaleElementss');
@@ -398,6 +405,7 @@ class ProductTableMap extends TableMap
$criteria->addSelectColumn(ProductTableMap::VISIBLE);
$criteria->addSelectColumn(ProductTableMap::POSITION);
$criteria->addSelectColumn(ProductTableMap::TEMPLATE_ID);
+ $criteria->addSelectColumn(ProductTableMap::BRAND_ID);
$criteria->addSelectColumn(ProductTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductTableMap::UPDATED_AT);
$criteria->addSelectColumn(ProductTableMap::VERSION);
@@ -410,6 +418,7 @@ class ProductTableMap extends TableMap
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID');
+ $criteria->addSelectColumn($alias . '.BRAND_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION');
diff --git a/core/lib/Thelia/Model/Map/ProductVersionTableMap.php b/core/lib/Thelia/Model/Map/ProductVersionTableMap.php
index e3e36c8be..d8d22c2b7 100644
--- a/core/lib/Thelia/Model/Map/ProductVersionTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductVersionTableMap.php
@@ -58,7 +58,7 @@ class ProductVersionTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 11;
+ const NUM_COLUMNS = 12;
/**
* The number of lazy-loaded columns
@@ -68,7 +68,7 @@ class ProductVersionTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 11;
+ const NUM_HYDRATE_COLUMNS = 12;
/**
* the column name for the ID field
@@ -100,6 +100,11 @@ class ProductVersionTableMap extends TableMap
*/
const TEMPLATE_ID = 'product_version.TEMPLATE_ID';
+ /**
+ * the column name for the BRAND_ID field
+ */
+ const BRAND_ID = 'product_version.BRAND_ID';
+
/**
* the column name for the CREATED_AT field
*/
@@ -137,12 +142,12 @@ class ProductVersionTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
- self::TYPE_COLNAME => array(ProductVersionTableMap::ID, ProductVersionTableMap::TAX_RULE_ID, ProductVersionTableMap::REF, ProductVersionTableMap::VISIBLE, ProductVersionTableMap::POSITION, ProductVersionTableMap::TEMPLATE_ID, ProductVersionTableMap::CREATED_AT, ProductVersionTableMap::UPDATED_AT, ProductVersionTableMap::VERSION, ProductVersionTableMap::VERSION_CREATED_AT, ProductVersionTableMap::VERSION_CREATED_BY, ),
- self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'TEMPLATE_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
- self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ self::TYPE_PHPNAME => array('Id', 'TaxRuleId', 'Ref', 'Visible', 'Position', 'TemplateId', 'BrandId', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'taxRuleId', 'ref', 'visible', 'position', 'templateId', 'brandId', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
+ self::TYPE_COLNAME => array(ProductVersionTableMap::ID, ProductVersionTableMap::TAX_RULE_ID, ProductVersionTableMap::REF, ProductVersionTableMap::VISIBLE, ProductVersionTableMap::POSITION, ProductVersionTableMap::TEMPLATE_ID, ProductVersionTableMap::BRAND_ID, ProductVersionTableMap::CREATED_AT, ProductVersionTableMap::UPDATED_AT, ProductVersionTableMap::VERSION, ProductVersionTableMap::VERSION_CREATED_AT, ProductVersionTableMap::VERSION_CREATED_BY, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'TAX_RULE_ID', 'REF', 'VISIBLE', 'POSITION', 'TEMPLATE_ID', 'BRAND_ID', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
+ self::TYPE_FIELDNAME => array('id', 'tax_rule_id', 'ref', 'visible', 'position', 'template_id', 'brand_id', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -152,12 +157,12 @@ class ProductVersionTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'TemplateId' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, 'Version' => 8, 'VersionCreatedAt' => 9, 'VersionCreatedBy' => 10, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'templateId' => 5, 'createdAt' => 6, 'updatedAt' => 7, 'version' => 8, 'versionCreatedAt' => 9, 'versionCreatedBy' => 10, ),
- self::TYPE_COLNAME => array(ProductVersionTableMap::ID => 0, ProductVersionTableMap::TAX_RULE_ID => 1, ProductVersionTableMap::REF => 2, ProductVersionTableMap::VISIBLE => 3, ProductVersionTableMap::POSITION => 4, ProductVersionTableMap::TEMPLATE_ID => 5, ProductVersionTableMap::CREATED_AT => 6, ProductVersionTableMap::UPDATED_AT => 7, ProductVersionTableMap::VERSION => 8, ProductVersionTableMap::VERSION_CREATED_AT => 9, ProductVersionTableMap::VERSION_CREATED_BY => 10, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'TEMPLATE_ID' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, 'VERSION' => 8, 'VERSION_CREATED_AT' => 9, 'VERSION_CREATED_BY' => 10, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'template_id' => 5, 'created_at' => 6, 'updated_at' => 7, 'version' => 8, 'version_created_at' => 9, 'version_created_by' => 10, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Visible' => 3, 'Position' => 4, 'TemplateId' => 5, 'BrandId' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, 'Version' => 9, 'VersionCreatedAt' => 10, 'VersionCreatedBy' => 11, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'templateId' => 5, 'brandId' => 6, 'createdAt' => 7, 'updatedAt' => 8, 'version' => 9, 'versionCreatedAt' => 10, 'versionCreatedBy' => 11, ),
+ self::TYPE_COLNAME => array(ProductVersionTableMap::ID => 0, ProductVersionTableMap::TAX_RULE_ID => 1, ProductVersionTableMap::REF => 2, ProductVersionTableMap::VISIBLE => 3, ProductVersionTableMap::POSITION => 4, ProductVersionTableMap::TEMPLATE_ID => 5, ProductVersionTableMap::BRAND_ID => 6, ProductVersionTableMap::CREATED_AT => 7, ProductVersionTableMap::UPDATED_AT => 8, ProductVersionTableMap::VERSION => 9, ProductVersionTableMap::VERSION_CREATED_AT => 10, ProductVersionTableMap::VERSION_CREATED_BY => 11, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'TEMPLATE_ID' => 5, 'BRAND_ID' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, 'VERSION' => 9, 'VERSION_CREATED_AT' => 10, 'VERSION_CREATED_BY' => 11, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'visible' => 3, 'position' => 4, 'template_id' => 5, 'brand_id' => 6, 'created_at' => 7, 'updated_at' => 8, 'version' => 9, 'version_created_at' => 10, 'version_created_by' => 11, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -182,6 +187,7 @@ class ProductVersionTableMap extends TableMap
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, 0);
$this->addColumn('TEMPLATE_ID', 'TemplateId', 'INTEGER', false, null, null);
+ $this->addColumn('BRAND_ID', 'BrandId', 'INTEGER', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
@@ -264,11 +270,11 @@ class ProductVersionTableMap extends TableMap
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 && $row[TableMap::TYPE_NUM == $indexType ? 8 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
+ if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 9 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)] === null) {
return null;
}
- return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 8 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
+ return serialize(array((string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], (string) $row[TableMap::TYPE_NUM == $indexType ? 9 + $offset : static::translateFieldName('Version', TableMap::TYPE_PHPNAME, $indexType)]));
}
/**
@@ -390,6 +396,7 @@ class ProductVersionTableMap extends TableMap
$criteria->addSelectColumn(ProductVersionTableMap::VISIBLE);
$criteria->addSelectColumn(ProductVersionTableMap::POSITION);
$criteria->addSelectColumn(ProductVersionTableMap::TEMPLATE_ID);
+ $criteria->addSelectColumn(ProductVersionTableMap::BRAND_ID);
$criteria->addSelectColumn(ProductVersionTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductVersionTableMap::UPDATED_AT);
$criteria->addSelectColumn(ProductVersionTableMap::VERSION);
@@ -402,6 +409,7 @@ class ProductVersionTableMap extends TableMap
$criteria->addSelectColumn($alias . '.VISIBLE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.TEMPLATE_ID');
+ $criteria->addSelectColumn($alias . '.BRAND_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
$criteria->addSelectColumn($alias . '.VERSION');
diff --git a/local/config/schema.xml b/local/config/schema.xml
index 9539cca25..11b653378 100644
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -33,12 +33,13 @@
| + {admin_sortable_header + current_order=$order + order='id' + reverse_order='id-reverse' + path='/admin/brands' + label="{intl l='ID'}" + } + | + ++ + | + {admin_sortable_header + current_order=$order + order='alpha' + reverse_order='alpha-reverse' + path='/admin/brand' + label="{intl l='Name'}" + } + | + ++ {admin_sortable_header + current_order=$order + order='manual' + reverse_order='manual-reverse' + path='/admin/brand' + label="{intl l="Position"}" + } + | + ++ {admin_sortable_header + current_order=$content_order + order='visible' + reverse_order='visible-reverse' + path={url path='/admin/brand'} + label="{intl l='Online'}" + } + | + + {module_include location='brands_table_header'} + +{intl l='Actions'} | +||
|---|---|---|---|---|---|---|---|
| {$ID} | + +
+ {loop type="image" name="folder_image" source="brand" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
+
+ |
+
+ + {loop type="auth" name="can_change" role="ADMIN" resource="admin.brand" access="UPDATE"} + {$TITLE} + {/loop} + {elseloop rel="can_change"} + {$TITLE} + {/elseloop} + | + ++ {admin_position_block + resource="admin.brand" + access="UPDATE" + path="/admin/brand/update-position" + url_parameter="brand_id" + in_place_edit_class="brandPositionChange" + position="$POSITION" + id="$ID" + } + | + +
+ {loop type="auth" name="can_change" role="ADMIN" resource="admin.brand" access="UPDATE"}
+
+
+
+ {/loop}
+
+ {elseloop rel="can_change"}
+
+
+
+ {/elseloop}
+ |
+
+ {module_include location='brands_table_row'}
+
+ + + | +||
|
+
+ {intl l="No brand has been created yet. Click the + button to create one."}
+
+ |
+ |||||||