diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 1f043374a..0013941be 100644 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -34,6 +34,8 @@ Thelia\Model\BrandImage + /admin/import + /admin/export diff --git a/core/lib/Thelia/Config/Resources/loop.xml b/core/lib/Thelia/Config/Resources/loop.xml index 3588e3787..bca98a6f3 100644 --- a/core/lib/Thelia/Config/Resources/loop.xml +++ b/core/lib/Thelia/Config/Resources/loop.xml @@ -57,7 +57,10 @@ - + + + + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 7a2da4a57..31823709f 100644 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -1160,13 +1160,14 @@ - - Thelia\Controller\Admin\ExportController::indexAction + + Thelia\Controller\Admin\ImportExportController::export + \d+ - - Thelia\Controller\Admin\ExportController::export - .+ + + Thelia\Controller\Admin\ImportExportController::import + \d+ diff --git a/core/lib/Thelia/Controller/Admin/ImportExportController.php b/core/lib/Thelia/Controller/Admin/ImportExportController.php new file mode 100644 index 000000000..4e35fa0bf --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/ImportExportController.php @@ -0,0 +1,31 @@ + + */ +class ImportExportController extends BaseAdminController +{ + public function import() + { + + } + + public function export() + { + + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Export.php b/core/lib/Thelia/Core/Template/Loop/Export.php new file mode 100644 index 000000000..1815b15d5 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Export.php @@ -0,0 +1,38 @@ + + */ +class Export extends ImportExportType +{ + protected function getBaseUrl() + { + return $this->container->getParameter("export.base_url"); + } + + protected function getQueryModel() + { + return ExportQuery::create(); + } + + protected function getCategoryName() + { + return "ExportCategoryId"; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/ExportCategory.php b/core/lib/Thelia/Core/Template/Loop/ExportCategory.php new file mode 100644 index 000000000..3fc425a77 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/ExportCategory.php @@ -0,0 +1,28 @@ + + */ +class ExportCategory extends ImportExportCategory +{ + protected function getQueryModel() + { + return ExportCategoryQuery::create(); + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/Import.php b/core/lib/Thelia/Core/Template/Loop/Import.php new file mode 100644 index 000000000..e15ec49b7 --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/Import.php @@ -0,0 +1,37 @@ + + */ +class Import extends ImportExportType +{ + protected function getBaseUrl() + { + return $this->container->getParameter("export.base_url"); + } + + protected function getQueryModel() + { + return ImportQuery::create(); + } + + protected function getCategoryName() + { + return "ImportCategoryId"; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/ImportCategory.php b/core/lib/Thelia/Core/Template/Loop/ImportCategory.php new file mode 100644 index 000000000..9b7b5f57d --- /dev/null +++ b/core/lib/Thelia/Core/Template/Loop/ImportCategory.php @@ -0,0 +1,27 @@ + + */ +class ImportCategory extends ImportExportCategory +{ + protected function getQueryModel() + { + return ImportCategoryQuery::create(); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/ImportExportCategory.php b/core/lib/Thelia/Core/Template/Loop/ImportExportCategory.php index f20c38bf6..d04094db2 100644 --- a/core/lib/Thelia/Core/Template/Loop/ImportExportCategory.php +++ b/core/lib/Thelia/Core/Template/Loop/ImportExportCategory.php @@ -18,7 +18,6 @@ use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\PropelSearchLoopInterface; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; -use Thelia\Model\Base\ImportExportCategoryQuery; use Thelia\Type\EnumListType; use Thelia\Type\TypeCollection; @@ -27,7 +26,7 @@ use Thelia\Type\TypeCollection; * @package Thelia\Core\Template\Loop * @author Benjamin Perche */ -class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface +abstract class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface { protected $timestampable = true; @@ -38,7 +37,6 @@ class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface */ public function parseResults(LoopResult $loopResult) { - /** @var \Thelia\Model\ImportExportCategory $category */ foreach ($loopResult->getResultDataCollection() as $category) { $loopResultRow = new LoopResultRow($category); @@ -62,7 +60,7 @@ class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface */ public function buildModelCriteria() { - $query = ImportExportCategoryQuery::create(); + $query = $this->getQueryModel(); if (null !== $ids = $this->getId()) { $query->filterById($ids, Criteria::IN); @@ -133,4 +131,6 @@ class ImportExportCategory extends BaseLoop implements PropelSearchLoopInterface ) ); } + + abstract protected function getQueryModel(); } \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/ImportExportType.php b/core/lib/Thelia/Core/Template/Loop/ImportExportType.php index 7990a4a6b..ae02e6854 100644 --- a/core/lib/Thelia/Core/Template/Loop/ImportExportType.php +++ b/core/lib/Thelia/Core/Template/Loop/ImportExportType.php @@ -11,11 +11,14 @@ /*************************************************************************************/ namespace Thelia\Core\Template\Loop; +use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\LoopResult; +use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Element\PropelSearchLoopInterface; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Tools\URL; use Thelia\Type\EnumListType; use Thelia\Type\TypeCollection; @@ -24,8 +27,10 @@ use Thelia\Type\TypeCollection; * @package Thelia\Core\Template\Loop * @author Benjamin Perche */ -class ImportExportType extends BaseLoop implements PropelSearchLoopInterface +abstract class ImportExportType extends BaseLoop implements PropelSearchLoopInterface { + protected $timestampable = true; + /** * @param LoopResult $loopResult * @@ -33,9 +38,27 @@ class ImportExportType extends BaseLoop implements PropelSearchLoopInterface */ public function parseResults(LoopResult $loopResult) { - // TODO: Implement parseResults() method. - } + foreach ($loopResult->getResultDataCollection() as $type) { + $loopResultRow = new LoopResultRow($type); + $url = URL::getInstance()->absoluteUrl( + $this->getBaseUrl() . DS . $type->getId() + ); + + $loopResultRow + ->set("ID", $type->getId()) + ->set("TITLE", $type->getTitle()) + ->set("DESCRIPTION", $type->getDescription()) + ->set("URL", $type->isImport() ? $url : null) + ->set("POSITION", $type->getPosition()) + ->set("CATEGORY_ID", $type->getImportExportCategoryId()) + ; + + $loopResult->addRow($loopResultRow); + } + + return $loopResult; + } /** * this method returns a Propel ModelCriteria @@ -44,7 +67,42 @@ class ImportExportType extends BaseLoop implements PropelSearchLoopInterface */ public function buildModelCriteria() { - // TODO: Implement buildModelCriteria() method. + $query = $this->getQueryModel(); + + if (null !== $ids = $this->getId()) { + $query->filterById($ids); + } + + if (null !== $categories = $this->getCategory()) { + $query->filterBy($this->getCategoryName(), $categories, Criteria::IN); + } + + if (null !== $orders = $this->getOrder()) { + foreach ($orders as $order) { + switch($order) { + case "id": + $query->orderById(); + break; + case "id_reverse": + $query->orderById(Criteria::DESC); + break; + case "alpha": + $query->addAscendingOrderByColumn("i18n_TITLE"); + break; + case "alpha_reverse": + $query->addDescendingOrderByColumn("i18n_TITLE"); + break; + case "manual": + $query->orderByPosition(); + break; + case "manual_reverse": + $query->orderByPosition(Criteria::DESC); + break; + } + } + } + + return $query; } /** @@ -75,6 +133,7 @@ class ImportExportType extends BaseLoop implements PropelSearchLoopInterface { return new ArgumentCollection( Argument::createIntListTypeArgument('id'), + Argument::createIntListTypeArgument('category'), new Argument( "order", new TypeCollection( @@ -84,4 +143,10 @@ class ImportExportType extends BaseLoop implements PropelSearchLoopInterface ) ); } + + abstract protected function getBaseUrl(); + + abstract protected function getQueryModel(); + + abstract protected function getCategoryName(); } \ No newline at end of file diff --git a/core/lib/Thelia/Model/Base/Export.php b/core/lib/Thelia/Model/Base/Export.php new file mode 100644 index 000000000..b5902b177 --- /dev/null +++ b/core/lib/Thelia/Model/Base/Export.php @@ -0,0 +1,1884 @@ +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 Export instance. If + * obj is an instance of Export, delegates to + * equals(Export). 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 Export 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 Export 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 [export_category_id] column value. + * + * @return int + */ + public function getExportCategoryId() + { + + return $this->export_category_id; + } + + /** + * 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\Export 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[ExportTableMap::ID] = true; + } + + + return $this; + } // setId() + + /** + * Set the value of [export_category_id] column. + * + * @param int $v new value + * @return \Thelia\Model\Export The current object (for fluent API support) + */ + public function setExportCategoryId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->export_category_id !== $v) { + $this->export_category_id = $v; + $this->modifiedColumns[ExportTableMap::EXPORT_CATEGORY_ID] = true; + } + + if ($this->aExportCategory !== null && $this->aExportCategory->getId() !== $v) { + $this->aExportCategory = null; + } + + + return $this; + } // setExportCategoryId() + + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return \Thelia\Model\Export 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[ExportTableMap::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\Export 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[ExportTableMap::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\Export 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[ExportTableMap::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 : ExportTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ExportTableMap::translateFieldName('ExportCategoryId', TableMap::TYPE_PHPNAME, $indexType)]; + $this->export_category_id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ExportTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $this->position = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ExportTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + if ($col === '0000-00-00 00:00:00') { + $col = null; + } + $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ExportTableMap::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 + 5; // 5 = ExportTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \Thelia\Model\Export 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->aExportCategory !== null && $this->export_category_id !== $this->aExportCategory->getId()) { + $this->aExportCategory = 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(ExportTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildExportQuery::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->aExportCategory = null; + $this->collExportI18ns = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see Export::setDeleted() + * @see Export::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(ExportTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildExportQuery::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(ExportTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + // timestampable behavior + if (!$this->isColumnModified(ExportTableMap::CREATED_AT)) { + $this->setCreatedAt(time()); + } + if (!$this->isColumnModified(ExportTableMap::UPDATED_AT)) { + $this->setUpdatedAt(time()); + } + } else { + $ret = $ret && $this->preUpdate($con); + // timestampable behavior + if ($this->isModified() && !$this->isColumnModified(ExportTableMap::UPDATED_AT)) { + $this->setUpdatedAt(time()); + } + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + ExportTableMap::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->aExportCategory !== null) { + if ($this->aExportCategory->isModified() || $this->aExportCategory->isNew()) { + $affectedRows += $this->aExportCategory->save($con); + } + $this->setExportCategory($this->aExportCategory); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + if ($this->exportI18nsScheduledForDeletion !== null) { + if (!$this->exportI18nsScheduledForDeletion->isEmpty()) { + \Thelia\Model\ExportI18nQuery::create() + ->filterByPrimaryKeys($this->exportI18nsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->exportI18nsScheduledForDeletion = null; + } + } + + if ($this->collExportI18ns !== null) { + foreach ($this->collExportI18ns 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[ExportTableMap::ID] = true; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ExportTableMap::ID . ')'); + } + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(ExportTableMap::ID)) { + $modifiedColumns[':p' . $index++] = '`ID`'; + } + if ($this->isColumnModified(ExportTableMap::EXPORT_CATEGORY_ID)) { + $modifiedColumns[':p' . $index++] = '`EXPORT_CATEGORY_ID`'; + } + if ($this->isColumnModified(ExportTableMap::POSITION)) { + $modifiedColumns[':p' . $index++] = '`POSITION`'; + } + if ($this->isColumnModified(ExportTableMap::CREATED_AT)) { + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; + } + if ($this->isColumnModified(ExportTableMap::UPDATED_AT)) { + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; + } + + $sql = sprintf( + 'INSERT INTO `export` (%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 '`EXPORT_CATEGORY_ID`': + $stmt->bindValue($identifier, $this->export_category_id, PDO::PARAM_INT); + 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 = ExportTableMap::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->getExportCategoryId(); + break; + case 2: + return $this->getPosition(); + break; + case 3: + return $this->getCreatedAt(); + break; + case 4: + 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['Export'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['Export'][$this->getPrimaryKey()] = true; + $keys = ExportTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getExportCategoryId(), + $keys[2] => $this->getPosition(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aExportCategory) { + $result['ExportCategory'] = $this->aExportCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + if (null !== $this->collExportI18ns) { + $result['ExportI18ns'] = $this->collExportI18ns->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 = ExportTableMap::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->setExportCategoryId($value); + break; + case 2: + $this->setPosition($value); + break; + case 3: + $this->setCreatedAt($value); + break; + case 4: + $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 = ExportTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setExportCategoryId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setPosition($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); + } + + /** + * 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(ExportTableMap::DATABASE_NAME); + + if ($this->isColumnModified(ExportTableMap::ID)) $criteria->add(ExportTableMap::ID, $this->id); + if ($this->isColumnModified(ExportTableMap::EXPORT_CATEGORY_ID)) $criteria->add(ExportTableMap::EXPORT_CATEGORY_ID, $this->export_category_id); + if ($this->isColumnModified(ExportTableMap::POSITION)) $criteria->add(ExportTableMap::POSITION, $this->position); + if ($this->isColumnModified(ExportTableMap::CREATED_AT)) $criteria->add(ExportTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(ExportTableMap::UPDATED_AT)) $criteria->add(ExportTableMap::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(ExportTableMap::DATABASE_NAME); + $criteria->add(ExportTableMap::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\Export (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->setExportCategoryId($this->getExportCategoryId()); + $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->getExportI18ns() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addExportI18n($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\Export 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 ChildExportCategory object. + * + * @param ChildExportCategory $v + * @return \Thelia\Model\Export The current object (for fluent API support) + * @throws PropelException + */ + public function setExportCategory(ChildExportCategory $v = null) + { + if ($v === null) { + $this->setExportCategoryId(NULL); + } else { + $this->setExportCategoryId($v->getId()); + } + + $this->aExportCategory = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildExportCategory object, it will not be re-added. + if ($v !== null) { + $v->addExport($this); + } + + + return $this; + } + + + /** + * Get the associated ChildExportCategory object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildExportCategory The associated ChildExportCategory object. + * @throws PropelException + */ + public function getExportCategory(ConnectionInterface $con = null) + { + if ($this->aExportCategory === null && ($this->export_category_id !== null)) { + $this->aExportCategory = ChildExportCategoryQuery::create()->findPk($this->export_category_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->aExportCategory->addExports($this); + */ + } + + return $this->aExportCategory; + } + + + /** + * 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 ('ExportI18n' == $relationName) { + return $this->initExportI18ns(); + } + } + + /** + * Clears out the collExportI18ns 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 addExportI18ns() + */ + public function clearExportI18ns() + { + $this->collExportI18ns = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collExportI18ns collection loaded partially. + */ + public function resetPartialExportI18ns($v = true) + { + $this->collExportI18nsPartial = $v; + } + + /** + * Initializes the collExportI18ns collection. + * + * By default this just sets the collExportI18ns collection to an empty array (like clearcollExportI18ns()); + * 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 initExportI18ns($overrideExisting = true) + { + if (null !== $this->collExportI18ns && !$overrideExisting) { + return; + } + $this->collExportI18ns = new ObjectCollection(); + $this->collExportI18ns->setModel('\Thelia\Model\ExportI18n'); + } + + /** + * Gets an array of ChildExportI18n 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 ChildExport 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|ChildExportI18n[] List of ChildExportI18n objects + * @throws PropelException + */ + public function getExportI18ns($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collExportI18nsPartial && !$this->isNew(); + if (null === $this->collExportI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collExportI18ns) { + // return empty collection + $this->initExportI18ns(); + } else { + $collExportI18ns = ChildExportI18nQuery::create(null, $criteria) + ->filterByExport($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collExportI18nsPartial && count($collExportI18ns)) { + $this->initExportI18ns(false); + + foreach ($collExportI18ns as $obj) { + if (false == $this->collExportI18ns->contains($obj)) { + $this->collExportI18ns->append($obj); + } + } + + $this->collExportI18nsPartial = true; + } + + reset($collExportI18ns); + + return $collExportI18ns; + } + + if ($partial && $this->collExportI18ns) { + foreach ($this->collExportI18ns as $obj) { + if ($obj->isNew()) { + $collExportI18ns[] = $obj; + } + } + } + + $this->collExportI18ns = $collExportI18ns; + $this->collExportI18nsPartial = false; + } + } + + return $this->collExportI18ns; + } + + /** + * Sets a collection of ExportI18n 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 $exportI18ns A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildExport The current object (for fluent API support) + */ + public function setExportI18ns(Collection $exportI18ns, ConnectionInterface $con = null) + { + $exportI18nsToDelete = $this->getExportI18ns(new Criteria(), $con)->diff($exportI18ns); + + + //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->exportI18nsScheduledForDeletion = clone $exportI18nsToDelete; + + foreach ($exportI18nsToDelete as $exportI18nRemoved) { + $exportI18nRemoved->setExport(null); + } + + $this->collExportI18ns = null; + foreach ($exportI18ns as $exportI18n) { + $this->addExportI18n($exportI18n); + } + + $this->collExportI18ns = $exportI18ns; + $this->collExportI18nsPartial = false; + + return $this; + } + + /** + * Returns the number of related ExportI18n objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related ExportI18n objects. + * @throws PropelException + */ + public function countExportI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collExportI18nsPartial && !$this->isNew(); + if (null === $this->collExportI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collExportI18ns) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getExportI18ns()); + } + + $query = ChildExportI18nQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByExport($this) + ->count($con); + } + + return count($this->collExportI18ns); + } + + /** + * Method called to associate a ChildExportI18n object to this object + * through the ChildExportI18n foreign key attribute. + * + * @param ChildExportI18n $l ChildExportI18n + * @return \Thelia\Model\Export The current object (for fluent API support) + */ + public function addExportI18n(ChildExportI18n $l) + { + if ($l && $locale = $l->getLocale()) { + $this->setLocale($locale); + $this->currentTranslations[$locale] = $l; + } + if ($this->collExportI18ns === null) { + $this->initExportI18ns(); + $this->collExportI18nsPartial = true; + } + + if (!in_array($l, $this->collExportI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddExportI18n($l); + } + + return $this; + } + + /** + * @param ExportI18n $exportI18n The exportI18n object to add. + */ + protected function doAddExportI18n($exportI18n) + { + $this->collExportI18ns[]= $exportI18n; + $exportI18n->setExport($this); + } + + /** + * @param ExportI18n $exportI18n The exportI18n object to remove. + * @return ChildExport The current object (for fluent API support) + */ + public function removeExportI18n($exportI18n) + { + if ($this->getExportI18ns()->contains($exportI18n)) { + $this->collExportI18ns->remove($this->collExportI18ns->search($exportI18n)); + if (null === $this->exportI18nsScheduledForDeletion) { + $this->exportI18nsScheduledForDeletion = clone $this->collExportI18ns; + $this->exportI18nsScheduledForDeletion->clear(); + } + $this->exportI18nsScheduledForDeletion[]= clone $exportI18n; + $exportI18n->setExport(null); + } + + return $this; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->export_category_id = 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->collExportI18ns) { + foreach ($this->collExportI18ns as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + // i18n behavior + $this->currentLocale = 'en_US'; + $this->currentTranslations = null; + + $this->collExportI18ns = null; + $this->aExportCategory = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(ExportTableMap::DEFAULT_STRING_FORMAT); + } + + // i18n behavior + + /** + * Sets the locale for translations + * + * @param string $locale Locale to use for the translation, e.g. 'fr_FR' + * + * @return ChildExport 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 ChildExportI18n */ + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) + { + if (!isset($this->currentTranslations[$locale])) { + if (null !== $this->collExportI18ns) { + foreach ($this->collExportI18ns as $translation) { + if ($translation->getLocale() == $locale) { + $this->currentTranslations[$locale] = $translation; + + return $translation; + } + } + } + if ($this->isNew()) { + $translation = new ChildExportI18n(); + $translation->setLocale($locale); + } else { + $translation = ChildExportI18nQuery::create() + ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) + ->findOneOrCreate($con); + $this->currentTranslations[$locale] = $translation; + } + $this->addExportI18n($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 ChildExport The current object (for fluent API support) + */ + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) + { + if (!$this->isNew()) { + ChildExportI18nQuery::create() + ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) + ->delete($con); + } + if (isset($this->currentTranslations[$locale])) { + unset($this->currentTranslations[$locale]); + } + foreach ($this->collExportI18ns as $key => $translation) { + if ($translation->getLocale() == $locale) { + unset($this->collExportI18ns[$key]); + break; + } + } + + return $this; + } + + /** + * Returns the current translation + * + * @param ConnectionInterface $con an optional connection object + * + * @return ChildExportI18n */ + 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\ExportI18n 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\ExportI18n The current object (for fluent API support) + */ + public function setDescription($v) + { $this->getCurrentTranslation()->setDescription($v); + + return $this; + } + + // timestampable behavior + + /** + * Mark the current object so that the update date doesn't get updated during next save + * + * @return ChildExport The current object (for fluent API support) + */ + public function keepUpdateDateUnchanged() + { + $this->modifiedColumns[ExportTableMap::UPDATED_AT] = true; + + return $this; + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/core/lib/Thelia/Model/Base/ExportCategory.php b/core/lib/Thelia/Model/Base/ExportCategory.php new file mode 100644 index 000000000..c100fc5b9 --- /dev/null +++ b/core/lib/Thelia/Model/Base/ExportCategory.php @@ -0,0 +1,1989 @@ +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 ExportCategory instance. If + * obj is an instance of ExportCategory, delegates to + * equals(ExportCategory). 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 ExportCategory 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 ExportCategory 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 [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\ExportCategory 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[ExportCategoryTableMap::ID] = true; + } + + + return $this; + } // setId() + + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return \Thelia\Model\ExportCategory 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[ExportCategoryTableMap::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\ExportCategory 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[ExportCategoryTableMap::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\ExportCategory 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[ExportCategoryTableMap::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 : ExportCategoryTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ExportCategoryTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $this->position = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ExportCategoryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + if ($col === '0000-00-00 00:00:00') { + $col = null; + } + $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ExportCategoryTableMap::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 + 4; // 4 = ExportCategoryTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \Thelia\Model\ExportCategory object", 0, $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(ExportCategoryTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildExportCategoryQuery::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->collExports = null; + + $this->collExportCategoryI18ns = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see ExportCategory::setDeleted() + * @see ExportCategory::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(ExportCategoryTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildExportCategoryQuery::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(ExportCategoryTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + // timestampable behavior + if (!$this->isColumnModified(ExportCategoryTableMap::CREATED_AT)) { + $this->setCreatedAt(time()); + } + if (!$this->isColumnModified(ExportCategoryTableMap::UPDATED_AT)) { + $this->setUpdatedAt(time()); + } + } else { + $ret = $ret && $this->preUpdate($con); + // timestampable behavior + if ($this->isModified() && !$this->isColumnModified(ExportCategoryTableMap::UPDATED_AT)) { + $this->setUpdatedAt(time()); + } + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + ExportCategoryTableMap::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(ConnectionInterface $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + if ($this->exportsScheduledForDeletion !== null) { + if (!$this->exportsScheduledForDeletion->isEmpty()) { + \Thelia\Model\ExportQuery::create() + ->filterByPrimaryKeys($this->exportsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->exportsScheduledForDeletion = null; + } + } + + if ($this->collExports !== null) { + foreach ($this->collExports as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->exportCategoryI18nsScheduledForDeletion !== null) { + if (!$this->exportCategoryI18nsScheduledForDeletion->isEmpty()) { + \Thelia\Model\ExportCategoryI18nQuery::create() + ->filterByPrimaryKeys($this->exportCategoryI18nsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->exportCategoryI18nsScheduledForDeletion = null; + } + } + + if ($this->collExportCategoryI18ns !== null) { + foreach ($this->collExportCategoryI18ns 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[ExportCategoryTableMap::ID] = true; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ExportCategoryTableMap::ID . ')'); + } + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(ExportCategoryTableMap::ID)) { + $modifiedColumns[':p' . $index++] = '`ID`'; + } + if ($this->isColumnModified(ExportCategoryTableMap::POSITION)) { + $modifiedColumns[':p' . $index++] = '`POSITION`'; + } + if ($this->isColumnModified(ExportCategoryTableMap::CREATED_AT)) { + $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; + } + if ($this->isColumnModified(ExportCategoryTableMap::UPDATED_AT)) { + $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; + } + + $sql = sprintf( + 'INSERT INTO `export_category` (%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 '`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 = ExportCategoryTableMap::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->getPosition(); + break; + case 2: + return $this->getCreatedAt(); + break; + case 3: + 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['ExportCategory'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['ExportCategory'][$this->getPrimaryKey()] = true; + $keys = ExportCategoryTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getPosition(), + $keys[2] => $this->getCreatedAt(), + $keys[3] => $this->getUpdatedAt(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->collExports) { + $result['Exports'] = $this->collExports->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } + if (null !== $this->collExportCategoryI18ns) { + $result['ExportCategoryI18ns'] = $this->collExportCategoryI18ns->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 = ExportCategoryTableMap::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->setPosition($value); + break; + case 2: + $this->setCreatedAt($value); + break; + case 3: + $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 = ExportCategoryTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setPosition($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]); + } + + /** + * 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(ExportCategoryTableMap::DATABASE_NAME); + + if ($this->isColumnModified(ExportCategoryTableMap::ID)) $criteria->add(ExportCategoryTableMap::ID, $this->id); + if ($this->isColumnModified(ExportCategoryTableMap::POSITION)) $criteria->add(ExportCategoryTableMap::POSITION, $this->position); + if ($this->isColumnModified(ExportCategoryTableMap::CREATED_AT)) $criteria->add(ExportCategoryTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(ExportCategoryTableMap::UPDATED_AT)) $criteria->add(ExportCategoryTableMap::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(ExportCategoryTableMap::DATABASE_NAME); + $criteria->add(ExportCategoryTableMap::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\ExportCategory (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->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->getExports() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addExport($relObj->copy($deepCopy)); + } + } + + foreach ($this->getExportCategoryI18ns() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addExportCategoryI18n($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\ExportCategory Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + + /** + * Initializes a collection based on the name of a relation. + * Avoids crafting an 'init[$relationName]s' method name + * that wouldn't work when StandardEnglishPluralizer is used. + * + * @param string $relationName The name of the relation to initialize + * @return void + */ + public function initRelation($relationName) + { + if ('Export' == $relationName) { + return $this->initExports(); + } + if ('ExportCategoryI18n' == $relationName) { + return $this->initExportCategoryI18ns(); + } + } + + /** + * Clears out the collExports 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 addExports() + */ + public function clearExports() + { + $this->collExports = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collExports collection loaded partially. + */ + public function resetPartialExports($v = true) + { + $this->collExportsPartial = $v; + } + + /** + * Initializes the collExports collection. + * + * By default this just sets the collExports collection to an empty array (like clearcollExports()); + * 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 initExports($overrideExisting = true) + { + if (null !== $this->collExports && !$overrideExisting) { + return; + } + $this->collExports = new ObjectCollection(); + $this->collExports->setModel('\Thelia\Model\Export'); + } + + /** + * Gets an array of ChildExport 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 ChildExportCategory 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|ChildExport[] List of ChildExport objects + * @throws PropelException + */ + public function getExports($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collExportsPartial && !$this->isNew(); + if (null === $this->collExports || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collExports) { + // return empty collection + $this->initExports(); + } else { + $collExports = ChildExportQuery::create(null, $criteria) + ->filterByExportCategory($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collExportsPartial && count($collExports)) { + $this->initExports(false); + + foreach ($collExports as $obj) { + if (false == $this->collExports->contains($obj)) { + $this->collExports->append($obj); + } + } + + $this->collExportsPartial = true; + } + + reset($collExports); + + return $collExports; + } + + if ($partial && $this->collExports) { + foreach ($this->collExports as $obj) { + if ($obj->isNew()) { + $collExports[] = $obj; + } + } + } + + $this->collExports = $collExports; + $this->collExportsPartial = false; + } + } + + return $this->collExports; + } + + /** + * Sets a collection of Export 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 $exports A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildExportCategory The current object (for fluent API support) + */ + public function setExports(Collection $exports, ConnectionInterface $con = null) + { + $exportsToDelete = $this->getExports(new Criteria(), $con)->diff($exports); + + + $this->exportsScheduledForDeletion = $exportsToDelete; + + foreach ($exportsToDelete as $exportRemoved) { + $exportRemoved->setExportCategory(null); + } + + $this->collExports = null; + foreach ($exports as $export) { + $this->addExport($export); + } + + $this->collExports = $exports; + $this->collExportsPartial = false; + + return $this; + } + + /** + * Returns the number of related Export objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related Export objects. + * @throws PropelException + */ + public function countExports(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collExportsPartial && !$this->isNew(); + if (null === $this->collExports || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collExports) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getExports()); + } + + $query = ChildExportQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByExportCategory($this) + ->count($con); + } + + return count($this->collExports); + } + + /** + * Method called to associate a ChildExport object to this object + * through the ChildExport foreign key attribute. + * + * @param ChildExport $l ChildExport + * @return \Thelia\Model\ExportCategory The current object (for fluent API support) + */ + public function addExport(ChildExport $l) + { + if ($this->collExports === null) { + $this->initExports(); + $this->collExportsPartial = true; + } + + if (!in_array($l, $this->collExports->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddExport($l); + } + + return $this; + } + + /** + * @param Export $export The export object to add. + */ + protected function doAddExport($export) + { + $this->collExports[]= $export; + $export->setExportCategory($this); + } + + /** + * @param Export $export The export object to remove. + * @return ChildExportCategory The current object (for fluent API support) + */ + public function removeExport($export) + { + if ($this->getExports()->contains($export)) { + $this->collExports->remove($this->collExports->search($export)); + if (null === $this->exportsScheduledForDeletion) { + $this->exportsScheduledForDeletion = clone $this->collExports; + $this->exportsScheduledForDeletion->clear(); + } + $this->exportsScheduledForDeletion[]= clone $export; + $export->setExportCategory(null); + } + + return $this; + } + + /** + * Clears out the collExportCategoryI18ns 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 addExportCategoryI18ns() + */ + public function clearExportCategoryI18ns() + { + $this->collExportCategoryI18ns = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Reset is the collExportCategoryI18ns collection loaded partially. + */ + public function resetPartialExportCategoryI18ns($v = true) + { + $this->collExportCategoryI18nsPartial = $v; + } + + /** + * Initializes the collExportCategoryI18ns collection. + * + * By default this just sets the collExportCategoryI18ns collection to an empty array (like clearcollExportCategoryI18ns()); + * 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 initExportCategoryI18ns($overrideExisting = true) + { + if (null !== $this->collExportCategoryI18ns && !$overrideExisting) { + return; + } + $this->collExportCategoryI18ns = new ObjectCollection(); + $this->collExportCategoryI18ns->setModel('\Thelia\Model\ExportCategoryI18n'); + } + + /** + * Gets an array of ChildExportCategoryI18n 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 ChildExportCategory 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|ChildExportCategoryI18n[] List of ChildExportCategoryI18n objects + * @throws PropelException + */ + public function getExportCategoryI18ns($criteria = null, ConnectionInterface $con = null) + { + $partial = $this->collExportCategoryI18nsPartial && !$this->isNew(); + if (null === $this->collExportCategoryI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collExportCategoryI18ns) { + // return empty collection + $this->initExportCategoryI18ns(); + } else { + $collExportCategoryI18ns = ChildExportCategoryI18nQuery::create(null, $criteria) + ->filterByExportCategory($this) + ->find($con); + + if (null !== $criteria) { + if (false !== $this->collExportCategoryI18nsPartial && count($collExportCategoryI18ns)) { + $this->initExportCategoryI18ns(false); + + foreach ($collExportCategoryI18ns as $obj) { + if (false == $this->collExportCategoryI18ns->contains($obj)) { + $this->collExportCategoryI18ns->append($obj); + } + } + + $this->collExportCategoryI18nsPartial = true; + } + + reset($collExportCategoryI18ns); + + return $collExportCategoryI18ns; + } + + if ($partial && $this->collExportCategoryI18ns) { + foreach ($this->collExportCategoryI18ns as $obj) { + if ($obj->isNew()) { + $collExportCategoryI18ns[] = $obj; + } + } + } + + $this->collExportCategoryI18ns = $collExportCategoryI18ns; + $this->collExportCategoryI18nsPartial = false; + } + } + + return $this->collExportCategoryI18ns; + } + + /** + * Sets a collection of ExportCategoryI18n 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 $exportCategoryI18ns A Propel collection. + * @param ConnectionInterface $con Optional connection object + * @return ChildExportCategory The current object (for fluent API support) + */ + public function setExportCategoryI18ns(Collection $exportCategoryI18ns, ConnectionInterface $con = null) + { + $exportCategoryI18nsToDelete = $this->getExportCategoryI18ns(new Criteria(), $con)->diff($exportCategoryI18ns); + + + //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->exportCategoryI18nsScheduledForDeletion = clone $exportCategoryI18nsToDelete; + + foreach ($exportCategoryI18nsToDelete as $exportCategoryI18nRemoved) { + $exportCategoryI18nRemoved->setExportCategory(null); + } + + $this->collExportCategoryI18ns = null; + foreach ($exportCategoryI18ns as $exportCategoryI18n) { + $this->addExportCategoryI18n($exportCategoryI18n); + } + + $this->collExportCategoryI18ns = $exportCategoryI18ns; + $this->collExportCategoryI18nsPartial = false; + + return $this; + } + + /** + * Returns the number of related ExportCategoryI18n objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param ConnectionInterface $con + * @return int Count of related ExportCategoryI18n objects. + * @throws PropelException + */ + public function countExportCategoryI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + { + $partial = $this->collExportCategoryI18nsPartial && !$this->isNew(); + if (null === $this->collExportCategoryI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collExportCategoryI18ns) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getExportCategoryI18ns()); + } + + $query = ChildExportCategoryI18nQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByExportCategory($this) + ->count($con); + } + + return count($this->collExportCategoryI18ns); + } + + /** + * Method called to associate a ChildExportCategoryI18n object to this object + * through the ChildExportCategoryI18n foreign key attribute. + * + * @param ChildExportCategoryI18n $l ChildExportCategoryI18n + * @return \Thelia\Model\ExportCategory The current object (for fluent API support) + */ + public function addExportCategoryI18n(ChildExportCategoryI18n $l) + { + if ($l && $locale = $l->getLocale()) { + $this->setLocale($locale); + $this->currentTranslations[$locale] = $l; + } + if ($this->collExportCategoryI18ns === null) { + $this->initExportCategoryI18ns(); + $this->collExportCategoryI18nsPartial = true; + } + + if (!in_array($l, $this->collExportCategoryI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddExportCategoryI18n($l); + } + + return $this; + } + + /** + * @param ExportCategoryI18n $exportCategoryI18n The exportCategoryI18n object to add. + */ + protected function doAddExportCategoryI18n($exportCategoryI18n) + { + $this->collExportCategoryI18ns[]= $exportCategoryI18n; + $exportCategoryI18n->setExportCategory($this); + } + + /** + * @param ExportCategoryI18n $exportCategoryI18n The exportCategoryI18n object to remove. + * @return ChildExportCategory The current object (for fluent API support) + */ + public function removeExportCategoryI18n($exportCategoryI18n) + { + if ($this->getExportCategoryI18ns()->contains($exportCategoryI18n)) { + $this->collExportCategoryI18ns->remove($this->collExportCategoryI18ns->search($exportCategoryI18n)); + if (null === $this->exportCategoryI18nsScheduledForDeletion) { + $this->exportCategoryI18nsScheduledForDeletion = clone $this->collExportCategoryI18ns; + $this->exportCategoryI18nsScheduledForDeletion->clear(); + } + $this->exportCategoryI18nsScheduledForDeletion[]= clone $exportCategoryI18n; + $exportCategoryI18n->setExportCategory(null); + } + + return $this; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = 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->collExports) { + foreach ($this->collExports as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collExportCategoryI18ns) { + foreach ($this->collExportCategoryI18ns as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + // i18n behavior + $this->currentLocale = 'en_US'; + $this->currentTranslations = null; + + $this->collExports = null; + $this->collExportCategoryI18ns = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(ExportCategoryTableMap::DEFAULT_STRING_FORMAT); + } + + // i18n behavior + + /** + * Sets the locale for translations + * + * @param string $locale Locale to use for the translation, e.g. 'fr_FR' + * + * @return ChildExportCategory 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 ChildExportCategoryI18n */ + public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) + { + if (!isset($this->currentTranslations[$locale])) { + if (null !== $this->collExportCategoryI18ns) { + foreach ($this->collExportCategoryI18ns as $translation) { + if ($translation->getLocale() == $locale) { + $this->currentTranslations[$locale] = $translation; + + return $translation; + } + } + } + if ($this->isNew()) { + $translation = new ChildExportCategoryI18n(); + $translation->setLocale($locale); + } else { + $translation = ChildExportCategoryI18nQuery::create() + ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) + ->findOneOrCreate($con); + $this->currentTranslations[$locale] = $translation; + } + $this->addExportCategoryI18n($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 ChildExportCategory The current object (for fluent API support) + */ + public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) + { + if (!$this->isNew()) { + ChildExportCategoryI18nQuery::create() + ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) + ->delete($con); + } + if (isset($this->currentTranslations[$locale])) { + unset($this->currentTranslations[$locale]); + } + foreach ($this->collExportCategoryI18ns as $key => $translation) { + if ($translation->getLocale() == $locale) { + unset($this->collExportCategoryI18ns[$key]); + break; + } + } + + return $this; + } + + /** + * Returns the current translation + * + * @param ConnectionInterface $con an optional connection object + * + * @return ChildExportCategoryI18n */ + 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\ExportCategoryI18n The current object (for fluent API support) + */ + public function setTitle($v) + { $this->getCurrentTranslation()->setTitle($v); + + return $this; + } + + // timestampable behavior + + /** + * Mark the current object so that the update date doesn't get updated during next save + * + * @return ChildExportCategory The current object (for fluent API support) + */ + public function keepUpdateDateUnchanged() + { + $this->modifiedColumns[ExportCategoryTableMap::UPDATED_AT] = true; + + return $this; + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/core/lib/Thelia/Model/Base/ExportCategoryI18n.php b/core/lib/Thelia/Model/Base/ExportCategoryI18n.php new file mode 100644 index 000000000..761f8239c --- /dev/null +++ b/core/lib/Thelia/Model/Base/ExportCategoryI18n.php @@ -0,0 +1,1268 @@ +locale = 'en_US'; + } + + /** + * Initializes internal state of Thelia\Model\Base\ExportCategoryI18n 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 ExportCategoryI18n instance. If + * obj is an instance of ExportCategoryI18n, delegates to + * equals(ExportCategoryI18n). 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 ExportCategoryI18n 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 ExportCategoryI18n 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; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \Thelia\Model\ExportCategoryI18n 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[ExportCategoryI18nTableMap::ID] = true; + } + + if ($this->aExportCategory !== null && $this->aExportCategory->getId() !== $v) { + $this->aExportCategory = null; + } + + + return $this; + } // setId() + + /** + * Set the value of [locale] column. + * + * @param string $v new value + * @return \Thelia\Model\ExportCategoryI18n 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[ExportCategoryI18nTableMap::LOCALE] = true; + } + + + return $this; + } // setLocale() + + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return \Thelia\Model\ExportCategoryI18n 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[ExportCategoryI18nTableMap::TITLE] = true; + } + + + return $this; + } // setTitle() + + /** + * 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 : ExportCategoryI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ExportCategoryI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; + $this->locale = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ExportCategoryI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $this->title = (null !== $col) ? (string) $col : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 3; // 3 = ExportCategoryI18nTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \Thelia\Model\ExportCategoryI18n 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->aExportCategory !== null && $this->id !== $this->aExportCategory->getId()) { + $this->aExportCategory = 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(ExportCategoryI18nTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildExportCategoryI18nQuery::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->aExportCategory = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see ExportCategoryI18n::setDeleted() + * @see ExportCategoryI18n::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(ExportCategoryI18nTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildExportCategoryI18nQuery::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(ExportCategoryI18nTableMap::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); + ExportCategoryI18nTableMap::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->aExportCategory !== null) { + if ($this->aExportCategory->isModified() || $this->aExportCategory->isNew()) { + $affectedRows += $this->aExportCategory->save($con); + } + $this->setExportCategory($this->aExportCategory); + } + + 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(ExportCategoryI18nTableMap::ID)) { + $modifiedColumns[':p' . $index++] = '`ID`'; + } + if ($this->isColumnModified(ExportCategoryI18nTableMap::LOCALE)) { + $modifiedColumns[':p' . $index++] = '`LOCALE`'; + } + if ($this->isColumnModified(ExportCategoryI18nTableMap::TITLE)) { + $modifiedColumns[':p' . $index++] = '`TITLE`'; + } + + $sql = sprintf( + 'INSERT INTO `export_category_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; + } + } + $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 = ExportCategoryI18nTableMap::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; + 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['ExportCategoryI18n'][serialize($this->getPrimaryKey())])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['ExportCategoryI18n'][serialize($this->getPrimaryKey())] = true; + $keys = ExportCategoryI18nTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getLocale(), + $keys[2] => $this->getTitle(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aExportCategory) { + $result['ExportCategory'] = $this->aExportCategory->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 = ExportCategoryI18nTableMap::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; + } // 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 = ExportCategoryI18nTableMap::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]]); + } + + /** + * 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(ExportCategoryI18nTableMap::DATABASE_NAME); + + if ($this->isColumnModified(ExportCategoryI18nTableMap::ID)) $criteria->add(ExportCategoryI18nTableMap::ID, $this->id); + if ($this->isColumnModified(ExportCategoryI18nTableMap::LOCALE)) $criteria->add(ExportCategoryI18nTableMap::LOCALE, $this->locale); + if ($this->isColumnModified(ExportCategoryI18nTableMap::TITLE)) $criteria->add(ExportCategoryI18nTableMap::TITLE, $this->title); + + 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(ExportCategoryI18nTableMap::DATABASE_NAME); + $criteria->add(ExportCategoryI18nTableMap::ID, $this->id); + $criteria->add(ExportCategoryI18nTableMap::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\ExportCategoryI18n (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()); + 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\ExportCategoryI18n 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 ChildExportCategory object. + * + * @param ChildExportCategory $v + * @return \Thelia\Model\ExportCategoryI18n The current object (for fluent API support) + * @throws PropelException + */ + public function setExportCategory(ChildExportCategory $v = null) + { + if ($v === null) { + $this->setId(NULL); + } else { + $this->setId($v->getId()); + } + + $this->aExportCategory = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildExportCategory object, it will not be re-added. + if ($v !== null) { + $v->addExportCategoryI18n($this); + } + + + return $this; + } + + + /** + * Get the associated ChildExportCategory object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildExportCategory The associated ChildExportCategory object. + * @throws PropelException + */ + public function getExportCategory(ConnectionInterface $con = null) + { + if ($this->aExportCategory === null && ($this->id !== null)) { + $this->aExportCategory = ChildExportCategoryQuery::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->aExportCategory->addExportCategoryI18ns($this); + */ + } + + return $this->aExportCategory; + } + + /** + * 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->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->aExportCategory = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(ExportCategoryI18nTableMap::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/ExportCategoryI18nQuery.php b/core/lib/Thelia/Model/Base/ExportCategoryI18nQuery.php new file mode 100644 index 000000000..5dfc31870 --- /dev/null +++ b/core/lib/Thelia/Model/Base/ExportCategoryI18nQuery.php @@ -0,0 +1,508 @@ +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 ChildExportCategoryI18n|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = ExportCategoryI18nTableMap::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(ExportCategoryI18nTableMap::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 ChildExportCategoryI18n A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT `ID`, `LOCALE`, `TITLE` FROM `export_category_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 ChildExportCategoryI18n(); + $obj->hydrate($row); + ExportCategoryI18nTableMap::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 ChildExportCategoryI18n|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 ChildExportCategoryI18nQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + $this->addUsingAlias(ExportCategoryI18nTableMap::ID, $key[0], Criteria::EQUAL); + $this->addUsingAlias(ExportCategoryI18nTableMap::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 ChildExportCategoryI18nQuery 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(ExportCategoryI18nTableMap::ID, $key[0], Criteria::EQUAL); + $cton1 = $this->getNewCriterion(ExportCategoryI18nTableMap::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 filterByExportCategory() + * + * @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 ChildExportCategoryI18nQuery 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(ExportCategoryI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(ExportCategoryI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportCategoryI18nTableMap::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 ChildExportCategoryI18nQuery 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(ExportCategoryI18nTableMap::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 ChildExportCategoryI18nQuery 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(ExportCategoryI18nTableMap::TITLE, $title, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\ExportCategory object + * + * @param \Thelia\Model\ExportCategory|ObjectCollection $exportCategory The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildExportCategoryI18nQuery The current query, for fluid interface + */ + public function filterByExportCategory($exportCategory, $comparison = null) + { + if ($exportCategory instanceof \Thelia\Model\ExportCategory) { + return $this + ->addUsingAlias(ExportCategoryI18nTableMap::ID, $exportCategory->getId(), $comparison); + } elseif ($exportCategory instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(ExportCategoryI18nTableMap::ID, $exportCategory->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByExportCategory() only accepts arguments of type \Thelia\Model\ExportCategory or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the ExportCategory relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildExportCategoryI18nQuery The current query, for fluid interface + */ + public function joinExportCategory($relationAlias = null, $joinType = 'LEFT JOIN') + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('ExportCategory'); + + // 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, 'ExportCategory'); + } + + return $this; + } + + /** + * Use the ExportCategory relation ExportCategory 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\ExportCategoryQuery A secondary query class using the current class as primary query + */ + public function useExportCategoryQuery($relationAlias = null, $joinType = 'LEFT JOIN') + { + return $this + ->joinExportCategory($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ExportCategory', '\Thelia\Model\ExportCategoryQuery'); + } + + /** + * Exclude object from result + * + * @param ChildExportCategoryI18n $exportCategoryI18n Object to remove from the list of results + * + * @return ChildExportCategoryI18nQuery The current query, for fluid interface + */ + public function prune($exportCategoryI18n = null) + { + if ($exportCategoryI18n) { + $this->addCond('pruneCond0', $this->getAliasedColName(ExportCategoryI18nTableMap::ID), $exportCategoryI18n->getId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond1', $this->getAliasedColName(ExportCategoryI18nTableMap::LOCALE), $exportCategoryI18n->getLocale(), Criteria::NOT_EQUAL); + $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); + } + + return $this; + } + + /** + * Deletes all rows from the export_category_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(ExportCategoryI18nTableMap::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). + ExportCategoryI18nTableMap::clearInstancePool(); + ExportCategoryI18nTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildExportCategoryI18n or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildExportCategoryI18n 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(ExportCategoryI18nTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(ExportCategoryI18nTableMap::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(); + + + ExportCategoryI18nTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + ExportCategoryI18nTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + +} // ExportCategoryI18nQuery diff --git a/core/lib/Thelia/Model/Base/ExportCategoryQuery.php b/core/lib/Thelia/Model/Base/ExportCategoryQuery.php new file mode 100644 index 000000000..af24f3f5a --- /dev/null +++ b/core/lib/Thelia/Model/Base/ExportCategoryQuery.php @@ -0,0 +1,764 @@ +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 ChildExportCategory|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = ExportCategoryTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(ExportCategoryTableMap::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 ChildExportCategory A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT `ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `export_category` 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 ChildExportCategory(); + $obj->hydrate($row); + ExportCategoryTableMap::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 ChildExportCategory|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 ChildExportCategoryQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(ExportCategoryTableMap::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 ChildExportCategoryQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(ExportCategoryTableMap::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 ChildExportCategoryQuery 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(ExportCategoryTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(ExportCategoryTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportCategoryTableMap::ID, $id, $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 ChildExportCategoryQuery 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(ExportCategoryTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($position['max'])) { + $this->addUsingAlias(ExportCategoryTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportCategoryTableMap::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 ChildExportCategoryQuery 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(ExportCategoryTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($createdAt['max'])) { + $this->addUsingAlias(ExportCategoryTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportCategoryTableMap::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 ChildExportCategoryQuery 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(ExportCategoryTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($updatedAt['max'])) { + $this->addUsingAlias(ExportCategoryTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportCategoryTableMap::UPDATED_AT, $updatedAt, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\Export object + * + * @param \Thelia\Model\Export|ObjectCollection $export the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function filterByExport($export, $comparison = null) + { + if ($export instanceof \Thelia\Model\Export) { + return $this + ->addUsingAlias(ExportCategoryTableMap::ID, $export->getExportCategoryId(), $comparison); + } elseif ($export instanceof ObjectCollection) { + return $this + ->useExportQuery() + ->filterByPrimaryKeys($export->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByExport() only accepts arguments of type \Thelia\Model\Export or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Export relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function joinExport($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Export'); + + // 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, 'Export'); + } + + return $this; + } + + /** + * Use the Export relation Export 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\ExportQuery A secondary query class using the current class as primary query + */ + public function useExportQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinExport($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Export', '\Thelia\Model\ExportQuery'); + } + + /** + * Filter the query by a related \Thelia\Model\ExportCategoryI18n object + * + * @param \Thelia\Model\ExportCategoryI18n|ObjectCollection $exportCategoryI18n the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function filterByExportCategoryI18n($exportCategoryI18n, $comparison = null) + { + if ($exportCategoryI18n instanceof \Thelia\Model\ExportCategoryI18n) { + return $this + ->addUsingAlias(ExportCategoryTableMap::ID, $exportCategoryI18n->getId(), $comparison); + } elseif ($exportCategoryI18n instanceof ObjectCollection) { + return $this + ->useExportCategoryI18nQuery() + ->filterByPrimaryKeys($exportCategoryI18n->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByExportCategoryI18n() only accepts arguments of type \Thelia\Model\ExportCategoryI18n or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the ExportCategoryI18n relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function joinExportCategoryI18n($relationAlias = null, $joinType = 'LEFT JOIN') + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('ExportCategoryI18n'); + + // 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, 'ExportCategoryI18n'); + } + + return $this; + } + + /** + * Use the ExportCategoryI18n relation ExportCategoryI18n 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\ExportCategoryI18nQuery A secondary query class using the current class as primary query + */ + public function useExportCategoryI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') + { + return $this + ->joinExportCategoryI18n($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ExportCategoryI18n', '\Thelia\Model\ExportCategoryI18nQuery'); + } + + /** + * Exclude object from result + * + * @param ChildExportCategory $exportCategory Object to remove from the list of results + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function prune($exportCategory = null) + { + if ($exportCategory) { + $this->addUsingAlias(ExportCategoryTableMap::ID, $exportCategory->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the export_category 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(ExportCategoryTableMap::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). + ExportCategoryTableMap::clearInstancePool(); + ExportCategoryTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildExportCategory or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildExportCategory 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(ExportCategoryTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(ExportCategoryTableMap::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(); + + + ExportCategoryTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + ExportCategoryTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + // 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 ChildExportCategoryQuery The current query, for fluid interface + */ + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $relationName = $relationAlias ? $relationAlias : 'ExportCategoryI18n'; + + return $this + ->joinExportCategoryI18n($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 ChildExportCategoryQuery The current query, for fluid interface + */ + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) + { + $this + ->joinI18n($locale, null, $joinType) + ->with('ExportCategoryI18n'); + $this->with['ExportCategoryI18n']->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 ChildExportCategoryI18nQuery 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 : 'ExportCategoryI18n', '\Thelia\Model\ExportCategoryI18nQuery'); + } + + // timestampable behavior + + /** + * Filter by the latest updated + * + * @param int $nbDays Maximum age of the latest update in days + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function recentlyUpdated($nbDays = 7) + { + return $this->addUsingAlias(ExportCategoryTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Filter by the latest created + * + * @param int $nbDays Maximum age of in days + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function recentlyCreated($nbDays = 7) + { + return $this->addUsingAlias(ExportCategoryTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Order by update date desc + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function lastUpdatedFirst() + { + return $this->addDescendingOrderByColumn(ExportCategoryTableMap::UPDATED_AT); + } + + /** + * Order by update date asc + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function firstUpdatedFirst() + { + return $this->addAscendingOrderByColumn(ExportCategoryTableMap::UPDATED_AT); + } + + /** + * Order by create date desc + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function lastCreatedFirst() + { + return $this->addDescendingOrderByColumn(ExportCategoryTableMap::CREATED_AT); + } + + /** + * Order by create date asc + * + * @return ChildExportCategoryQuery The current query, for fluid interface + */ + public function firstCreatedFirst() + { + return $this->addAscendingOrderByColumn(ExportCategoryTableMap::CREATED_AT); + } + +} // ExportCategoryQuery diff --git a/core/lib/Thelia/Model/Base/ExportI18n.php b/core/lib/Thelia/Model/Base/ExportI18n.php new file mode 100644 index 000000000..e8271f18a --- /dev/null +++ b/core/lib/Thelia/Model/Base/ExportI18n.php @@ -0,0 +1,1326 @@ +locale = 'en_US'; + } + + /** + * Initializes internal state of Thelia\Model\Base\ExportI18n 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 ExportI18n instance. If + * obj is an instance of ExportI18n, delegates to + * equals(ExportI18n). 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 ExportI18n 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 ExportI18n 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; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \Thelia\Model\ExportI18n 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[ExportI18nTableMap::ID] = true; + } + + if ($this->aExport !== null && $this->aExport->getId() !== $v) { + $this->aExport = null; + } + + + return $this; + } // setId() + + /** + * Set the value of [locale] column. + * + * @param string $v new value + * @return \Thelia\Model\ExportI18n 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[ExportI18nTableMap::LOCALE] = true; + } + + + return $this; + } // setLocale() + + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return \Thelia\Model\ExportI18n 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[ExportI18nTableMap::TITLE] = true; + } + + + return $this; + } // setTitle() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return \Thelia\Model\ExportI18n 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[ExportI18nTableMap::DESCRIPTION] = true; + } + + + return $this; + } // setDescription() + + /** + * 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 : ExportI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ExportI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; + $this->locale = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ExportI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $this->title = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ExportI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; + $this->description = (null !== $col) ? (string) $col : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 4; // 4 = ExportI18nTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \Thelia\Model\ExportI18n 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->aExport !== null && $this->id !== $this->aExport->getId()) { + $this->aExport = 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(ExportI18nTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildExportI18nQuery::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->aExport = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see ExportI18n::setDeleted() + * @see ExportI18n::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(ExportI18nTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildExportI18nQuery::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(ExportI18nTableMap::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); + ExportI18nTableMap::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->aExport !== null) { + if ($this->aExport->isModified() || $this->aExport->isNew()) { + $affectedRows += $this->aExport->save($con); + } + $this->setExport($this->aExport); + } + + 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(ExportI18nTableMap::ID)) { + $modifiedColumns[':p' . $index++] = '`ID`'; + } + if ($this->isColumnModified(ExportI18nTableMap::LOCALE)) { + $modifiedColumns[':p' . $index++] = '`LOCALE`'; + } + if ($this->isColumnModified(ExportI18nTableMap::TITLE)) { + $modifiedColumns[':p' . $index++] = '`TITLE`'; + } + if ($this->isColumnModified(ExportI18nTableMap::DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; + } + + $sql = sprintf( + 'INSERT INTO `export_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; + } + } + $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 = ExportI18nTableMap::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; + 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['ExportI18n'][serialize($this->getPrimaryKey())])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['ExportI18n'][serialize($this->getPrimaryKey())] = true; + $keys = ExportI18nTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getLocale(), + $keys[2] => $this->getTitle(), + $keys[3] => $this->getDescription(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aExport) { + $result['Export'] = $this->aExport->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 = ExportI18nTableMap::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; + } // 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 = ExportI18nTableMap::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]]); + } + + /** + * 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(ExportI18nTableMap::DATABASE_NAME); + + if ($this->isColumnModified(ExportI18nTableMap::ID)) $criteria->add(ExportI18nTableMap::ID, $this->id); + if ($this->isColumnModified(ExportI18nTableMap::LOCALE)) $criteria->add(ExportI18nTableMap::LOCALE, $this->locale); + if ($this->isColumnModified(ExportI18nTableMap::TITLE)) $criteria->add(ExportI18nTableMap::TITLE, $this->title); + if ($this->isColumnModified(ExportI18nTableMap::DESCRIPTION)) $criteria->add(ExportI18nTableMap::DESCRIPTION, $this->description); + + 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(ExportI18nTableMap::DATABASE_NAME); + $criteria->add(ExportI18nTableMap::ID, $this->id); + $criteria->add(ExportI18nTableMap::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\ExportI18n (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()); + 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\ExportI18n 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 ChildExport object. + * + * @param ChildExport $v + * @return \Thelia\Model\ExportI18n The current object (for fluent API support) + * @throws PropelException + */ + public function setExport(ChildExport $v = null) + { + if ($v === null) { + $this->setId(NULL); + } else { + $this->setId($v->getId()); + } + + $this->aExport = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildExport object, it will not be re-added. + if ($v !== null) { + $v->addExportI18n($this); + } + + + return $this; + } + + + /** + * Get the associated ChildExport object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildExport The associated ChildExport object. + * @throws PropelException + */ + public function getExport(ConnectionInterface $con = null) + { + if ($this->aExport === null && ($this->id !== null)) { + $this->aExport = ChildExportQuery::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->aExport->addExportI18ns($this); + */ + } + + return $this->aExport; + } + + /** + * 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->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->aExport = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(ExportI18nTableMap::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/ExportI18nQuery.php b/core/lib/Thelia/Model/Base/ExportI18nQuery.php new file mode 100644 index 000000000..4c0956f12 --- /dev/null +++ b/core/lib/Thelia/Model/Base/ExportI18nQuery.php @@ -0,0 +1,541 @@ +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 ChildExportI18n|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = ExportI18nTableMap::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(ExportI18nTableMap::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 ChildExportI18n A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION` FROM `export_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 ChildExportI18n(); + $obj->hydrate($row); + ExportI18nTableMap::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 ChildExportI18n|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 ChildExportI18nQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + $this->addUsingAlias(ExportI18nTableMap::ID, $key[0], Criteria::EQUAL); + $this->addUsingAlias(ExportI18nTableMap::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 ChildExportI18nQuery 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(ExportI18nTableMap::ID, $key[0], Criteria::EQUAL); + $cton1 = $this->getNewCriterion(ExportI18nTableMap::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 filterByExport() + * + * @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 ChildExportI18nQuery 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(ExportI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(ExportI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportI18nTableMap::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 ChildExportI18nQuery 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(ExportI18nTableMap::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 ChildExportI18nQuery 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(ExportI18nTableMap::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 ChildExportI18nQuery 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(ExportI18nTableMap::DESCRIPTION, $description, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\Export object + * + * @param \Thelia\Model\Export|ObjectCollection $export The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildExportI18nQuery The current query, for fluid interface + */ + public function filterByExport($export, $comparison = null) + { + if ($export instanceof \Thelia\Model\Export) { + return $this + ->addUsingAlias(ExportI18nTableMap::ID, $export->getId(), $comparison); + } elseif ($export instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(ExportI18nTableMap::ID, $export->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByExport() only accepts arguments of type \Thelia\Model\Export or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Export relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildExportI18nQuery The current query, for fluid interface + */ + public function joinExport($relationAlias = null, $joinType = 'LEFT JOIN') + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Export'); + + // 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, 'Export'); + } + + return $this; + } + + /** + * Use the Export relation Export 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\ExportQuery A secondary query class using the current class as primary query + */ + public function useExportQuery($relationAlias = null, $joinType = 'LEFT JOIN') + { + return $this + ->joinExport($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Export', '\Thelia\Model\ExportQuery'); + } + + /** + * Exclude object from result + * + * @param ChildExportI18n $exportI18n Object to remove from the list of results + * + * @return ChildExportI18nQuery The current query, for fluid interface + */ + public function prune($exportI18n = null) + { + if ($exportI18n) { + $this->addCond('pruneCond0', $this->getAliasedColName(ExportI18nTableMap::ID), $exportI18n->getId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond1', $this->getAliasedColName(ExportI18nTableMap::LOCALE), $exportI18n->getLocale(), Criteria::NOT_EQUAL); + $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); + } + + return $this; + } + + /** + * Deletes all rows from the export_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(ExportI18nTableMap::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). + ExportI18nTableMap::clearInstancePool(); + ExportI18nTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildExportI18n or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildExportI18n 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(ExportI18nTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(ExportI18nTableMap::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(); + + + ExportI18nTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + ExportI18nTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + +} // ExportI18nQuery diff --git a/core/lib/Thelia/Model/Base/ExportQuery.php b/core/lib/Thelia/Model/Base/ExportQuery.php new file mode 100644 index 000000000..1a34da44f --- /dev/null +++ b/core/lib/Thelia/Model/Base/ExportQuery.php @@ -0,0 +1,813 @@ +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 ChildExport|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = ExportTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(ExportTableMap::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 ChildExport A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT `ID`, `EXPORT_CATEGORY_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `export` 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 ChildExport(); + $obj->hydrate($row); + ExportTableMap::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 ChildExport|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 ChildExportQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(ExportTableMap::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 ChildExportQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(ExportTableMap::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 ChildExportQuery 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(ExportTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(ExportTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the export_category_id column + * + * Example usage: + * + * $query->filterByExportCategoryId(1234); // WHERE export_category_id = 1234 + * $query->filterByExportCategoryId(array(12, 34)); // WHERE export_category_id IN (12, 34) + * $query->filterByExportCategoryId(array('min' => 12)); // WHERE export_category_id > 12 + * + * + * @see filterByExportCategory() + * + * @param mixed $exportCategoryId 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 ChildExportQuery The current query, for fluid interface + */ + public function filterByExportCategoryId($exportCategoryId = null, $comparison = null) + { + if (is_array($exportCategoryId)) { + $useMinMax = false; + if (isset($exportCategoryId['min'])) { + $this->addUsingAlias(ExportTableMap::EXPORT_CATEGORY_ID, $exportCategoryId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($exportCategoryId['max'])) { + $this->addUsingAlias(ExportTableMap::EXPORT_CATEGORY_ID, $exportCategoryId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportTableMap::EXPORT_CATEGORY_ID, $exportCategoryId, $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 ChildExportQuery 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(ExportTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($position['max'])) { + $this->addUsingAlias(ExportTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportTableMap::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 ChildExportQuery 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(ExportTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($createdAt['max'])) { + $this->addUsingAlias(ExportTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportTableMap::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 ChildExportQuery 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(ExportTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($updatedAt['max'])) { + $this->addUsingAlias(ExportTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(ExportTableMap::UPDATED_AT, $updatedAt, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\ExportCategory object + * + * @param \Thelia\Model\ExportCategory|ObjectCollection $exportCategory The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function filterByExportCategory($exportCategory, $comparison = null) + { + if ($exportCategory instanceof \Thelia\Model\ExportCategory) { + return $this + ->addUsingAlias(ExportTableMap::EXPORT_CATEGORY_ID, $exportCategory->getId(), $comparison); + } elseif ($exportCategory instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(ExportTableMap::EXPORT_CATEGORY_ID, $exportCategory->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByExportCategory() only accepts arguments of type \Thelia\Model\ExportCategory or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the ExportCategory relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function joinExportCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('ExportCategory'); + + // 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, 'ExportCategory'); + } + + return $this; + } + + /** + * Use the ExportCategory relation ExportCategory 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\ExportCategoryQuery A secondary query class using the current class as primary query + */ + public function useExportCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinExportCategory($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ExportCategory', '\Thelia\Model\ExportCategoryQuery'); + } + + /** + * Filter the query by a related \Thelia\Model\ExportI18n object + * + * @param \Thelia\Model\ExportI18n|ObjectCollection $exportI18n the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function filterByExportI18n($exportI18n, $comparison = null) + { + if ($exportI18n instanceof \Thelia\Model\ExportI18n) { + return $this + ->addUsingAlias(ExportTableMap::ID, $exportI18n->getId(), $comparison); + } elseif ($exportI18n instanceof ObjectCollection) { + return $this + ->useExportI18nQuery() + ->filterByPrimaryKeys($exportI18n->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByExportI18n() only accepts arguments of type \Thelia\Model\ExportI18n or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the ExportI18n relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function joinExportI18n($relationAlias = null, $joinType = 'LEFT JOIN') + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('ExportI18n'); + + // 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, 'ExportI18n'); + } + + return $this; + } + + /** + * Use the ExportI18n relation ExportI18n 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\ExportI18nQuery A secondary query class using the current class as primary query + */ + public function useExportI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') + { + return $this + ->joinExportI18n($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ExportI18n', '\Thelia\Model\ExportI18nQuery'); + } + + /** + * Exclude object from result + * + * @param ChildExport $export Object to remove from the list of results + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function prune($export = null) + { + if ($export) { + $this->addUsingAlias(ExportTableMap::ID, $export->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the export 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(ExportTableMap::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). + ExportTableMap::clearInstancePool(); + ExportTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildExport or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildExport 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(ExportTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(ExportTableMap::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(); + + + ExportTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + ExportTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + // 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 ChildExportQuery The current query, for fluid interface + */ + public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $relationName = $relationAlias ? $relationAlias : 'ExportI18n'; + + return $this + ->joinExportI18n($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 ChildExportQuery The current query, for fluid interface + */ + public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) + { + $this + ->joinI18n($locale, null, $joinType) + ->with('ExportI18n'); + $this->with['ExportI18n']->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 ChildExportI18nQuery 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 : 'ExportI18n', '\Thelia\Model\ExportI18nQuery'); + } + + // timestampable behavior + + /** + * Filter by the latest updated + * + * @param int $nbDays Maximum age of the latest update in days + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function recentlyUpdated($nbDays = 7) + { + return $this->addUsingAlias(ExportTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Filter by the latest created + * + * @param int $nbDays Maximum age of in days + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function recentlyCreated($nbDays = 7) + { + return $this->addUsingAlias(ExportTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + } + + /** + * Order by update date desc + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function lastUpdatedFirst() + { + return $this->addDescendingOrderByColumn(ExportTableMap::UPDATED_AT); + } + + /** + * Order by update date asc + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function firstUpdatedFirst() + { + return $this->addAscendingOrderByColumn(ExportTableMap::UPDATED_AT); + } + + /** + * Order by create date desc + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function lastCreatedFirst() + { + return $this->addDescendingOrderByColumn(ExportTableMap::CREATED_AT); + } + + /** + * Order by create date asc + * + * @return ChildExportQuery The current query, for fluid interface + */ + public function firstCreatedFirst() + { + return $this->addAscendingOrderByColumn(ExportTableMap::CREATED_AT); + } + +} // ExportQuery diff --git a/core/lib/Thelia/Model/Base/ImportExportType.php b/core/lib/Thelia/Model/Base/Import.php similarity index 69% rename from core/lib/Thelia/Model/Base/ImportExportType.php rename to core/lib/Thelia/Model/Base/Import.php index 47595ded9..e2b0e3cd6 100644 --- a/core/lib/Thelia/Model/Base/ImportExportType.php +++ b/core/lib/Thelia/Model/Base/Import.php @@ -17,20 +17,20 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; -use Thelia\Model\ImportExportCategory as ChildImportExportCategory; -use Thelia\Model\ImportExportCategoryQuery as ChildImportExportCategoryQuery; -use Thelia\Model\ImportExportType as ChildImportExportType; -use Thelia\Model\ImportExportTypeI18n as ChildImportExportTypeI18n; -use Thelia\Model\ImportExportTypeI18nQuery as ChildImportExportTypeI18nQuery; -use Thelia\Model\ImportExportTypeQuery as ChildImportExportTypeQuery; -use Thelia\Model\Map\ImportExportTypeTableMap; +use Thelia\Model\Import as ChildImport; +use Thelia\Model\ImportCategory as ChildImportCategory; +use Thelia\Model\ImportCategoryQuery as ChildImportCategoryQuery; +use Thelia\Model\ImportI18n as ChildImportI18n; +use Thelia\Model\ImportI18nQuery as ChildImportI18nQuery; +use Thelia\Model\ImportQuery as ChildImportQuery; +use Thelia\Model\Map\ImportTableMap; -abstract class ImportExportType implements ActiveRecordInterface +abstract class Import implements ActiveRecordInterface { /** * TableMap class name */ - const TABLE_MAP = '\\Thelia\\Model\\Map\\ImportExportTypeTableMap'; + const TABLE_MAP = '\\Thelia\\Model\\Map\\ImportTableMap'; /** @@ -66,16 +66,10 @@ abstract class ImportExportType implements ActiveRecordInterface protected $id; /** - * The value for the url_action field. - * @var string - */ - protected $url_action; - - /** - * The value for the import_export_category_id field. + * The value for the import_category_id field. * @var int */ - protected $import_export_category_id; + protected $import_category_id; /** * The value for the position field. @@ -96,15 +90,15 @@ abstract class ImportExportType implements ActiveRecordInterface protected $updated_at; /** - * @var ImportExportCategory + * @var ImportCategory */ - protected $aImportExportCategory; + protected $aImportCategory; /** - * @var ObjectCollection|ChildImportExportTypeI18n[] Collection to store aggregation of ChildImportExportTypeI18n objects. + * @var ObjectCollection|ChildImportI18n[] Collection to store aggregation of ChildImportI18n objects. */ - protected $collImportExportTypeI18ns; - protected $collImportExportTypeI18nsPartial; + protected $collImportI18ns; + protected $collImportI18nsPartial; /** * Flag to prevent endless save loop, if this object is referenced @@ -124,7 +118,7 @@ abstract class ImportExportType implements ActiveRecordInterface /** * Current translation objects - * @var array[ChildImportExportTypeI18n] + * @var array[ChildImportI18n] */ protected $currentTranslations; @@ -132,10 +126,10 @@ abstract class ImportExportType implements ActiveRecordInterface * An array of objects scheduled for deletion. * @var ObjectCollection */ - protected $importExportTypeI18nsScheduledForDeletion = null; + protected $importI18nsScheduledForDeletion = null; /** - * Initializes internal state of Thelia\Model\Base\ImportExportType object. + * Initializes internal state of Thelia\Model\Base\Import object. */ public function __construct() { @@ -230,9 +224,9 @@ abstract class ImportExportType implements ActiveRecordInterface } /** - * Compares this with another ImportExportType instance. If - * obj is an instance of ImportExportType, delegates to - * equals(ImportExportType). Otherwise, returns false. + * Compares this with another Import instance. If + * obj is an instance of Import, delegates to + * equals(Import). Otherwise, returns false. * * @param mixed $obj The object to compare to. * @return boolean Whether equal to the object specified. @@ -315,7 +309,7 @@ abstract class ImportExportType implements ActiveRecordInterface * @param string $name The virtual column name * @param mixed $value The value to give to the virtual column * - * @return ImportExportType The current object, for fluid interface + * @return Import The current object, for fluid interface */ public function setVirtualColumn($name, $value) { @@ -347,7 +341,7 @@ abstract class ImportExportType implements ActiveRecordInterface * or a format name ('XML', 'YAML', 'JSON', 'CSV') * @param string $data The source data to import from * - * @return ImportExportType The current object, for fluid interface + * @return Import The current object, for fluid interface */ public function importFrom($parser, $data) { @@ -404,25 +398,14 @@ abstract class ImportExportType implements ActiveRecordInterface } /** - * Get the [url_action] column value. - * - * @return string - */ - public function getUrlAction() - { - - return $this->url_action; - } - - /** - * Get the [import_export_category_id] column value. + * Get the [import_category_id] column value. * * @return int */ - public function getImportExportCategoryId() + public function getImportCategoryId() { - return $this->import_export_category_id; + return $this->import_category_id; } /** @@ -480,7 +463,7 @@ abstract class ImportExportType implements ActiveRecordInterface * Set the value of [id] column. * * @param int $v new value - * @return \Thelia\Model\ImportExportType The current object (for fluent API support) + * @return \Thelia\Model\Import The current object (for fluent API support) */ public function setId($v) { @@ -490,7 +473,7 @@ abstract class ImportExportType implements ActiveRecordInterface if ($this->id !== $v) { $this->id = $v; - $this->modifiedColumns[ImportExportTypeTableMap::ID] = true; + $this->modifiedColumns[ImportTableMap::ID] = true; } @@ -498,56 +481,35 @@ abstract class ImportExportType implements ActiveRecordInterface } // setId() /** - * Set the value of [url_action] column. - * - * @param string $v new value - * @return \Thelia\Model\ImportExportType The current object (for fluent API support) - */ - public function setUrlAction($v) - { - if ($v !== null) { - $v = (string) $v; - } - - if ($this->url_action !== $v) { - $this->url_action = $v; - $this->modifiedColumns[ImportExportTypeTableMap::URL_ACTION] = true; - } - - - return $this; - } // setUrlAction() - - /** - * Set the value of [import_export_category_id] column. + * Set the value of [import_category_id] column. * * @param int $v new value - * @return \Thelia\Model\ImportExportType The current object (for fluent API support) + * @return \Thelia\Model\Import The current object (for fluent API support) */ - public function setImportExportCategoryId($v) + public function setImportCategoryId($v) { if ($v !== null) { $v = (int) $v; } - if ($this->import_export_category_id !== $v) { - $this->import_export_category_id = $v; - $this->modifiedColumns[ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID] = true; + if ($this->import_category_id !== $v) { + $this->import_category_id = $v; + $this->modifiedColumns[ImportTableMap::IMPORT_CATEGORY_ID] = true; } - if ($this->aImportExportCategory !== null && $this->aImportExportCategory->getId() !== $v) { - $this->aImportExportCategory = null; + if ($this->aImportCategory !== null && $this->aImportCategory->getId() !== $v) { + $this->aImportCategory = null; } return $this; - } // setImportExportCategoryId() + } // setImportCategoryId() /** * Set the value of [position] column. * * @param int $v new value - * @return \Thelia\Model\ImportExportType The current object (for fluent API support) + * @return \Thelia\Model\Import The current object (for fluent API support) */ public function setPosition($v) { @@ -557,7 +519,7 @@ abstract class ImportExportType implements ActiveRecordInterface if ($this->position !== $v) { $this->position = $v; - $this->modifiedColumns[ImportExportTypeTableMap::POSITION] = true; + $this->modifiedColumns[ImportTableMap::POSITION] = true; } @@ -569,7 +531,7 @@ abstract class ImportExportType implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\ImportExportType The current object (for fluent API support) + * @return \Thelia\Model\Import The current object (for fluent API support) */ public function setCreatedAt($v) { @@ -577,7 +539,7 @@ abstract class ImportExportType implements ActiveRecordInterface if ($this->created_at !== null || $dt !== null) { if ($dt !== $this->created_at) { $this->created_at = $dt; - $this->modifiedColumns[ImportExportTypeTableMap::CREATED_AT] = true; + $this->modifiedColumns[ImportTableMap::CREATED_AT] = true; } } // if either are not null @@ -590,7 +552,7 @@ abstract class ImportExportType implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\ImportExportType The current object (for fluent API support) + * @return \Thelia\Model\Import The current object (for fluent API support) */ public function setUpdatedAt($v) { @@ -598,7 +560,7 @@ abstract class ImportExportType implements ActiveRecordInterface if ($this->updated_at !== null || $dt !== null) { if ($dt !== $this->updated_at) { $this->updated_at = $dt; - $this->modifiedColumns[ImportExportTypeTableMap::UPDATED_AT] = true; + $this->modifiedColumns[ImportTableMap::UPDATED_AT] = true; } } // if either are not null @@ -643,25 +605,22 @@ abstract class ImportExportType implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ImportExportTypeTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ImportTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ImportExportTypeTableMap::translateFieldName('UrlAction', TableMap::TYPE_PHPNAME, $indexType)]; - $this->url_action = (null !== $col) ? (string) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ImportTableMap::translateFieldName('ImportCategoryId', TableMap::TYPE_PHPNAME, $indexType)]; + $this->import_category_id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ImportExportTypeTableMap::translateFieldName('ImportExportCategoryId', TableMap::TYPE_PHPNAME, $indexType)]; - $this->import_export_category_id = (null !== $col) ? (int) $col : null; - - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ImportExportTypeTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ImportTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; $this->position = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ImportExportTypeTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ImportTableMap::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 : ImportExportTypeTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ImportTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -674,10 +633,10 @@ abstract class ImportExportType implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 6; // 6 = ImportExportTypeTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 5; // 5 = ImportTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException("Error populating \Thelia\Model\ImportExportType object", 0, $e); + throw new PropelException("Error populating \Thelia\Model\Import object", 0, $e); } } @@ -696,8 +655,8 @@ abstract class ImportExportType implements ActiveRecordInterface */ public function ensureConsistency() { - if ($this->aImportExportCategory !== null && $this->import_export_category_id !== $this->aImportExportCategory->getId()) { - $this->aImportExportCategory = null; + if ($this->aImportCategory !== null && $this->import_category_id !== $this->aImportCategory->getId()) { + $this->aImportCategory = null; } } // ensureConsistency @@ -722,13 +681,13 @@ abstract class ImportExportType implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ImportExportTypeTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ImportTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. - $dataFetcher = ChildImportExportTypeQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $dataFetcher = ChildImportQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { @@ -738,8 +697,8 @@ abstract class ImportExportType implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->aImportExportCategory = null; - $this->collImportExportTypeI18ns = null; + $this->aImportCategory = null; + $this->collImportI18ns = null; } // if (deep) } @@ -750,8 +709,8 @@ abstract class ImportExportType implements ActiveRecordInterface * @param ConnectionInterface $con * @return void * @throws PropelException - * @see ImportExportType::setDeleted() - * @see ImportExportType::isDeleted() + * @see Import::setDeleted() + * @see Import::isDeleted() */ public function delete(ConnectionInterface $con = null) { @@ -760,12 +719,12 @@ abstract class ImportExportType implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportTableMap::DATABASE_NAME); } $con->beginTransaction(); try { - $deleteQuery = ChildImportExportTypeQuery::create() + $deleteQuery = ChildImportQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { @@ -802,7 +761,7 @@ abstract class ImportExportType implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportTableMap::DATABASE_NAME); } $con->beginTransaction(); @@ -812,16 +771,16 @@ abstract class ImportExportType implements ActiveRecordInterface if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - if (!$this->isColumnModified(ImportExportTypeTableMap::CREATED_AT)) { + if (!$this->isColumnModified(ImportTableMap::CREATED_AT)) { $this->setCreatedAt(time()); } - if (!$this->isColumnModified(ImportExportTypeTableMap::UPDATED_AT)) { + if (!$this->isColumnModified(ImportTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } else { $ret = $ret && $this->preUpdate($con); // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ImportExportTypeTableMap::UPDATED_AT)) { + if ($this->isModified() && !$this->isColumnModified(ImportTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } @@ -833,7 +792,7 @@ abstract class ImportExportType implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - ImportExportTypeTableMap::addInstanceToPool($this); + ImportTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -868,11 +827,11 @@ abstract class ImportExportType implements ActiveRecordInterface // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aImportExportCategory !== null) { - if ($this->aImportExportCategory->isModified() || $this->aImportExportCategory->isNew()) { - $affectedRows += $this->aImportExportCategory->save($con); + if ($this->aImportCategory !== null) { + if ($this->aImportCategory->isModified() || $this->aImportCategory->isNew()) { + $affectedRows += $this->aImportCategory->save($con); } - $this->setImportExportCategory($this->aImportExportCategory); + $this->setImportCategory($this->aImportCategory); } if ($this->isNew() || $this->isModified()) { @@ -886,17 +845,17 @@ abstract class ImportExportType implements ActiveRecordInterface $this->resetModified(); } - if ($this->importExportTypeI18nsScheduledForDeletion !== null) { - if (!$this->importExportTypeI18nsScheduledForDeletion->isEmpty()) { - \Thelia\Model\ImportExportTypeI18nQuery::create() - ->filterByPrimaryKeys($this->importExportTypeI18nsScheduledForDeletion->getPrimaryKeys(false)) + if ($this->importI18nsScheduledForDeletion !== null) { + if (!$this->importI18nsScheduledForDeletion->isEmpty()) { + \Thelia\Model\ImportI18nQuery::create() + ->filterByPrimaryKeys($this->importI18nsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); - $this->importExportTypeI18nsScheduledForDeletion = null; + $this->importI18nsScheduledForDeletion = null; } } - if ($this->collImportExportTypeI18ns !== null) { - foreach ($this->collImportExportTypeI18ns as $referrerFK) { + if ($this->collImportI18ns !== null) { + foreach ($this->collImportI18ns as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } @@ -923,33 +882,30 @@ abstract class ImportExportType implements ActiveRecordInterface $modifiedColumns = array(); $index = 0; - $this->modifiedColumns[ImportExportTypeTableMap::ID] = true; + $this->modifiedColumns[ImportTableMap::ID] = true; if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ImportExportTypeTableMap::ID . ')'); + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ImportTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ImportExportTypeTableMap::ID)) { + if ($this->isColumnModified(ImportTableMap::ID)) { $modifiedColumns[':p' . $index++] = '`ID`'; } - if ($this->isColumnModified(ImportExportTypeTableMap::URL_ACTION)) { - $modifiedColumns[':p' . $index++] = '`URL_ACTION`'; + if ($this->isColumnModified(ImportTableMap::IMPORT_CATEGORY_ID)) { + $modifiedColumns[':p' . $index++] = '`IMPORT_CATEGORY_ID`'; } - if ($this->isColumnModified(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID)) { - $modifiedColumns[':p' . $index++] = '`IMPORT_EXPORT_CATEGORY_ID`'; - } - if ($this->isColumnModified(ImportExportTypeTableMap::POSITION)) { + if ($this->isColumnModified(ImportTableMap::POSITION)) { $modifiedColumns[':p' . $index++] = '`POSITION`'; } - if ($this->isColumnModified(ImportExportTypeTableMap::CREATED_AT)) { + if ($this->isColumnModified(ImportTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } - if ($this->isColumnModified(ImportExportTypeTableMap::UPDATED_AT)) { + if ($this->isColumnModified(ImportTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO `import_export_type` (%s) VALUES (%s)', + 'INSERT INTO `import` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -961,11 +917,8 @@ abstract class ImportExportType implements ActiveRecordInterface case '`ID`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; - case '`URL_ACTION`': - $stmt->bindValue($identifier, $this->url_action, PDO::PARAM_STR); - break; - case '`IMPORT_EXPORT_CATEGORY_ID`': - $stmt->bindValue($identifier, $this->import_export_category_id, PDO::PARAM_INT); + case '`IMPORT_CATEGORY_ID`': + $stmt->bindValue($identifier, $this->import_category_id, PDO::PARAM_INT); break; case '`POSITION`': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); @@ -1022,7 +975,7 @@ abstract class ImportExportType implements ActiveRecordInterface */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { - $pos = ImportExportTypeTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ImportTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); return $field; @@ -1042,18 +995,15 @@ abstract class ImportExportType implements ActiveRecordInterface return $this->getId(); break; case 1: - return $this->getUrlAction(); + return $this->getImportCategoryId(); break; case 2: - return $this->getImportExportCategoryId(); - break; - case 3: return $this->getPosition(); break; - case 4: + case 3: return $this->getCreatedAt(); break; - case 5: + case 4: return $this->getUpdatedAt(); break; default: @@ -1079,18 +1029,17 @@ abstract class ImportExportType implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['ImportExportType'][$this->getPrimaryKey()])) { + if (isset($alreadyDumpedObjects['Import'][$this->getPrimaryKey()])) { return '*RECURSION*'; } - $alreadyDumpedObjects['ImportExportType'][$this->getPrimaryKey()] = true; - $keys = ImportExportTypeTableMap::getFieldNames($keyType); + $alreadyDumpedObjects['Import'][$this->getPrimaryKey()] = true; + $keys = ImportTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), - $keys[1] => $this->getUrlAction(), - $keys[2] => $this->getImportExportCategoryId(), - $keys[3] => $this->getPosition(), - $keys[4] => $this->getCreatedAt(), - $keys[5] => $this->getUpdatedAt(), + $keys[1] => $this->getImportCategoryId(), + $keys[2] => $this->getPosition(), + $keys[3] => $this->getCreatedAt(), + $keys[4] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1098,11 +1047,11 @@ abstract class ImportExportType implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->aImportExportCategory) { - $result['ImportExportCategory'] = $this->aImportExportCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + if (null !== $this->aImportCategory) { + $result['ImportCategory'] = $this->aImportCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } - if (null !== $this->collImportExportTypeI18ns) { - $result['ImportExportTypeI18ns'] = $this->collImportExportTypeI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + if (null !== $this->collImportI18ns) { + $result['ImportI18ns'] = $this->collImportI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } @@ -1122,7 +1071,7 @@ abstract class ImportExportType implements ActiveRecordInterface */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) { - $pos = ImportExportTypeTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ImportTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); return $this->setByPosition($pos, $value); } @@ -1142,18 +1091,15 @@ abstract class ImportExportType implements ActiveRecordInterface $this->setId($value); break; case 1: - $this->setUrlAction($value); + $this->setImportCategoryId($value); break; case 2: - $this->setImportExportCategoryId($value); - break; - case 3: $this->setPosition($value); break; - case 4: + case 3: $this->setCreatedAt($value); break; - case 5: + case 4: $this->setUpdatedAt($value); break; } // switch() @@ -1178,14 +1124,13 @@ abstract class ImportExportType implements ActiveRecordInterface */ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { - $keys = ImportExportTypeTableMap::getFieldNames($keyType); + $keys = ImportTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setUrlAction($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setImportExportCategoryId($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]]); + if (array_key_exists($keys[1], $arr)) $this->setImportCategoryId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setPosition($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]); } /** @@ -1195,14 +1140,13 @@ abstract class ImportExportType implements ActiveRecordInterface */ public function buildCriteria() { - $criteria = new Criteria(ImportExportTypeTableMap::DATABASE_NAME); + $criteria = new Criteria(ImportTableMap::DATABASE_NAME); - if ($this->isColumnModified(ImportExportTypeTableMap::ID)) $criteria->add(ImportExportTypeTableMap::ID, $this->id); - if ($this->isColumnModified(ImportExportTypeTableMap::URL_ACTION)) $criteria->add(ImportExportTypeTableMap::URL_ACTION, $this->url_action); - if ($this->isColumnModified(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID)) $criteria->add(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $this->import_export_category_id); - if ($this->isColumnModified(ImportExportTypeTableMap::POSITION)) $criteria->add(ImportExportTypeTableMap::POSITION, $this->position); - if ($this->isColumnModified(ImportExportTypeTableMap::CREATED_AT)) $criteria->add(ImportExportTypeTableMap::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ImportExportTypeTableMap::UPDATED_AT)) $criteria->add(ImportExportTypeTableMap::UPDATED_AT, $this->updated_at); + if ($this->isColumnModified(ImportTableMap::ID)) $criteria->add(ImportTableMap::ID, $this->id); + if ($this->isColumnModified(ImportTableMap::IMPORT_CATEGORY_ID)) $criteria->add(ImportTableMap::IMPORT_CATEGORY_ID, $this->import_category_id); + if ($this->isColumnModified(ImportTableMap::POSITION)) $criteria->add(ImportTableMap::POSITION, $this->position); + if ($this->isColumnModified(ImportTableMap::CREATED_AT)) $criteria->add(ImportTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(ImportTableMap::UPDATED_AT)) $criteria->add(ImportTableMap::UPDATED_AT, $this->updated_at); return $criteria; } @@ -1217,8 +1161,8 @@ abstract class ImportExportType implements ActiveRecordInterface */ public function buildPkeyCriteria() { - $criteria = new Criteria(ImportExportTypeTableMap::DATABASE_NAME); - $criteria->add(ImportExportTypeTableMap::ID, $this->id); + $criteria = new Criteria(ImportTableMap::DATABASE_NAME); + $criteria->add(ImportTableMap::ID, $this->id); return $criteria; } @@ -1259,15 +1203,14 @@ abstract class ImportExportType implements ActiveRecordInterface * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \Thelia\Model\ImportExportType (or compatible) type. + * @param object $copyObj An object of \Thelia\Model\Import (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->setUrlAction($this->getUrlAction()); - $copyObj->setImportExportCategoryId($this->getImportExportCategoryId()); + $copyObj->setImportCategoryId($this->getImportCategoryId()); $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -1277,9 +1220,9 @@ abstract class ImportExportType implements ActiveRecordInterface // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getImportExportTypeI18ns() as $relObj) { + foreach ($this->getImportI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addImportExportTypeI18n($relObj->copy($deepCopy)); + $copyObj->addImportI18n($relObj->copy($deepCopy)); } } @@ -1300,7 +1243,7 @@ abstract class ImportExportType implements ActiveRecordInterface * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return \Thelia\Model\ImportExportType Clone of current object. + * @return \Thelia\Model\Import Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) @@ -1314,26 +1257,26 @@ abstract class ImportExportType implements ActiveRecordInterface } /** - * Declares an association between this object and a ChildImportExportCategory object. + * Declares an association between this object and a ChildImportCategory object. * - * @param ChildImportExportCategory $v - * @return \Thelia\Model\ImportExportType The current object (for fluent API support) + * @param ChildImportCategory $v + * @return \Thelia\Model\Import The current object (for fluent API support) * @throws PropelException */ - public function setImportExportCategory(ChildImportExportCategory $v = null) + public function setImportCategory(ChildImportCategory $v = null) { if ($v === null) { - $this->setImportExportCategoryId(NULL); + $this->setImportCategoryId(NULL); } else { - $this->setImportExportCategoryId($v->getId()); + $this->setImportCategoryId($v->getId()); } - $this->aImportExportCategory = $v; + $this->aImportCategory = $v; // Add binding for other direction of this n:n relationship. - // If this object has already been added to the ChildImportExportCategory object, it will not be re-added. + // If this object has already been added to the ChildImportCategory object, it will not be re-added. if ($v !== null) { - $v->addImportExportType($this); + $v->addImport($this); } @@ -1342,26 +1285,26 @@ abstract class ImportExportType implements ActiveRecordInterface /** - * Get the associated ChildImportExportCategory object + * Get the associated ChildImportCategory object * * @param ConnectionInterface $con Optional Connection object. - * @return ChildImportExportCategory The associated ChildImportExportCategory object. + * @return ChildImportCategory The associated ChildImportCategory object. * @throws PropelException */ - public function getImportExportCategory(ConnectionInterface $con = null) + public function getImportCategory(ConnectionInterface $con = null) { - if ($this->aImportExportCategory === null && ($this->import_export_category_id !== null)) { - $this->aImportExportCategory = ChildImportExportCategoryQuery::create()->findPk($this->import_export_category_id, $con); + if ($this->aImportCategory === null && ($this->import_category_id !== null)) { + $this->aImportCategory = ChildImportCategoryQuery::create()->findPk($this->import_category_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->aImportExportCategory->addImportExportTypes($this); + $this->aImportCategory->addImports($this); */ } - return $this->aImportExportCategory; + return $this->aImportCategory; } @@ -1375,37 +1318,37 @@ abstract class ImportExportType implements ActiveRecordInterface */ public function initRelation($relationName) { - if ('ImportExportTypeI18n' == $relationName) { - return $this->initImportExportTypeI18ns(); + if ('ImportI18n' == $relationName) { + return $this->initImportI18ns(); } } /** - * Clears out the collImportExportTypeI18ns collection + * Clears out the collImportI18ns 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 addImportExportTypeI18ns() + * @see addImportI18ns() */ - public function clearImportExportTypeI18ns() + public function clearImportI18ns() { - $this->collImportExportTypeI18ns = null; // important to set this to NULL since that means it is uninitialized + $this->collImportI18ns = null; // important to set this to NULL since that means it is uninitialized } /** - * Reset is the collImportExportTypeI18ns collection loaded partially. + * Reset is the collImportI18ns collection loaded partially. */ - public function resetPartialImportExportTypeI18ns($v = true) + public function resetPartialImportI18ns($v = true) { - $this->collImportExportTypeI18nsPartial = $v; + $this->collImportI18nsPartial = $v; } /** - * Initializes the collImportExportTypeI18ns collection. + * Initializes the collImportI18ns collection. * - * By default this just sets the collImportExportTypeI18ns collection to an empty array (like clearcollImportExportTypeI18ns()); + * By default this just sets the collImportI18ns collection to an empty array (like clearcollImportI18ns()); * 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. * @@ -1414,192 +1357,192 @@ abstract class ImportExportType implements ActiveRecordInterface * * @return void */ - public function initImportExportTypeI18ns($overrideExisting = true) + public function initImportI18ns($overrideExisting = true) { - if (null !== $this->collImportExportTypeI18ns && !$overrideExisting) { + if (null !== $this->collImportI18ns && !$overrideExisting) { return; } - $this->collImportExportTypeI18ns = new ObjectCollection(); - $this->collImportExportTypeI18ns->setModel('\Thelia\Model\ImportExportTypeI18n'); + $this->collImportI18ns = new ObjectCollection(); + $this->collImportI18ns->setModel('\Thelia\Model\ImportI18n'); } /** - * Gets an array of ChildImportExportTypeI18n objects which contain a foreign key that references this object. + * Gets an array of ChildImportI18n 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 ChildImportExportType is new, it will return + * If this ChildImport 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|ChildImportExportTypeI18n[] List of ChildImportExportTypeI18n objects + * @return Collection|ChildImportI18n[] List of ChildImportI18n objects * @throws PropelException */ - public function getImportExportTypeI18ns($criteria = null, ConnectionInterface $con = null) + public function getImportI18ns($criteria = null, ConnectionInterface $con = null) { - $partial = $this->collImportExportTypeI18nsPartial && !$this->isNew(); - if (null === $this->collImportExportTypeI18ns || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collImportExportTypeI18ns) { + $partial = $this->collImportI18nsPartial && !$this->isNew(); + if (null === $this->collImportI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collImportI18ns) { // return empty collection - $this->initImportExportTypeI18ns(); + $this->initImportI18ns(); } else { - $collImportExportTypeI18ns = ChildImportExportTypeI18nQuery::create(null, $criteria) - ->filterByImportExportType($this) + $collImportI18ns = ChildImportI18nQuery::create(null, $criteria) + ->filterByImport($this) ->find($con); if (null !== $criteria) { - if (false !== $this->collImportExportTypeI18nsPartial && count($collImportExportTypeI18ns)) { - $this->initImportExportTypeI18ns(false); + if (false !== $this->collImportI18nsPartial && count($collImportI18ns)) { + $this->initImportI18ns(false); - foreach ($collImportExportTypeI18ns as $obj) { - if (false == $this->collImportExportTypeI18ns->contains($obj)) { - $this->collImportExportTypeI18ns->append($obj); + foreach ($collImportI18ns as $obj) { + if (false == $this->collImportI18ns->contains($obj)) { + $this->collImportI18ns->append($obj); } } - $this->collImportExportTypeI18nsPartial = true; + $this->collImportI18nsPartial = true; } - reset($collImportExportTypeI18ns); + reset($collImportI18ns); - return $collImportExportTypeI18ns; + return $collImportI18ns; } - if ($partial && $this->collImportExportTypeI18ns) { - foreach ($this->collImportExportTypeI18ns as $obj) { + if ($partial && $this->collImportI18ns) { + foreach ($this->collImportI18ns as $obj) { if ($obj->isNew()) { - $collImportExportTypeI18ns[] = $obj; + $collImportI18ns[] = $obj; } } } - $this->collImportExportTypeI18ns = $collImportExportTypeI18ns; - $this->collImportExportTypeI18nsPartial = false; + $this->collImportI18ns = $collImportI18ns; + $this->collImportI18nsPartial = false; } } - return $this->collImportExportTypeI18ns; + return $this->collImportI18ns; } /** - * Sets a collection of ImportExportTypeI18n objects related by a one-to-many relationship + * Sets a collection of ImportI18n 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 $importExportTypeI18ns A Propel collection. + * @param Collection $importI18ns A Propel collection. * @param ConnectionInterface $con Optional connection object - * @return ChildImportExportType The current object (for fluent API support) + * @return ChildImport The current object (for fluent API support) */ - public function setImportExportTypeI18ns(Collection $importExportTypeI18ns, ConnectionInterface $con = null) + public function setImportI18ns(Collection $importI18ns, ConnectionInterface $con = null) { - $importExportTypeI18nsToDelete = $this->getImportExportTypeI18ns(new Criteria(), $con)->diff($importExportTypeI18ns); + $importI18nsToDelete = $this->getImportI18ns(new Criteria(), $con)->diff($importI18ns); //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->importExportTypeI18nsScheduledForDeletion = clone $importExportTypeI18nsToDelete; + $this->importI18nsScheduledForDeletion = clone $importI18nsToDelete; - foreach ($importExportTypeI18nsToDelete as $importExportTypeI18nRemoved) { - $importExportTypeI18nRemoved->setImportExportType(null); + foreach ($importI18nsToDelete as $importI18nRemoved) { + $importI18nRemoved->setImport(null); } - $this->collImportExportTypeI18ns = null; - foreach ($importExportTypeI18ns as $importExportTypeI18n) { - $this->addImportExportTypeI18n($importExportTypeI18n); + $this->collImportI18ns = null; + foreach ($importI18ns as $importI18n) { + $this->addImportI18n($importI18n); } - $this->collImportExportTypeI18ns = $importExportTypeI18ns; - $this->collImportExportTypeI18nsPartial = false; + $this->collImportI18ns = $importI18ns; + $this->collImportI18nsPartial = false; return $this; } /** - * Returns the number of related ImportExportTypeI18n objects. + * Returns the number of related ImportI18n objects. * * @param Criteria $criteria * @param boolean $distinct * @param ConnectionInterface $con - * @return int Count of related ImportExportTypeI18n objects. + * @return int Count of related ImportI18n objects. * @throws PropelException */ - public function countImportExportTypeI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countImportI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { - $partial = $this->collImportExportTypeI18nsPartial && !$this->isNew(); - if (null === $this->collImportExportTypeI18ns || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collImportExportTypeI18ns) { + $partial = $this->collImportI18nsPartial && !$this->isNew(); + if (null === $this->collImportI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collImportI18ns) { return 0; } if ($partial && !$criteria) { - return count($this->getImportExportTypeI18ns()); + return count($this->getImportI18ns()); } - $query = ChildImportExportTypeI18nQuery::create(null, $criteria); + $query = ChildImportI18nQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query - ->filterByImportExportType($this) + ->filterByImport($this) ->count($con); } - return count($this->collImportExportTypeI18ns); + return count($this->collImportI18ns); } /** - * Method called to associate a ChildImportExportTypeI18n object to this object - * through the ChildImportExportTypeI18n foreign key attribute. + * Method called to associate a ChildImportI18n object to this object + * through the ChildImportI18n foreign key attribute. * - * @param ChildImportExportTypeI18n $l ChildImportExportTypeI18n - * @return \Thelia\Model\ImportExportType The current object (for fluent API support) + * @param ChildImportI18n $l ChildImportI18n + * @return \Thelia\Model\Import The current object (for fluent API support) */ - public function addImportExportTypeI18n(ChildImportExportTypeI18n $l) + public function addImportI18n(ChildImportI18n $l) { if ($l && $locale = $l->getLocale()) { $this->setLocale($locale); $this->currentTranslations[$locale] = $l; } - if ($this->collImportExportTypeI18ns === null) { - $this->initImportExportTypeI18ns(); - $this->collImportExportTypeI18nsPartial = true; + if ($this->collImportI18ns === null) { + $this->initImportI18ns(); + $this->collImportI18nsPartial = true; } - if (!in_array($l, $this->collImportExportTypeI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddImportExportTypeI18n($l); + if (!in_array($l, $this->collImportI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddImportI18n($l); } return $this; } /** - * @param ImportExportTypeI18n $importExportTypeI18n The importExportTypeI18n object to add. + * @param ImportI18n $importI18n The importI18n object to add. */ - protected function doAddImportExportTypeI18n($importExportTypeI18n) + protected function doAddImportI18n($importI18n) { - $this->collImportExportTypeI18ns[]= $importExportTypeI18n; - $importExportTypeI18n->setImportExportType($this); + $this->collImportI18ns[]= $importI18n; + $importI18n->setImport($this); } /** - * @param ImportExportTypeI18n $importExportTypeI18n The importExportTypeI18n object to remove. - * @return ChildImportExportType The current object (for fluent API support) + * @param ImportI18n $importI18n The importI18n object to remove. + * @return ChildImport The current object (for fluent API support) */ - public function removeImportExportTypeI18n($importExportTypeI18n) + public function removeImportI18n($importI18n) { - if ($this->getImportExportTypeI18ns()->contains($importExportTypeI18n)) { - $this->collImportExportTypeI18ns->remove($this->collImportExportTypeI18ns->search($importExportTypeI18n)); - if (null === $this->importExportTypeI18nsScheduledForDeletion) { - $this->importExportTypeI18nsScheduledForDeletion = clone $this->collImportExportTypeI18ns; - $this->importExportTypeI18nsScheduledForDeletion->clear(); + if ($this->getImportI18ns()->contains($importI18n)) { + $this->collImportI18ns->remove($this->collImportI18ns->search($importI18n)); + if (null === $this->importI18nsScheduledForDeletion) { + $this->importI18nsScheduledForDeletion = clone $this->collImportI18ns; + $this->importI18nsScheduledForDeletion->clear(); } - $this->importExportTypeI18nsScheduledForDeletion[]= clone $importExportTypeI18n; - $importExportTypeI18n->setImportExportType(null); + $this->importI18nsScheduledForDeletion[]= clone $importI18n; + $importI18n->setImport(null); } return $this; @@ -1611,8 +1554,7 @@ abstract class ImportExportType implements ActiveRecordInterface public function clear() { $this->id = null; - $this->url_action = null; - $this->import_export_category_id = null; + $this->import_category_id = null; $this->position = null; $this->created_at = null; $this->updated_at = null; @@ -1635,8 +1577,8 @@ abstract class ImportExportType implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collImportExportTypeI18ns) { - foreach ($this->collImportExportTypeI18ns as $o) { + if ($this->collImportI18ns) { + foreach ($this->collImportI18ns as $o) { $o->clearAllReferences($deep); } } @@ -1646,8 +1588,8 @@ abstract class ImportExportType implements ActiveRecordInterface $this->currentLocale = 'en_US'; $this->currentTranslations = null; - $this->collImportExportTypeI18ns = null; - $this->aImportExportCategory = null; + $this->collImportI18ns = null; + $this->aImportCategory = null; } /** @@ -1657,7 +1599,7 @@ abstract class ImportExportType implements ActiveRecordInterface */ public function __toString() { - return (string) $this->exportTo(ImportExportTypeTableMap::DEFAULT_STRING_FORMAT); + return (string) $this->exportTo(ImportTableMap::DEFAULT_STRING_FORMAT); } // i18n behavior @@ -1667,7 +1609,7 @@ abstract class ImportExportType implements ActiveRecordInterface * * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * - * @return ChildImportExportType The current object (for fluent API support) + * @return ChildImport The current object (for fluent API support) */ public function setLocale($locale = 'en_US') { @@ -1692,12 +1634,12 @@ abstract class ImportExportType implements ActiveRecordInterface * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * @param ConnectionInterface $con an optional connection object * - * @return ChildImportExportTypeI18n */ + * @return ChildImportI18n */ public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { - if (null !== $this->collImportExportTypeI18ns) { - foreach ($this->collImportExportTypeI18ns as $translation) { + if (null !== $this->collImportI18ns) { + foreach ($this->collImportI18ns as $translation) { if ($translation->getLocale() == $locale) { $this->currentTranslations[$locale] = $translation; @@ -1706,15 +1648,15 @@ abstract class ImportExportType implements ActiveRecordInterface } } if ($this->isNew()) { - $translation = new ChildImportExportTypeI18n(); + $translation = new ChildImportI18n(); $translation->setLocale($locale); } else { - $translation = ChildImportExportTypeI18nQuery::create() + $translation = ChildImportI18nQuery::create() ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) ->findOneOrCreate($con); $this->currentTranslations[$locale] = $translation; } - $this->addImportExportTypeI18n($translation); + $this->addImportI18n($translation); } return $this->currentTranslations[$locale]; @@ -1726,21 +1668,21 @@ abstract class ImportExportType implements ActiveRecordInterface * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * @param ConnectionInterface $con an optional connection object * - * @return ChildImportExportType The current object (for fluent API support) + * @return ChildImport The current object (for fluent API support) */ public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { - ChildImportExportTypeI18nQuery::create() + ChildImportI18nQuery::create() ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) ->delete($con); } if (isset($this->currentTranslations[$locale])) { unset($this->currentTranslations[$locale]); } - foreach ($this->collImportExportTypeI18ns as $key => $translation) { + foreach ($this->collImportI18ns as $key => $translation) { if ($translation->getLocale() == $locale) { - unset($this->collImportExportTypeI18ns[$key]); + unset($this->collImportI18ns[$key]); break; } } @@ -1753,7 +1695,7 @@ abstract class ImportExportType implements ActiveRecordInterface * * @param ConnectionInterface $con an optional connection object * - * @return ChildImportExportTypeI18n */ + * @return ChildImportI18n */ public function getCurrentTranslation(ConnectionInterface $con = null) { return $this->getTranslation($this->getLocale(), $con); @@ -1775,7 +1717,7 @@ abstract class ImportExportType implements ActiveRecordInterface * Set the value of [title] column. * * @param string $v new value - * @return \Thelia\Model\ImportExportTypeI18n The current object (for fluent API support) + * @return \Thelia\Model\ImportI18n The current object (for fluent API support) */ public function setTitle($v) { $this->getCurrentTranslation()->setTitle($v); @@ -1799,7 +1741,7 @@ abstract class ImportExportType implements ActiveRecordInterface * Set the value of [description] column. * * @param string $v new value - * @return \Thelia\Model\ImportExportTypeI18n The current object (for fluent API support) + * @return \Thelia\Model\ImportI18n The current object (for fluent API support) */ public function setDescription($v) { $this->getCurrentTranslation()->setDescription($v); @@ -1812,11 +1754,11 @@ abstract class ImportExportType implements ActiveRecordInterface /** * Mark the current object so that the update date doesn't get updated during next save * - * @return ChildImportExportType The current object (for fluent API support) + * @return ChildImport The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { - $this->modifiedColumns[ImportExportTypeTableMap::UPDATED_AT] = true; + $this->modifiedColumns[ImportTableMap::UPDATED_AT] = true; return $this; } diff --git a/core/lib/Thelia/Model/Base/ImportExportCategory.php b/core/lib/Thelia/Model/Base/ImportCategory.php similarity index 68% rename from core/lib/Thelia/Model/Base/ImportExportCategory.php rename to core/lib/Thelia/Model/Base/ImportCategory.php index ed0e5007c..83f3f2810 100644 --- a/core/lib/Thelia/Model/Base/ImportExportCategory.php +++ b/core/lib/Thelia/Model/Base/ImportCategory.php @@ -17,20 +17,20 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; use Propel\Runtime\Util\PropelDateTime; -use Thelia\Model\ImportExportCategory as ChildImportExportCategory; -use Thelia\Model\ImportExportCategoryI18n as ChildImportExportCategoryI18n; -use Thelia\Model\ImportExportCategoryI18nQuery as ChildImportExportCategoryI18nQuery; -use Thelia\Model\ImportExportCategoryQuery as ChildImportExportCategoryQuery; -use Thelia\Model\ImportExportType as ChildImportExportType; -use Thelia\Model\ImportExportTypeQuery as ChildImportExportTypeQuery; -use Thelia\Model\Map\ImportExportCategoryTableMap; +use Thelia\Model\Import as ChildImport; +use Thelia\Model\ImportCategory as ChildImportCategory; +use Thelia\Model\ImportCategoryI18n as ChildImportCategoryI18n; +use Thelia\Model\ImportCategoryI18nQuery as ChildImportCategoryI18nQuery; +use Thelia\Model\ImportCategoryQuery as ChildImportCategoryQuery; +use Thelia\Model\ImportQuery as ChildImportQuery; +use Thelia\Model\Map\ImportCategoryTableMap; -abstract class ImportExportCategory implements ActiveRecordInterface +abstract class ImportCategory implements ActiveRecordInterface { /** * TableMap class name */ - const TABLE_MAP = '\\Thelia\\Model\\Map\\ImportExportCategoryTableMap'; + const TABLE_MAP = '\\Thelia\\Model\\Map\\ImportCategoryTableMap'; /** @@ -84,16 +84,16 @@ abstract class ImportExportCategory implements ActiveRecordInterface protected $updated_at; /** - * @var ObjectCollection|ChildImportExportType[] Collection to store aggregation of ChildImportExportType objects. + * @var ObjectCollection|ChildImport[] Collection to store aggregation of ChildImport objects. */ - protected $collImportExportTypes; - protected $collImportExportTypesPartial; + protected $collImports; + protected $collImportsPartial; /** - * @var ObjectCollection|ChildImportExportCategoryI18n[] Collection to store aggregation of ChildImportExportCategoryI18n objects. + * @var ObjectCollection|ChildImportCategoryI18n[] Collection to store aggregation of ChildImportCategoryI18n objects. */ - protected $collImportExportCategoryI18ns; - protected $collImportExportCategoryI18nsPartial; + protected $collImportCategoryI18ns; + protected $collImportCategoryI18nsPartial; /** * Flag to prevent endless save loop, if this object is referenced @@ -113,7 +113,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface /** * Current translation objects - * @var array[ChildImportExportCategoryI18n] + * @var array[ChildImportCategoryI18n] */ protected $currentTranslations; @@ -121,16 +121,16 @@ abstract class ImportExportCategory implements ActiveRecordInterface * An array of objects scheduled for deletion. * @var ObjectCollection */ - protected $importExportTypesScheduledForDeletion = null; + protected $importsScheduledForDeletion = null; /** * An array of objects scheduled for deletion. * @var ObjectCollection */ - protected $importExportCategoryI18nsScheduledForDeletion = null; + protected $importCategoryI18nsScheduledForDeletion = null; /** - * Initializes internal state of Thelia\Model\Base\ImportExportCategory object. + * Initializes internal state of Thelia\Model\Base\ImportCategory object. */ public function __construct() { @@ -225,9 +225,9 @@ abstract class ImportExportCategory implements ActiveRecordInterface } /** - * Compares this with another ImportExportCategory instance. If - * obj is an instance of ImportExportCategory, delegates to - * equals(ImportExportCategory). Otherwise, returns false. + * Compares this with another ImportCategory instance. If + * obj is an instance of ImportCategory, delegates to + * equals(ImportCategory). Otherwise, returns false. * * @param mixed $obj The object to compare to. * @return boolean Whether equal to the object specified. @@ -310,7 +310,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * @param string $name The virtual column name * @param mixed $value The value to give to the virtual column * - * @return ImportExportCategory The current object, for fluid interface + * @return ImportCategory The current object, for fluid interface */ public function setVirtualColumn($name, $value) { @@ -342,7 +342,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * or a format name ('XML', 'YAML', 'JSON', 'CSV') * @param string $data The source data to import from * - * @return ImportExportCategory The current object, for fluid interface + * @return ImportCategory The current object, for fluid interface */ public function importFrom($parser, $data) { @@ -453,7 +453,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * Set the value of [id] column. * * @param int $v new value - * @return \Thelia\Model\ImportExportCategory The current object (for fluent API support) + * @return \Thelia\Model\ImportCategory The current object (for fluent API support) */ public function setId($v) { @@ -463,7 +463,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface if ($this->id !== $v) { $this->id = $v; - $this->modifiedColumns[ImportExportCategoryTableMap::ID] = true; + $this->modifiedColumns[ImportCategoryTableMap::ID] = true; } @@ -474,7 +474,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * Set the value of [position] column. * * @param int $v new value - * @return \Thelia\Model\ImportExportCategory The current object (for fluent API support) + * @return \Thelia\Model\ImportCategory The current object (for fluent API support) */ public function setPosition($v) { @@ -484,7 +484,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface if ($this->position !== $v) { $this->position = $v; - $this->modifiedColumns[ImportExportCategoryTableMap::POSITION] = true; + $this->modifiedColumns[ImportCategoryTableMap::POSITION] = true; } @@ -496,7 +496,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\ImportExportCategory The current object (for fluent API support) + * @return \Thelia\Model\ImportCategory The current object (for fluent API support) */ public function setCreatedAt($v) { @@ -504,7 +504,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface if ($this->created_at !== null || $dt !== null) { if ($dt !== $this->created_at) { $this->created_at = $dt; - $this->modifiedColumns[ImportExportCategoryTableMap::CREATED_AT] = true; + $this->modifiedColumns[ImportCategoryTableMap::CREATED_AT] = true; } } // if either are not null @@ -517,7 +517,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * * @param mixed $v string, integer (timestamp), or \DateTime value. * Empty strings are treated as NULL. - * @return \Thelia\Model\ImportExportCategory The current object (for fluent API support) + * @return \Thelia\Model\ImportCategory The current object (for fluent API support) */ public function setUpdatedAt($v) { @@ -525,7 +525,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface if ($this->updated_at !== null || $dt !== null) { if ($dt !== $this->updated_at) { $this->updated_at = $dt; - $this->modifiedColumns[ImportExportCategoryTableMap::UPDATED_AT] = true; + $this->modifiedColumns[ImportCategoryTableMap::UPDATED_AT] = true; } } // if either are not null @@ -570,19 +570,19 @@ abstract class ImportExportCategory implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ImportExportCategoryTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ImportCategoryTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ImportExportCategoryTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ImportCategoryTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; $this->position = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ImportExportCategoryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ImportCategoryTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } $this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ImportExportCategoryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ImportCategoryTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -595,10 +595,10 @@ abstract class ImportExportCategory implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 4; // 4 = ImportExportCategoryTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 4; // 4 = ImportCategoryTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException("Error populating \Thelia\Model\ImportExportCategory object", 0, $e); + throw new PropelException("Error populating \Thelia\Model\ImportCategory object", 0, $e); } } @@ -640,13 +640,13 @@ abstract class ImportExportCategory implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ImportExportCategoryTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ImportCategoryTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. - $dataFetcher = ChildImportExportCategoryQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $dataFetcher = ChildImportCategoryQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { @@ -656,9 +656,9 @@ abstract class ImportExportCategory implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->collImportExportTypes = null; + $this->collImports = null; - $this->collImportExportCategoryI18ns = null; + $this->collImportCategoryI18ns = null; } // if (deep) } @@ -669,8 +669,8 @@ abstract class ImportExportCategory implements ActiveRecordInterface * @param ConnectionInterface $con * @return void * @throws PropelException - * @see ImportExportCategory::setDeleted() - * @see ImportExportCategory::isDeleted() + * @see ImportCategory::setDeleted() + * @see ImportCategory::isDeleted() */ public function delete(ConnectionInterface $con = null) { @@ -679,12 +679,12 @@ abstract class ImportExportCategory implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryTableMap::DATABASE_NAME); } $con->beginTransaction(); try { - $deleteQuery = ChildImportExportCategoryQuery::create() + $deleteQuery = ChildImportCategoryQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { @@ -721,7 +721,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryTableMap::DATABASE_NAME); } $con->beginTransaction(); @@ -731,16 +731,16 @@ abstract class ImportExportCategory implements ActiveRecordInterface if ($isInsert) { $ret = $ret && $this->preInsert($con); // timestampable behavior - if (!$this->isColumnModified(ImportExportCategoryTableMap::CREATED_AT)) { + if (!$this->isColumnModified(ImportCategoryTableMap::CREATED_AT)) { $this->setCreatedAt(time()); } - if (!$this->isColumnModified(ImportExportCategoryTableMap::UPDATED_AT)) { + if (!$this->isColumnModified(ImportCategoryTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } else { $ret = $ret && $this->preUpdate($con); // timestampable behavior - if ($this->isModified() && !$this->isColumnModified(ImportExportCategoryTableMap::UPDATED_AT)) { + if ($this->isModified() && !$this->isColumnModified(ImportCategoryTableMap::UPDATED_AT)) { $this->setUpdatedAt(time()); } } @@ -752,7 +752,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - ImportExportCategoryTableMap::addInstanceToPool($this); + ImportCategoryTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -793,34 +793,34 @@ abstract class ImportExportCategory implements ActiveRecordInterface $this->resetModified(); } - if ($this->importExportTypesScheduledForDeletion !== null) { - if (!$this->importExportTypesScheduledForDeletion->isEmpty()) { - \Thelia\Model\ImportExportTypeQuery::create() - ->filterByPrimaryKeys($this->importExportTypesScheduledForDeletion->getPrimaryKeys(false)) + if ($this->importsScheduledForDeletion !== null) { + if (!$this->importsScheduledForDeletion->isEmpty()) { + \Thelia\Model\ImportQuery::create() + ->filterByPrimaryKeys($this->importsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); - $this->importExportTypesScheduledForDeletion = null; + $this->importsScheduledForDeletion = null; } } - if ($this->collImportExportTypes !== null) { - foreach ($this->collImportExportTypes as $referrerFK) { + if ($this->collImports !== null) { + foreach ($this->collImports as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } - if ($this->importExportCategoryI18nsScheduledForDeletion !== null) { - if (!$this->importExportCategoryI18nsScheduledForDeletion->isEmpty()) { - \Thelia\Model\ImportExportCategoryI18nQuery::create() - ->filterByPrimaryKeys($this->importExportCategoryI18nsScheduledForDeletion->getPrimaryKeys(false)) + if ($this->importCategoryI18nsScheduledForDeletion !== null) { + if (!$this->importCategoryI18nsScheduledForDeletion->isEmpty()) { + \Thelia\Model\ImportCategoryI18nQuery::create() + ->filterByPrimaryKeys($this->importCategoryI18nsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); - $this->importExportCategoryI18nsScheduledForDeletion = null; + $this->importCategoryI18nsScheduledForDeletion = null; } } - if ($this->collImportExportCategoryI18ns !== null) { - foreach ($this->collImportExportCategoryI18ns as $referrerFK) { + if ($this->collImportCategoryI18ns !== null) { + foreach ($this->collImportCategoryI18ns as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } @@ -847,27 +847,27 @@ abstract class ImportExportCategory implements ActiveRecordInterface $modifiedColumns = array(); $index = 0; - $this->modifiedColumns[ImportExportCategoryTableMap::ID] = true; + $this->modifiedColumns[ImportCategoryTableMap::ID] = true; if (null !== $this->id) { - throw new PropelException('Cannot insert a value for auto-increment primary key (' . ImportExportCategoryTableMap::ID . ')'); + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ImportCategoryTableMap::ID . ')'); } // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ImportExportCategoryTableMap::ID)) { + if ($this->isColumnModified(ImportCategoryTableMap::ID)) { $modifiedColumns[':p' . $index++] = '`ID`'; } - if ($this->isColumnModified(ImportExportCategoryTableMap::POSITION)) { + if ($this->isColumnModified(ImportCategoryTableMap::POSITION)) { $modifiedColumns[':p' . $index++] = '`POSITION`'; } - if ($this->isColumnModified(ImportExportCategoryTableMap::CREATED_AT)) { + if ($this->isColumnModified(ImportCategoryTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = '`CREATED_AT`'; } - if ($this->isColumnModified(ImportExportCategoryTableMap::UPDATED_AT)) { + if ($this->isColumnModified(ImportCategoryTableMap::UPDATED_AT)) { $modifiedColumns[':p' . $index++] = '`UPDATED_AT`'; } $sql = sprintf( - 'INSERT INTO `import_export_category` (%s) VALUES (%s)', + 'INSERT INTO `import_category` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -934,7 +934,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { - $pos = ImportExportCategoryTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ImportCategoryTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); return $field; @@ -985,11 +985,11 @@ abstract class ImportExportCategory implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['ImportExportCategory'][$this->getPrimaryKey()])) { + if (isset($alreadyDumpedObjects['ImportCategory'][$this->getPrimaryKey()])) { return '*RECURSION*'; } - $alreadyDumpedObjects['ImportExportCategory'][$this->getPrimaryKey()] = true; - $keys = ImportExportCategoryTableMap::getFieldNames($keyType); + $alreadyDumpedObjects['ImportCategory'][$this->getPrimaryKey()] = true; + $keys = ImportCategoryTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getPosition(), @@ -1002,11 +1002,11 @@ abstract class ImportExportCategory implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->collImportExportTypes) { - $result['ImportExportTypes'] = $this->collImportExportTypes->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + if (null !== $this->collImports) { + $result['Imports'] = $this->collImports->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } - if (null !== $this->collImportExportCategoryI18ns) { - $result['ImportExportCategoryI18ns'] = $this->collImportExportCategoryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + if (null !== $this->collImportCategoryI18ns) { + $result['ImportCategoryI18ns'] = $this->collImportCategoryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } @@ -1026,7 +1026,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) { - $pos = ImportExportCategoryTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ImportCategoryTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); return $this->setByPosition($pos, $value); } @@ -1076,7 +1076,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface */ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { - $keys = ImportExportCategoryTableMap::getFieldNames($keyType); + $keys = ImportCategoryTableMap::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setPosition($arr[$keys[1]]); @@ -1091,12 +1091,12 @@ abstract class ImportExportCategory implements ActiveRecordInterface */ public function buildCriteria() { - $criteria = new Criteria(ImportExportCategoryTableMap::DATABASE_NAME); + $criteria = new Criteria(ImportCategoryTableMap::DATABASE_NAME); - if ($this->isColumnModified(ImportExportCategoryTableMap::ID)) $criteria->add(ImportExportCategoryTableMap::ID, $this->id); - if ($this->isColumnModified(ImportExportCategoryTableMap::POSITION)) $criteria->add(ImportExportCategoryTableMap::POSITION, $this->position); - if ($this->isColumnModified(ImportExportCategoryTableMap::CREATED_AT)) $criteria->add(ImportExportCategoryTableMap::CREATED_AT, $this->created_at); - if ($this->isColumnModified(ImportExportCategoryTableMap::UPDATED_AT)) $criteria->add(ImportExportCategoryTableMap::UPDATED_AT, $this->updated_at); + if ($this->isColumnModified(ImportCategoryTableMap::ID)) $criteria->add(ImportCategoryTableMap::ID, $this->id); + if ($this->isColumnModified(ImportCategoryTableMap::POSITION)) $criteria->add(ImportCategoryTableMap::POSITION, $this->position); + if ($this->isColumnModified(ImportCategoryTableMap::CREATED_AT)) $criteria->add(ImportCategoryTableMap::CREATED_AT, $this->created_at); + if ($this->isColumnModified(ImportCategoryTableMap::UPDATED_AT)) $criteria->add(ImportCategoryTableMap::UPDATED_AT, $this->updated_at); return $criteria; } @@ -1111,8 +1111,8 @@ abstract class ImportExportCategory implements ActiveRecordInterface */ public function buildPkeyCriteria() { - $criteria = new Criteria(ImportExportCategoryTableMap::DATABASE_NAME); - $criteria->add(ImportExportCategoryTableMap::ID, $this->id); + $criteria = new Criteria(ImportCategoryTableMap::DATABASE_NAME); + $criteria->add(ImportCategoryTableMap::ID, $this->id); return $criteria; } @@ -1153,7 +1153,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \Thelia\Model\ImportExportCategory (or compatible) type. + * @param object $copyObj An object of \Thelia\Model\ImportCategory (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 @@ -1169,15 +1169,15 @@ abstract class ImportExportCategory implements ActiveRecordInterface // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); - foreach ($this->getImportExportTypes() as $relObj) { + foreach ($this->getImports() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addImportExportType($relObj->copy($deepCopy)); + $copyObj->addImport($relObj->copy($deepCopy)); } } - foreach ($this->getImportExportCategoryI18ns() as $relObj) { + foreach ($this->getImportCategoryI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves - $copyObj->addImportExportCategoryI18n($relObj->copy($deepCopy)); + $copyObj->addImportCategoryI18n($relObj->copy($deepCopy)); } } @@ -1198,7 +1198,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return \Thelia\Model\ImportExportCategory Clone of current object. + * @return \Thelia\Model\ImportCategory Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) @@ -1222,40 +1222,40 @@ abstract class ImportExportCategory implements ActiveRecordInterface */ public function initRelation($relationName) { - if ('ImportExportType' == $relationName) { - return $this->initImportExportTypes(); + if ('Import' == $relationName) { + return $this->initImports(); } - if ('ImportExportCategoryI18n' == $relationName) { - return $this->initImportExportCategoryI18ns(); + if ('ImportCategoryI18n' == $relationName) { + return $this->initImportCategoryI18ns(); } } /** - * Clears out the collImportExportTypes collection + * Clears out the collImports 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 addImportExportTypes() + * @see addImports() */ - public function clearImportExportTypes() + public function clearImports() { - $this->collImportExportTypes = null; // important to set this to NULL since that means it is uninitialized + $this->collImports = null; // important to set this to NULL since that means it is uninitialized } /** - * Reset is the collImportExportTypes collection loaded partially. + * Reset is the collImports collection loaded partially. */ - public function resetPartialImportExportTypes($v = true) + public function resetPartialImports($v = true) { - $this->collImportExportTypesPartial = $v; + $this->collImportsPartial = $v; } /** - * Initializes the collImportExportTypes collection. + * Initializes the collImports collection. * - * By default this just sets the collImportExportTypes collection to an empty array (like clearcollImportExportTypes()); + * By default this just sets the collImports collection to an empty array (like clearcollImports()); * 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. * @@ -1264,216 +1264,216 @@ abstract class ImportExportCategory implements ActiveRecordInterface * * @return void */ - public function initImportExportTypes($overrideExisting = true) + public function initImports($overrideExisting = true) { - if (null !== $this->collImportExportTypes && !$overrideExisting) { + if (null !== $this->collImports && !$overrideExisting) { return; } - $this->collImportExportTypes = new ObjectCollection(); - $this->collImportExportTypes->setModel('\Thelia\Model\ImportExportType'); + $this->collImports = new ObjectCollection(); + $this->collImports->setModel('\Thelia\Model\Import'); } /** - * Gets an array of ChildImportExportType objects which contain a foreign key that references this object. + * Gets an array of ChildImport 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 ChildImportExportCategory is new, it will return + * If this ChildImportCategory 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|ChildImportExportType[] List of ChildImportExportType objects + * @return Collection|ChildImport[] List of ChildImport objects * @throws PropelException */ - public function getImportExportTypes($criteria = null, ConnectionInterface $con = null) + public function getImports($criteria = null, ConnectionInterface $con = null) { - $partial = $this->collImportExportTypesPartial && !$this->isNew(); - if (null === $this->collImportExportTypes || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collImportExportTypes) { + $partial = $this->collImportsPartial && !$this->isNew(); + if (null === $this->collImports || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collImports) { // return empty collection - $this->initImportExportTypes(); + $this->initImports(); } else { - $collImportExportTypes = ChildImportExportTypeQuery::create(null, $criteria) - ->filterByImportExportCategory($this) + $collImports = ChildImportQuery::create(null, $criteria) + ->filterByImportCategory($this) ->find($con); if (null !== $criteria) { - if (false !== $this->collImportExportTypesPartial && count($collImportExportTypes)) { - $this->initImportExportTypes(false); + if (false !== $this->collImportsPartial && count($collImports)) { + $this->initImports(false); - foreach ($collImportExportTypes as $obj) { - if (false == $this->collImportExportTypes->contains($obj)) { - $this->collImportExportTypes->append($obj); + foreach ($collImports as $obj) { + if (false == $this->collImports->contains($obj)) { + $this->collImports->append($obj); } } - $this->collImportExportTypesPartial = true; + $this->collImportsPartial = true; } - reset($collImportExportTypes); + reset($collImports); - return $collImportExportTypes; + return $collImports; } - if ($partial && $this->collImportExportTypes) { - foreach ($this->collImportExportTypes as $obj) { + if ($partial && $this->collImports) { + foreach ($this->collImports as $obj) { if ($obj->isNew()) { - $collImportExportTypes[] = $obj; + $collImports[] = $obj; } } } - $this->collImportExportTypes = $collImportExportTypes; - $this->collImportExportTypesPartial = false; + $this->collImports = $collImports; + $this->collImportsPartial = false; } } - return $this->collImportExportTypes; + return $this->collImports; } /** - * Sets a collection of ImportExportType objects related by a one-to-many relationship + * Sets a collection of Import 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 $importExportTypes A Propel collection. + * @param Collection $imports A Propel collection. * @param ConnectionInterface $con Optional connection object - * @return ChildImportExportCategory The current object (for fluent API support) + * @return ChildImportCategory The current object (for fluent API support) */ - public function setImportExportTypes(Collection $importExportTypes, ConnectionInterface $con = null) + public function setImports(Collection $imports, ConnectionInterface $con = null) { - $importExportTypesToDelete = $this->getImportExportTypes(new Criteria(), $con)->diff($importExportTypes); + $importsToDelete = $this->getImports(new Criteria(), $con)->diff($imports); - $this->importExportTypesScheduledForDeletion = $importExportTypesToDelete; + $this->importsScheduledForDeletion = $importsToDelete; - foreach ($importExportTypesToDelete as $importExportTypeRemoved) { - $importExportTypeRemoved->setImportExportCategory(null); + foreach ($importsToDelete as $importRemoved) { + $importRemoved->setImportCategory(null); } - $this->collImportExportTypes = null; - foreach ($importExportTypes as $importExportType) { - $this->addImportExportType($importExportType); + $this->collImports = null; + foreach ($imports as $import) { + $this->addImport($import); } - $this->collImportExportTypes = $importExportTypes; - $this->collImportExportTypesPartial = false; + $this->collImports = $imports; + $this->collImportsPartial = false; return $this; } /** - * Returns the number of related ImportExportType objects. + * Returns the number of related Import objects. * * @param Criteria $criteria * @param boolean $distinct * @param ConnectionInterface $con - * @return int Count of related ImportExportType objects. + * @return int Count of related Import objects. * @throws PropelException */ - public function countImportExportTypes(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countImports(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { - $partial = $this->collImportExportTypesPartial && !$this->isNew(); - if (null === $this->collImportExportTypes || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collImportExportTypes) { + $partial = $this->collImportsPartial && !$this->isNew(); + if (null === $this->collImports || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collImports) { return 0; } if ($partial && !$criteria) { - return count($this->getImportExportTypes()); + return count($this->getImports()); } - $query = ChildImportExportTypeQuery::create(null, $criteria); + $query = ChildImportQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query - ->filterByImportExportCategory($this) + ->filterByImportCategory($this) ->count($con); } - return count($this->collImportExportTypes); + return count($this->collImports); } /** - * Method called to associate a ChildImportExportType object to this object - * through the ChildImportExportType foreign key attribute. + * Method called to associate a ChildImport object to this object + * through the ChildImport foreign key attribute. * - * @param ChildImportExportType $l ChildImportExportType - * @return \Thelia\Model\ImportExportCategory The current object (for fluent API support) + * @param ChildImport $l ChildImport + * @return \Thelia\Model\ImportCategory The current object (for fluent API support) */ - public function addImportExportType(ChildImportExportType $l) + public function addImport(ChildImport $l) { - if ($this->collImportExportTypes === null) { - $this->initImportExportTypes(); - $this->collImportExportTypesPartial = true; + if ($this->collImports === null) { + $this->initImports(); + $this->collImportsPartial = true; } - if (!in_array($l, $this->collImportExportTypes->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddImportExportType($l); + if (!in_array($l, $this->collImports->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddImport($l); } return $this; } /** - * @param ImportExportType $importExportType The importExportType object to add. + * @param Import $import The import object to add. */ - protected function doAddImportExportType($importExportType) + protected function doAddImport($import) { - $this->collImportExportTypes[]= $importExportType; - $importExportType->setImportExportCategory($this); + $this->collImports[]= $import; + $import->setImportCategory($this); } /** - * @param ImportExportType $importExportType The importExportType object to remove. - * @return ChildImportExportCategory The current object (for fluent API support) + * @param Import $import The import object to remove. + * @return ChildImportCategory The current object (for fluent API support) */ - public function removeImportExportType($importExportType) + public function removeImport($import) { - if ($this->getImportExportTypes()->contains($importExportType)) { - $this->collImportExportTypes->remove($this->collImportExportTypes->search($importExportType)); - if (null === $this->importExportTypesScheduledForDeletion) { - $this->importExportTypesScheduledForDeletion = clone $this->collImportExportTypes; - $this->importExportTypesScheduledForDeletion->clear(); + if ($this->getImports()->contains($import)) { + $this->collImports->remove($this->collImports->search($import)); + if (null === $this->importsScheduledForDeletion) { + $this->importsScheduledForDeletion = clone $this->collImports; + $this->importsScheduledForDeletion->clear(); } - $this->importExportTypesScheduledForDeletion[]= clone $importExportType; - $importExportType->setImportExportCategory(null); + $this->importsScheduledForDeletion[]= clone $import; + $import->setImportCategory(null); } return $this; } /** - * Clears out the collImportExportCategoryI18ns collection + * Clears out the collImportCategoryI18ns 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 addImportExportCategoryI18ns() + * @see addImportCategoryI18ns() */ - public function clearImportExportCategoryI18ns() + public function clearImportCategoryI18ns() { - $this->collImportExportCategoryI18ns = null; // important to set this to NULL since that means it is uninitialized + $this->collImportCategoryI18ns = null; // important to set this to NULL since that means it is uninitialized } /** - * Reset is the collImportExportCategoryI18ns collection loaded partially. + * Reset is the collImportCategoryI18ns collection loaded partially. */ - public function resetPartialImportExportCategoryI18ns($v = true) + public function resetPartialImportCategoryI18ns($v = true) { - $this->collImportExportCategoryI18nsPartial = $v; + $this->collImportCategoryI18nsPartial = $v; } /** - * Initializes the collImportExportCategoryI18ns collection. + * Initializes the collImportCategoryI18ns collection. * - * By default this just sets the collImportExportCategoryI18ns collection to an empty array (like clearcollImportExportCategoryI18ns()); + * By default this just sets the collImportCategoryI18ns collection to an empty array (like clearcollImportCategoryI18ns()); * 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. * @@ -1482,192 +1482,192 @@ abstract class ImportExportCategory implements ActiveRecordInterface * * @return void */ - public function initImportExportCategoryI18ns($overrideExisting = true) + public function initImportCategoryI18ns($overrideExisting = true) { - if (null !== $this->collImportExportCategoryI18ns && !$overrideExisting) { + if (null !== $this->collImportCategoryI18ns && !$overrideExisting) { return; } - $this->collImportExportCategoryI18ns = new ObjectCollection(); - $this->collImportExportCategoryI18ns->setModel('\Thelia\Model\ImportExportCategoryI18n'); + $this->collImportCategoryI18ns = new ObjectCollection(); + $this->collImportCategoryI18ns->setModel('\Thelia\Model\ImportCategoryI18n'); } /** - * Gets an array of ChildImportExportCategoryI18n objects which contain a foreign key that references this object. + * Gets an array of ChildImportCategoryI18n 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 ChildImportExportCategory is new, it will return + * If this ChildImportCategory 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|ChildImportExportCategoryI18n[] List of ChildImportExportCategoryI18n objects + * @return Collection|ChildImportCategoryI18n[] List of ChildImportCategoryI18n objects * @throws PropelException */ - public function getImportExportCategoryI18ns($criteria = null, ConnectionInterface $con = null) + public function getImportCategoryI18ns($criteria = null, ConnectionInterface $con = null) { - $partial = $this->collImportExportCategoryI18nsPartial && !$this->isNew(); - if (null === $this->collImportExportCategoryI18ns || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collImportExportCategoryI18ns) { + $partial = $this->collImportCategoryI18nsPartial && !$this->isNew(); + if (null === $this->collImportCategoryI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collImportCategoryI18ns) { // return empty collection - $this->initImportExportCategoryI18ns(); + $this->initImportCategoryI18ns(); } else { - $collImportExportCategoryI18ns = ChildImportExportCategoryI18nQuery::create(null, $criteria) - ->filterByImportExportCategory($this) + $collImportCategoryI18ns = ChildImportCategoryI18nQuery::create(null, $criteria) + ->filterByImportCategory($this) ->find($con); if (null !== $criteria) { - if (false !== $this->collImportExportCategoryI18nsPartial && count($collImportExportCategoryI18ns)) { - $this->initImportExportCategoryI18ns(false); + if (false !== $this->collImportCategoryI18nsPartial && count($collImportCategoryI18ns)) { + $this->initImportCategoryI18ns(false); - foreach ($collImportExportCategoryI18ns as $obj) { - if (false == $this->collImportExportCategoryI18ns->contains($obj)) { - $this->collImportExportCategoryI18ns->append($obj); + foreach ($collImportCategoryI18ns as $obj) { + if (false == $this->collImportCategoryI18ns->contains($obj)) { + $this->collImportCategoryI18ns->append($obj); } } - $this->collImportExportCategoryI18nsPartial = true; + $this->collImportCategoryI18nsPartial = true; } - reset($collImportExportCategoryI18ns); + reset($collImportCategoryI18ns); - return $collImportExportCategoryI18ns; + return $collImportCategoryI18ns; } - if ($partial && $this->collImportExportCategoryI18ns) { - foreach ($this->collImportExportCategoryI18ns as $obj) { + if ($partial && $this->collImportCategoryI18ns) { + foreach ($this->collImportCategoryI18ns as $obj) { if ($obj->isNew()) { - $collImportExportCategoryI18ns[] = $obj; + $collImportCategoryI18ns[] = $obj; } } } - $this->collImportExportCategoryI18ns = $collImportExportCategoryI18ns; - $this->collImportExportCategoryI18nsPartial = false; + $this->collImportCategoryI18ns = $collImportCategoryI18ns; + $this->collImportCategoryI18nsPartial = false; } } - return $this->collImportExportCategoryI18ns; + return $this->collImportCategoryI18ns; } /** - * Sets a collection of ImportExportCategoryI18n objects related by a one-to-many relationship + * Sets a collection of ImportCategoryI18n 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 $importExportCategoryI18ns A Propel collection. + * @param Collection $importCategoryI18ns A Propel collection. * @param ConnectionInterface $con Optional connection object - * @return ChildImportExportCategory The current object (for fluent API support) + * @return ChildImportCategory The current object (for fluent API support) */ - public function setImportExportCategoryI18ns(Collection $importExportCategoryI18ns, ConnectionInterface $con = null) + public function setImportCategoryI18ns(Collection $importCategoryI18ns, ConnectionInterface $con = null) { - $importExportCategoryI18nsToDelete = $this->getImportExportCategoryI18ns(new Criteria(), $con)->diff($importExportCategoryI18ns); + $importCategoryI18nsToDelete = $this->getImportCategoryI18ns(new Criteria(), $con)->diff($importCategoryI18ns); //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->importExportCategoryI18nsScheduledForDeletion = clone $importExportCategoryI18nsToDelete; + $this->importCategoryI18nsScheduledForDeletion = clone $importCategoryI18nsToDelete; - foreach ($importExportCategoryI18nsToDelete as $importExportCategoryI18nRemoved) { - $importExportCategoryI18nRemoved->setImportExportCategory(null); + foreach ($importCategoryI18nsToDelete as $importCategoryI18nRemoved) { + $importCategoryI18nRemoved->setImportCategory(null); } - $this->collImportExportCategoryI18ns = null; - foreach ($importExportCategoryI18ns as $importExportCategoryI18n) { - $this->addImportExportCategoryI18n($importExportCategoryI18n); + $this->collImportCategoryI18ns = null; + foreach ($importCategoryI18ns as $importCategoryI18n) { + $this->addImportCategoryI18n($importCategoryI18n); } - $this->collImportExportCategoryI18ns = $importExportCategoryI18ns; - $this->collImportExportCategoryI18nsPartial = false; + $this->collImportCategoryI18ns = $importCategoryI18ns; + $this->collImportCategoryI18nsPartial = false; return $this; } /** - * Returns the number of related ImportExportCategoryI18n objects. + * Returns the number of related ImportCategoryI18n objects. * * @param Criteria $criteria * @param boolean $distinct * @param ConnectionInterface $con - * @return int Count of related ImportExportCategoryI18n objects. + * @return int Count of related ImportCategoryI18n objects. * @throws PropelException */ - public function countImportExportCategoryI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) + public function countImportCategoryI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { - $partial = $this->collImportExportCategoryI18nsPartial && !$this->isNew(); - if (null === $this->collImportExportCategoryI18ns || null !== $criteria || $partial) { - if ($this->isNew() && null === $this->collImportExportCategoryI18ns) { + $partial = $this->collImportCategoryI18nsPartial && !$this->isNew(); + if (null === $this->collImportCategoryI18ns || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collImportCategoryI18ns) { return 0; } if ($partial && !$criteria) { - return count($this->getImportExportCategoryI18ns()); + return count($this->getImportCategoryI18ns()); } - $query = ChildImportExportCategoryI18nQuery::create(null, $criteria); + $query = ChildImportCategoryI18nQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query - ->filterByImportExportCategory($this) + ->filterByImportCategory($this) ->count($con); } - return count($this->collImportExportCategoryI18ns); + return count($this->collImportCategoryI18ns); } /** - * Method called to associate a ChildImportExportCategoryI18n object to this object - * through the ChildImportExportCategoryI18n foreign key attribute. + * Method called to associate a ChildImportCategoryI18n object to this object + * through the ChildImportCategoryI18n foreign key attribute. * - * @param ChildImportExportCategoryI18n $l ChildImportExportCategoryI18n - * @return \Thelia\Model\ImportExportCategory The current object (for fluent API support) + * @param ChildImportCategoryI18n $l ChildImportCategoryI18n + * @return \Thelia\Model\ImportCategory The current object (for fluent API support) */ - public function addImportExportCategoryI18n(ChildImportExportCategoryI18n $l) + public function addImportCategoryI18n(ChildImportCategoryI18n $l) { if ($l && $locale = $l->getLocale()) { $this->setLocale($locale); $this->currentTranslations[$locale] = $l; } - if ($this->collImportExportCategoryI18ns === null) { - $this->initImportExportCategoryI18ns(); - $this->collImportExportCategoryI18nsPartial = true; + if ($this->collImportCategoryI18ns === null) { + $this->initImportCategoryI18ns(); + $this->collImportCategoryI18nsPartial = true; } - if (!in_array($l, $this->collImportExportCategoryI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated - $this->doAddImportExportCategoryI18n($l); + if (!in_array($l, $this->collImportCategoryI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddImportCategoryI18n($l); } return $this; } /** - * @param ImportExportCategoryI18n $importExportCategoryI18n The importExportCategoryI18n object to add. + * @param ImportCategoryI18n $importCategoryI18n The importCategoryI18n object to add. */ - protected function doAddImportExportCategoryI18n($importExportCategoryI18n) + protected function doAddImportCategoryI18n($importCategoryI18n) { - $this->collImportExportCategoryI18ns[]= $importExportCategoryI18n; - $importExportCategoryI18n->setImportExportCategory($this); + $this->collImportCategoryI18ns[]= $importCategoryI18n; + $importCategoryI18n->setImportCategory($this); } /** - * @param ImportExportCategoryI18n $importExportCategoryI18n The importExportCategoryI18n object to remove. - * @return ChildImportExportCategory The current object (for fluent API support) + * @param ImportCategoryI18n $importCategoryI18n The importCategoryI18n object to remove. + * @return ChildImportCategory The current object (for fluent API support) */ - public function removeImportExportCategoryI18n($importExportCategoryI18n) + public function removeImportCategoryI18n($importCategoryI18n) { - if ($this->getImportExportCategoryI18ns()->contains($importExportCategoryI18n)) { - $this->collImportExportCategoryI18ns->remove($this->collImportExportCategoryI18ns->search($importExportCategoryI18n)); - if (null === $this->importExportCategoryI18nsScheduledForDeletion) { - $this->importExportCategoryI18nsScheduledForDeletion = clone $this->collImportExportCategoryI18ns; - $this->importExportCategoryI18nsScheduledForDeletion->clear(); + if ($this->getImportCategoryI18ns()->contains($importCategoryI18n)) { + $this->collImportCategoryI18ns->remove($this->collImportCategoryI18ns->search($importCategoryI18n)); + if (null === $this->importCategoryI18nsScheduledForDeletion) { + $this->importCategoryI18nsScheduledForDeletion = clone $this->collImportCategoryI18ns; + $this->importCategoryI18nsScheduledForDeletion->clear(); } - $this->importExportCategoryI18nsScheduledForDeletion[]= clone $importExportCategoryI18n; - $importExportCategoryI18n->setImportExportCategory(null); + $this->importCategoryI18nsScheduledForDeletion[]= clone $importCategoryI18n; + $importCategoryI18n->setImportCategory(null); } return $this; @@ -1701,13 +1701,13 @@ abstract class ImportExportCategory implements ActiveRecordInterface public function clearAllReferences($deep = false) { if ($deep) { - if ($this->collImportExportTypes) { - foreach ($this->collImportExportTypes as $o) { + if ($this->collImports) { + foreach ($this->collImports as $o) { $o->clearAllReferences($deep); } } - if ($this->collImportExportCategoryI18ns) { - foreach ($this->collImportExportCategoryI18ns as $o) { + if ($this->collImportCategoryI18ns) { + foreach ($this->collImportCategoryI18ns as $o) { $o->clearAllReferences($deep); } } @@ -1717,8 +1717,8 @@ abstract class ImportExportCategory implements ActiveRecordInterface $this->currentLocale = 'en_US'; $this->currentTranslations = null; - $this->collImportExportTypes = null; - $this->collImportExportCategoryI18ns = null; + $this->collImports = null; + $this->collImportCategoryI18ns = null; } /** @@ -1728,7 +1728,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface */ public function __toString() { - return (string) $this->exportTo(ImportExportCategoryTableMap::DEFAULT_STRING_FORMAT); + return (string) $this->exportTo(ImportCategoryTableMap::DEFAULT_STRING_FORMAT); } // i18n behavior @@ -1738,7 +1738,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * - * @return ChildImportExportCategory The current object (for fluent API support) + * @return ChildImportCategory The current object (for fluent API support) */ public function setLocale($locale = 'en_US') { @@ -1763,12 +1763,12 @@ abstract class ImportExportCategory implements ActiveRecordInterface * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * @param ConnectionInterface $con an optional connection object * - * @return ChildImportExportCategoryI18n */ + * @return ChildImportCategoryI18n */ public function getTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!isset($this->currentTranslations[$locale])) { - if (null !== $this->collImportExportCategoryI18ns) { - foreach ($this->collImportExportCategoryI18ns as $translation) { + if (null !== $this->collImportCategoryI18ns) { + foreach ($this->collImportCategoryI18ns as $translation) { if ($translation->getLocale() == $locale) { $this->currentTranslations[$locale] = $translation; @@ -1777,15 +1777,15 @@ abstract class ImportExportCategory implements ActiveRecordInterface } } if ($this->isNew()) { - $translation = new ChildImportExportCategoryI18n(); + $translation = new ChildImportCategoryI18n(); $translation->setLocale($locale); } else { - $translation = ChildImportExportCategoryI18nQuery::create() + $translation = ChildImportCategoryI18nQuery::create() ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) ->findOneOrCreate($con); $this->currentTranslations[$locale] = $translation; } - $this->addImportExportCategoryI18n($translation); + $this->addImportCategoryI18n($translation); } return $this->currentTranslations[$locale]; @@ -1797,21 +1797,21 @@ abstract class ImportExportCategory implements ActiveRecordInterface * @param string $locale Locale to use for the translation, e.g. 'fr_FR' * @param ConnectionInterface $con an optional connection object * - * @return ChildImportExportCategory The current object (for fluent API support) + * @return ChildImportCategory The current object (for fluent API support) */ public function removeTranslation($locale = 'en_US', ConnectionInterface $con = null) { if (!$this->isNew()) { - ChildImportExportCategoryI18nQuery::create() + ChildImportCategoryI18nQuery::create() ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale)) ->delete($con); } if (isset($this->currentTranslations[$locale])) { unset($this->currentTranslations[$locale]); } - foreach ($this->collImportExportCategoryI18ns as $key => $translation) { + foreach ($this->collImportCategoryI18ns as $key => $translation) { if ($translation->getLocale() == $locale) { - unset($this->collImportExportCategoryI18ns[$key]); + unset($this->collImportCategoryI18ns[$key]); break; } } @@ -1824,7 +1824,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * * @param ConnectionInterface $con an optional connection object * - * @return ChildImportExportCategoryI18n */ + * @return ChildImportCategoryI18n */ public function getCurrentTranslation(ConnectionInterface $con = null) { return $this->getTranslation($this->getLocale(), $con); @@ -1846,7 +1846,7 @@ abstract class ImportExportCategory implements ActiveRecordInterface * Set the value of [title] column. * * @param string $v new value - * @return \Thelia\Model\ImportExportCategoryI18n The current object (for fluent API support) + * @return \Thelia\Model\ImportCategoryI18n The current object (for fluent API support) */ public function setTitle($v) { $this->getCurrentTranslation()->setTitle($v); @@ -1859,11 +1859,11 @@ abstract class ImportExportCategory implements ActiveRecordInterface /** * Mark the current object so that the update date doesn't get updated during next save * - * @return ChildImportExportCategory The current object (for fluent API support) + * @return ChildImportCategory The current object (for fluent API support) */ public function keepUpdateDateUnchanged() { - $this->modifiedColumns[ImportExportCategoryTableMap::UPDATED_AT] = true; + $this->modifiedColumns[ImportCategoryTableMap::UPDATED_AT] = true; return $this; } diff --git a/core/lib/Thelia/Model/Base/ImportExportCategoryI18n.php b/core/lib/Thelia/Model/Base/ImportCategoryI18n.php similarity index 84% rename from core/lib/Thelia/Model/Base/ImportExportCategoryI18n.php rename to core/lib/Thelia/Model/Base/ImportCategoryI18n.php index 53519dc56..6f6b5d6c4 100644 --- a/core/lib/Thelia/Model/Base/ImportExportCategoryI18n.php +++ b/core/lib/Thelia/Model/Base/ImportCategoryI18n.php @@ -14,17 +14,17 @@ use Propel\Runtime\Exception\BadMethodCallException; use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; -use Thelia\Model\ImportExportCategory as ChildImportExportCategory; -use Thelia\Model\ImportExportCategoryI18nQuery as ChildImportExportCategoryI18nQuery; -use Thelia\Model\ImportExportCategoryQuery as ChildImportExportCategoryQuery; -use Thelia\Model\Map\ImportExportCategoryI18nTableMap; +use Thelia\Model\ImportCategory as ChildImportCategory; +use Thelia\Model\ImportCategoryI18nQuery as ChildImportCategoryI18nQuery; +use Thelia\Model\ImportCategoryQuery as ChildImportCategoryQuery; +use Thelia\Model\Map\ImportCategoryI18nTableMap; -abstract class ImportExportCategoryI18n implements ActiveRecordInterface +abstract class ImportCategoryI18n implements ActiveRecordInterface { /** * TableMap class name */ - const TABLE_MAP = '\\Thelia\\Model\\Map\\ImportExportCategoryI18nTableMap'; + const TABLE_MAP = '\\Thelia\\Model\\Map\\ImportCategoryI18nTableMap'; /** @@ -73,9 +73,9 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface protected $title; /** - * @var ImportExportCategory + * @var ImportCategory */ - protected $aImportExportCategory; + protected $aImportCategory; /** * Flag to prevent endless save loop, if this object is referenced @@ -97,7 +97,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface } /** - * Initializes internal state of Thelia\Model\Base\ImportExportCategoryI18n object. + * Initializes internal state of Thelia\Model\Base\ImportCategoryI18n object. * @see applyDefaults() */ public function __construct() @@ -194,9 +194,9 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface } /** - * Compares this with another ImportExportCategoryI18n instance. If - * obj is an instance of ImportExportCategoryI18n, delegates to - * equals(ImportExportCategoryI18n). Otherwise, returns false. + * Compares this with another ImportCategoryI18n instance. If + * obj is an instance of ImportCategoryI18n, delegates to + * equals(ImportCategoryI18n). Otherwise, returns false. * * @param mixed $obj The object to compare to. * @return boolean Whether equal to the object specified. @@ -279,7 +279,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface * @param string $name The virtual column name * @param mixed $value The value to give to the virtual column * - * @return ImportExportCategoryI18n The current object, for fluid interface + * @return ImportCategoryI18n The current object, for fluid interface */ public function setVirtualColumn($name, $value) { @@ -311,7 +311,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface * or a format name ('XML', 'YAML', 'JSON', 'CSV') * @param string $data The source data to import from * - * @return ImportExportCategoryI18n The current object, for fluid interface + * @return ImportCategoryI18n The current object, for fluid interface */ public function importFrom($parser, $data) { @@ -393,7 +393,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface * Set the value of [id] column. * * @param int $v new value - * @return \Thelia\Model\ImportExportCategoryI18n The current object (for fluent API support) + * @return \Thelia\Model\ImportCategoryI18n The current object (for fluent API support) */ public function setId($v) { @@ -403,11 +403,11 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface if ($this->id !== $v) { $this->id = $v; - $this->modifiedColumns[ImportExportCategoryI18nTableMap::ID] = true; + $this->modifiedColumns[ImportCategoryI18nTableMap::ID] = true; } - if ($this->aImportExportCategory !== null && $this->aImportExportCategory->getId() !== $v) { - $this->aImportExportCategory = null; + if ($this->aImportCategory !== null && $this->aImportCategory->getId() !== $v) { + $this->aImportCategory = null; } @@ -418,7 +418,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface * Set the value of [locale] column. * * @param string $v new value - * @return \Thelia\Model\ImportExportCategoryI18n The current object (for fluent API support) + * @return \Thelia\Model\ImportCategoryI18n The current object (for fluent API support) */ public function setLocale($v) { @@ -428,7 +428,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface if ($this->locale !== $v) { $this->locale = $v; - $this->modifiedColumns[ImportExportCategoryI18nTableMap::LOCALE] = true; + $this->modifiedColumns[ImportCategoryI18nTableMap::LOCALE] = true; } @@ -439,7 +439,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface * Set the value of [title] column. * * @param string $v new value - * @return \Thelia\Model\ImportExportCategoryI18n The current object (for fluent API support) + * @return \Thelia\Model\ImportCategoryI18n The current object (for fluent API support) */ public function setTitle($v) { @@ -449,7 +449,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface if ($this->title !== $v) { $this->title = $v; - $this->modifiedColumns[ImportExportCategoryI18nTableMap::TITLE] = true; + $this->modifiedColumns[ImportCategoryI18nTableMap::TITLE] = true; } @@ -497,13 +497,13 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ImportExportCategoryI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ImportCategoryI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ImportExportCategoryI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ImportCategoryI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; $this->locale = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ImportExportCategoryI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ImportCategoryI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; $this->title = (null !== $col) ? (string) $col : null; $this->resetModified(); @@ -513,10 +513,10 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 3; // 3 = ImportExportCategoryI18nTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 3; // 3 = ImportCategoryI18nTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException("Error populating \Thelia\Model\ImportExportCategoryI18n object", 0, $e); + throw new PropelException("Error populating \Thelia\Model\ImportCategoryI18n object", 0, $e); } } @@ -535,8 +535,8 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface */ public function ensureConsistency() { - if ($this->aImportExportCategory !== null && $this->id !== $this->aImportExportCategory->getId()) { - $this->aImportExportCategory = null; + if ($this->aImportCategory !== null && $this->id !== $this->aImportCategory->getId()) { + $this->aImportCategory = null; } } // ensureConsistency @@ -561,13 +561,13 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ImportCategoryI18nTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. - $dataFetcher = ChildImportExportCategoryI18nQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $dataFetcher = ChildImportCategoryI18nQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { @@ -577,7 +577,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->aImportExportCategory = null; + $this->aImportCategory = null; } // if (deep) } @@ -587,8 +587,8 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface * @param ConnectionInterface $con * @return void * @throws PropelException - * @see ImportExportCategoryI18n::setDeleted() - * @see ImportExportCategoryI18n::isDeleted() + * @see ImportCategoryI18n::setDeleted() + * @see ImportCategoryI18n::isDeleted() */ public function delete(ConnectionInterface $con = null) { @@ -597,12 +597,12 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryI18nTableMap::DATABASE_NAME); } $con->beginTransaction(); try { - $deleteQuery = ChildImportExportCategoryI18nQuery::create() + $deleteQuery = ChildImportCategoryI18nQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { @@ -639,7 +639,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryI18nTableMap::DATABASE_NAME); } $con->beginTransaction(); @@ -659,7 +659,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - ImportExportCategoryI18nTableMap::addInstanceToPool($this); + ImportCategoryI18nTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -694,11 +694,11 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aImportExportCategory !== null) { - if ($this->aImportExportCategory->isModified() || $this->aImportExportCategory->isNew()) { - $affectedRows += $this->aImportExportCategory->save($con); + if ($this->aImportCategory !== null) { + if ($this->aImportCategory->isModified() || $this->aImportCategory->isNew()) { + $affectedRows += $this->aImportCategory->save($con); } - $this->setImportExportCategory($this->aImportExportCategory); + $this->setImportCategory($this->aImportCategory); } if ($this->isNew() || $this->isModified()) { @@ -734,18 +734,18 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ImportExportCategoryI18nTableMap::ID)) { + if ($this->isColumnModified(ImportCategoryI18nTableMap::ID)) { $modifiedColumns[':p' . $index++] = '`ID`'; } - if ($this->isColumnModified(ImportExportCategoryI18nTableMap::LOCALE)) { + if ($this->isColumnModified(ImportCategoryI18nTableMap::LOCALE)) { $modifiedColumns[':p' . $index++] = '`LOCALE`'; } - if ($this->isColumnModified(ImportExportCategoryI18nTableMap::TITLE)) { + if ($this->isColumnModified(ImportCategoryI18nTableMap::TITLE)) { $modifiedColumns[':p' . $index++] = '`TITLE`'; } $sql = sprintf( - 'INSERT INTO `import_export_category_i18n` (%s) VALUES (%s)', + 'INSERT INTO `import_category_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -802,7 +802,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { - $pos = ImportExportCategoryI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ImportCategoryI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); return $field; @@ -850,11 +850,11 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['ImportExportCategoryI18n'][serialize($this->getPrimaryKey())])) { + if (isset($alreadyDumpedObjects['ImportCategoryI18n'][serialize($this->getPrimaryKey())])) { return '*RECURSION*'; } - $alreadyDumpedObjects['ImportExportCategoryI18n'][serialize($this->getPrimaryKey())] = true; - $keys = ImportExportCategoryI18nTableMap::getFieldNames($keyType); + $alreadyDumpedObjects['ImportCategoryI18n'][serialize($this->getPrimaryKey())] = true; + $keys = ImportCategoryI18nTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getLocale(), @@ -866,8 +866,8 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->aImportExportCategory) { - $result['ImportExportCategory'] = $this->aImportExportCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + if (null !== $this->aImportCategory) { + $result['ImportCategory'] = $this->aImportCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -887,7 +887,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) { - $pos = ImportExportCategoryI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ImportCategoryI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); return $this->setByPosition($pos, $value); } @@ -934,7 +934,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface */ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { - $keys = ImportExportCategoryI18nTableMap::getFieldNames($keyType); + $keys = ImportCategoryI18nTableMap::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]]); @@ -948,11 +948,11 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface */ public function buildCriteria() { - $criteria = new Criteria(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $criteria = new Criteria(ImportCategoryI18nTableMap::DATABASE_NAME); - if ($this->isColumnModified(ImportExportCategoryI18nTableMap::ID)) $criteria->add(ImportExportCategoryI18nTableMap::ID, $this->id); - if ($this->isColumnModified(ImportExportCategoryI18nTableMap::LOCALE)) $criteria->add(ImportExportCategoryI18nTableMap::LOCALE, $this->locale); - if ($this->isColumnModified(ImportExportCategoryI18nTableMap::TITLE)) $criteria->add(ImportExportCategoryI18nTableMap::TITLE, $this->title); + if ($this->isColumnModified(ImportCategoryI18nTableMap::ID)) $criteria->add(ImportCategoryI18nTableMap::ID, $this->id); + if ($this->isColumnModified(ImportCategoryI18nTableMap::LOCALE)) $criteria->add(ImportCategoryI18nTableMap::LOCALE, $this->locale); + if ($this->isColumnModified(ImportCategoryI18nTableMap::TITLE)) $criteria->add(ImportCategoryI18nTableMap::TITLE, $this->title); return $criteria; } @@ -967,9 +967,9 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface */ public function buildPkeyCriteria() { - $criteria = new Criteria(ImportExportCategoryI18nTableMap::DATABASE_NAME); - $criteria->add(ImportExportCategoryI18nTableMap::ID, $this->id); - $criteria->add(ImportExportCategoryI18nTableMap::LOCALE, $this->locale); + $criteria = new Criteria(ImportCategoryI18nTableMap::DATABASE_NAME); + $criteria->add(ImportCategoryI18nTableMap::ID, $this->id); + $criteria->add(ImportCategoryI18nTableMap::LOCALE, $this->locale); return $criteria; } @@ -1016,7 +1016,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \Thelia\Model\ImportExportCategoryI18n (or compatible) type. + * @param object $copyObj An object of \Thelia\Model\ImportCategoryI18n (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 @@ -1040,7 +1040,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return \Thelia\Model\ImportExportCategoryI18n Clone of current object. + * @return \Thelia\Model\ImportCategoryI18n Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) @@ -1054,13 +1054,13 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface } /** - * Declares an association between this object and a ChildImportExportCategory object. + * Declares an association between this object and a ChildImportCategory object. * - * @param ChildImportExportCategory $v - * @return \Thelia\Model\ImportExportCategoryI18n The current object (for fluent API support) + * @param ChildImportCategory $v + * @return \Thelia\Model\ImportCategoryI18n The current object (for fluent API support) * @throws PropelException */ - public function setImportExportCategory(ChildImportExportCategory $v = null) + public function setImportCategory(ChildImportCategory $v = null) { if ($v === null) { $this->setId(NULL); @@ -1068,12 +1068,12 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface $this->setId($v->getId()); } - $this->aImportExportCategory = $v; + $this->aImportCategory = $v; // Add binding for other direction of this n:n relationship. - // If this object has already been added to the ChildImportExportCategory object, it will not be re-added. + // If this object has already been added to the ChildImportCategory object, it will not be re-added. if ($v !== null) { - $v->addImportExportCategoryI18n($this); + $v->addImportCategoryI18n($this); } @@ -1082,26 +1082,26 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface /** - * Get the associated ChildImportExportCategory object + * Get the associated ChildImportCategory object * * @param ConnectionInterface $con Optional Connection object. - * @return ChildImportExportCategory The associated ChildImportExportCategory object. + * @return ChildImportCategory The associated ChildImportCategory object. * @throws PropelException */ - public function getImportExportCategory(ConnectionInterface $con = null) + public function getImportCategory(ConnectionInterface $con = null) { - if ($this->aImportExportCategory === null && ($this->id !== null)) { - $this->aImportExportCategory = ChildImportExportCategoryQuery::create()->findPk($this->id, $con); + if ($this->aImportCategory === null && ($this->id !== null)) { + $this->aImportCategory = ChildImportCategoryQuery::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->aImportExportCategory->addImportExportCategoryI18ns($this); + $this->aImportCategory->addImportCategoryI18ns($this); */ } - return $this->aImportExportCategory; + return $this->aImportCategory; } /** @@ -1134,7 +1134,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface if ($deep) { } // if ($deep) - $this->aImportExportCategory = null; + $this->aImportCategory = null; } /** @@ -1144,7 +1144,7 @@ abstract class ImportExportCategoryI18n implements ActiveRecordInterface */ public function __toString() { - return (string) $this->exportTo(ImportExportCategoryI18nTableMap::DEFAULT_STRING_FORMAT); + return (string) $this->exportTo(ImportCategoryI18nTableMap::DEFAULT_STRING_FORMAT); } /** diff --git a/core/lib/Thelia/Model/Base/ImportExportCategoryI18nQuery.php b/core/lib/Thelia/Model/Base/ImportCategoryI18nQuery.php similarity index 60% rename from core/lib/Thelia/Model/Base/ImportExportCategoryI18nQuery.php rename to core/lib/Thelia/Model/Base/ImportCategoryI18nQuery.php index 05ee2eb89..648858914 100644 --- a/core/lib/Thelia/Model/Base/ImportExportCategoryI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ImportCategoryI18nQuery.php @@ -12,72 +12,72 @@ use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; -use Thelia\Model\ImportExportCategoryI18n as ChildImportExportCategoryI18n; -use Thelia\Model\ImportExportCategoryI18nQuery as ChildImportExportCategoryI18nQuery; -use Thelia\Model\Map\ImportExportCategoryI18nTableMap; +use Thelia\Model\ImportCategoryI18n as ChildImportCategoryI18n; +use Thelia\Model\ImportCategoryI18nQuery as ChildImportCategoryI18nQuery; +use Thelia\Model\Map\ImportCategoryI18nTableMap; /** - * Base class that represents a query for the 'import_export_category_i18n' table. + * Base class that represents a query for the 'import_category_i18n' table. * * * - * @method ChildImportExportCategoryI18nQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildImportExportCategoryI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column - * @method ChildImportExportCategoryI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column + * @method ChildImportCategoryI18nQuery orderById($order = Criteria::ASC) Order by the id column + * @method ChildImportCategoryI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column + * @method ChildImportCategoryI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column * - * @method ChildImportExportCategoryI18nQuery groupById() Group by the id column - * @method ChildImportExportCategoryI18nQuery groupByLocale() Group by the locale column - * @method ChildImportExportCategoryI18nQuery groupByTitle() Group by the title column + * @method ChildImportCategoryI18nQuery groupById() Group by the id column + * @method ChildImportCategoryI18nQuery groupByLocale() Group by the locale column + * @method ChildImportCategoryI18nQuery groupByTitle() Group by the title column * - * @method ChildImportExportCategoryI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query - * @method ChildImportExportCategoryI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query - * @method ChildImportExportCategoryI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query + * @method ChildImportCategoryI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query + * @method ChildImportCategoryI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query + * @method ChildImportCategoryI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildImportExportCategoryI18nQuery leftJoinImportExportCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportCategory relation - * @method ChildImportExportCategoryI18nQuery rightJoinImportExportCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportCategory relation - * @method ChildImportExportCategoryI18nQuery innerJoinImportExportCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportCategory relation + * @method ChildImportCategoryI18nQuery leftJoinImportCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportCategory relation + * @method ChildImportCategoryI18nQuery rightJoinImportCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportCategory relation + * @method ChildImportCategoryI18nQuery innerJoinImportCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportCategory relation * - * @method ChildImportExportCategoryI18n findOne(ConnectionInterface $con = null) Return the first ChildImportExportCategoryI18n matching the query - * @method ChildImportExportCategoryI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportExportCategoryI18n matching the query, or a new ChildImportExportCategoryI18n object populated from the query conditions when no match is found + * @method ChildImportCategoryI18n findOne(ConnectionInterface $con = null) Return the first ChildImportCategoryI18n matching the query + * @method ChildImportCategoryI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportCategoryI18n matching the query, or a new ChildImportCategoryI18n object populated from the query conditions when no match is found * - * @method ChildImportExportCategoryI18n findOneById(int $id) Return the first ChildImportExportCategoryI18n filtered by the id column - * @method ChildImportExportCategoryI18n findOneByLocale(string $locale) Return the first ChildImportExportCategoryI18n filtered by the locale column - * @method ChildImportExportCategoryI18n findOneByTitle(string $title) Return the first ChildImportExportCategoryI18n filtered by the title column + * @method ChildImportCategoryI18n findOneById(int $id) Return the first ChildImportCategoryI18n filtered by the id column + * @method ChildImportCategoryI18n findOneByLocale(string $locale) Return the first ChildImportCategoryI18n filtered by the locale column + * @method ChildImportCategoryI18n findOneByTitle(string $title) Return the first ChildImportCategoryI18n filtered by the title column * - * @method array findById(int $id) Return ChildImportExportCategoryI18n objects filtered by the id column - * @method array findByLocale(string $locale) Return ChildImportExportCategoryI18n objects filtered by the locale column - * @method array findByTitle(string $title) Return ChildImportExportCategoryI18n objects filtered by the title column + * @method array findById(int $id) Return ChildImportCategoryI18n objects filtered by the id column + * @method array findByLocale(string $locale) Return ChildImportCategoryI18n objects filtered by the locale column + * @method array findByTitle(string $title) Return ChildImportCategoryI18n objects filtered by the title column * */ -abstract class ImportExportCategoryI18nQuery extends ModelCriteria +abstract class ImportCategoryI18nQuery extends ModelCriteria { /** - * Initializes internal state of \Thelia\Model\Base\ImportExportCategoryI18nQuery object. + * Initializes internal state of \Thelia\Model\Base\ImportCategoryI18nQuery object. * * @param string $dbName The database name * @param string $modelName The phpName of a model, e.g. 'Book' * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ - public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportExportCategoryI18n', $modelAlias = null) + public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportCategoryI18n', $modelAlias = null) { parent::__construct($dbName, $modelName, $modelAlias); } /** - * Returns a new ChildImportExportCategoryI18nQuery object. + * Returns a new ChildImportCategoryI18nQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * - * @return ChildImportExportCategoryI18nQuery + * @return ChildImportCategoryI18nQuery */ public static function create($modelAlias = null, $criteria = null) { - if ($criteria instanceof \Thelia\Model\ImportExportCategoryI18nQuery) { + if ($criteria instanceof \Thelia\Model\ImportCategoryI18nQuery) { return $criteria; } - $query = new \Thelia\Model\ImportExportCategoryI18nQuery(); + $query = new \Thelia\Model\ImportCategoryI18nQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } @@ -100,19 +100,19 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria * @param array[$id, $locale] $key Primary key to use for the query * @param ConnectionInterface $con an optional connection object * - * @return ChildImportExportCategoryI18n|array|mixed the result, formatted by the current formatter + * @return ChildImportCategoryI18n|array|mixed the result, formatted by the current formatter */ public function findPk($key, $con = null) { if ($key === null) { return null; } - if ((null !== ($obj = ImportExportCategoryI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) { + if ((null !== ($obj = ImportCategoryI18nTableMap::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(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ImportCategoryI18nTableMap::DATABASE_NAME); } $this->basePreSelect($con); if ($this->formatter || $this->modelAlias || $this->with || $this->select @@ -131,11 +131,11 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildImportExportCategoryI18n A model object, or null if the key is not found + * @return ChildImportCategoryI18n A model object, or null if the key is not found */ protected function findPkSimple($key, $con) { - $sql = 'SELECT `ID`, `LOCALE`, `TITLE` FROM `import_export_category_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE` FROM `import_category_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -147,9 +147,9 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria } $obj = null; if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new ChildImportExportCategoryI18n(); + $obj = new ChildImportCategoryI18n(); $obj->hydrate($row); - ImportExportCategoryI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); + ImportCategoryI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); } $stmt->closeCursor(); @@ -162,7 +162,7 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildImportExportCategoryI18n|array|mixed the result, formatted by the current formatter + * @return ChildImportCategoryI18n|array|mixed the result, formatted by the current formatter */ protected function findPkComplex($key, $con) { @@ -204,12 +204,12 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria * * @param mixed $key Primary key to use for the query * - * @return ChildImportExportCategoryI18nQuery The current query, for fluid interface + * @return ChildImportCategoryI18nQuery The current query, for fluid interface */ public function filterByPrimaryKey($key) { - $this->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $key[0], Criteria::EQUAL); - $this->addUsingAlias(ImportExportCategoryI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); + $this->addUsingAlias(ImportCategoryI18nTableMap::ID, $key[0], Criteria::EQUAL); + $this->addUsingAlias(ImportCategoryI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); return $this; } @@ -219,7 +219,7 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria * * @param array $keys The list of primary key to use for the query * - * @return ChildImportExportCategoryI18nQuery The current query, for fluid interface + * @return ChildImportCategoryI18nQuery The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { @@ -227,8 +227,8 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria return $this->add(null, '1<>1', Criteria::CUSTOM); } foreach ($keys as $key) { - $cton0 = $this->getNewCriterion(ImportExportCategoryI18nTableMap::ID, $key[0], Criteria::EQUAL); - $cton1 = $this->getNewCriterion(ImportExportCategoryI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); + $cton0 = $this->getNewCriterion(ImportCategoryI18nTableMap::ID, $key[0], Criteria::EQUAL); + $cton1 = $this->getNewCriterion(ImportCategoryI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); $cton0->addAnd($cton1); $this->addOr($cton0); } @@ -246,7 +246,7 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @see filterByImportExportCategory() + * @see filterByImportCategory() * * @param mixed $id The value to use as filter. * Use scalar values for equality. @@ -254,18 +254,18 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportCategoryI18nQuery The current query, for fluid interface + * @return ChildImportCategoryI18nQuery 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(ImportExportCategoryI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ImportCategoryI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($id['max'])) { - $this->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ImportCategoryI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -276,7 +276,7 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $id, $comparison); + return $this->addUsingAlias(ImportCategoryI18nTableMap::ID, $id, $comparison); } /** @@ -292,7 +292,7 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportCategoryI18nQuery The current query, for fluid interface + * @return ChildImportCategoryI18nQuery The current query, for fluid interface */ public function filterByLocale($locale = null, $comparison = null) { @@ -305,7 +305,7 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportCategoryI18nTableMap::LOCALE, $locale, $comparison); + return $this->addUsingAlias(ImportCategoryI18nTableMap::LOCALE, $locale, $comparison); } /** @@ -321,7 +321,7 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportCategoryI18nQuery The current query, for fluid interface + * @return ChildImportCategoryI18nQuery The current query, for fluid interface */ public function filterByTitle($title = null, $comparison = null) { @@ -334,46 +334,46 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportCategoryI18nTableMap::TITLE, $title, $comparison); + return $this->addUsingAlias(ImportCategoryI18nTableMap::TITLE, $title, $comparison); } /** - * Filter the query by a related \Thelia\Model\ImportExportCategory object + * Filter the query by a related \Thelia\Model\ImportCategory object * - * @param \Thelia\Model\ImportExportCategory|ObjectCollection $importExportCategory The related object(s) to use as filter + * @param \Thelia\Model\ImportCategory|ObjectCollection $importCategory The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportCategoryI18nQuery The current query, for fluid interface + * @return ChildImportCategoryI18nQuery The current query, for fluid interface */ - public function filterByImportExportCategory($importExportCategory, $comparison = null) + public function filterByImportCategory($importCategory, $comparison = null) { - if ($importExportCategory instanceof \Thelia\Model\ImportExportCategory) { + if ($importCategory instanceof \Thelia\Model\ImportCategory) { return $this - ->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $importExportCategory->getId(), $comparison); - } elseif ($importExportCategory instanceof ObjectCollection) { + ->addUsingAlias(ImportCategoryI18nTableMap::ID, $importCategory->getId(), $comparison); + } elseif ($importCategory instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this - ->addUsingAlias(ImportExportCategoryI18nTableMap::ID, $importExportCategory->toKeyValue('PrimaryKey', 'Id'), $comparison); + ->addUsingAlias(ImportCategoryI18nTableMap::ID, $importCategory->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { - throw new PropelException('filterByImportExportCategory() only accepts arguments of type \Thelia\Model\ImportExportCategory or Collection'); + throw new PropelException('filterByImportCategory() only accepts arguments of type \Thelia\Model\ImportCategory or Collection'); } } /** - * Adds a JOIN clause to the query using the ImportExportCategory relation + * Adds a JOIN clause to the query using the ImportCategory relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildImportExportCategoryI18nQuery The current query, for fluid interface + * @return ChildImportCategoryI18nQuery The current query, for fluid interface */ - public function joinImportExportCategory($relationAlias = null, $joinType = 'LEFT JOIN') + public function joinImportCategory($relationAlias = null, $joinType = 'LEFT JOIN') { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ImportExportCategory'); + $relationMap = $tableMap->getRelation('ImportCategory'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -388,14 +388,14 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'ImportExportCategory'); + $this->addJoinObject($join, 'ImportCategory'); } return $this; } /** - * Use the ImportExportCategory relation ImportExportCategory object + * Use the ImportCategory relation ImportCategory object * * @see useQuery() * @@ -403,27 +403,27 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return \Thelia\Model\ImportExportCategoryQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\ImportCategoryQuery A secondary query class using the current class as primary query */ - public function useImportExportCategoryQuery($relationAlias = null, $joinType = 'LEFT JOIN') + public function useImportCategoryQuery($relationAlias = null, $joinType = 'LEFT JOIN') { return $this - ->joinImportExportCategory($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ImportExportCategory', '\Thelia\Model\ImportExportCategoryQuery'); + ->joinImportCategory($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ImportCategory', '\Thelia\Model\ImportCategoryQuery'); } /** * Exclude object from result * - * @param ChildImportExportCategoryI18n $importExportCategoryI18n Object to remove from the list of results + * @param ChildImportCategoryI18n $importCategoryI18n Object to remove from the list of results * - * @return ChildImportExportCategoryI18nQuery The current query, for fluid interface + * @return ChildImportCategoryI18nQuery The current query, for fluid interface */ - public function prune($importExportCategoryI18n = null) + public function prune($importCategoryI18n = null) { - if ($importExportCategoryI18n) { - $this->addCond('pruneCond0', $this->getAliasedColName(ImportExportCategoryI18nTableMap::ID), $importExportCategoryI18n->getId(), Criteria::NOT_EQUAL); - $this->addCond('pruneCond1', $this->getAliasedColName(ImportExportCategoryI18nTableMap::LOCALE), $importExportCategoryI18n->getLocale(), Criteria::NOT_EQUAL); + if ($importCategoryI18n) { + $this->addCond('pruneCond0', $this->getAliasedColName(ImportCategoryI18nTableMap::ID), $importCategoryI18n->getId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond1', $this->getAliasedColName(ImportCategoryI18nTableMap::LOCALE), $importCategoryI18n->getLocale(), Criteria::NOT_EQUAL); $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); } @@ -431,7 +431,7 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria } /** - * Deletes all rows from the import_export_category_i18n table. + * Deletes all rows from the import_category_i18n table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). @@ -439,7 +439,7 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria public function doDeleteAll(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryI18nTableMap::DATABASE_NAME); } $affectedRows = 0; // initialize var to track total num of affected rows try { @@ -450,8 +450,8 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria // Because this db requires some delete cascade/set null emulation, we have to // clear the cached instance *after* the emulation has happened (since // instances get re-added by the select statement contained therein). - ImportExportCategoryI18nTableMap::clearInstancePool(); - ImportExportCategoryI18nTableMap::clearRelatedInstancePool(); + ImportCategoryI18nTableMap::clearInstancePool(); + ImportCategoryI18nTableMap::clearRelatedInstancePool(); $con->commit(); } catch (PropelException $e) { @@ -463,9 +463,9 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria } /** - * Performs a DELETE on the database, given a ChildImportExportCategoryI18n or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ChildImportCategoryI18n or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ChildImportExportCategoryI18n object or primary key or array of primary keys + * @param mixed $values Criteria or ChildImportCategoryI18n 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 @@ -476,13 +476,13 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria public function delete(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryI18nTableMap::DATABASE_NAME); } $criteria = $this; // Set the correct dbName - $criteria->setDbName(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $criteria->setDbName(ImportCategoryI18nTableMap::DATABASE_NAME); $affectedRows = 0; // initialize var to track total num of affected rows @@ -492,10 +492,10 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria $con->beginTransaction(); - ImportExportCategoryI18nTableMap::removeInstanceFromPool($criteria); + ImportCategoryI18nTableMap::removeInstanceFromPool($criteria); $affectedRows += ModelCriteria::delete($con); - ImportExportCategoryI18nTableMap::clearRelatedInstancePool(); + ImportCategoryI18nTableMap::clearRelatedInstancePool(); $con->commit(); return $affectedRows; @@ -505,4 +505,4 @@ abstract class ImportExportCategoryI18nQuery extends ModelCriteria } } -} // ImportExportCategoryI18nQuery +} // ImportCategoryI18nQuery diff --git a/core/lib/Thelia/Model/Base/ImportExportCategoryQuery.php b/core/lib/Thelia/Model/Base/ImportCategoryQuery.php similarity index 59% rename from core/lib/Thelia/Model/Base/ImportExportCategoryQuery.php rename to core/lib/Thelia/Model/Base/ImportCategoryQuery.php index 535ad75ac..9c00639ad 100644 --- a/core/lib/Thelia/Model/Base/ImportExportCategoryQuery.php +++ b/core/lib/Thelia/Model/Base/ImportCategoryQuery.php @@ -12,81 +12,81 @@ use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; -use Thelia\Model\ImportExportCategory as ChildImportExportCategory; -use Thelia\Model\ImportExportCategoryI18nQuery as ChildImportExportCategoryI18nQuery; -use Thelia\Model\ImportExportCategoryQuery as ChildImportExportCategoryQuery; -use Thelia\Model\Map\ImportExportCategoryTableMap; +use Thelia\Model\ImportCategory as ChildImportCategory; +use Thelia\Model\ImportCategoryI18nQuery as ChildImportCategoryI18nQuery; +use Thelia\Model\ImportCategoryQuery as ChildImportCategoryQuery; +use Thelia\Model\Map\ImportCategoryTableMap; /** - * Base class that represents a query for the 'import_export_category' table. + * Base class that represents a query for the 'import_category' table. * * * - * @method ChildImportExportCategoryQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildImportExportCategoryQuery orderByPosition($order = Criteria::ASC) Order by the position column - * @method ChildImportExportCategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column - * @method ChildImportExportCategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column + * @method ChildImportCategoryQuery orderById($order = Criteria::ASC) Order by the id column + * @method ChildImportCategoryQuery orderByPosition($order = Criteria::ASC) Order by the position column + * @method ChildImportCategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column + * @method ChildImportCategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * - * @method ChildImportExportCategoryQuery groupById() Group by the id column - * @method ChildImportExportCategoryQuery groupByPosition() Group by the position column - * @method ChildImportExportCategoryQuery groupByCreatedAt() Group by the created_at column - * @method ChildImportExportCategoryQuery groupByUpdatedAt() Group by the updated_at column + * @method ChildImportCategoryQuery groupById() Group by the id column + * @method ChildImportCategoryQuery groupByPosition() Group by the position column + * @method ChildImportCategoryQuery groupByCreatedAt() Group by the created_at column + * @method ChildImportCategoryQuery groupByUpdatedAt() Group by the updated_at column * - * @method ChildImportExportCategoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query - * @method ChildImportExportCategoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query - * @method ChildImportExportCategoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query + * @method ChildImportCategoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query + * @method ChildImportCategoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query + * @method ChildImportCategoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildImportExportCategoryQuery leftJoinImportExportType($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportType relation - * @method ChildImportExportCategoryQuery rightJoinImportExportType($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportType relation - * @method ChildImportExportCategoryQuery innerJoinImportExportType($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportType relation + * @method ChildImportCategoryQuery leftJoinImport($relationAlias = null) Adds a LEFT JOIN clause to the query using the Import relation + * @method ChildImportCategoryQuery rightJoinImport($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Import relation + * @method ChildImportCategoryQuery innerJoinImport($relationAlias = null) Adds a INNER JOIN clause to the query using the Import relation * - * @method ChildImportExportCategoryQuery leftJoinImportExportCategoryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportCategoryI18n relation - * @method ChildImportExportCategoryQuery rightJoinImportExportCategoryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportCategoryI18n relation - * @method ChildImportExportCategoryQuery innerJoinImportExportCategoryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportCategoryI18n relation + * @method ChildImportCategoryQuery leftJoinImportCategoryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportCategoryI18n relation + * @method ChildImportCategoryQuery rightJoinImportCategoryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportCategoryI18n relation + * @method ChildImportCategoryQuery innerJoinImportCategoryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportCategoryI18n relation * - * @method ChildImportExportCategory findOne(ConnectionInterface $con = null) Return the first ChildImportExportCategory matching the query - * @method ChildImportExportCategory findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportExportCategory matching the query, or a new ChildImportExportCategory object populated from the query conditions when no match is found + * @method ChildImportCategory findOne(ConnectionInterface $con = null) Return the first ChildImportCategory matching the query + * @method ChildImportCategory findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportCategory matching the query, or a new ChildImportCategory object populated from the query conditions when no match is found * - * @method ChildImportExportCategory findOneById(int $id) Return the first ChildImportExportCategory filtered by the id column - * @method ChildImportExportCategory findOneByPosition(int $position) Return the first ChildImportExportCategory filtered by the position column - * @method ChildImportExportCategory findOneByCreatedAt(string $created_at) Return the first ChildImportExportCategory filtered by the created_at column - * @method ChildImportExportCategory findOneByUpdatedAt(string $updated_at) Return the first ChildImportExportCategory filtered by the updated_at column + * @method ChildImportCategory findOneById(int $id) Return the first ChildImportCategory filtered by the id column + * @method ChildImportCategory findOneByPosition(int $position) Return the first ChildImportCategory filtered by the position column + * @method ChildImportCategory findOneByCreatedAt(string $created_at) Return the first ChildImportCategory filtered by the created_at column + * @method ChildImportCategory findOneByUpdatedAt(string $updated_at) Return the first ChildImportCategory filtered by the updated_at column * - * @method array findById(int $id) Return ChildImportExportCategory objects filtered by the id column - * @method array findByPosition(int $position) Return ChildImportExportCategory objects filtered by the position column - * @method array findByCreatedAt(string $created_at) Return ChildImportExportCategory objects filtered by the created_at column - * @method array findByUpdatedAt(string $updated_at) Return ChildImportExportCategory objects filtered by the updated_at column + * @method array findById(int $id) Return ChildImportCategory objects filtered by the id column + * @method array findByPosition(int $position) Return ChildImportCategory objects filtered by the position column + * @method array findByCreatedAt(string $created_at) Return ChildImportCategory objects filtered by the created_at column + * @method array findByUpdatedAt(string $updated_at) Return ChildImportCategory objects filtered by the updated_at column * */ -abstract class ImportExportCategoryQuery extends ModelCriteria +abstract class ImportCategoryQuery extends ModelCriteria { /** - * Initializes internal state of \Thelia\Model\Base\ImportExportCategoryQuery object. + * Initializes internal state of \Thelia\Model\Base\ImportCategoryQuery object. * * @param string $dbName The database name * @param string $modelName The phpName of a model, e.g. 'Book' * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ - public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportExportCategory', $modelAlias = null) + public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportCategory', $modelAlias = null) { parent::__construct($dbName, $modelName, $modelAlias); } /** - * Returns a new ChildImportExportCategoryQuery object. + * Returns a new ChildImportCategoryQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * - * @return ChildImportExportCategoryQuery + * @return ChildImportCategoryQuery */ public static function create($modelAlias = null, $criteria = null) { - if ($criteria instanceof \Thelia\Model\ImportExportCategoryQuery) { + if ($criteria instanceof \Thelia\Model\ImportCategoryQuery) { return $criteria; } - $query = new \Thelia\Model\ImportExportCategoryQuery(); + $query = new \Thelia\Model\ImportCategoryQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } @@ -109,19 +109,19 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con an optional connection object * - * @return ChildImportExportCategory|array|mixed the result, formatted by the current formatter + * @return ChildImportCategory|array|mixed the result, formatted by the current formatter */ public function findPk($key, $con = null) { if ($key === null) { return null; } - if ((null !== ($obj = ImportExportCategoryTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + if ((null !== ($obj = ImportCategoryTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { // the object is already in the instance pool return $obj; } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ImportExportCategoryTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ImportCategoryTableMap::DATABASE_NAME); } $this->basePreSelect($con); if ($this->formatter || $this->modelAlias || $this->with || $this->select @@ -140,11 +140,11 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildImportExportCategory A model object, or null if the key is not found + * @return ChildImportCategory A model object, or null if the key is not found */ protected function findPkSimple($key, $con) { - $sql = 'SELECT `ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `import_export_category` WHERE `ID` = :p0'; + $sql = 'SELECT `ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `import_category` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -155,9 +155,9 @@ abstract class ImportExportCategoryQuery extends ModelCriteria } $obj = null; if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new ChildImportExportCategory(); + $obj = new ChildImportCategory(); $obj->hydrate($row); - ImportExportCategoryTableMap::addInstanceToPool($obj, (string) $key); + ImportCategoryTableMap::addInstanceToPool($obj, (string) $key); } $stmt->closeCursor(); @@ -170,7 +170,7 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildImportExportCategory|array|mixed the result, formatted by the current formatter + * @return ChildImportCategory|array|mixed the result, formatted by the current formatter */ protected function findPkComplex($key, $con) { @@ -212,12 +212,12 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * * @param mixed $key Primary key to use for the query * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(ImportExportCategoryTableMap::ID, $key, Criteria::EQUAL); + return $this->addUsingAlias(ImportCategoryTableMap::ID, $key, Criteria::EQUAL); } /** @@ -225,12 +225,12 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * * @param array $keys The list of primary key to use for the query * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(ImportExportCategoryTableMap::ID, $keys, Criteria::IN); + return $this->addUsingAlias(ImportCategoryTableMap::ID, $keys, Criteria::IN); } /** @@ -249,18 +249,18 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery 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(ImportExportCategoryTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ImportCategoryTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($id['max'])) { - $this->addUsingAlias(ImportExportCategoryTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ImportCategoryTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -271,7 +271,7 @@ abstract class ImportExportCategoryQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportCategoryTableMap::ID, $id, $comparison); + return $this->addUsingAlias(ImportCategoryTableMap::ID, $id, $comparison); } /** @@ -290,18 +290,18 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery 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(ImportExportCategoryTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ImportCategoryTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($position['max'])) { - $this->addUsingAlias(ImportExportCategoryTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ImportCategoryTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -312,7 +312,7 @@ abstract class ImportExportCategoryQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportCategoryTableMap::POSITION, $position, $comparison); + return $this->addUsingAlias(ImportCategoryTableMap::POSITION, $position, $comparison); } /** @@ -333,18 +333,18 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery 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(ImportExportCategoryTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ImportCategoryTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($createdAt['max'])) { - $this->addUsingAlias(ImportExportCategoryTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ImportCategoryTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -355,7 +355,7 @@ abstract class ImportExportCategoryQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportCategoryTableMap::CREATED_AT, $createdAt, $comparison); + return $this->addUsingAlias(ImportCategoryTableMap::CREATED_AT, $createdAt, $comparison); } /** @@ -376,18 +376,18 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery 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(ImportExportCategoryTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ImportCategoryTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($updatedAt['max'])) { - $this->addUsingAlias(ImportExportCategoryTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ImportCategoryTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -398,44 +398,44 @@ abstract class ImportExportCategoryQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportCategoryTableMap::UPDATED_AT, $updatedAt, $comparison); + return $this->addUsingAlias(ImportCategoryTableMap::UPDATED_AT, $updatedAt, $comparison); } /** - * Filter the query by a related \Thelia\Model\ImportExportType object + * Filter the query by a related \Thelia\Model\Import object * - * @param \Thelia\Model\ImportExportType|ObjectCollection $importExportType the related object to use as filter + * @param \Thelia\Model\Import|ObjectCollection $import the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ - public function filterByImportExportType($importExportType, $comparison = null) + public function filterByImport($import, $comparison = null) { - if ($importExportType instanceof \Thelia\Model\ImportExportType) { + if ($import instanceof \Thelia\Model\Import) { return $this - ->addUsingAlias(ImportExportCategoryTableMap::ID, $importExportType->getImportExportCategoryId(), $comparison); - } elseif ($importExportType instanceof ObjectCollection) { + ->addUsingAlias(ImportCategoryTableMap::ID, $import->getImportCategoryId(), $comparison); + } elseif ($import instanceof ObjectCollection) { return $this - ->useImportExportTypeQuery() - ->filterByPrimaryKeys($importExportType->getPrimaryKeys()) + ->useImportQuery() + ->filterByPrimaryKeys($import->getPrimaryKeys()) ->endUse(); } else { - throw new PropelException('filterByImportExportType() only accepts arguments of type \Thelia\Model\ImportExportType or Collection'); + throw new PropelException('filterByImport() only accepts arguments of type \Thelia\Model\Import or Collection'); } } /** - * Adds a JOIN clause to the query using the ImportExportType relation + * Adds a JOIN clause to the query using the Import relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ - public function joinImportExportType($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinImport($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ImportExportType'); + $relationMap = $tableMap->getRelation('Import'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -450,14 +450,14 @@ abstract class ImportExportCategoryQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'ImportExportType'); + $this->addJoinObject($join, 'Import'); } return $this; } /** - * Use the ImportExportType relation ImportExportType object + * Use the Import relation Import object * * @see useQuery() * @@ -465,50 +465,50 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return \Thelia\Model\ImportExportTypeQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\ImportQuery A secondary query class using the current class as primary query */ - public function useImportExportTypeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function useImportQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this - ->joinImportExportType($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ImportExportType', '\Thelia\Model\ImportExportTypeQuery'); + ->joinImport($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Import', '\Thelia\Model\ImportQuery'); } /** - * Filter the query by a related \Thelia\Model\ImportExportCategoryI18n object + * Filter the query by a related \Thelia\Model\ImportCategoryI18n object * - * @param \Thelia\Model\ImportExportCategoryI18n|ObjectCollection $importExportCategoryI18n the related object to use as filter + * @param \Thelia\Model\ImportCategoryI18n|ObjectCollection $importCategoryI18n the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ - public function filterByImportExportCategoryI18n($importExportCategoryI18n, $comparison = null) + public function filterByImportCategoryI18n($importCategoryI18n, $comparison = null) { - if ($importExportCategoryI18n instanceof \Thelia\Model\ImportExportCategoryI18n) { + if ($importCategoryI18n instanceof \Thelia\Model\ImportCategoryI18n) { return $this - ->addUsingAlias(ImportExportCategoryTableMap::ID, $importExportCategoryI18n->getId(), $comparison); - } elseif ($importExportCategoryI18n instanceof ObjectCollection) { + ->addUsingAlias(ImportCategoryTableMap::ID, $importCategoryI18n->getId(), $comparison); + } elseif ($importCategoryI18n instanceof ObjectCollection) { return $this - ->useImportExportCategoryI18nQuery() - ->filterByPrimaryKeys($importExportCategoryI18n->getPrimaryKeys()) + ->useImportCategoryI18nQuery() + ->filterByPrimaryKeys($importCategoryI18n->getPrimaryKeys()) ->endUse(); } else { - throw new PropelException('filterByImportExportCategoryI18n() only accepts arguments of type \Thelia\Model\ImportExportCategoryI18n or Collection'); + throw new PropelException('filterByImportCategoryI18n() only accepts arguments of type \Thelia\Model\ImportCategoryI18n or Collection'); } } /** - * Adds a JOIN clause to the query using the ImportExportCategoryI18n relation + * Adds a JOIN clause to the query using the ImportCategoryI18n relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ - public function joinImportExportCategoryI18n($relationAlias = null, $joinType = 'LEFT JOIN') + public function joinImportCategoryI18n($relationAlias = null, $joinType = 'LEFT JOIN') { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ImportExportCategoryI18n'); + $relationMap = $tableMap->getRelation('ImportCategoryI18n'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -523,14 +523,14 @@ abstract class ImportExportCategoryQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'ImportExportCategoryI18n'); + $this->addJoinObject($join, 'ImportCategoryI18n'); } return $this; } /** - * Use the ImportExportCategoryI18n relation ImportExportCategoryI18n object + * Use the ImportCategoryI18n relation ImportCategoryI18n object * * @see useQuery() * @@ -538,33 +538,33 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return \Thelia\Model\ImportExportCategoryI18nQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\ImportCategoryI18nQuery A secondary query class using the current class as primary query */ - public function useImportExportCategoryI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') + public function useImportCategoryI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') { return $this - ->joinImportExportCategoryI18n($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ImportExportCategoryI18n', '\Thelia\Model\ImportExportCategoryI18nQuery'); + ->joinImportCategoryI18n($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ImportCategoryI18n', '\Thelia\Model\ImportCategoryI18nQuery'); } /** * Exclude object from result * - * @param ChildImportExportCategory $importExportCategory Object to remove from the list of results + * @param ChildImportCategory $importCategory Object to remove from the list of results * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ - public function prune($importExportCategory = null) + public function prune($importCategory = null) { - if ($importExportCategory) { - $this->addUsingAlias(ImportExportCategoryTableMap::ID, $importExportCategory->getId(), Criteria::NOT_EQUAL); + if ($importCategory) { + $this->addUsingAlias(ImportCategoryTableMap::ID, $importCategory->getId(), Criteria::NOT_EQUAL); } return $this; } /** - * Deletes all rows from the import_export_category table. + * Deletes all rows from the import_category table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). @@ -572,7 +572,7 @@ abstract class ImportExportCategoryQuery extends ModelCriteria public function doDeleteAll(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryTableMap::DATABASE_NAME); } $affectedRows = 0; // initialize var to track total num of affected rows try { @@ -583,8 +583,8 @@ abstract class ImportExportCategoryQuery extends ModelCriteria // Because this db requires some delete cascade/set null emulation, we have to // clear the cached instance *after* the emulation has happened (since // instances get re-added by the select statement contained therein). - ImportExportCategoryTableMap::clearInstancePool(); - ImportExportCategoryTableMap::clearRelatedInstancePool(); + ImportCategoryTableMap::clearInstancePool(); + ImportCategoryTableMap::clearRelatedInstancePool(); $con->commit(); } catch (PropelException $e) { @@ -596,9 +596,9 @@ abstract class ImportExportCategoryQuery extends ModelCriteria } /** - * Performs a DELETE on the database, given a ChildImportExportCategory or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ChildImportCategory or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ChildImportExportCategory object or primary key or array of primary keys + * @param mixed $values Criteria or ChildImportCategory 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 @@ -609,13 +609,13 @@ abstract class ImportExportCategoryQuery extends ModelCriteria public function delete(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryTableMap::DATABASE_NAME); } $criteria = $this; // Set the correct dbName - $criteria->setDbName(ImportExportCategoryTableMap::DATABASE_NAME); + $criteria->setDbName(ImportCategoryTableMap::DATABASE_NAME); $affectedRows = 0; // initialize var to track total num of affected rows @@ -625,10 +625,10 @@ abstract class ImportExportCategoryQuery extends ModelCriteria $con->beginTransaction(); - ImportExportCategoryTableMap::removeInstanceFromPool($criteria); + ImportCategoryTableMap::removeInstanceFromPool($criteria); $affectedRows += ModelCriteria::delete($con); - ImportExportCategoryTableMap::clearRelatedInstancePool(); + ImportCategoryTableMap::clearRelatedInstancePool(); $con->commit(); return $affectedRows; @@ -647,14 +647,14 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * @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 ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { - $relationName = $relationAlias ? $relationAlias : 'ImportExportCategoryI18n'; + $relationName = $relationAlias ? $relationAlias : 'ImportCategoryI18n'; return $this - ->joinImportExportCategoryI18n($relationAlias, $joinType) + ->joinImportCategoryI18n($relationAlias, $joinType) ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale); } @@ -665,14 +665,14 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * @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 ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) - ->with('ImportExportCategoryI18n'); - $this->with['ImportExportCategoryI18n']->setIsWithOneToMany(false); + ->with('ImportCategoryI18n'); + $this->with['ImportCategoryI18n']->setIsWithOneToMany(false); return $this; } @@ -686,13 +686,13 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * @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 ChildImportExportCategoryI18nQuery A secondary query class using the current class as primary query + * @return ChildImportCategoryI18nQuery 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 : 'ImportExportCategoryI18n', '\Thelia\Model\ImportExportCategoryI18nQuery'); + ->useQuery($relationAlias ? $relationAlias : 'ImportCategoryI18n', '\Thelia\Model\ImportCategoryI18nQuery'); } // timestampable behavior @@ -702,11 +702,11 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * * @param int $nbDays Maximum age of the latest update in days * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(ImportExportCategoryTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + return $this->addUsingAlias(ImportCategoryTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); } /** @@ -714,51 +714,51 @@ abstract class ImportExportCategoryQuery extends ModelCriteria * * @param int $nbDays Maximum age of in days * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(ImportExportCategoryTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + return $this->addUsingAlias(ImportCategoryTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); } /** * Order by update date desc * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(ImportExportCategoryTableMap::UPDATED_AT); + return $this->addDescendingOrderByColumn(ImportCategoryTableMap::UPDATED_AT); } /** * Order by update date asc * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(ImportExportCategoryTableMap::UPDATED_AT); + return $this->addAscendingOrderByColumn(ImportCategoryTableMap::UPDATED_AT); } /** * Order by create date desc * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(ImportExportCategoryTableMap::CREATED_AT); + return $this->addDescendingOrderByColumn(ImportCategoryTableMap::CREATED_AT); } /** * Order by create date asc * - * @return ChildImportExportCategoryQuery The current query, for fluid interface + * @return ChildImportCategoryQuery The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(ImportExportCategoryTableMap::CREATED_AT); + return $this->addAscendingOrderByColumn(ImportCategoryTableMap::CREATED_AT); } -} // ImportExportCategoryQuery +} // ImportCategoryQuery diff --git a/core/lib/Thelia/Model/Base/ImportExportTypeI18n.php b/core/lib/Thelia/Model/Base/ImportI18n.php similarity index 84% rename from core/lib/Thelia/Model/Base/ImportExportTypeI18n.php rename to core/lib/Thelia/Model/Base/ImportI18n.php index 0aca83a7f..9387e2419 100644 --- a/core/lib/Thelia/Model/Base/ImportExportTypeI18n.php +++ b/core/lib/Thelia/Model/Base/ImportI18n.php @@ -14,17 +14,17 @@ use Propel\Runtime\Exception\BadMethodCallException; use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Parser\AbstractParser; -use Thelia\Model\ImportExportType as ChildImportExportType; -use Thelia\Model\ImportExportTypeI18nQuery as ChildImportExportTypeI18nQuery; -use Thelia\Model\ImportExportTypeQuery as ChildImportExportTypeQuery; -use Thelia\Model\Map\ImportExportTypeI18nTableMap; +use Thelia\Model\Import as ChildImport; +use Thelia\Model\ImportI18nQuery as ChildImportI18nQuery; +use Thelia\Model\ImportQuery as ChildImportQuery; +use Thelia\Model\Map\ImportI18nTableMap; -abstract class ImportExportTypeI18n implements ActiveRecordInterface +abstract class ImportI18n implements ActiveRecordInterface { /** * TableMap class name */ - const TABLE_MAP = '\\Thelia\\Model\\Map\\ImportExportTypeI18nTableMap'; + const TABLE_MAP = '\\Thelia\\Model\\Map\\ImportI18nTableMap'; /** @@ -79,9 +79,9 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface protected $description; /** - * @var ImportExportType + * @var Import */ - protected $aImportExportType; + protected $aImport; /** * Flag to prevent endless save loop, if this object is referenced @@ -103,7 +103,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface } /** - * Initializes internal state of Thelia\Model\Base\ImportExportTypeI18n object. + * Initializes internal state of Thelia\Model\Base\ImportI18n object. * @see applyDefaults() */ public function __construct() @@ -200,9 +200,9 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface } /** - * Compares this with another ImportExportTypeI18n instance. If - * obj is an instance of ImportExportTypeI18n, delegates to - * equals(ImportExportTypeI18n). Otherwise, returns false. + * Compares this with another ImportI18n instance. If + * obj is an instance of ImportI18n, delegates to + * equals(ImportI18n). Otherwise, returns false. * * @param mixed $obj The object to compare to. * @return boolean Whether equal to the object specified. @@ -285,7 +285,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface * @param string $name The virtual column name * @param mixed $value The value to give to the virtual column * - * @return ImportExportTypeI18n The current object, for fluid interface + * @return ImportI18n The current object, for fluid interface */ public function setVirtualColumn($name, $value) { @@ -317,7 +317,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface * or a format name ('XML', 'YAML', 'JSON', 'CSV') * @param string $data The source data to import from * - * @return ImportExportTypeI18n The current object, for fluid interface + * @return ImportI18n The current object, for fluid interface */ public function importFrom($parser, $data) { @@ -410,7 +410,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface * Set the value of [id] column. * * @param int $v new value - * @return \Thelia\Model\ImportExportTypeI18n The current object (for fluent API support) + * @return \Thelia\Model\ImportI18n The current object (for fluent API support) */ public function setId($v) { @@ -420,11 +420,11 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface if ($this->id !== $v) { $this->id = $v; - $this->modifiedColumns[ImportExportTypeI18nTableMap::ID] = true; + $this->modifiedColumns[ImportI18nTableMap::ID] = true; } - if ($this->aImportExportType !== null && $this->aImportExportType->getId() !== $v) { - $this->aImportExportType = null; + if ($this->aImport !== null && $this->aImport->getId() !== $v) { + $this->aImport = null; } @@ -435,7 +435,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface * Set the value of [locale] column. * * @param string $v new value - * @return \Thelia\Model\ImportExportTypeI18n The current object (for fluent API support) + * @return \Thelia\Model\ImportI18n The current object (for fluent API support) */ public function setLocale($v) { @@ -445,7 +445,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface if ($this->locale !== $v) { $this->locale = $v; - $this->modifiedColumns[ImportExportTypeI18nTableMap::LOCALE] = true; + $this->modifiedColumns[ImportI18nTableMap::LOCALE] = true; } @@ -456,7 +456,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface * Set the value of [title] column. * * @param string $v new value - * @return \Thelia\Model\ImportExportTypeI18n The current object (for fluent API support) + * @return \Thelia\Model\ImportI18n The current object (for fluent API support) */ public function setTitle($v) { @@ -466,7 +466,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface if ($this->title !== $v) { $this->title = $v; - $this->modifiedColumns[ImportExportTypeI18nTableMap::TITLE] = true; + $this->modifiedColumns[ImportI18nTableMap::TITLE] = true; } @@ -477,7 +477,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface * Set the value of [description] column. * * @param string $v new value - * @return \Thelia\Model\ImportExportTypeI18n The current object (for fluent API support) + * @return \Thelia\Model\ImportI18n The current object (for fluent API support) */ public function setDescription($v) { @@ -487,7 +487,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface if ($this->description !== $v) { $this->description = $v; - $this->modifiedColumns[ImportExportTypeI18nTableMap::DESCRIPTION] = true; + $this->modifiedColumns[ImportI18nTableMap::DESCRIPTION] = true; } @@ -535,16 +535,16 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface try { - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ImportExportTypeI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ImportI18nTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; $this->id = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ImportExportTypeI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ImportI18nTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)]; $this->locale = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ImportExportTypeI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ImportI18nTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)]; $this->title = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ImportExportTypeI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ImportI18nTableMap::translateFieldName('Description', TableMap::TYPE_PHPNAME, $indexType)]; $this->description = (null !== $col) ? (string) $col : null; $this->resetModified(); @@ -554,10 +554,10 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface $this->ensureConsistency(); } - return $startcol + 4; // 4 = ImportExportTypeI18nTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 4; // 4 = ImportI18nTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { - throw new PropelException("Error populating \Thelia\Model\ImportExportTypeI18n object", 0, $e); + throw new PropelException("Error populating \Thelia\Model\ImportI18n object", 0, $e); } } @@ -576,8 +576,8 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface */ public function ensureConsistency() { - if ($this->aImportExportType !== null && $this->id !== $this->aImportExportType->getId()) { - $this->aImportExportType = null; + if ($this->aImport !== null && $this->id !== $this->aImport->getId()) { + $this->aImport = null; } } // ensureConsistency @@ -602,13 +602,13 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ImportExportTypeI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ImportI18nTableMap::DATABASE_NAME); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. - $dataFetcher = ChildImportExportTypeI18nQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $dataFetcher = ChildImportI18nQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); $row = $dataFetcher->fetch(); $dataFetcher->close(); if (!$row) { @@ -618,7 +618,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface if ($deep) { // also de-associate any related objects? - $this->aImportExportType = null; + $this->aImport = null; } // if (deep) } @@ -628,8 +628,8 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface * @param ConnectionInterface $con * @return void * @throws PropelException - * @see ImportExportTypeI18n::setDeleted() - * @see ImportExportTypeI18n::isDeleted() + * @see ImportI18n::setDeleted() + * @see ImportI18n::isDeleted() */ public function delete(ConnectionInterface $con = null) { @@ -638,12 +638,12 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportI18nTableMap::DATABASE_NAME); } $con->beginTransaction(); try { - $deleteQuery = ChildImportExportTypeI18nQuery::create() + $deleteQuery = ChildImportI18nQuery::create() ->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { @@ -680,7 +680,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface } if ($con === null) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportI18nTableMap::DATABASE_NAME); } $con->beginTransaction(); @@ -700,7 +700,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface $this->postUpdate($con); } $this->postSave($con); - ImportExportTypeI18nTableMap::addInstanceToPool($this); + ImportI18nTableMap::addInstanceToPool($this); } else { $affectedRows = 0; } @@ -735,11 +735,11 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface // method. This object relates to these object(s) by a // foreign key reference. - if ($this->aImportExportType !== null) { - if ($this->aImportExportType->isModified() || $this->aImportExportType->isNew()) { - $affectedRows += $this->aImportExportType->save($con); + if ($this->aImport !== null) { + if ($this->aImport->isModified() || $this->aImport->isNew()) { + $affectedRows += $this->aImport->save($con); } - $this->setImportExportType($this->aImportExportType); + $this->setImport($this->aImport); } if ($this->isNew() || $this->isModified()) { @@ -775,21 +775,21 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface // check the columns in natural order for more readable SQL queries - if ($this->isColumnModified(ImportExportTypeI18nTableMap::ID)) { + if ($this->isColumnModified(ImportI18nTableMap::ID)) { $modifiedColumns[':p' . $index++] = '`ID`'; } - if ($this->isColumnModified(ImportExportTypeI18nTableMap::LOCALE)) { + if ($this->isColumnModified(ImportI18nTableMap::LOCALE)) { $modifiedColumns[':p' . $index++] = '`LOCALE`'; } - if ($this->isColumnModified(ImportExportTypeI18nTableMap::TITLE)) { + if ($this->isColumnModified(ImportI18nTableMap::TITLE)) { $modifiedColumns[':p' . $index++] = '`TITLE`'; } - if ($this->isColumnModified(ImportExportTypeI18nTableMap::DESCRIPTION)) { + if ($this->isColumnModified(ImportI18nTableMap::DESCRIPTION)) { $modifiedColumns[':p' . $index++] = '`DESCRIPTION`'; } $sql = sprintf( - 'INSERT INTO `import_export_type_i18n` (%s) VALUES (%s)', + 'INSERT INTO `import_i18n` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); @@ -849,7 +849,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface */ public function getByName($name, $type = TableMap::TYPE_PHPNAME) { - $pos = ImportExportTypeI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ImportI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); $field = $this->getByPosition($pos); return $field; @@ -900,11 +900,11 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface */ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { - if (isset($alreadyDumpedObjects['ImportExportTypeI18n'][serialize($this->getPrimaryKey())])) { + if (isset($alreadyDumpedObjects['ImportI18n'][serialize($this->getPrimaryKey())])) { return '*RECURSION*'; } - $alreadyDumpedObjects['ImportExportTypeI18n'][serialize($this->getPrimaryKey())] = true; - $keys = ImportExportTypeI18nTableMap::getFieldNames($keyType); + $alreadyDumpedObjects['ImportI18n'][serialize($this->getPrimaryKey())] = true; + $keys = ImportI18nTableMap::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getLocale(), @@ -917,8 +917,8 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface } if ($includeForeignObjects) { - if (null !== $this->aImportExportType) { - $result['ImportExportType'] = $this->aImportExportType->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + if (null !== $this->aImport) { + $result['Import'] = $this->aImport->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } } @@ -938,7 +938,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface */ public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) { - $pos = ImportExportTypeI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $pos = ImportI18nTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); return $this->setByPosition($pos, $value); } @@ -988,7 +988,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface */ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) { - $keys = ImportExportTypeI18nTableMap::getFieldNames($keyType); + $keys = ImportI18nTableMap::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]]); @@ -1003,12 +1003,12 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface */ public function buildCriteria() { - $criteria = new Criteria(ImportExportTypeI18nTableMap::DATABASE_NAME); + $criteria = new Criteria(ImportI18nTableMap::DATABASE_NAME); - if ($this->isColumnModified(ImportExportTypeI18nTableMap::ID)) $criteria->add(ImportExportTypeI18nTableMap::ID, $this->id); - if ($this->isColumnModified(ImportExportTypeI18nTableMap::LOCALE)) $criteria->add(ImportExportTypeI18nTableMap::LOCALE, $this->locale); - if ($this->isColumnModified(ImportExportTypeI18nTableMap::TITLE)) $criteria->add(ImportExportTypeI18nTableMap::TITLE, $this->title); - if ($this->isColumnModified(ImportExportTypeI18nTableMap::DESCRIPTION)) $criteria->add(ImportExportTypeI18nTableMap::DESCRIPTION, $this->description); + if ($this->isColumnModified(ImportI18nTableMap::ID)) $criteria->add(ImportI18nTableMap::ID, $this->id); + if ($this->isColumnModified(ImportI18nTableMap::LOCALE)) $criteria->add(ImportI18nTableMap::LOCALE, $this->locale); + if ($this->isColumnModified(ImportI18nTableMap::TITLE)) $criteria->add(ImportI18nTableMap::TITLE, $this->title); + if ($this->isColumnModified(ImportI18nTableMap::DESCRIPTION)) $criteria->add(ImportI18nTableMap::DESCRIPTION, $this->description); return $criteria; } @@ -1023,9 +1023,9 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface */ public function buildPkeyCriteria() { - $criteria = new Criteria(ImportExportTypeI18nTableMap::DATABASE_NAME); - $criteria->add(ImportExportTypeI18nTableMap::ID, $this->id); - $criteria->add(ImportExportTypeI18nTableMap::LOCALE, $this->locale); + $criteria = new Criteria(ImportI18nTableMap::DATABASE_NAME); + $criteria->add(ImportI18nTableMap::ID, $this->id); + $criteria->add(ImportI18nTableMap::LOCALE, $this->locale); return $criteria; } @@ -1072,7 +1072,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface * If desired, this method can also make copies of all associated (fkey referrers) * objects. * - * @param object $copyObj An object of \Thelia\Model\ImportExportTypeI18n (or compatible) type. + * @param object $copyObj An object of \Thelia\Model\ImportI18n (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 @@ -1097,7 +1097,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface * objects. * * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. - * @return \Thelia\Model\ImportExportTypeI18n Clone of current object. + * @return \Thelia\Model\ImportI18n Clone of current object. * @throws PropelException */ public function copy($deepCopy = false) @@ -1111,13 +1111,13 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface } /** - * Declares an association between this object and a ChildImportExportType object. + * Declares an association between this object and a ChildImport object. * - * @param ChildImportExportType $v - * @return \Thelia\Model\ImportExportTypeI18n The current object (for fluent API support) + * @param ChildImport $v + * @return \Thelia\Model\ImportI18n The current object (for fluent API support) * @throws PropelException */ - public function setImportExportType(ChildImportExportType $v = null) + public function setImport(ChildImport $v = null) { if ($v === null) { $this->setId(NULL); @@ -1125,12 +1125,12 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface $this->setId($v->getId()); } - $this->aImportExportType = $v; + $this->aImport = $v; // Add binding for other direction of this n:n relationship. - // If this object has already been added to the ChildImportExportType object, it will not be re-added. + // If this object has already been added to the ChildImport object, it will not be re-added. if ($v !== null) { - $v->addImportExportTypeI18n($this); + $v->addImportI18n($this); } @@ -1139,26 +1139,26 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface /** - * Get the associated ChildImportExportType object + * Get the associated ChildImport object * * @param ConnectionInterface $con Optional Connection object. - * @return ChildImportExportType The associated ChildImportExportType object. + * @return ChildImport The associated ChildImport object. * @throws PropelException */ - public function getImportExportType(ConnectionInterface $con = null) + public function getImport(ConnectionInterface $con = null) { - if ($this->aImportExportType === null && ($this->id !== null)) { - $this->aImportExportType = ChildImportExportTypeQuery::create()->findPk($this->id, $con); + if ($this->aImport === null && ($this->id !== null)) { + $this->aImport = ChildImportQuery::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->aImportExportType->addImportExportTypeI18ns($this); + $this->aImport->addImportI18ns($this); */ } - return $this->aImportExportType; + return $this->aImport; } /** @@ -1192,7 +1192,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface if ($deep) { } // if ($deep) - $this->aImportExportType = null; + $this->aImport = null; } /** @@ -1202,7 +1202,7 @@ abstract class ImportExportTypeI18n implements ActiveRecordInterface */ public function __toString() { - return (string) $this->exportTo(ImportExportTypeI18nTableMap::DEFAULT_STRING_FORMAT); + return (string) $this->exportTo(ImportI18nTableMap::DEFAULT_STRING_FORMAT); } /** diff --git a/core/lib/Thelia/Model/Base/ImportExportTypeI18nQuery.php b/core/lib/Thelia/Model/Base/ImportI18nQuery.php similarity index 61% rename from core/lib/Thelia/Model/Base/ImportExportTypeI18nQuery.php rename to core/lib/Thelia/Model/Base/ImportI18nQuery.php index 2d5176307..630823b9e 100644 --- a/core/lib/Thelia/Model/Base/ImportExportTypeI18nQuery.php +++ b/core/lib/Thelia/Model/Base/ImportI18nQuery.php @@ -12,76 +12,76 @@ use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; -use Thelia\Model\ImportExportTypeI18n as ChildImportExportTypeI18n; -use Thelia\Model\ImportExportTypeI18nQuery as ChildImportExportTypeI18nQuery; -use Thelia\Model\Map\ImportExportTypeI18nTableMap; +use Thelia\Model\ImportI18n as ChildImportI18n; +use Thelia\Model\ImportI18nQuery as ChildImportI18nQuery; +use Thelia\Model\Map\ImportI18nTableMap; /** - * Base class that represents a query for the 'import_export_type_i18n' table. + * Base class that represents a query for the 'import_i18n' table. * * * - * @method ChildImportExportTypeI18nQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildImportExportTypeI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column - * @method ChildImportExportTypeI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column - * @method ChildImportExportTypeI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column + * @method ChildImportI18nQuery orderById($order = Criteria::ASC) Order by the id column + * @method ChildImportI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column + * @method ChildImportI18nQuery orderByTitle($order = Criteria::ASC) Order by the title column + * @method ChildImportI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column * - * @method ChildImportExportTypeI18nQuery groupById() Group by the id column - * @method ChildImportExportTypeI18nQuery groupByLocale() Group by the locale column - * @method ChildImportExportTypeI18nQuery groupByTitle() Group by the title column - * @method ChildImportExportTypeI18nQuery groupByDescription() Group by the description column + * @method ChildImportI18nQuery groupById() Group by the id column + * @method ChildImportI18nQuery groupByLocale() Group by the locale column + * @method ChildImportI18nQuery groupByTitle() Group by the title column + * @method ChildImportI18nQuery groupByDescription() Group by the description column * - * @method ChildImportExportTypeI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query - * @method ChildImportExportTypeI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query - * @method ChildImportExportTypeI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query + * @method ChildImportI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query + * @method ChildImportI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query + * @method ChildImportI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildImportExportTypeI18nQuery leftJoinImportExportType($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportType relation - * @method ChildImportExportTypeI18nQuery rightJoinImportExportType($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportType relation - * @method ChildImportExportTypeI18nQuery innerJoinImportExportType($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportType relation + * @method ChildImportI18nQuery leftJoinImport($relationAlias = null) Adds a LEFT JOIN clause to the query using the Import relation + * @method ChildImportI18nQuery rightJoinImport($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Import relation + * @method ChildImportI18nQuery innerJoinImport($relationAlias = null) Adds a INNER JOIN clause to the query using the Import relation * - * @method ChildImportExportTypeI18n findOne(ConnectionInterface $con = null) Return the first ChildImportExportTypeI18n matching the query - * @method ChildImportExportTypeI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportExportTypeI18n matching the query, or a new ChildImportExportTypeI18n object populated from the query conditions when no match is found + * @method ChildImportI18n findOne(ConnectionInterface $con = null) Return the first ChildImportI18n matching the query + * @method ChildImportI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportI18n matching the query, or a new ChildImportI18n object populated from the query conditions when no match is found * - * @method ChildImportExportTypeI18n findOneById(int $id) Return the first ChildImportExportTypeI18n filtered by the id column - * @method ChildImportExportTypeI18n findOneByLocale(string $locale) Return the first ChildImportExportTypeI18n filtered by the locale column - * @method ChildImportExportTypeI18n findOneByTitle(string $title) Return the first ChildImportExportTypeI18n filtered by the title column - * @method ChildImportExportTypeI18n findOneByDescription(string $description) Return the first ChildImportExportTypeI18n filtered by the description column + * @method ChildImportI18n findOneById(int $id) Return the first ChildImportI18n filtered by the id column + * @method ChildImportI18n findOneByLocale(string $locale) Return the first ChildImportI18n filtered by the locale column + * @method ChildImportI18n findOneByTitle(string $title) Return the first ChildImportI18n filtered by the title column + * @method ChildImportI18n findOneByDescription(string $description) Return the first ChildImportI18n filtered by the description column * - * @method array findById(int $id) Return ChildImportExportTypeI18n objects filtered by the id column - * @method array findByLocale(string $locale) Return ChildImportExportTypeI18n objects filtered by the locale column - * @method array findByTitle(string $title) Return ChildImportExportTypeI18n objects filtered by the title column - * @method array findByDescription(string $description) Return ChildImportExportTypeI18n objects filtered by the description column + * @method array findById(int $id) Return ChildImportI18n objects filtered by the id column + * @method array findByLocale(string $locale) Return ChildImportI18n objects filtered by the locale column + * @method array findByTitle(string $title) Return ChildImportI18n objects filtered by the title column + * @method array findByDescription(string $description) Return ChildImportI18n objects filtered by the description column * */ -abstract class ImportExportTypeI18nQuery extends ModelCriteria +abstract class ImportI18nQuery extends ModelCriteria { /** - * Initializes internal state of \Thelia\Model\Base\ImportExportTypeI18nQuery object. + * Initializes internal state of \Thelia\Model\Base\ImportI18nQuery object. * * @param string $dbName The database name * @param string $modelName The phpName of a model, e.g. 'Book' * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ - public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportExportTypeI18n', $modelAlias = null) + public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportI18n', $modelAlias = null) { parent::__construct($dbName, $modelName, $modelAlias); } /** - * Returns a new ChildImportExportTypeI18nQuery object. + * Returns a new ChildImportI18nQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * - * @return ChildImportExportTypeI18nQuery + * @return ChildImportI18nQuery */ public static function create($modelAlias = null, $criteria = null) { - if ($criteria instanceof \Thelia\Model\ImportExportTypeI18nQuery) { + if ($criteria instanceof \Thelia\Model\ImportI18nQuery) { return $criteria; } - $query = new \Thelia\Model\ImportExportTypeI18nQuery(); + $query = new \Thelia\Model\ImportI18nQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } @@ -104,19 +104,19 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * @param array[$id, $locale] $key Primary key to use for the query * @param ConnectionInterface $con an optional connection object * - * @return ChildImportExportTypeI18n|array|mixed the result, formatted by the current formatter + * @return ChildImportI18n|array|mixed the result, formatted by the current formatter */ public function findPk($key, $con = null) { if ($key === null) { return null; } - if ((null !== ($obj = ImportExportTypeI18nTableMap::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) { + if ((null !== ($obj = ImportI18nTableMap::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(ImportExportTypeI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ImportI18nTableMap::DATABASE_NAME); } $this->basePreSelect($con); if ($this->formatter || $this->modelAlias || $this->with || $this->select @@ -135,11 +135,11 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildImportExportTypeI18n A model object, or null if the key is not found + * @return ChildImportI18n A model object, or null if the key is not found */ protected function findPkSimple($key, $con) { - $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION` FROM `import_export_type_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; + $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION` FROM `import_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); @@ -151,9 +151,9 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria } $obj = null; if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new ChildImportExportTypeI18n(); + $obj = new ChildImportI18n(); $obj->hydrate($row); - ImportExportTypeI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); + ImportI18nTableMap::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1]))); } $stmt->closeCursor(); @@ -166,7 +166,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildImportExportTypeI18n|array|mixed the result, formatted by the current formatter + * @return ChildImportI18n|array|mixed the result, formatted by the current formatter */ protected function findPkComplex($key, $con) { @@ -208,12 +208,12 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * * @param mixed $key Primary key to use for the query * - * @return ChildImportExportTypeI18nQuery The current query, for fluid interface + * @return ChildImportI18nQuery The current query, for fluid interface */ public function filterByPrimaryKey($key) { - $this->addUsingAlias(ImportExportTypeI18nTableMap::ID, $key[0], Criteria::EQUAL); - $this->addUsingAlias(ImportExportTypeI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); + $this->addUsingAlias(ImportI18nTableMap::ID, $key[0], Criteria::EQUAL); + $this->addUsingAlias(ImportI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); return $this; } @@ -223,7 +223,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * * @param array $keys The list of primary key to use for the query * - * @return ChildImportExportTypeI18nQuery The current query, for fluid interface + * @return ChildImportI18nQuery The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { @@ -231,8 +231,8 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria return $this->add(null, '1<>1', Criteria::CUSTOM); } foreach ($keys as $key) { - $cton0 = $this->getNewCriterion(ImportExportTypeI18nTableMap::ID, $key[0], Criteria::EQUAL); - $cton1 = $this->getNewCriterion(ImportExportTypeI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); + $cton0 = $this->getNewCriterion(ImportI18nTableMap::ID, $key[0], Criteria::EQUAL); + $cton1 = $this->getNewCriterion(ImportI18nTableMap::LOCALE, $key[1], Criteria::EQUAL); $cton0->addAnd($cton1); $this->addOr($cton0); } @@ -250,7 +250,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * $query->filterById(array('min' => 12)); // WHERE id > 12 * * - * @see filterByImportExportType() + * @see filterByImport() * * @param mixed $id The value to use as filter. * Use scalar values for equality. @@ -258,18 +258,18 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeI18nQuery The current query, for fluid interface + * @return ChildImportI18nQuery 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(ImportExportTypeI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ImportI18nTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($id['max'])) { - $this->addUsingAlias(ImportExportTypeI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ImportI18nTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -280,7 +280,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportTypeI18nTableMap::ID, $id, $comparison); + return $this->addUsingAlias(ImportI18nTableMap::ID, $id, $comparison); } /** @@ -296,7 +296,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeI18nQuery The current query, for fluid interface + * @return ChildImportI18nQuery The current query, for fluid interface */ public function filterByLocale($locale = null, $comparison = null) { @@ -309,7 +309,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportTypeI18nTableMap::LOCALE, $locale, $comparison); + return $this->addUsingAlias(ImportI18nTableMap::LOCALE, $locale, $comparison); } /** @@ -325,7 +325,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeI18nQuery The current query, for fluid interface + * @return ChildImportI18nQuery The current query, for fluid interface */ public function filterByTitle($title = null, $comparison = null) { @@ -338,7 +338,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportTypeI18nTableMap::TITLE, $title, $comparison); + return $this->addUsingAlias(ImportI18nTableMap::TITLE, $title, $comparison); } /** @@ -354,7 +354,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * Accepts wildcards (* and % trigger a LIKE) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeI18nQuery The current query, for fluid interface + * @return ChildImportI18nQuery The current query, for fluid interface */ public function filterByDescription($description = null, $comparison = null) { @@ -367,46 +367,46 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportTypeI18nTableMap::DESCRIPTION, $description, $comparison); + return $this->addUsingAlias(ImportI18nTableMap::DESCRIPTION, $description, $comparison); } /** - * Filter the query by a related \Thelia\Model\ImportExportType object + * Filter the query by a related \Thelia\Model\Import object * - * @param \Thelia\Model\ImportExportType|ObjectCollection $importExportType The related object(s) to use as filter + * @param \Thelia\Model\Import|ObjectCollection $import The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeI18nQuery The current query, for fluid interface + * @return ChildImportI18nQuery The current query, for fluid interface */ - public function filterByImportExportType($importExportType, $comparison = null) + public function filterByImport($import, $comparison = null) { - if ($importExportType instanceof \Thelia\Model\ImportExportType) { + if ($import instanceof \Thelia\Model\Import) { return $this - ->addUsingAlias(ImportExportTypeI18nTableMap::ID, $importExportType->getId(), $comparison); - } elseif ($importExportType instanceof ObjectCollection) { + ->addUsingAlias(ImportI18nTableMap::ID, $import->getId(), $comparison); + } elseif ($import instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this - ->addUsingAlias(ImportExportTypeI18nTableMap::ID, $importExportType->toKeyValue('PrimaryKey', 'Id'), $comparison); + ->addUsingAlias(ImportI18nTableMap::ID, $import->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { - throw new PropelException('filterByImportExportType() only accepts arguments of type \Thelia\Model\ImportExportType or Collection'); + throw new PropelException('filterByImport() only accepts arguments of type \Thelia\Model\Import or Collection'); } } /** - * Adds a JOIN clause to the query using the ImportExportType relation + * Adds a JOIN clause to the query using the Import relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildImportExportTypeI18nQuery The current query, for fluid interface + * @return ChildImportI18nQuery The current query, for fluid interface */ - public function joinImportExportType($relationAlias = null, $joinType = 'LEFT JOIN') + public function joinImport($relationAlias = null, $joinType = 'LEFT JOIN') { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ImportExportType'); + $relationMap = $tableMap->getRelation('Import'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -421,14 +421,14 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'ImportExportType'); + $this->addJoinObject($join, 'Import'); } return $this; } /** - * Use the ImportExportType relation ImportExportType object + * Use the Import relation Import object * * @see useQuery() * @@ -436,27 +436,27 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return \Thelia\Model\ImportExportTypeQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\ImportQuery A secondary query class using the current class as primary query */ - public function useImportExportTypeQuery($relationAlias = null, $joinType = 'LEFT JOIN') + public function useImportQuery($relationAlias = null, $joinType = 'LEFT JOIN') { return $this - ->joinImportExportType($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ImportExportType', '\Thelia\Model\ImportExportTypeQuery'); + ->joinImport($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Import', '\Thelia\Model\ImportQuery'); } /** * Exclude object from result * - * @param ChildImportExportTypeI18n $importExportTypeI18n Object to remove from the list of results + * @param ChildImportI18n $importI18n Object to remove from the list of results * - * @return ChildImportExportTypeI18nQuery The current query, for fluid interface + * @return ChildImportI18nQuery The current query, for fluid interface */ - public function prune($importExportTypeI18n = null) + public function prune($importI18n = null) { - if ($importExportTypeI18n) { - $this->addCond('pruneCond0', $this->getAliasedColName(ImportExportTypeI18nTableMap::ID), $importExportTypeI18n->getId(), Criteria::NOT_EQUAL); - $this->addCond('pruneCond1', $this->getAliasedColName(ImportExportTypeI18nTableMap::LOCALE), $importExportTypeI18n->getLocale(), Criteria::NOT_EQUAL); + if ($importI18n) { + $this->addCond('pruneCond0', $this->getAliasedColName(ImportI18nTableMap::ID), $importI18n->getId(), Criteria::NOT_EQUAL); + $this->addCond('pruneCond1', $this->getAliasedColName(ImportI18nTableMap::LOCALE), $importI18n->getLocale(), Criteria::NOT_EQUAL); $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); } @@ -464,7 +464,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria } /** - * Deletes all rows from the import_export_type_i18n table. + * Deletes all rows from the import_i18n table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). @@ -472,7 +472,7 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria public function doDeleteAll(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportI18nTableMap::DATABASE_NAME); } $affectedRows = 0; // initialize var to track total num of affected rows try { @@ -483,8 +483,8 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria // Because this db requires some delete cascade/set null emulation, we have to // clear the cached instance *after* the emulation has happened (since // instances get re-added by the select statement contained therein). - ImportExportTypeI18nTableMap::clearInstancePool(); - ImportExportTypeI18nTableMap::clearRelatedInstancePool(); + ImportI18nTableMap::clearInstancePool(); + ImportI18nTableMap::clearRelatedInstancePool(); $con->commit(); } catch (PropelException $e) { @@ -496,9 +496,9 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria } /** - * Performs a DELETE on the database, given a ChildImportExportTypeI18n or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ChildImportI18n or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ChildImportExportTypeI18n object or primary key or array of primary keys + * @param mixed $values Criteria or ChildImportI18n 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 @@ -509,13 +509,13 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria public function delete(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportI18nTableMap::DATABASE_NAME); } $criteria = $this; // Set the correct dbName - $criteria->setDbName(ImportExportTypeI18nTableMap::DATABASE_NAME); + $criteria->setDbName(ImportI18nTableMap::DATABASE_NAME); $affectedRows = 0; // initialize var to track total num of affected rows @@ -525,10 +525,10 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria $con->beginTransaction(); - ImportExportTypeI18nTableMap::removeInstanceFromPool($criteria); + ImportI18nTableMap::removeInstanceFromPool($criteria); $affectedRows += ModelCriteria::delete($con); - ImportExportTypeI18nTableMap::clearRelatedInstancePool(); + ImportI18nTableMap::clearRelatedInstancePool(); $con->commit(); return $affectedRows; @@ -538,4 +538,4 @@ abstract class ImportExportTypeI18nQuery extends ModelCriteria } } -} // ImportExportTypeI18nQuery +} // ImportI18nQuery diff --git a/core/lib/Thelia/Model/Base/ImportExportTypeQuery.php b/core/lib/Thelia/Model/Base/ImportQuery.php similarity index 54% rename from core/lib/Thelia/Model/Base/ImportExportTypeQuery.php rename to core/lib/Thelia/Model/Base/ImportQuery.php index 953591923..7fa735844 100644 --- a/core/lib/Thelia/Model/Base/ImportExportTypeQuery.php +++ b/core/lib/Thelia/Model/Base/ImportQuery.php @@ -12,89 +12,85 @@ use Propel\Runtime\Collection\Collection; use Propel\Runtime\Collection\ObjectCollection; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Exception\PropelException; -use Thelia\Model\ImportExportType as ChildImportExportType; -use Thelia\Model\ImportExportTypeI18nQuery as ChildImportExportTypeI18nQuery; -use Thelia\Model\ImportExportTypeQuery as ChildImportExportTypeQuery; -use Thelia\Model\Map\ImportExportTypeTableMap; +use Thelia\Model\Import as ChildImport; +use Thelia\Model\ImportI18nQuery as ChildImportI18nQuery; +use Thelia\Model\ImportQuery as ChildImportQuery; +use Thelia\Model\Map\ImportTableMap; /** - * Base class that represents a query for the 'import_export_type' table. + * Base class that represents a query for the 'import' table. * * * - * @method ChildImportExportTypeQuery orderById($order = Criteria::ASC) Order by the id column - * @method ChildImportExportTypeQuery orderByUrlAction($order = Criteria::ASC) Order by the url_action column - * @method ChildImportExportTypeQuery orderByImportExportCategoryId($order = Criteria::ASC) Order by the import_export_category_id column - * @method ChildImportExportTypeQuery orderByPosition($order = Criteria::ASC) Order by the position column - * @method ChildImportExportTypeQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column - * @method ChildImportExportTypeQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column + * @method ChildImportQuery orderById($order = Criteria::ASC) Order by the id column + * @method ChildImportQuery orderByImportCategoryId($order = Criteria::ASC) Order by the import_category_id column + * @method ChildImportQuery orderByPosition($order = Criteria::ASC) Order by the position column + * @method ChildImportQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column + * @method ChildImportQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * - * @method ChildImportExportTypeQuery groupById() Group by the id column - * @method ChildImportExportTypeQuery groupByUrlAction() Group by the url_action column - * @method ChildImportExportTypeQuery groupByImportExportCategoryId() Group by the import_export_category_id column - * @method ChildImportExportTypeQuery groupByPosition() Group by the position column - * @method ChildImportExportTypeQuery groupByCreatedAt() Group by the created_at column - * @method ChildImportExportTypeQuery groupByUpdatedAt() Group by the updated_at column + * @method ChildImportQuery groupById() Group by the id column + * @method ChildImportQuery groupByImportCategoryId() Group by the import_category_id column + * @method ChildImportQuery groupByPosition() Group by the position column + * @method ChildImportQuery groupByCreatedAt() Group by the created_at column + * @method ChildImportQuery groupByUpdatedAt() Group by the updated_at column * - * @method ChildImportExportTypeQuery leftJoin($relation) Adds a LEFT JOIN clause to the query - * @method ChildImportExportTypeQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query - * @method ChildImportExportTypeQuery innerJoin($relation) Adds a INNER JOIN clause to the query + * @method ChildImportQuery leftJoin($relation) Adds a LEFT JOIN clause to the query + * @method ChildImportQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query + * @method ChildImportQuery innerJoin($relation) Adds a INNER JOIN clause to the query * - * @method ChildImportExportTypeQuery leftJoinImportExportCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportCategory relation - * @method ChildImportExportTypeQuery rightJoinImportExportCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportCategory relation - * @method ChildImportExportTypeQuery innerJoinImportExportCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportCategory relation + * @method ChildImportQuery leftJoinImportCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportCategory relation + * @method ChildImportQuery rightJoinImportCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportCategory relation + * @method ChildImportQuery innerJoinImportCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportCategory relation * - * @method ChildImportExportTypeQuery leftJoinImportExportTypeI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportExportTypeI18n relation - * @method ChildImportExportTypeQuery rightJoinImportExportTypeI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportExportTypeI18n relation - * @method ChildImportExportTypeQuery innerJoinImportExportTypeI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportExportTypeI18n relation + * @method ChildImportQuery leftJoinImportI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImportI18n relation + * @method ChildImportQuery rightJoinImportI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImportI18n relation + * @method ChildImportQuery innerJoinImportI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ImportI18n relation * - * @method ChildImportExportType findOne(ConnectionInterface $con = null) Return the first ChildImportExportType matching the query - * @method ChildImportExportType findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImportExportType matching the query, or a new ChildImportExportType object populated from the query conditions when no match is found + * @method ChildImport findOne(ConnectionInterface $con = null) Return the first ChildImport matching the query + * @method ChildImport findOneOrCreate(ConnectionInterface $con = null) Return the first ChildImport matching the query, or a new ChildImport object populated from the query conditions when no match is found * - * @method ChildImportExportType findOneById(int $id) Return the first ChildImportExportType filtered by the id column - * @method ChildImportExportType findOneByUrlAction(string $url_action) Return the first ChildImportExportType filtered by the url_action column - * @method ChildImportExportType findOneByImportExportCategoryId(int $import_export_category_id) Return the first ChildImportExportType filtered by the import_export_category_id column - * @method ChildImportExportType findOneByPosition(int $position) Return the first ChildImportExportType filtered by the position column - * @method ChildImportExportType findOneByCreatedAt(string $created_at) Return the first ChildImportExportType filtered by the created_at column - * @method ChildImportExportType findOneByUpdatedAt(string $updated_at) Return the first ChildImportExportType filtered by the updated_at column + * @method ChildImport findOneById(int $id) Return the first ChildImport filtered by the id column + * @method ChildImport findOneByImportCategoryId(int $import_category_id) Return the first ChildImport filtered by the import_category_id column + * @method ChildImport findOneByPosition(int $position) Return the first ChildImport filtered by the position column + * @method ChildImport findOneByCreatedAt(string $created_at) Return the first ChildImport filtered by the created_at column + * @method ChildImport findOneByUpdatedAt(string $updated_at) Return the first ChildImport filtered by the updated_at column * - * @method array findById(int $id) Return ChildImportExportType objects filtered by the id column - * @method array findByUrlAction(string $url_action) Return ChildImportExportType objects filtered by the url_action column - * @method array findByImportExportCategoryId(int $import_export_category_id) Return ChildImportExportType objects filtered by the import_export_category_id column - * @method array findByPosition(int $position) Return ChildImportExportType objects filtered by the position column - * @method array findByCreatedAt(string $created_at) Return ChildImportExportType objects filtered by the created_at column - * @method array findByUpdatedAt(string $updated_at) Return ChildImportExportType objects filtered by the updated_at column + * @method array findById(int $id) Return ChildImport objects filtered by the id column + * @method array findByImportCategoryId(int $import_category_id) Return ChildImport objects filtered by the import_category_id column + * @method array findByPosition(int $position) Return ChildImport objects filtered by the position column + * @method array findByCreatedAt(string $created_at) Return ChildImport objects filtered by the created_at column + * @method array findByUpdatedAt(string $updated_at) Return ChildImport objects filtered by the updated_at column * */ -abstract class ImportExportTypeQuery extends ModelCriteria +abstract class ImportQuery extends ModelCriteria { /** - * Initializes internal state of \Thelia\Model\Base\ImportExportTypeQuery object. + * Initializes internal state of \Thelia\Model\Base\ImportQuery object. * * @param string $dbName The database name * @param string $modelName The phpName of a model, e.g. 'Book' * @param string $modelAlias The alias for the model in this query, e.g. 'b' */ - public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\ImportExportType', $modelAlias = null) + public function __construct($dbName = 'thelia', $modelName = '\\Thelia\\Model\\Import', $modelAlias = null) { parent::__construct($dbName, $modelName, $modelAlias); } /** - * Returns a new ChildImportExportTypeQuery object. + * Returns a new ChildImportQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * - * @return ChildImportExportTypeQuery + * @return ChildImportQuery */ public static function create($modelAlias = null, $criteria = null) { - if ($criteria instanceof \Thelia\Model\ImportExportTypeQuery) { + if ($criteria instanceof \Thelia\Model\ImportQuery) { return $criteria; } - $query = new \Thelia\Model\ImportExportTypeQuery(); + $query = new \Thelia\Model\ImportQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } @@ -117,19 +113,19 @@ abstract class ImportExportTypeQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con an optional connection object * - * @return ChildImportExportType|array|mixed the result, formatted by the current formatter + * @return ChildImport|array|mixed the result, formatted by the current formatter */ public function findPk($key, $con = null) { if ($key === null) { return null; } - if ((null !== ($obj = ImportExportTypeTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + if ((null !== ($obj = ImportTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { // the object is already in the instance pool return $obj; } if ($con === null) { - $con = Propel::getServiceContainer()->getReadConnection(ImportExportTypeTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getReadConnection(ImportTableMap::DATABASE_NAME); } $this->basePreSelect($con); if ($this->formatter || $this->modelAlias || $this->with || $this->select @@ -148,11 +144,11 @@ abstract class ImportExportTypeQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildImportExportType A model object, or null if the key is not found + * @return ChildImport A model object, or null if the key is not found */ protected function findPkSimple($key, $con) { - $sql = 'SELECT `ID`, `URL_ACTION`, `IMPORT_EXPORT_CATEGORY_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `import_export_type` WHERE `ID` = :p0'; + $sql = 'SELECT `ID`, `IMPORT_CATEGORY_ID`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `import` WHERE `ID` = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -163,9 +159,9 @@ abstract class ImportExportTypeQuery extends ModelCriteria } $obj = null; if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { - $obj = new ChildImportExportType(); + $obj = new ChildImport(); $obj->hydrate($row); - ImportExportTypeTableMap::addInstanceToPool($obj, (string) $key); + ImportTableMap::addInstanceToPool($obj, (string) $key); } $stmt->closeCursor(); @@ -178,7 +174,7 @@ abstract class ImportExportTypeQuery extends ModelCriteria * @param mixed $key Primary key to use for the query * @param ConnectionInterface $con A connection object * - * @return ChildImportExportType|array|mixed the result, formatted by the current formatter + * @return ChildImport|array|mixed the result, formatted by the current formatter */ protected function findPkComplex($key, $con) { @@ -220,12 +216,12 @@ abstract class ImportExportTypeQuery extends ModelCriteria * * @param mixed $key Primary key to use for the query * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ public function filterByPrimaryKey($key) { - return $this->addUsingAlias(ImportExportTypeTableMap::ID, $key, Criteria::EQUAL); + return $this->addUsingAlias(ImportTableMap::ID, $key, Criteria::EQUAL); } /** @@ -233,12 +229,12 @@ abstract class ImportExportTypeQuery extends ModelCriteria * * @param array $keys The list of primary key to use for the query * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ public function filterByPrimaryKeys($keys) { - return $this->addUsingAlias(ImportExportTypeTableMap::ID, $keys, Criteria::IN); + return $this->addUsingAlias(ImportTableMap::ID, $keys, Criteria::IN); } /** @@ -257,18 +253,18 @@ abstract class ImportExportTypeQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery 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(ImportExportTypeTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ImportTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($id['max'])) { - $this->addUsingAlias(ImportExportTypeTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ImportTableMap::ID, $id['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -279,68 +275,39 @@ abstract class ImportExportTypeQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportTypeTableMap::ID, $id, $comparison); + return $this->addUsingAlias(ImportTableMap::ID, $id, $comparison); } /** - * Filter the query on the url_action column + * Filter the query on the import_category_id column * * Example usage: * - * $query->filterByUrlAction('fooValue'); // WHERE url_action = 'fooValue' - * $query->filterByUrlAction('%fooValue%'); // WHERE url_action LIKE '%fooValue%' + * $query->filterByImportCategoryId(1234); // WHERE import_category_id = 1234 + * $query->filterByImportCategoryId(array(12, 34)); // WHERE import_category_id IN (12, 34) + * $query->filterByImportCategoryId(array('min' => 12)); // WHERE import_category_id > 12 * * - * @param string $urlAction 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 + * @see filterByImportCategory() * - * @return ChildImportExportTypeQuery The current query, for fluid interface - */ - public function filterByUrlAction($urlAction = null, $comparison = null) - { - if (null === $comparison) { - if (is_array($urlAction)) { - $comparison = Criteria::IN; - } elseif (preg_match('/[\%\*]/', $urlAction)) { - $urlAction = str_replace('*', '%', $urlAction); - $comparison = Criteria::LIKE; - } - } - - return $this->addUsingAlias(ImportExportTypeTableMap::URL_ACTION, $urlAction, $comparison); - } - - /** - * Filter the query on the import_export_category_id column - * - * Example usage: - * - * $query->filterByImportExportCategoryId(1234); // WHERE import_export_category_id = 1234 - * $query->filterByImportExportCategoryId(array(12, 34)); // WHERE import_export_category_id IN (12, 34) - * $query->filterByImportExportCategoryId(array('min' => 12)); // WHERE import_export_category_id > 12 - * - * - * @see filterByImportExportCategory() - * - * @param mixed $importExportCategoryId The value to use as filter. + * @param mixed $importCategoryId 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 ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ - public function filterByImportExportCategoryId($importExportCategoryId = null, $comparison = null) + public function filterByImportCategoryId($importCategoryId = null, $comparison = null) { - if (is_array($importExportCategoryId)) { + if (is_array($importCategoryId)) { $useMinMax = false; - if (isset($importExportCategoryId['min'])) { - $this->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategoryId['min'], Criteria::GREATER_EQUAL); + if (isset($importCategoryId['min'])) { + $this->addUsingAlias(ImportTableMap::IMPORT_CATEGORY_ID, $importCategoryId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($importExportCategoryId['max'])) { - $this->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategoryId['max'], Criteria::LESS_EQUAL); + if (isset($importCategoryId['max'])) { + $this->addUsingAlias(ImportTableMap::IMPORT_CATEGORY_ID, $importCategoryId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -351,7 +318,7 @@ abstract class ImportExportTypeQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategoryId, $comparison); + return $this->addUsingAlias(ImportTableMap::IMPORT_CATEGORY_ID, $importCategoryId, $comparison); } /** @@ -370,18 +337,18 @@ abstract class ImportExportTypeQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery 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(ImportExportTypeTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ImportTableMap::POSITION, $position['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($position['max'])) { - $this->addUsingAlias(ImportExportTypeTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ImportTableMap::POSITION, $position['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -392,7 +359,7 @@ abstract class ImportExportTypeQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportTypeTableMap::POSITION, $position, $comparison); + return $this->addUsingAlias(ImportTableMap::POSITION, $position, $comparison); } /** @@ -413,18 +380,18 @@ abstract class ImportExportTypeQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery 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(ImportExportTypeTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ImportTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($createdAt['max'])) { - $this->addUsingAlias(ImportExportTypeTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ImportTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -435,7 +402,7 @@ abstract class ImportExportTypeQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportTypeTableMap::CREATED_AT, $createdAt, $comparison); + return $this->addUsingAlias(ImportTableMap::CREATED_AT, $createdAt, $comparison); } /** @@ -456,18 +423,18 @@ abstract class ImportExportTypeQuery extends ModelCriteria * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery 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(ImportExportTypeTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); + $this->addUsingAlias(ImportTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($updatedAt['max'])) { - $this->addUsingAlias(ImportExportTypeTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); + $this->addUsingAlias(ImportTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -478,46 +445,46 @@ abstract class ImportExportTypeQuery extends ModelCriteria } } - return $this->addUsingAlias(ImportExportTypeTableMap::UPDATED_AT, $updatedAt, $comparison); + return $this->addUsingAlias(ImportTableMap::UPDATED_AT, $updatedAt, $comparison); } /** - * Filter the query by a related \Thelia\Model\ImportExportCategory object + * Filter the query by a related \Thelia\Model\ImportCategory object * - * @param \Thelia\Model\ImportExportCategory|ObjectCollection $importExportCategory The related object(s) to use as filter + * @param \Thelia\Model\ImportCategory|ObjectCollection $importCategory The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ - public function filterByImportExportCategory($importExportCategory, $comparison = null) + public function filterByImportCategory($importCategory, $comparison = null) { - if ($importExportCategory instanceof \Thelia\Model\ImportExportCategory) { + if ($importCategory instanceof \Thelia\Model\ImportCategory) { return $this - ->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategory->getId(), $comparison); - } elseif ($importExportCategory instanceof ObjectCollection) { + ->addUsingAlias(ImportTableMap::IMPORT_CATEGORY_ID, $importCategory->getId(), $comparison); + } elseif ($importCategory instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this - ->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategory->toKeyValue('PrimaryKey', 'Id'), $comparison); + ->addUsingAlias(ImportTableMap::IMPORT_CATEGORY_ID, $importCategory->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { - throw new PropelException('filterByImportExportCategory() only accepts arguments of type \Thelia\Model\ImportExportCategory or Collection'); + throw new PropelException('filterByImportCategory() only accepts arguments of type \Thelia\Model\ImportCategory or Collection'); } } /** - * Adds a JOIN clause to the query using the ImportExportCategory relation + * Adds a JOIN clause to the query using the ImportCategory relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ - public function joinImportExportCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function joinImportCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN) { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ImportExportCategory'); + $relationMap = $tableMap->getRelation('ImportCategory'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -532,14 +499,14 @@ abstract class ImportExportTypeQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'ImportExportCategory'); + $this->addJoinObject($join, 'ImportCategory'); } return $this; } /** - * Use the ImportExportCategory relation ImportExportCategory object + * Use the ImportCategory relation ImportCategory object * * @see useQuery() * @@ -547,50 +514,50 @@ abstract class ImportExportTypeQuery extends ModelCriteria * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return \Thelia\Model\ImportExportCategoryQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\ImportCategoryQuery A secondary query class using the current class as primary query */ - public function useImportExportCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + public function useImportCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) { return $this - ->joinImportExportCategory($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ImportExportCategory', '\Thelia\Model\ImportExportCategoryQuery'); + ->joinImportCategory($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ImportCategory', '\Thelia\Model\ImportCategoryQuery'); } /** - * Filter the query by a related \Thelia\Model\ImportExportTypeI18n object + * Filter the query by a related \Thelia\Model\ImportI18n object * - * @param \Thelia\Model\ImportExportTypeI18n|ObjectCollection $importExportTypeI18n the related object to use as filter + * @param \Thelia\Model\ImportI18n|ObjectCollection $importI18n the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ - public function filterByImportExportTypeI18n($importExportTypeI18n, $comparison = null) + public function filterByImportI18n($importI18n, $comparison = null) { - if ($importExportTypeI18n instanceof \Thelia\Model\ImportExportTypeI18n) { + if ($importI18n instanceof \Thelia\Model\ImportI18n) { return $this - ->addUsingAlias(ImportExportTypeTableMap::ID, $importExportTypeI18n->getId(), $comparison); - } elseif ($importExportTypeI18n instanceof ObjectCollection) { + ->addUsingAlias(ImportTableMap::ID, $importI18n->getId(), $comparison); + } elseif ($importI18n instanceof ObjectCollection) { return $this - ->useImportExportTypeI18nQuery() - ->filterByPrimaryKeys($importExportTypeI18n->getPrimaryKeys()) + ->useImportI18nQuery() + ->filterByPrimaryKeys($importI18n->getPrimaryKeys()) ->endUse(); } else { - throw new PropelException('filterByImportExportTypeI18n() only accepts arguments of type \Thelia\Model\ImportExportTypeI18n or Collection'); + throw new PropelException('filterByImportI18n() only accepts arguments of type \Thelia\Model\ImportI18n or Collection'); } } /** - * Adds a JOIN clause to the query using the ImportExportTypeI18n relation + * Adds a JOIN clause to the query using the ImportI18n relation * * @param string $relationAlias optional alias for the relation * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ - public function joinImportExportTypeI18n($relationAlias = null, $joinType = 'LEFT JOIN') + public function joinImportI18n($relationAlias = null, $joinType = 'LEFT JOIN') { $tableMap = $this->getTableMap(); - $relationMap = $tableMap->getRelation('ImportExportTypeI18n'); + $relationMap = $tableMap->getRelation('ImportI18n'); // create a ModelJoin object for this join $join = new ModelJoin(); @@ -605,14 +572,14 @@ abstract class ImportExportTypeQuery extends ModelCriteria $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); $this->addJoinObject($join, $relationAlias); } else { - $this->addJoinObject($join, 'ImportExportTypeI18n'); + $this->addJoinObject($join, 'ImportI18n'); } return $this; } /** - * Use the ImportExportTypeI18n relation ImportExportTypeI18n object + * Use the ImportI18n relation ImportI18n object * * @see useQuery() * @@ -620,33 +587,33 @@ abstract class ImportExportTypeQuery extends ModelCriteria * to be used as main alias in the secondary query * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' * - * @return \Thelia\Model\ImportExportTypeI18nQuery A secondary query class using the current class as primary query + * @return \Thelia\Model\ImportI18nQuery A secondary query class using the current class as primary query */ - public function useImportExportTypeI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') + public function useImportI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') { return $this - ->joinImportExportTypeI18n($relationAlias, $joinType) - ->useQuery($relationAlias ? $relationAlias : 'ImportExportTypeI18n', '\Thelia\Model\ImportExportTypeI18nQuery'); + ->joinImportI18n($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'ImportI18n', '\Thelia\Model\ImportI18nQuery'); } /** * Exclude object from result * - * @param ChildImportExportType $importExportType Object to remove from the list of results + * @param ChildImport $import Object to remove from the list of results * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ - public function prune($importExportType = null) + public function prune($import = null) { - if ($importExportType) { - $this->addUsingAlias(ImportExportTypeTableMap::ID, $importExportType->getId(), Criteria::NOT_EQUAL); + if ($import) { + $this->addUsingAlias(ImportTableMap::ID, $import->getId(), Criteria::NOT_EQUAL); } return $this; } /** - * Deletes all rows from the import_export_type table. + * Deletes all rows from the import table. * * @param ConnectionInterface $con the connection to use * @return int The number of affected rows (if supported by underlying database driver). @@ -654,7 +621,7 @@ abstract class ImportExportTypeQuery extends ModelCriteria public function doDeleteAll(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportTableMap::DATABASE_NAME); } $affectedRows = 0; // initialize var to track total num of affected rows try { @@ -665,8 +632,8 @@ abstract class ImportExportTypeQuery extends ModelCriteria // Because this db requires some delete cascade/set null emulation, we have to // clear the cached instance *after* the emulation has happened (since // instances get re-added by the select statement contained therein). - ImportExportTypeTableMap::clearInstancePool(); - ImportExportTypeTableMap::clearRelatedInstancePool(); + ImportTableMap::clearInstancePool(); + ImportTableMap::clearRelatedInstancePool(); $con->commit(); } catch (PropelException $e) { @@ -678,9 +645,9 @@ abstract class ImportExportTypeQuery extends ModelCriteria } /** - * Performs a DELETE on the database, given a ChildImportExportType or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ChildImport or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ChildImportExportType object or primary key or array of primary keys + * @param mixed $values Criteria or ChildImport 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 @@ -691,13 +658,13 @@ abstract class ImportExportTypeQuery extends ModelCriteria public function delete(ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportTableMap::DATABASE_NAME); } $criteria = $this; // Set the correct dbName - $criteria->setDbName(ImportExportTypeTableMap::DATABASE_NAME); + $criteria->setDbName(ImportTableMap::DATABASE_NAME); $affectedRows = 0; // initialize var to track total num of affected rows @@ -707,10 +674,10 @@ abstract class ImportExportTypeQuery extends ModelCriteria $con->beginTransaction(); - ImportExportTypeTableMap::removeInstanceFromPool($criteria); + ImportTableMap::removeInstanceFromPool($criteria); $affectedRows += ModelCriteria::delete($con); - ImportExportTypeTableMap::clearRelatedInstancePool(); + ImportTableMap::clearRelatedInstancePool(); $con->commit(); return $affectedRows; @@ -729,14 +696,14 @@ abstract class ImportExportTypeQuery extends ModelCriteria * @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 ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ public function joinI18n($locale = 'en_US', $relationAlias = null, $joinType = Criteria::LEFT_JOIN) { - $relationName = $relationAlias ? $relationAlias : 'ImportExportTypeI18n'; + $relationName = $relationAlias ? $relationAlias : 'ImportI18n'; return $this - ->joinImportExportTypeI18n($relationAlias, $joinType) + ->joinImportI18n($relationAlias, $joinType) ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale); } @@ -747,14 +714,14 @@ abstract class ImportExportTypeQuery extends ModelCriteria * @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 ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ public function joinWithI18n($locale = 'en_US', $joinType = Criteria::LEFT_JOIN) { $this ->joinI18n($locale, null, $joinType) - ->with('ImportExportTypeI18n'); - $this->with['ImportExportTypeI18n']->setIsWithOneToMany(false); + ->with('ImportI18n'); + $this->with['ImportI18n']->setIsWithOneToMany(false); return $this; } @@ -768,13 +735,13 @@ abstract class ImportExportTypeQuery extends ModelCriteria * @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 ChildImportExportTypeI18nQuery A secondary query class using the current class as primary query + * @return ChildImportI18nQuery 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 : 'ImportExportTypeI18n', '\Thelia\Model\ImportExportTypeI18nQuery'); + ->useQuery($relationAlias ? $relationAlias : 'ImportI18n', '\Thelia\Model\ImportI18nQuery'); } // timestampable behavior @@ -784,11 +751,11 @@ abstract class ImportExportTypeQuery extends ModelCriteria * * @param int $nbDays Maximum age of the latest update in days * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ public function recentlyUpdated($nbDays = 7) { - return $this->addUsingAlias(ImportExportTypeTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + return $this->addUsingAlias(ImportTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); } /** @@ -796,51 +763,51 @@ abstract class ImportExportTypeQuery extends ModelCriteria * * @param int $nbDays Maximum age of in days * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ public function recentlyCreated($nbDays = 7) { - return $this->addUsingAlias(ImportExportTypeTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); + return $this->addUsingAlias(ImportTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL); } /** * Order by update date desc * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ public function lastUpdatedFirst() { - return $this->addDescendingOrderByColumn(ImportExportTypeTableMap::UPDATED_AT); + return $this->addDescendingOrderByColumn(ImportTableMap::UPDATED_AT); } /** * Order by update date asc * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ public function firstUpdatedFirst() { - return $this->addAscendingOrderByColumn(ImportExportTypeTableMap::UPDATED_AT); + return $this->addAscendingOrderByColumn(ImportTableMap::UPDATED_AT); } /** * Order by create date desc * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ public function lastCreatedFirst() { - return $this->addDescendingOrderByColumn(ImportExportTypeTableMap::CREATED_AT); + return $this->addDescendingOrderByColumn(ImportTableMap::CREATED_AT); } /** * Order by create date asc * - * @return ChildImportExportTypeQuery The current query, for fluid interface + * @return ChildImportQuery The current query, for fluid interface */ public function firstCreatedFirst() { - return $this->addAscendingOrderByColumn(ImportExportTypeTableMap::CREATED_AT); + return $this->addAscendingOrderByColumn(ImportTableMap::CREATED_AT); } -} // ImportExportTypeQuery +} // ImportQuery diff --git a/core/lib/Thelia/Model/Export.php b/core/lib/Thelia/Model/Export.php new file mode 100644 index 000000000..1f1d5e100 --- /dev/null +++ b/core/lib/Thelia/Model/Export.php @@ -0,0 +1,10 @@ + array('Id', 'Locale', 'Title', ), + self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', ), + self::TYPE_COLNAME => array(ExportCategoryI18nTableMap::ID, ExportCategoryI18nTableMap::LOCALE, ExportCategoryI18nTableMap::TITLE, ), + self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', ), + self::TYPE_FIELDNAME => array('id', 'locale', 'title', ), + self::TYPE_NUM => array(0, 1, 2, ) + ); + + /** + * 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, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, ), + self::TYPE_COLNAME => array(ExportCategoryI18nTableMap::ID => 0, ExportCategoryI18nTableMap::LOCALE => 1, ExportCategoryI18nTableMap::TITLE => 2, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, ), + self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, ), + self::TYPE_NUM => array(0, 1, 2, ) + ); + + /** + * 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('export_category_i18n'); + $this->setPhpName('ExportCategoryI18n'); + $this->setClassName('\\Thelia\\Model\\ExportCategoryI18n'); + $this->setPackage('Thelia.Model'); + $this->setUseIdGenerator(false); + // columns + $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'export_category', 'ID', true, null, null); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); + $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('ExportCategory', '\\Thelia\\Model\\ExportCategory', 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\ExportCategoryI18n $obj A \Thelia\Model\ExportCategoryI18n 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\ExportCategoryI18n object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && null !== $value) { + if (is_object($value) && $value instanceof \Thelia\Model\ExportCategoryI18n) { + $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\ExportCategoryI18n 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 ? ExportCategoryI18nTableMap::CLASS_DEFAULT : ExportCategoryI18nTableMap::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 (ExportCategoryI18n object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = ExportCategoryI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ExportCategoryI18nTableMap::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 + ExportCategoryI18nTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = ExportCategoryI18nTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + ExportCategoryI18nTableMap::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 = ExportCategoryI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ExportCategoryI18nTableMap::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; + ExportCategoryI18nTableMap::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(ExportCategoryI18nTableMap::ID); + $criteria->addSelectColumn(ExportCategoryI18nTableMap::LOCALE); + $criteria->addSelectColumn(ExportCategoryI18nTableMap::TITLE); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.LOCALE'); + $criteria->addSelectColumn($alias . '.TITLE'); + } + } + + /** + * 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(ExportCategoryI18nTableMap::DATABASE_NAME)->getTable(ExportCategoryI18nTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ExportCategoryI18nTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ExportCategoryI18nTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ExportCategoryI18nTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a ExportCategoryI18n or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ExportCategoryI18n 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(ExportCategoryI18nTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \Thelia\Model\ExportCategoryI18n) { // 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(ExportCategoryI18nTableMap::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(ExportCategoryI18nTableMap::ID, $value[0]); + $criterion->addAnd($criteria->getNewCriterion(ExportCategoryI18nTableMap::LOCALE, $value[1])); + $criteria->addOr($criterion); + } + } + + $query = ExportCategoryI18nQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { ExportCategoryI18nTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { ExportCategoryI18nTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the export_category_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 ExportCategoryI18nQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a ExportCategoryI18n or Criteria object. + * + * @param mixed $criteria Criteria or ExportCategoryI18n 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(ExportCategoryI18nTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from ExportCategoryI18n object + } + + + // Set the correct dbName + $query = ExportCategoryI18nQuery::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; + } + +} // ExportCategoryI18nTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +ExportCategoryI18nTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/ExportCategoryTableMap.php b/core/lib/Thelia/Model/Map/ExportCategoryTableMap.php new file mode 100644 index 000000000..1d5f32451 --- /dev/null +++ b/core/lib/Thelia/Model/Map/ExportCategoryTableMap.php @@ -0,0 +1,461 @@ + array('Id', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(ExportCategoryTableMap::ID, ExportCategoryTableMap::POSITION, ExportCategoryTableMap::CREATED_AT, ExportCategoryTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'Position' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'position' => 1, 'createdAt' => 2, 'updatedAt' => 3, ), + self::TYPE_COLNAME => array(ExportCategoryTableMap::ID => 0, ExportCategoryTableMap::POSITION => 1, ExportCategoryTableMap::CREATED_AT => 2, ExportCategoryTableMap::UPDATED_AT => 3, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'POSITION' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ), + self::TYPE_FIELDNAME => array('id' => 0, 'position' => 1, 'created_at' => 2, 'updated_at' => 3, ), + self::TYPE_NUM => array(0, 1, 2, 3, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('export_category'); + $this->setPhpName('ExportCategory'); + $this->setClassName('\\Thelia\\Model\\ExportCategory'); + $this->setPackage('Thelia.Model'); + $this->setUseIdGenerator(true); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addColumn('POSITION', 'Position', 'INTEGER', true, 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('Export', '\\Thelia\\Model\\Export', RelationMap::ONE_TO_MANY, array('id' => 'export_category_id', ), 'CASCADE', 'RESTRICT', 'Exports'); + $this->addRelation('ExportCategoryI18n', '\\Thelia\\Model\\ExportCategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ExportCategoryI18ns'); + } // buildRelations() + + /** + * + * Gets the list of behaviors registered for this table + * + * @return array Associative array (name => parameters) of behaviors + */ + public function getBehaviors() + { + return array( + 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), + 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), + ); + } // getBehaviors() + /** + * Method to invalidate the instance pool of all tables related to export_category * 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. + ExportTableMap::clearInstancePool(); + ExportCategoryI18nTableMap::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 ? ExportCategoryTableMap::CLASS_DEFAULT : ExportCategoryTableMap::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 (ExportCategory object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = ExportCategoryTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ExportCategoryTableMap::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 + ExportCategoryTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = ExportCategoryTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + ExportCategoryTableMap::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 = ExportCategoryTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ExportCategoryTableMap::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; + ExportCategoryTableMap::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(ExportCategoryTableMap::ID); + $criteria->addSelectColumn(ExportCategoryTableMap::POSITION); + $criteria->addSelectColumn(ExportCategoryTableMap::CREATED_AT); + $criteria->addSelectColumn(ExportCategoryTableMap::UPDATED_AT); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $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(ExportCategoryTableMap::DATABASE_NAME)->getTable(ExportCategoryTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ExportCategoryTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ExportCategoryTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ExportCategoryTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a ExportCategory or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ExportCategory 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(ExportCategoryTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \Thelia\Model\ExportCategory) { // 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(ExportCategoryTableMap::DATABASE_NAME); + $criteria->add(ExportCategoryTableMap::ID, (array) $values, Criteria::IN); + } + + $query = ExportCategoryQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { ExportCategoryTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { ExportCategoryTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the export_category 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 ExportCategoryQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a ExportCategory or Criteria object. + * + * @param mixed $criteria Criteria or ExportCategory 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(ExportCategoryTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from ExportCategory object + } + + if ($criteria->containsKey(ExportCategoryTableMap::ID) && $criteria->keyContainsValue(ExportCategoryTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ExportCategoryTableMap::ID.')'); + } + + + // Set the correct dbName + $query = ExportCategoryQuery::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; + } + +} // ExportCategoryTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +ExportCategoryTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/ExportI18nTableMap.php b/core/lib/Thelia/Model/Map/ExportI18nTableMap.php new file mode 100644 index 000000000..228a4e288 --- /dev/null +++ b/core/lib/Thelia/Model/Map/ExportI18nTableMap.php @@ -0,0 +1,482 @@ + array('Id', 'Locale', 'Title', 'Description', ), + self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', ), + self::TYPE_COLNAME => array(ExportI18nTableMap::ID, ExportI18nTableMap::LOCALE, ExportI18nTableMap::TITLE, ExportI18nTableMap::DESCRIPTION, ), + self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', ), + self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', ), + self::TYPE_NUM => array(0, 1, 2, 3, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ), + self::TYPE_COLNAME => array(ExportI18nTableMap::ID => 0, ExportI18nTableMap::LOCALE => 1, ExportI18nTableMap::TITLE => 2, ExportI18nTableMap::DESCRIPTION => 3, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, ), + self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ), + self::TYPE_NUM => array(0, 1, 2, 3, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('export_i18n'); + $this->setPhpName('ExportI18n'); + $this->setClassName('\\Thelia\\Model\\ExportI18n'); + $this->setPackage('Thelia.Model'); + $this->setUseIdGenerator(false); + // columns + $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'export', 'ID', true, null, null); + $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); + $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); + $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('Export', '\\Thelia\\Model\\Export', 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\ExportI18n $obj A \Thelia\Model\ExportI18n 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\ExportI18n object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && null !== $value) { + if (is_object($value) && $value instanceof \Thelia\Model\ExportI18n) { + $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\ExportI18n 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 ? ExportI18nTableMap::CLASS_DEFAULT : ExportI18nTableMap::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 (ExportI18n object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = ExportI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ExportI18nTableMap::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 + ExportI18nTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = ExportI18nTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + ExportI18nTableMap::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 = ExportI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ExportI18nTableMap::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; + ExportI18nTableMap::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(ExportI18nTableMap::ID); + $criteria->addSelectColumn(ExportI18nTableMap::LOCALE); + $criteria->addSelectColumn(ExportI18nTableMap::TITLE); + $criteria->addSelectColumn(ExportI18nTableMap::DESCRIPTION); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.LOCALE'); + $criteria->addSelectColumn($alias . '.TITLE'); + $criteria->addSelectColumn($alias . '.DESCRIPTION'); + } + } + + /** + * 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(ExportI18nTableMap::DATABASE_NAME)->getTable(ExportI18nTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ExportI18nTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ExportI18nTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ExportI18nTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a ExportI18n or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ExportI18n 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(ExportI18nTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \Thelia\Model\ExportI18n) { // 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(ExportI18nTableMap::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(ExportI18nTableMap::ID, $value[0]); + $criterion->addAnd($criteria->getNewCriterion(ExportI18nTableMap::LOCALE, $value[1])); + $criteria->addOr($criterion); + } + } + + $query = ExportI18nQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { ExportI18nTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { ExportI18nTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the export_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 ExportI18nQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a ExportI18n or Criteria object. + * + * @param mixed $criteria Criteria or ExportI18n 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(ExportI18nTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from ExportI18n object + } + + + // Set the correct dbName + $query = ExportI18nQuery::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; + } + +} // ExportI18nTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +ExportI18nTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/ExportTableMap.php b/core/lib/Thelia/Model/Map/ExportTableMap.php new file mode 100644 index 000000000..f9ead6b5b --- /dev/null +++ b/core/lib/Thelia/Model/Map/ExportTableMap.php @@ -0,0 +1,468 @@ + array('Id', 'ExportCategoryId', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'exportCategoryId', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(ExportTableMap::ID, ExportTableMap::EXPORT_CATEGORY_ID, ExportTableMap::POSITION, ExportTableMap::CREATED_AT, ExportTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'EXPORT_CATEGORY_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'export_category_id', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'ExportCategoryId' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'exportCategoryId' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), + self::TYPE_COLNAME => array(ExportTableMap::ID => 0, ExportTableMap::EXPORT_CATEGORY_ID => 1, ExportTableMap::POSITION => 2, ExportTableMap::CREATED_AT => 3, ExportTableMap::UPDATED_AT => 4, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'EXPORT_CATEGORY_ID' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), + self::TYPE_FIELDNAME => array('id' => 0, 'export_category_id' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('export'); + $this->setPhpName('Export'); + $this->setClassName('\\Thelia\\Model\\Export'); + $this->setPackage('Thelia.Model'); + $this->setUseIdGenerator(true); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addForeignKey('EXPORT_CATEGORY_ID', 'ExportCategoryId', 'INTEGER', 'export_category', 'ID', true, null, null); + $this->addColumn('POSITION', 'Position', 'INTEGER', true, 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('ExportCategory', '\\Thelia\\Model\\ExportCategory', RelationMap::MANY_TO_ONE, array('export_category_id' => 'id', ), 'CASCADE', 'RESTRICT'); + $this->addRelation('ExportI18n', '\\Thelia\\Model\\ExportI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ExportI18ns'); + } // buildRelations() + + /** + * + * Gets the list of behaviors registered for this table + * + * @return array Associative array (name => parameters) of behaviors + */ + public function getBehaviors() + { + return array( + 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ), + 'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ), + ); + } // getBehaviors() + /** + * Method to invalidate the instance pool of all tables related to export * 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. + ExportI18nTableMap::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 ? ExportTableMap::CLASS_DEFAULT : ExportTableMap::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 (Export object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = ExportTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ExportTableMap::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 + ExportTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = ExportTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + ExportTableMap::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 = ExportTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ExportTableMap::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; + ExportTableMap::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(ExportTableMap::ID); + $criteria->addSelectColumn(ExportTableMap::EXPORT_CATEGORY_ID); + $criteria->addSelectColumn(ExportTableMap::POSITION); + $criteria->addSelectColumn(ExportTableMap::CREATED_AT); + $criteria->addSelectColumn(ExportTableMap::UPDATED_AT); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.EXPORT_CATEGORY_ID'); + $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(ExportTableMap::DATABASE_NAME)->getTable(ExportTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ExportTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ExportTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ExportTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a Export or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or Export 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(ExportTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \Thelia\Model\Export) { // 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(ExportTableMap::DATABASE_NAME); + $criteria->add(ExportTableMap::ID, (array) $values, Criteria::IN); + } + + $query = ExportQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { ExportTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { ExportTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the export 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 ExportQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a Export or Criteria object. + * + * @param mixed $criteria Criteria or Export 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(ExportTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from Export object + } + + if ($criteria->containsKey(ExportTableMap::ID) && $criteria->keyContainsValue(ExportTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ExportTableMap::ID.')'); + } + + + // Set the correct dbName + $query = ExportQuery::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; + } + +} // ExportTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +ExportTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/ImportExportCategoryI18nTableMap.php b/core/lib/Thelia/Model/Map/ImportCategoryI18nTableMap.php similarity index 76% rename from core/lib/Thelia/Model/Map/ImportExportCategoryI18nTableMap.php rename to core/lib/Thelia/Model/Map/ImportCategoryI18nTableMap.php index daf000bf1..c4e254f43 100644 --- a/core/lib/Thelia/Model/Map/ImportExportCategoryI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ImportCategoryI18nTableMap.php @@ -11,12 +11,12 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\RelationMap; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMapTrait; -use Thelia\Model\ImportExportCategoryI18n; -use Thelia\Model\ImportExportCategoryI18nQuery; +use Thelia\Model\ImportCategoryI18n; +use Thelia\Model\ImportCategoryI18nQuery; /** - * This class defines the structure of the 'import_export_category_i18n' table. + * This class defines the structure of the 'import_category_i18n' table. * * * @@ -26,14 +26,14 @@ use Thelia\Model\ImportExportCategoryI18nQuery; * (i.e. if it's a text column type). * */ -class ImportExportCategoryI18nTableMap extends TableMap +class ImportCategoryI18nTableMap extends TableMap { use InstancePoolTrait; use TableMapTrait; /** * The (dot-path) name of this class */ - const CLASS_NAME = 'Thelia.Model.Map.ImportExportCategoryI18nTableMap'; + const CLASS_NAME = 'Thelia.Model.Map.ImportCategoryI18nTableMap'; /** * The default database name for this class @@ -43,17 +43,17 @@ class ImportExportCategoryI18nTableMap extends TableMap /** * The table name for this class */ - const TABLE_NAME = 'import_export_category_i18n'; + const TABLE_NAME = 'import_category_i18n'; /** * The related Propel class for this table */ - const OM_CLASS = '\\Thelia\\Model\\ImportExportCategoryI18n'; + const OM_CLASS = '\\Thelia\\Model\\ImportCategoryI18n'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'Thelia.Model.ImportExportCategoryI18n'; + const CLASS_DEFAULT = 'Thelia.Model.ImportCategoryI18n'; /** * The total number of columns @@ -73,17 +73,17 @@ class ImportExportCategoryI18nTableMap extends TableMap /** * the column name for the ID field */ - const ID = 'import_export_category_i18n.ID'; + const ID = 'import_category_i18n.ID'; /** * the column name for the LOCALE field */ - const LOCALE = 'import_export_category_i18n.LOCALE'; + const LOCALE = 'import_category_i18n.LOCALE'; /** * the column name for the TITLE field */ - const TITLE = 'import_export_category_i18n.TITLE'; + const TITLE = 'import_category_i18n.TITLE'; /** * The default string format for model objects of the related table @@ -99,7 +99,7 @@ class ImportExportCategoryI18nTableMap extends TableMap protected static $fieldNames = array ( self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', ), self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', ), - self::TYPE_COLNAME => array(ImportExportCategoryI18nTableMap::ID, ImportExportCategoryI18nTableMap::LOCALE, ImportExportCategoryI18nTableMap::TITLE, ), + self::TYPE_COLNAME => array(ImportCategoryI18nTableMap::ID, ImportCategoryI18nTableMap::LOCALE, ImportCategoryI18nTableMap::TITLE, ), self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', ), self::TYPE_FIELDNAME => array('id', 'locale', 'title', ), self::TYPE_NUM => array(0, 1, 2, ) @@ -114,7 +114,7 @@ class ImportExportCategoryI18nTableMap extends TableMap protected static $fieldKeys = array ( self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, ), - self::TYPE_COLNAME => array(ImportExportCategoryI18nTableMap::ID => 0, ImportExportCategoryI18nTableMap::LOCALE => 1, ImportExportCategoryI18nTableMap::TITLE => 2, ), + self::TYPE_COLNAME => array(ImportCategoryI18nTableMap::ID => 0, ImportCategoryI18nTableMap::LOCALE => 1, ImportCategoryI18nTableMap::TITLE => 2, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, ), self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, ), self::TYPE_NUM => array(0, 1, 2, ) @@ -130,13 +130,13 @@ class ImportExportCategoryI18nTableMap extends TableMap public function initialize() { // attributes - $this->setName('import_export_category_i18n'); - $this->setPhpName('ImportExportCategoryI18n'); - $this->setClassName('\\Thelia\\Model\\ImportExportCategoryI18n'); + $this->setName('import_category_i18n'); + $this->setPhpName('ImportCategoryI18n'); + $this->setClassName('\\Thelia\\Model\\ImportCategoryI18n'); $this->setPackage('Thelia.Model'); $this->setUseIdGenerator(false); // columns - $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'import_export_category', 'ID', true, null, null); + $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'import_category', 'ID', true, null, null); $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); } // initialize() @@ -146,7 +146,7 @@ class ImportExportCategoryI18nTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('ImportExportCategory', '\\Thelia\\Model\\ImportExportCategory', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null); + $this->addRelation('ImportCategory', '\\Thelia\\Model\\ImportCategory', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null); } // buildRelations() /** @@ -157,7 +157,7 @@ class ImportExportCategoryI18nTableMap extends TableMap * to the cache in order to ensure that the same objects are always returned by find*() * and findPk*() calls. * - * @param \Thelia\Model\ImportExportCategoryI18n $obj A \Thelia\Model\ImportExportCategoryI18n object. + * @param \Thelia\Model\ImportCategoryI18n $obj A \Thelia\Model\ImportCategoryI18n 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) @@ -178,12 +178,12 @@ class ImportExportCategoryI18nTableMap extends TableMap * 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\ImportExportCategoryI18n object or a primary key value. + * @param mixed $value A \Thelia\Model\ImportCategoryI18n object or a primary key value. */ public static function removeInstanceFromPool($value) { if (Propel::isInstancePoolingEnabled() && null !== $value) { - if (is_object($value) && $value instanceof \Thelia\Model\ImportExportCategoryI18n) { + if (is_object($value) && $value instanceof \Thelia\Model\ImportCategoryI18n) { $key = serialize(array((string) $value->getId(), (string) $value->getLocale())); } elseif (is_array($value) && count($value) === 2) { @@ -194,7 +194,7 @@ class ImportExportCategoryI18nTableMap extends TableMap return; } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\ImportExportCategoryI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\ImportCategoryI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); throw $e; } @@ -254,7 +254,7 @@ class ImportExportCategoryI18nTableMap extends TableMap */ public static function getOMClass($withPrefix = true) { - return $withPrefix ? ImportExportCategoryI18nTableMap::CLASS_DEFAULT : ImportExportCategoryI18nTableMap::OM_CLASS; + return $withPrefix ? ImportCategoryI18nTableMap::CLASS_DEFAULT : ImportCategoryI18nTableMap::OM_CLASS; } /** @@ -268,21 +268,21 @@ class ImportExportCategoryI18nTableMap extends TableMap * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (ImportExportCategoryI18n object, last column rank) + * @return array (ImportCategoryI18n object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - $key = ImportExportCategoryI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = ImportExportCategoryI18nTableMap::getInstanceFromPool($key))) { + $key = ImportCategoryI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ImportCategoryI18nTableMap::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 + ImportExportCategoryI18nTableMap::NUM_HYDRATE_COLUMNS; + $col = $offset + ImportCategoryI18nTableMap::NUM_HYDRATE_COLUMNS; } else { - $cls = ImportExportCategoryI18nTableMap::OM_CLASS; + $cls = ImportCategoryI18nTableMap::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); - ImportExportCategoryI18nTableMap::addInstanceToPool($obj, $key); + ImportCategoryI18nTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); @@ -305,8 +305,8 @@ class ImportExportCategoryI18nTableMap extends TableMap $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { - $key = ImportExportCategoryI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = ImportExportCategoryI18nTableMap::getInstanceFromPool($key))) { + $key = ImportCategoryI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ImportCategoryI18nTableMap::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 @@ -315,7 +315,7 @@ class ImportExportCategoryI18nTableMap extends TableMap $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; - ImportExportCategoryI18nTableMap::addInstanceToPool($obj, $key); + ImportCategoryI18nTableMap::addInstanceToPool($obj, $key); } // if key exists } @@ -336,9 +336,9 @@ class ImportExportCategoryI18nTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(ImportExportCategoryI18nTableMap::ID); - $criteria->addSelectColumn(ImportExportCategoryI18nTableMap::LOCALE); - $criteria->addSelectColumn(ImportExportCategoryI18nTableMap::TITLE); + $criteria->addSelectColumn(ImportCategoryI18nTableMap::ID); + $criteria->addSelectColumn(ImportCategoryI18nTableMap::LOCALE); + $criteria->addSelectColumn(ImportCategoryI18nTableMap::TITLE); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.LOCALE'); @@ -355,7 +355,7 @@ class ImportExportCategoryI18nTableMap extends TableMap */ public static function getTableMap() { - return Propel::getServiceContainer()->getDatabaseMap(ImportExportCategoryI18nTableMap::DATABASE_NAME)->getTable(ImportExportCategoryI18nTableMap::TABLE_NAME); + return Propel::getServiceContainer()->getDatabaseMap(ImportCategoryI18nTableMap::DATABASE_NAME)->getTable(ImportCategoryI18nTableMap::TABLE_NAME); } /** @@ -363,16 +363,16 @@ class ImportExportCategoryI18nTableMap extends TableMap */ public static function buildTableMap() { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportExportCategoryI18nTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(ImportExportCategoryI18nTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new ImportExportCategoryI18nTableMap()); + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportCategoryI18nTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ImportCategoryI18nTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ImportCategoryI18nTableMap()); } } /** - * Performs a DELETE on the database, given a ImportExportCategoryI18n or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ImportCategoryI18n or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ImportExportCategoryI18n object or primary key or array of primary keys + * @param mixed $values Criteria or ImportCategoryI18n 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 @@ -383,17 +383,17 @@ class ImportExportCategoryI18nTableMap extends TableMap public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryI18nTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; - } elseif ($values instanceof \Thelia\Model\ImportExportCategoryI18n) { // it's a model object + } elseif ($values instanceof \Thelia\Model\ImportCategoryI18n) { // 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(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $criteria = new Criteria(ImportCategoryI18nTableMap::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)) { @@ -401,17 +401,17 @@ class ImportExportCategoryI18nTableMap extends TableMap $values = array($values); } foreach ($values as $value) { - $criterion = $criteria->getNewCriterion(ImportExportCategoryI18nTableMap::ID, $value[0]); - $criterion->addAnd($criteria->getNewCriterion(ImportExportCategoryI18nTableMap::LOCALE, $value[1])); + $criterion = $criteria->getNewCriterion(ImportCategoryI18nTableMap::ID, $value[0]); + $criterion->addAnd($criteria->getNewCriterion(ImportCategoryI18nTableMap::LOCALE, $value[1])); $criteria->addOr($criterion); } } - $query = ImportExportCategoryI18nQuery::create()->mergeWith($criteria); + $query = ImportCategoryI18nQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { ImportExportCategoryI18nTableMap::clearInstancePool(); + if ($values instanceof Criteria) { ImportCategoryI18nTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { ImportExportCategoryI18nTableMap::removeInstanceFromPool($singleval); + foreach ((array) $values as $singleval) { ImportCategoryI18nTableMap::removeInstanceFromPool($singleval); } } @@ -419,20 +419,20 @@ class ImportExportCategoryI18nTableMap extends TableMap } /** - * Deletes all rows from the import_export_category_i18n table. + * Deletes all rows from the import_category_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 ImportExportCategoryI18nQuery::create()->doDeleteAll($con); + return ImportCategoryI18nQuery::create()->doDeleteAll($con); } /** - * Performs an INSERT on the database, given a ImportExportCategoryI18n or Criteria object. + * Performs an INSERT on the database, given a ImportCategoryI18n or Criteria object. * - * @param mixed $criteria Criteria or ImportExportCategoryI18n object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or ImportCategoryI18n 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 @@ -441,18 +441,18 @@ class ImportExportCategoryI18nTableMap extends TableMap public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryI18nTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { - $criteria = $criteria->buildCriteria(); // build Criteria from ImportExportCategoryI18n object + $criteria = $criteria->buildCriteria(); // build Criteria from ImportCategoryI18n object } // Set the correct dbName - $query = ImportExportCategoryI18nQuery::create()->mergeWith($criteria); + $query = ImportCategoryI18nQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info @@ -468,7 +468,7 @@ class ImportExportCategoryI18nTableMap extends TableMap return $pk; } -} // ImportExportCategoryI18nTableMap +} // ImportCategoryI18nTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // -ImportExportCategoryI18nTableMap::buildTableMap(); +ImportCategoryI18nTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/ImportExportCategoryTableMap.php b/core/lib/Thelia/Model/Map/ImportCategoryTableMap.php similarity index 74% rename from core/lib/Thelia/Model/Map/ImportExportCategoryTableMap.php rename to core/lib/Thelia/Model/Map/ImportCategoryTableMap.php index 96a0d768c..e75ddf2ba 100644 --- a/core/lib/Thelia/Model/Map/ImportExportCategoryTableMap.php +++ b/core/lib/Thelia/Model/Map/ImportCategoryTableMap.php @@ -11,12 +11,12 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\RelationMap; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMapTrait; -use Thelia\Model\ImportExportCategory; -use Thelia\Model\ImportExportCategoryQuery; +use Thelia\Model\ImportCategory; +use Thelia\Model\ImportCategoryQuery; /** - * This class defines the structure of the 'import_export_category' table. + * This class defines the structure of the 'import_category' table. * * * @@ -26,14 +26,14 @@ use Thelia\Model\ImportExportCategoryQuery; * (i.e. if it's a text column type). * */ -class ImportExportCategoryTableMap extends TableMap +class ImportCategoryTableMap extends TableMap { use InstancePoolTrait; use TableMapTrait; /** * The (dot-path) name of this class */ - const CLASS_NAME = 'Thelia.Model.Map.ImportExportCategoryTableMap'; + const CLASS_NAME = 'Thelia.Model.Map.ImportCategoryTableMap'; /** * The default database name for this class @@ -43,17 +43,17 @@ class ImportExportCategoryTableMap extends TableMap /** * The table name for this class */ - const TABLE_NAME = 'import_export_category'; + const TABLE_NAME = 'import_category'; /** * The related Propel class for this table */ - const OM_CLASS = '\\Thelia\\Model\\ImportExportCategory'; + const OM_CLASS = '\\Thelia\\Model\\ImportCategory'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'Thelia.Model.ImportExportCategory'; + const CLASS_DEFAULT = 'Thelia.Model.ImportCategory'; /** * The total number of columns @@ -73,22 +73,22 @@ class ImportExportCategoryTableMap extends TableMap /** * the column name for the ID field */ - const ID = 'import_export_category.ID'; + const ID = 'import_category.ID'; /** * the column name for the POSITION field */ - const POSITION = 'import_export_category.POSITION'; + const POSITION = 'import_category.POSITION'; /** * the column name for the CREATED_AT field */ - const CREATED_AT = 'import_export_category.CREATED_AT'; + const CREATED_AT = 'import_category.CREATED_AT'; /** * the column name for the UPDATED_AT field */ - const UPDATED_AT = 'import_export_category.UPDATED_AT'; + const UPDATED_AT = 'import_category.UPDATED_AT'; /** * The default string format for model objects of the related table @@ -113,7 +113,7 @@ class ImportExportCategoryTableMap extends TableMap protected static $fieldNames = array ( self::TYPE_PHPNAME => array('Id', 'Position', 'CreatedAt', 'UpdatedAt', ), self::TYPE_STUDLYPHPNAME => array('id', 'position', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(ImportExportCategoryTableMap::ID, ImportExportCategoryTableMap::POSITION, ImportExportCategoryTableMap::CREATED_AT, ImportExportCategoryTableMap::UPDATED_AT, ), + self::TYPE_COLNAME => array(ImportCategoryTableMap::ID, ImportCategoryTableMap::POSITION, ImportCategoryTableMap::CREATED_AT, ImportCategoryTableMap::UPDATED_AT, ), self::TYPE_RAW_COLNAME => array('ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), self::TYPE_FIELDNAME => array('id', 'position', 'created_at', 'updated_at', ), self::TYPE_NUM => array(0, 1, 2, 3, ) @@ -128,7 +128,7 @@ class ImportExportCategoryTableMap extends TableMap protected static $fieldKeys = array ( self::TYPE_PHPNAME => array('Id' => 0, 'Position' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'position' => 1, 'createdAt' => 2, 'updatedAt' => 3, ), - self::TYPE_COLNAME => array(ImportExportCategoryTableMap::ID => 0, ImportExportCategoryTableMap::POSITION => 1, ImportExportCategoryTableMap::CREATED_AT => 2, ImportExportCategoryTableMap::UPDATED_AT => 3, ), + self::TYPE_COLNAME => array(ImportCategoryTableMap::ID => 0, ImportCategoryTableMap::POSITION => 1, ImportCategoryTableMap::CREATED_AT => 2, ImportCategoryTableMap::UPDATED_AT => 3, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'POSITION' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ), self::TYPE_FIELDNAME => array('id' => 0, 'position' => 1, 'created_at' => 2, 'updated_at' => 3, ), self::TYPE_NUM => array(0, 1, 2, 3, ) @@ -144,9 +144,9 @@ class ImportExportCategoryTableMap extends TableMap public function initialize() { // attributes - $this->setName('import_export_category'); - $this->setPhpName('ImportExportCategory'); - $this->setClassName('\\Thelia\\Model\\ImportExportCategory'); + $this->setName('import_category'); + $this->setPhpName('ImportCategory'); + $this->setClassName('\\Thelia\\Model\\ImportCategory'); $this->setPackage('Thelia.Model'); $this->setUseIdGenerator(true); // columns @@ -161,8 +161,8 @@ class ImportExportCategoryTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('ImportExportType', '\\Thelia\\Model\\ImportExportType', RelationMap::ONE_TO_MANY, array('id' => 'import_export_category_id', ), 'CASCADE', 'RESTRICT', 'ImportExportTypes'); - $this->addRelation('ImportExportCategoryI18n', '\\Thelia\\Model\\ImportExportCategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ImportExportCategoryI18ns'); + $this->addRelation('Import', '\\Thelia\\Model\\Import', RelationMap::ONE_TO_MANY, array('id' => 'import_category_id', ), 'CASCADE', 'RESTRICT', 'Imports'); + $this->addRelation('ImportCategoryI18n', '\\Thelia\\Model\\ImportCategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ImportCategoryI18ns'); } // buildRelations() /** @@ -179,14 +179,14 @@ class ImportExportCategoryTableMap extends TableMap ); } // getBehaviors() /** - * Method to invalidate the instance pool of all tables related to import_export_category * by a foreign key with ON DELETE CASCADE + * Method to invalidate the instance pool of all tables related to import_category * 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. - ImportExportTypeTableMap::clearInstancePool(); - ImportExportCategoryI18nTableMap::clearInstancePool(); + ImportTableMap::clearInstancePool(); + ImportCategoryI18nTableMap::clearInstancePool(); } /** @@ -245,7 +245,7 @@ class ImportExportCategoryTableMap extends TableMap */ public static function getOMClass($withPrefix = true) { - return $withPrefix ? ImportExportCategoryTableMap::CLASS_DEFAULT : ImportExportCategoryTableMap::OM_CLASS; + return $withPrefix ? ImportCategoryTableMap::CLASS_DEFAULT : ImportCategoryTableMap::OM_CLASS; } /** @@ -259,21 +259,21 @@ class ImportExportCategoryTableMap extends TableMap * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (ImportExportCategory object, last column rank) + * @return array (ImportCategory object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - $key = ImportExportCategoryTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = ImportExportCategoryTableMap::getInstanceFromPool($key))) { + $key = ImportCategoryTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ImportCategoryTableMap::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 + ImportExportCategoryTableMap::NUM_HYDRATE_COLUMNS; + $col = $offset + ImportCategoryTableMap::NUM_HYDRATE_COLUMNS; } else { - $cls = ImportExportCategoryTableMap::OM_CLASS; + $cls = ImportCategoryTableMap::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); - ImportExportCategoryTableMap::addInstanceToPool($obj, $key); + ImportCategoryTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); @@ -296,8 +296,8 @@ class ImportExportCategoryTableMap extends TableMap $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { - $key = ImportExportCategoryTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = ImportExportCategoryTableMap::getInstanceFromPool($key))) { + $key = ImportCategoryTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ImportCategoryTableMap::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 @@ -306,7 +306,7 @@ class ImportExportCategoryTableMap extends TableMap $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; - ImportExportCategoryTableMap::addInstanceToPool($obj, $key); + ImportCategoryTableMap::addInstanceToPool($obj, $key); } // if key exists } @@ -327,10 +327,10 @@ class ImportExportCategoryTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(ImportExportCategoryTableMap::ID); - $criteria->addSelectColumn(ImportExportCategoryTableMap::POSITION); - $criteria->addSelectColumn(ImportExportCategoryTableMap::CREATED_AT); - $criteria->addSelectColumn(ImportExportCategoryTableMap::UPDATED_AT); + $criteria->addSelectColumn(ImportCategoryTableMap::ID); + $criteria->addSelectColumn(ImportCategoryTableMap::POSITION); + $criteria->addSelectColumn(ImportCategoryTableMap::CREATED_AT); + $criteria->addSelectColumn(ImportCategoryTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.POSITION'); @@ -348,7 +348,7 @@ class ImportExportCategoryTableMap extends TableMap */ public static function getTableMap() { - return Propel::getServiceContainer()->getDatabaseMap(ImportExportCategoryTableMap::DATABASE_NAME)->getTable(ImportExportCategoryTableMap::TABLE_NAME); + return Propel::getServiceContainer()->getDatabaseMap(ImportCategoryTableMap::DATABASE_NAME)->getTable(ImportCategoryTableMap::TABLE_NAME); } /** @@ -356,16 +356,16 @@ class ImportExportCategoryTableMap extends TableMap */ public static function buildTableMap() { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportExportCategoryTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(ImportExportCategoryTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new ImportExportCategoryTableMap()); + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportCategoryTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ImportCategoryTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ImportCategoryTableMap()); } } /** - * Performs a DELETE on the database, given a ImportExportCategory or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ImportCategory or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ImportExportCategory object or primary key or array of primary keys + * @param mixed $values Criteria or ImportCategory 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 @@ -376,25 +376,25 @@ class ImportExportCategoryTableMap extends TableMap public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; - } elseif ($values instanceof \Thelia\Model\ImportExportCategory) { // it's a model object + } elseif ($values instanceof \Thelia\Model\ImportCategory) { // 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(ImportExportCategoryTableMap::DATABASE_NAME); - $criteria->add(ImportExportCategoryTableMap::ID, (array) $values, Criteria::IN); + $criteria = new Criteria(ImportCategoryTableMap::DATABASE_NAME); + $criteria->add(ImportCategoryTableMap::ID, (array) $values, Criteria::IN); } - $query = ImportExportCategoryQuery::create()->mergeWith($criteria); + $query = ImportCategoryQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { ImportExportCategoryTableMap::clearInstancePool(); + if ($values instanceof Criteria) { ImportCategoryTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { ImportExportCategoryTableMap::removeInstanceFromPool($singleval); + foreach ((array) $values as $singleval) { ImportCategoryTableMap::removeInstanceFromPool($singleval); } } @@ -402,20 +402,20 @@ class ImportExportCategoryTableMap extends TableMap } /** - * Deletes all rows from the import_export_category table. + * Deletes all rows from the import_category 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 ImportExportCategoryQuery::create()->doDeleteAll($con); + return ImportCategoryQuery::create()->doDeleteAll($con); } /** - * Performs an INSERT on the database, given a ImportExportCategory or Criteria object. + * Performs an INSERT on the database, given a ImportCategory or Criteria object. * - * @param mixed $criteria Criteria or ImportExportCategory object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or ImportCategory 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 @@ -424,22 +424,22 @@ class ImportExportCategoryTableMap extends TableMap public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportCategoryTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportCategoryTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { - $criteria = $criteria->buildCriteria(); // build Criteria from ImportExportCategory object + $criteria = $criteria->buildCriteria(); // build Criteria from ImportCategory object } - if ($criteria->containsKey(ImportExportCategoryTableMap::ID) && $criteria->keyContainsValue(ImportExportCategoryTableMap::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImportExportCategoryTableMap::ID.')'); + if ($criteria->containsKey(ImportCategoryTableMap::ID) && $criteria->keyContainsValue(ImportCategoryTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImportCategoryTableMap::ID.')'); } // Set the correct dbName - $query = ImportExportCategoryQuery::create()->mergeWith($criteria); + $query = ImportCategoryQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info @@ -455,7 +455,7 @@ class ImportExportCategoryTableMap extends TableMap return $pk; } -} // ImportExportCategoryTableMap +} // ImportCategoryTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // -ImportExportCategoryTableMap::buildTableMap(); +ImportCategoryTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/ImportExportTypeI18nTableMap.php b/core/lib/Thelia/Model/Map/ImportI18nTableMap.php similarity index 77% rename from core/lib/Thelia/Model/Map/ImportExportTypeI18nTableMap.php rename to core/lib/Thelia/Model/Map/ImportI18nTableMap.php index 291ccf906..98279a3c8 100644 --- a/core/lib/Thelia/Model/Map/ImportExportTypeI18nTableMap.php +++ b/core/lib/Thelia/Model/Map/ImportI18nTableMap.php @@ -11,12 +11,12 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\RelationMap; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMapTrait; -use Thelia\Model\ImportExportTypeI18n; -use Thelia\Model\ImportExportTypeI18nQuery; +use Thelia\Model\ImportI18n; +use Thelia\Model\ImportI18nQuery; /** - * This class defines the structure of the 'import_export_type_i18n' table. + * This class defines the structure of the 'import_i18n' table. * * * @@ -26,14 +26,14 @@ use Thelia\Model\ImportExportTypeI18nQuery; * (i.e. if it's a text column type). * */ -class ImportExportTypeI18nTableMap extends TableMap +class ImportI18nTableMap extends TableMap { use InstancePoolTrait; use TableMapTrait; /** * The (dot-path) name of this class */ - const CLASS_NAME = 'Thelia.Model.Map.ImportExportTypeI18nTableMap'; + const CLASS_NAME = 'Thelia.Model.Map.ImportI18nTableMap'; /** * The default database name for this class @@ -43,17 +43,17 @@ class ImportExportTypeI18nTableMap extends TableMap /** * The table name for this class */ - const TABLE_NAME = 'import_export_type_i18n'; + const TABLE_NAME = 'import_i18n'; /** * The related Propel class for this table */ - const OM_CLASS = '\\Thelia\\Model\\ImportExportTypeI18n'; + const OM_CLASS = '\\Thelia\\Model\\ImportI18n'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'Thelia.Model.ImportExportTypeI18n'; + const CLASS_DEFAULT = 'Thelia.Model.ImportI18n'; /** * The total number of columns @@ -73,22 +73,22 @@ class ImportExportTypeI18nTableMap extends TableMap /** * the column name for the ID field */ - const ID = 'import_export_type_i18n.ID'; + const ID = 'import_i18n.ID'; /** * the column name for the LOCALE field */ - const LOCALE = 'import_export_type_i18n.LOCALE'; + const LOCALE = 'import_i18n.LOCALE'; /** * the column name for the TITLE field */ - const TITLE = 'import_export_type_i18n.TITLE'; + const TITLE = 'import_i18n.TITLE'; /** * the column name for the DESCRIPTION field */ - const DESCRIPTION = 'import_export_type_i18n.DESCRIPTION'; + const DESCRIPTION = 'import_i18n.DESCRIPTION'; /** * The default string format for model objects of the related table @@ -104,7 +104,7 @@ class ImportExportTypeI18nTableMap extends TableMap protected static $fieldNames = array ( self::TYPE_PHPNAME => array('Id', 'Locale', 'Title', 'Description', ), self::TYPE_STUDLYPHPNAME => array('id', 'locale', 'title', 'description', ), - self::TYPE_COLNAME => array(ImportExportTypeI18nTableMap::ID, ImportExportTypeI18nTableMap::LOCALE, ImportExportTypeI18nTableMap::TITLE, ImportExportTypeI18nTableMap::DESCRIPTION, ), + self::TYPE_COLNAME => array(ImportI18nTableMap::ID, ImportI18nTableMap::LOCALE, ImportI18nTableMap::TITLE, ImportI18nTableMap::DESCRIPTION, ), self::TYPE_RAW_COLNAME => array('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', ), self::TYPE_FIELDNAME => array('id', 'locale', 'title', 'description', ), self::TYPE_NUM => array(0, 1, 2, 3, ) @@ -119,7 +119,7 @@ class ImportExportTypeI18nTableMap extends TableMap protected static $fieldKeys = array ( self::TYPE_PHPNAME => array('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, ), self::TYPE_STUDLYPHPNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ), - self::TYPE_COLNAME => array(ImportExportTypeI18nTableMap::ID => 0, ImportExportTypeI18nTableMap::LOCALE => 1, ImportExportTypeI18nTableMap::TITLE => 2, ImportExportTypeI18nTableMap::DESCRIPTION => 3, ), + self::TYPE_COLNAME => array(ImportI18nTableMap::ID => 0, ImportI18nTableMap::LOCALE => 1, ImportI18nTableMap::TITLE => 2, ImportI18nTableMap::DESCRIPTION => 3, ), self::TYPE_RAW_COLNAME => array('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, ), self::TYPE_FIELDNAME => array('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ), self::TYPE_NUM => array(0, 1, 2, 3, ) @@ -135,13 +135,13 @@ class ImportExportTypeI18nTableMap extends TableMap public function initialize() { // attributes - $this->setName('import_export_type_i18n'); - $this->setPhpName('ImportExportTypeI18n'); - $this->setClassName('\\Thelia\\Model\\ImportExportTypeI18n'); + $this->setName('import_i18n'); + $this->setPhpName('ImportI18n'); + $this->setClassName('\\Thelia\\Model\\ImportI18n'); $this->setPackage('Thelia.Model'); $this->setUseIdGenerator(false); // columns - $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'import_export_type', 'ID', true, null, null); + $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'import', 'ID', true, null, null); $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_US'); $this->addColumn('TITLE', 'Title', 'VARCHAR', true, 255, null); $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null); @@ -152,7 +152,7 @@ class ImportExportTypeI18nTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('ImportExportType', '\\Thelia\\Model\\ImportExportType', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null); + $this->addRelation('Import', '\\Thelia\\Model\\Import', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null); } // buildRelations() /** @@ -163,7 +163,7 @@ class ImportExportTypeI18nTableMap extends TableMap * to the cache in order to ensure that the same objects are always returned by find*() * and findPk*() calls. * - * @param \Thelia\Model\ImportExportTypeI18n $obj A \Thelia\Model\ImportExportTypeI18n object. + * @param \Thelia\Model\ImportI18n $obj A \Thelia\Model\ImportI18n 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) @@ -184,12 +184,12 @@ class ImportExportTypeI18nTableMap extends TableMap * 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\ImportExportTypeI18n object or a primary key value. + * @param mixed $value A \Thelia\Model\ImportI18n object or a primary key value. */ public static function removeInstanceFromPool($value) { if (Propel::isInstancePoolingEnabled() && null !== $value) { - if (is_object($value) && $value instanceof \Thelia\Model\ImportExportTypeI18n) { + if (is_object($value) && $value instanceof \Thelia\Model\ImportI18n) { $key = serialize(array((string) $value->getId(), (string) $value->getLocale())); } elseif (is_array($value) && count($value) === 2) { @@ -200,7 +200,7 @@ class ImportExportTypeI18nTableMap extends TableMap return; } else { - $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\ImportExportTypeI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or \Thelia\Model\ImportI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true))); throw $e; } @@ -260,7 +260,7 @@ class ImportExportTypeI18nTableMap extends TableMap */ public static function getOMClass($withPrefix = true) { - return $withPrefix ? ImportExportTypeI18nTableMap::CLASS_DEFAULT : ImportExportTypeI18nTableMap::OM_CLASS; + return $withPrefix ? ImportI18nTableMap::CLASS_DEFAULT : ImportI18nTableMap::OM_CLASS; } /** @@ -274,21 +274,21 @@ class ImportExportTypeI18nTableMap extends TableMap * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (ImportExportTypeI18n object, last column rank) + * @return array (ImportI18n object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - $key = ImportExportTypeI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = ImportExportTypeI18nTableMap::getInstanceFromPool($key))) { + $key = ImportI18nTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ImportI18nTableMap::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 + ImportExportTypeI18nTableMap::NUM_HYDRATE_COLUMNS; + $col = $offset + ImportI18nTableMap::NUM_HYDRATE_COLUMNS; } else { - $cls = ImportExportTypeI18nTableMap::OM_CLASS; + $cls = ImportI18nTableMap::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); - ImportExportTypeI18nTableMap::addInstanceToPool($obj, $key); + ImportI18nTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); @@ -311,8 +311,8 @@ class ImportExportTypeI18nTableMap extends TableMap $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { - $key = ImportExportTypeI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = ImportExportTypeI18nTableMap::getInstanceFromPool($key))) { + $key = ImportI18nTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ImportI18nTableMap::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 @@ -321,7 +321,7 @@ class ImportExportTypeI18nTableMap extends TableMap $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; - ImportExportTypeI18nTableMap::addInstanceToPool($obj, $key); + ImportI18nTableMap::addInstanceToPool($obj, $key); } // if key exists } @@ -342,10 +342,10 @@ class ImportExportTypeI18nTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(ImportExportTypeI18nTableMap::ID); - $criteria->addSelectColumn(ImportExportTypeI18nTableMap::LOCALE); - $criteria->addSelectColumn(ImportExportTypeI18nTableMap::TITLE); - $criteria->addSelectColumn(ImportExportTypeI18nTableMap::DESCRIPTION); + $criteria->addSelectColumn(ImportI18nTableMap::ID); + $criteria->addSelectColumn(ImportI18nTableMap::LOCALE); + $criteria->addSelectColumn(ImportI18nTableMap::TITLE); + $criteria->addSelectColumn(ImportI18nTableMap::DESCRIPTION); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.LOCALE'); @@ -363,7 +363,7 @@ class ImportExportTypeI18nTableMap extends TableMap */ public static function getTableMap() { - return Propel::getServiceContainer()->getDatabaseMap(ImportExportTypeI18nTableMap::DATABASE_NAME)->getTable(ImportExportTypeI18nTableMap::TABLE_NAME); + return Propel::getServiceContainer()->getDatabaseMap(ImportI18nTableMap::DATABASE_NAME)->getTable(ImportI18nTableMap::TABLE_NAME); } /** @@ -371,16 +371,16 @@ class ImportExportTypeI18nTableMap extends TableMap */ public static function buildTableMap() { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportExportTypeI18nTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(ImportExportTypeI18nTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new ImportExportTypeI18nTableMap()); + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportI18nTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ImportI18nTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ImportI18nTableMap()); } } /** - * Performs a DELETE on the database, given a ImportExportTypeI18n or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a ImportI18n or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ImportExportTypeI18n object or primary key or array of primary keys + * @param mixed $values Criteria or ImportI18n 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 @@ -391,17 +391,17 @@ class ImportExportTypeI18nTableMap extends TableMap public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportI18nTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; - } elseif ($values instanceof \Thelia\Model\ImportExportTypeI18n) { // it's a model object + } elseif ($values instanceof \Thelia\Model\ImportI18n) { // 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(ImportExportTypeI18nTableMap::DATABASE_NAME); + $criteria = new Criteria(ImportI18nTableMap::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)) { @@ -409,17 +409,17 @@ class ImportExportTypeI18nTableMap extends TableMap $values = array($values); } foreach ($values as $value) { - $criterion = $criteria->getNewCriterion(ImportExportTypeI18nTableMap::ID, $value[0]); - $criterion->addAnd($criteria->getNewCriterion(ImportExportTypeI18nTableMap::LOCALE, $value[1])); + $criterion = $criteria->getNewCriterion(ImportI18nTableMap::ID, $value[0]); + $criterion->addAnd($criteria->getNewCriterion(ImportI18nTableMap::LOCALE, $value[1])); $criteria->addOr($criterion); } } - $query = ImportExportTypeI18nQuery::create()->mergeWith($criteria); + $query = ImportI18nQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { ImportExportTypeI18nTableMap::clearInstancePool(); + if ($values instanceof Criteria) { ImportI18nTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { ImportExportTypeI18nTableMap::removeInstanceFromPool($singleval); + foreach ((array) $values as $singleval) { ImportI18nTableMap::removeInstanceFromPool($singleval); } } @@ -427,20 +427,20 @@ class ImportExportTypeI18nTableMap extends TableMap } /** - * Deletes all rows from the import_export_type_i18n table. + * Deletes all rows from the import_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 ImportExportTypeI18nQuery::create()->doDeleteAll($con); + return ImportI18nQuery::create()->doDeleteAll($con); } /** - * Performs an INSERT on the database, given a ImportExportTypeI18n or Criteria object. + * Performs an INSERT on the database, given a ImportI18n or Criteria object. * - * @param mixed $criteria Criteria or ImportExportTypeI18n object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or ImportI18n 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 @@ -449,18 +449,18 @@ class ImportExportTypeI18nTableMap extends TableMap public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeI18nTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportI18nTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { - $criteria = $criteria->buildCriteria(); // build Criteria from ImportExportTypeI18n object + $criteria = $criteria->buildCriteria(); // build Criteria from ImportI18n object } // Set the correct dbName - $query = ImportExportTypeI18nQuery::create()->mergeWith($criteria); + $query = ImportI18nQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info @@ -476,7 +476,7 @@ class ImportExportTypeI18nTableMap extends TableMap return $pk; } -} // ImportExportTypeI18nTableMap +} // ImportI18nTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // -ImportExportTypeI18nTableMap::buildTableMap(); +ImportI18nTableMap::buildTableMap(); diff --git a/core/lib/Thelia/Model/Map/ImportExportTypeTableMap.php b/core/lib/Thelia/Model/Map/ImportTableMap.php similarity index 65% rename from core/lib/Thelia/Model/Map/ImportExportTypeTableMap.php rename to core/lib/Thelia/Model/Map/ImportTableMap.php index 5533343fd..873b4d196 100644 --- a/core/lib/Thelia/Model/Map/ImportExportTypeTableMap.php +++ b/core/lib/Thelia/Model/Map/ImportTableMap.php @@ -11,12 +11,12 @@ use Propel\Runtime\Exception\PropelException; use Propel\Runtime\Map\RelationMap; use Propel\Runtime\Map\TableMap; use Propel\Runtime\Map\TableMapTrait; -use Thelia\Model\ImportExportType; -use Thelia\Model\ImportExportTypeQuery; +use Thelia\Model\Import; +use Thelia\Model\ImportQuery; /** - * This class defines the structure of the 'import_export_type' table. + * This class defines the structure of the 'import' table. * * * @@ -26,14 +26,14 @@ use Thelia\Model\ImportExportTypeQuery; * (i.e. if it's a text column type). * */ -class ImportExportTypeTableMap extends TableMap +class ImportTableMap extends TableMap { use InstancePoolTrait; use TableMapTrait; /** * The (dot-path) name of this class */ - const CLASS_NAME = 'Thelia.Model.Map.ImportExportTypeTableMap'; + const CLASS_NAME = 'Thelia.Model.Map.ImportTableMap'; /** * The default database name for this class @@ -43,22 +43,22 @@ class ImportExportTypeTableMap extends TableMap /** * The table name for this class */ - const TABLE_NAME = 'import_export_type'; + const TABLE_NAME = 'import'; /** * The related Propel class for this table */ - const OM_CLASS = '\\Thelia\\Model\\ImportExportType'; + const OM_CLASS = '\\Thelia\\Model\\Import'; /** * A class that can be returned by this tableMap */ - const CLASS_DEFAULT = 'Thelia.Model.ImportExportType'; + const CLASS_DEFAULT = 'Thelia.Model.Import'; /** * The total number of columns */ - const NUM_COLUMNS = 6; + const NUM_COLUMNS = 5; /** * The number of lazy-loaded columns @@ -68,37 +68,32 @@ class ImportExportTypeTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 6; + const NUM_HYDRATE_COLUMNS = 5; /** * the column name for the ID field */ - const ID = 'import_export_type.ID'; + const ID = 'import.ID'; /** - * the column name for the URL_ACTION field + * the column name for the IMPORT_CATEGORY_ID field */ - const URL_ACTION = 'import_export_type.URL_ACTION'; - - /** - * the column name for the IMPORT_EXPORT_CATEGORY_ID field - */ - const IMPORT_EXPORT_CATEGORY_ID = 'import_export_type.IMPORT_EXPORT_CATEGORY_ID'; + const IMPORT_CATEGORY_ID = 'import.IMPORT_CATEGORY_ID'; /** * the column name for the POSITION field */ - const POSITION = 'import_export_type.POSITION'; + const POSITION = 'import.POSITION'; /** * the column name for the CREATED_AT field */ - const CREATED_AT = 'import_export_type.CREATED_AT'; + const CREATED_AT = 'import.CREATED_AT'; /** * the column name for the UPDATED_AT field */ - const UPDATED_AT = 'import_export_type.UPDATED_AT'; + const UPDATED_AT = 'import.UPDATED_AT'; /** * The default string format for model objects of the related table @@ -121,12 +116,12 @@ class ImportExportTypeTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'UrlAction', 'ImportExportCategoryId', 'Position', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'urlAction', 'importExportCategoryId', 'position', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID, ImportExportTypeTableMap::URL_ACTION, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, ImportExportTypeTableMap::POSITION, ImportExportTypeTableMap::CREATED_AT, ImportExportTypeTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'URL_ACTION', 'IMPORT_EXPORT_CATEGORY_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'url_action', 'import_export_category_id', 'position', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id', 'ImportCategoryId', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'importCategoryId', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(ImportTableMap::ID, ImportTableMap::IMPORT_CATEGORY_ID, ImportTableMap::POSITION, ImportTableMap::CREATED_AT, ImportTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'IMPORT_CATEGORY_ID', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'import_category_id', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -136,12 +131,12 @@ class ImportExportTypeTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'UrlAction' => 1, 'ImportExportCategoryId' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'urlAction' => 1, 'importExportCategoryId' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), - self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID => 0, ImportExportTypeTableMap::URL_ACTION => 1, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID => 2, ImportExportTypeTableMap::POSITION => 3, ImportExportTypeTableMap::CREATED_AT => 4, ImportExportTypeTableMap::UPDATED_AT => 5, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'URL_ACTION' => 1, 'IMPORT_EXPORT_CATEGORY_ID' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), - self::TYPE_FIELDNAME => array('id' => 0, 'url_action' => 1, 'import_export_category_id' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) + self::TYPE_PHPNAME => array('Id' => 0, 'ImportCategoryId' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'importCategoryId' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), + self::TYPE_COLNAME => array(ImportTableMap::ID => 0, ImportTableMap::IMPORT_CATEGORY_ID => 1, ImportTableMap::POSITION => 2, ImportTableMap::CREATED_AT => 3, ImportTableMap::UPDATED_AT => 4, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'IMPORT_CATEGORY_ID' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), + self::TYPE_FIELDNAME => array('id' => 0, 'import_category_id' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, ) ); /** @@ -154,15 +149,14 @@ class ImportExportTypeTableMap extends TableMap public function initialize() { // attributes - $this->setName('import_export_type'); - $this->setPhpName('ImportExportType'); - $this->setClassName('\\Thelia\\Model\\ImportExportType'); + $this->setName('import'); + $this->setPhpName('Import'); + $this->setClassName('\\Thelia\\Model\\Import'); $this->setPackage('Thelia.Model'); $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('URL_ACTION', 'UrlAction', 'VARCHAR', true, 255, null); - $this->addForeignKey('IMPORT_EXPORT_CATEGORY_ID', 'ImportExportCategoryId', 'INTEGER', 'import_export_category', 'ID', true, null, null); + $this->addForeignKey('IMPORT_CATEGORY_ID', 'ImportCategoryId', 'INTEGER', 'import_category', 'ID', true, null, null); $this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -173,8 +167,8 @@ class ImportExportTypeTableMap extends TableMap */ public function buildRelations() { - $this->addRelation('ImportExportCategory', '\\Thelia\\Model\\ImportExportCategory', RelationMap::MANY_TO_ONE, array('import_export_category_id' => 'id', ), 'CASCADE', 'RESTRICT'); - $this->addRelation('ImportExportTypeI18n', '\\Thelia\\Model\\ImportExportTypeI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ImportExportTypeI18ns'); + $this->addRelation('ImportCategory', '\\Thelia\\Model\\ImportCategory', RelationMap::MANY_TO_ONE, array('import_category_id' => 'id', ), 'CASCADE', 'RESTRICT'); + $this->addRelation('ImportI18n', '\\Thelia\\Model\\ImportI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ImportI18ns'); } // buildRelations() /** @@ -191,13 +185,13 @@ class ImportExportTypeTableMap extends TableMap ); } // getBehaviors() /** - * Method to invalidate the instance pool of all tables related to import_export_type * by a foreign key with ON DELETE CASCADE + * Method to invalidate the instance pool of all tables related to import * 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. - ImportExportTypeI18nTableMap::clearInstancePool(); + ImportI18nTableMap::clearInstancePool(); } /** @@ -256,7 +250,7 @@ class ImportExportTypeTableMap extends TableMap */ public static function getOMClass($withPrefix = true) { - return $withPrefix ? ImportExportTypeTableMap::CLASS_DEFAULT : ImportExportTypeTableMap::OM_CLASS; + return $withPrefix ? ImportTableMap::CLASS_DEFAULT : ImportTableMap::OM_CLASS; } /** @@ -270,21 +264,21 @@ class ImportExportTypeTableMap extends TableMap * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. - * @return array (ImportExportType object, last column rank) + * @return array (Import object, last column rank) */ public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) { - $key = ImportExportTypeTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); - if (null !== ($obj = ImportExportTypeTableMap::getInstanceFromPool($key))) { + $key = ImportTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = ImportTableMap::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 + ImportExportTypeTableMap::NUM_HYDRATE_COLUMNS; + $col = $offset + ImportTableMap::NUM_HYDRATE_COLUMNS; } else { - $cls = ImportExportTypeTableMap::OM_CLASS; + $cls = ImportTableMap::OM_CLASS; $obj = new $cls(); $col = $obj->hydrate($row, $offset, false, $indexType); - ImportExportTypeTableMap::addInstanceToPool($obj, $key); + ImportTableMap::addInstanceToPool($obj, $key); } return array($obj, $col); @@ -307,8 +301,8 @@ class ImportExportTypeTableMap extends TableMap $cls = static::getOMClass(false); // populate the object(s) while ($row = $dataFetcher->fetch()) { - $key = ImportExportTypeTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); - if (null !== ($obj = ImportExportTypeTableMap::getInstanceFromPool($key))) { + $key = ImportTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = ImportTableMap::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 @@ -317,7 +311,7 @@ class ImportExportTypeTableMap extends TableMap $obj = new $cls(); $obj->hydrate($row); $results[] = $obj; - ImportExportTypeTableMap::addInstanceToPool($obj, $key); + ImportTableMap::addInstanceToPool($obj, $key); } // if key exists } @@ -338,16 +332,14 @@ class ImportExportTypeTableMap extends TableMap public static function addSelectColumns(Criteria $criteria, $alias = null) { if (null === $alias) { - $criteria->addSelectColumn(ImportExportTypeTableMap::ID); - $criteria->addSelectColumn(ImportExportTypeTableMap::URL_ACTION); - $criteria->addSelectColumn(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID); - $criteria->addSelectColumn(ImportExportTypeTableMap::POSITION); - $criteria->addSelectColumn(ImportExportTypeTableMap::CREATED_AT); - $criteria->addSelectColumn(ImportExportTypeTableMap::UPDATED_AT); + $criteria->addSelectColumn(ImportTableMap::ID); + $criteria->addSelectColumn(ImportTableMap::IMPORT_CATEGORY_ID); + $criteria->addSelectColumn(ImportTableMap::POSITION); + $criteria->addSelectColumn(ImportTableMap::CREATED_AT); + $criteria->addSelectColumn(ImportTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); - $criteria->addSelectColumn($alias . '.URL_ACTION'); - $criteria->addSelectColumn($alias . '.IMPORT_EXPORT_CATEGORY_ID'); + $criteria->addSelectColumn($alias . '.IMPORT_CATEGORY_ID'); $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); @@ -363,7 +355,7 @@ class ImportExportTypeTableMap extends TableMap */ public static function getTableMap() { - return Propel::getServiceContainer()->getDatabaseMap(ImportExportTypeTableMap::DATABASE_NAME)->getTable(ImportExportTypeTableMap::TABLE_NAME); + return Propel::getServiceContainer()->getDatabaseMap(ImportTableMap::DATABASE_NAME)->getTable(ImportTableMap::TABLE_NAME); } /** @@ -371,16 +363,16 @@ class ImportExportTypeTableMap extends TableMap */ public static function buildTableMap() { - $dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportExportTypeTableMap::DATABASE_NAME); - if (!$dbMap->hasTable(ImportExportTypeTableMap::TABLE_NAME)) { - $dbMap->addTableObject(new ImportExportTypeTableMap()); + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ImportTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(ImportTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new ImportTableMap()); } } /** - * Performs a DELETE on the database, given a ImportExportType or Criteria object OR a primary key value. + * Performs a DELETE on the database, given a Import or Criteria object OR a primary key value. * - * @param mixed $values Criteria or ImportExportType object or primary key or array of primary keys + * @param mixed $values Criteria or Import 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 @@ -391,25 +383,25 @@ class ImportExportTypeTableMap extends TableMap public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $criteria = $values; - } elseif ($values instanceof \Thelia\Model\ImportExportType) { // it's a model object + } elseif ($values instanceof \Thelia\Model\Import) { // 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(ImportExportTypeTableMap::DATABASE_NAME); - $criteria->add(ImportExportTypeTableMap::ID, (array) $values, Criteria::IN); + $criteria = new Criteria(ImportTableMap::DATABASE_NAME); + $criteria->add(ImportTableMap::ID, (array) $values, Criteria::IN); } - $query = ImportExportTypeQuery::create()->mergeWith($criteria); + $query = ImportQuery::create()->mergeWith($criteria); - if ($values instanceof Criteria) { ImportExportTypeTableMap::clearInstancePool(); + if ($values instanceof Criteria) { ImportTableMap::clearInstancePool(); } elseif (!is_object($values)) { // it's a primary key, or an array of pks - foreach ((array) $values as $singleval) { ImportExportTypeTableMap::removeInstanceFromPool($singleval); + foreach ((array) $values as $singleval) { ImportTableMap::removeInstanceFromPool($singleval); } } @@ -417,20 +409,20 @@ class ImportExportTypeTableMap extends TableMap } /** - * Deletes all rows from the import_export_type table. + * Deletes all rows from the import 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 ImportExportTypeQuery::create()->doDeleteAll($con); + return ImportQuery::create()->doDeleteAll($con); } /** - * Performs an INSERT on the database, given a ImportExportType or Criteria object. + * Performs an INSERT on the database, given a Import or Criteria object. * - * @param mixed $criteria Criteria or ImportExportType object containing data that is used to create the INSERT statement. + * @param mixed $criteria Criteria or Import 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 @@ -439,22 +431,22 @@ class ImportExportTypeTableMap extends TableMap public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { - $con = Propel::getServiceContainer()->getWriteConnection(ImportExportTypeTableMap::DATABASE_NAME); + $con = Propel::getServiceContainer()->getWriteConnection(ImportTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // rename for clarity } else { - $criteria = $criteria->buildCriteria(); // build Criteria from ImportExportType object + $criteria = $criteria->buildCriteria(); // build Criteria from Import object } - if ($criteria->containsKey(ImportExportTypeTableMap::ID) && $criteria->keyContainsValue(ImportExportTypeTableMap::ID) ) { - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImportExportTypeTableMap::ID.')'); + if ($criteria->containsKey(ImportTableMap::ID) && $criteria->keyContainsValue(ImportTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ImportTableMap::ID.')'); } // Set the correct dbName - $query = ImportExportTypeQuery::create()->mergeWith($criteria); + $query = ImportQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info @@ -470,7 +462,7 @@ class ImportExportTypeTableMap extends TableMap return $pk; } -} // ImportExportTypeTableMap +} // ImportTableMap // This is the static code needed to register the TableMap for this table with the main Propel class. // -ImportExportTypeTableMap::buildTableMap(); +ImportTableMap::buildTableMap(); diff --git a/local/config/schema.xml b/local/config/schema.xml index 0738419ee..a62929ec3 100644 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -1512,7 +1512,7 @@ - +
@@ -1521,18 +1521,43 @@
- +
+ + + + + + + +
+ - - + - - + + - - + + + + + + + +
+ + + + + + + + + + + diff --git a/setup/thelia.sql b/setup/thelia.sql index d5d300552..c5fa24f45 100644 --- a/setup/thelia.sql +++ b/setup/thelia.sql @@ -1874,12 +1874,12 @@ CREATE TABLE `form_firewall` ) ENGINE=InnoDB; -- --------------------------------------------------------------------- --- import_export_category +-- import_category -- --------------------------------------------------------------------- -DROP TABLE IF EXISTS `import_export_category`; +DROP TABLE IF EXISTS `import_category`; -CREATE TABLE `import_export_category` +CREATE TABLE `import_category` ( `id` INTEGER NOT NULL AUTO_INCREMENT, `position` INTEGER NOT NULL, @@ -1889,24 +1889,60 @@ CREATE TABLE `import_export_category` ) ENGINE=InnoDB; -- --------------------------------------------------------------------- --- import_export_type +-- export_category -- --------------------------------------------------------------------- -DROP TABLE IF EXISTS `import_export_type`; +DROP TABLE IF EXISTS `export_category`; -CREATE TABLE `import_export_type` +CREATE TABLE `export_category` ( `id` INTEGER NOT NULL AUTO_INCREMENT, - `url_action` VARCHAR(255) NOT NULL, - `import_export_category_id` INTEGER NOT NULL, + `position` INTEGER NOT NULL, + `created_at` DATETIME, + `updated_at` DATETIME, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- import +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `import`; + +CREATE TABLE `import` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `import_category_id` INTEGER NOT NULL, `position` INTEGER NOT NULL, `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`), - INDEX `idx_import_export_type_import_export_category_id` (`import_export_category_id`), - CONSTRAINT `fk_import_export_type_import_export_category_id` - FOREIGN KEY (`import_export_category_id`) - REFERENCES `import_export_category` (`id`) + INDEX `idx_import_import_category_id` (`import_category_id`), + CONSTRAINT `fk_import_import_category_id` + FOREIGN KEY (`import_category_id`) + REFERENCES `import_category` (`id`) + ON UPDATE RESTRICT + ON DELETE CASCADE +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- export +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `export`; + +CREATE TABLE `export` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `export_category_id` INTEGER NOT NULL, + `position` INTEGER NOT NULL, + `created_at` DATETIME, + `updated_at` DATETIME, + PRIMARY KEY (`id`), + INDEX `idx_export_export_category_id` (`export_category_id`), + CONSTRAINT `fk_export_export_category_id` + FOREIGN KEY (`export_category_id`) + REFERENCES `export_category` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE ) ENGINE=InnoDB; @@ -2607,39 +2643,76 @@ CREATE TABLE `brand_image_i18n` ) ENGINE=InnoDB; -- --------------------------------------------------------------------- --- import_export_category_i18n +-- import_category_i18n -- --------------------------------------------------------------------- -DROP TABLE IF EXISTS `import_export_category_i18n`; +DROP TABLE IF EXISTS `import_category_i18n`; -CREATE TABLE `import_export_category_i18n` +CREATE TABLE `import_category_i18n` ( `id` INTEGER NOT NULL, `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255) NOT NULL, PRIMARY KEY (`id`,`locale`), - CONSTRAINT `import_export_category_i18n_FK_1` + CONSTRAINT `import_category_i18n_FK_1` FOREIGN KEY (`id`) - REFERENCES `import_export_category` (`id`) + REFERENCES `import_category` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB; -- --------------------------------------------------------------------- --- import_export_type_i18n +-- export_category_i18n -- --------------------------------------------------------------------- -DROP TABLE IF EXISTS `import_export_type_i18n`; +DROP TABLE IF EXISTS `export_category_i18n`; -CREATE TABLE `import_export_type_i18n` +CREATE TABLE `export_category_i18n` +( + `id` INTEGER NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, + `title` VARCHAR(255) NOT NULL, + PRIMARY KEY (`id`,`locale`), + CONSTRAINT `export_category_i18n_FK_1` + FOREIGN KEY (`id`) + REFERENCES `export_category` (`id`) + ON DELETE CASCADE +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- import_i18n +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `import_i18n`; + +CREATE TABLE `import_i18n` ( `id` INTEGER NOT NULL, `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, `title` VARCHAR(255) NOT NULL, `description` LONGTEXT, PRIMARY KEY (`id`,`locale`), - CONSTRAINT `import_export_type_i18n_FK_1` + CONSTRAINT `import_i18n_FK_1` FOREIGN KEY (`id`) - REFERENCES `import_export_type` (`id`) + REFERENCES `import` (`id`) + ON DELETE CASCADE +) ENGINE=InnoDB; + +-- --------------------------------------------------------------------- +-- export_i18n +-- --------------------------------------------------------------------- + +DROP TABLE IF EXISTS `export_i18n`; + +CREATE TABLE `export_i18n` +( + `id` INTEGER NOT NULL, + `locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL, + `title` VARCHAR(255) NOT NULL, + `description` LONGTEXT, + PRIMARY KEY (`id`,`locale`), + CONSTRAINT `export_i18n_FK_1` + FOREIGN KEY (`id`) + REFERENCES `export` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB; diff --git a/templates/backOffice/default/export.html b/templates/backOffice/default/export.html index 6cafbd178..e1a1b0b87 100644 --- a/templates/backOffice/default/export.html +++ b/templates/backOffice/default/export.html @@ -27,7 +27,7 @@ {module_include location='tools_top'} - {loop name="import-export-category" type="import-export-category"} + {loop name="export-category" type="export-category"} {if $LOOP_COUNT % 3}
{/if} @@ -51,9 +51,11 @@
- - - + {loop name="export-categ-list" type="export" category=$ID} + + + + {/loop}
n
{$TITLE}